texts:
I wanted to display an HUD, similar to the strategic games' one (like in DotA 2, Warcraft III, Starcraft II or Age of Empires). I didn't really know how to do it, so I managed to create a Texture Object and placed it in front of the scene. The image attached is the HUD itself, with some transparent "holes" in which I placed the cameras. I don't know if this description explains well what I'm trying to say, so I made this screenshot:

The HUD is just a png image with a greater z-index. The image has three "holes": one for the gameboard, one for the dice, and one for the spells you can see on the right. The holes are filled with the cameras, so we can see the objects beyond the transparency. Everything looks quite nice.

But if I change aspect ratio (which was Free Aspect), my layout gets completely screwed up.

Notice that the HUD borders are not fully displayed; the spells on the right are misplaced, and so are the dice.

I managed to get the free aspect resolution, it is 1440x720, a perfect 2:1. But, even if I change my resolution to 800x400, things are not getting better.

I've read something about pillarboxing and letterboxing, but I'm not sure that those techniques will help me with this issue. Is there something I can do to resize my objects and my cameras dynamically to fit the screen for every resolution like in the first screenshot?

Of course, if you have any other solutions for the HUD, I'll be glad to learn!


texts:
I'm trying to implement Parallax scrolling in two dimensions using SDL, but I've run into an issue using SDL_BlitSurface() to blit my layer images to the screen buffer.
The images I'm using for this are borrowed from http://en.wikipedia.org/wiki/Parallax_scrolling, and I was able to get it working fine just scrolling along the X axis, using the following code:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);
        layer->x_offset %= buffer->w;
        int draw_x = layer->x_offset - layer->image->w;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w) {
            blitrect.x = draw_x;
            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);
            draw_x += layer->image->w;
        }
    }
}

This works.

Now, I've tried to adapt this into two dimensions. Here's the draw method I'm using now:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);

        //resize offset so as not to overflow ints or whatever
        layer->x_offset %= buffer->w;
        layer->y_offset %= buffer->h;

        int draw_x = layer->x_offset - layer->image->w;
        int draw_y = layer->y_offset - layer->image->h;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w && draw_y <= buffer->h) {

            blitrect.x = draw_x;
            blitrect.y = draw_y;

            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);

            if(draw_x <= buffer->w)
                draw_x += layer->image->w;
            if(draw_y <= buffer->h)
                draw_y += layer->image->h;
        }
    }
}

I've added the logic for blitting a layer that's moving in the vertical axis, but when I tested it, this just doesn't play nice. Areas of the screen end up not being blitted, which causes a lovely un-drawn effect:

Link to image as I can't post them directly (new user): SDL blitting bug example

Just to be clear, the images themselves are pushed around in another method. The front two layers are moving along the horizontal axis with varying velocity, and the background is moving vertically with a fixed velocity and horizontal with a variable velocity, but that's largely irrelevant as it's my blit function which is bugged.

It looks like I'm not re-drawing the area of the screen that has the repeating image on it, but I'm lost as to how to go about this.


texts: Monte Carlo Tree Search for simultaneous multiplayer game

texts: I am developing AI for bomberman and i want to implement monte carlo tree search. I read that MTCS can be applied for simultanous multiplayer game. Problem i have is that i dont know how to implement it. For instance, how to store all possible moves in one game state or how to apply UTC selection. Should i call utc selection for all players and final state to select will be combination of their moves? Has anybody any literature to read or article? Thanks


texts:
Hello all I have been having an issue with a 2D platformer I'm working on in Unity. It has an aiming style similar to Shadow Complex where the aiming will rotate around the character in direction to wherever the right joystick (360 controller) will be facing. Here's some expert drawings to visualize the issue.

What I have currently working involves raycasts and getting it to rotate which works and is fun but I would really prefer to have the cursor "snap" to the correct position. I'm not sure if I'm on to the correct way to do this or if my "snapping" method is the best possible way to do this.


texts: How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel?

texts:
I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
The map would be entirely put in darkness at the beginning, but as the player shoots the environment, it would be rendered with its "real texture". So say I have a tree. First it is entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this, I'm using a raycast to get the impact point and so I can access any renderer of the point that the player is shooting on. I guess the next step would be to write a custom shader to light the exact pixel that is shot. Do you have any idea how I could write this shader or another way of doing this effect?

Regards


texts:
I am using unity 5.1.0f(64 bit) and  Vuforia SDK Version: vuforia-unity-5-0-5

The web cam is operating normally in windows but in unity in Play Mode not.

I am getting an error message
"failed to load QCARWrapper.dll: expected 64bit architecture..."

Can anybody help out solving this issue?


texts: Why is there a white border around my app icon?

texts:
EDIT:  This is because Unity did not support Android's adaptive icons.  As of Unity 2018, it is supported natively.

For Unity 2018+, see this question.
For Unity 2017-, see Jimmy's answer.

I am developing an Android app in Unity.  I have two versions of the app on my phone, both with identical icons. The white border is only on the newer version of the app. I am using a Google Pixel.

Why is this there, and how do I get rid of it?

Is this tied to my phone or my app? If it is tied to my phone, why is it on one icon, but not the other (they are same icon)? I don't want other users to have this pointless border around the app, as my icon already has a border.


texts: Can you compare a parameter to another parameter using ChoiceFormat?

texts:
I'm currently using the I18NBundle (wiki  | docs) package from LibGDX to do some internationalization for my game. the I18NBundle internally uses the java MessageFormat (docs) to format strings such as this:

// The string to format.
shields = Shields: {0, number, integer}

// Do the formatting
bundle.format("shields", 5);
>> Shields: 5

It can also do conditionals like so:

// # = if exact
// < = if greater than
shields = Shields: {0, choice, 0# No Shields! | 1# One Shield! | 1< {0, number, integer} Shields!}

bundle.format("shields", 0);
>> Shields: No Shield!

bundle.format("shields", 1);
>> Shields: One Shield!

bundle.format("shields", 5);
>> Shields: 5 Shields!

Now I'm trying to compare two input parameters to each other. I tried this:

// If parameter 1 is greater than parameter 0...
score = Score: {0, choice, {1}< {0} New high score! | {0}}

bundle.format("score", newScore, highScore);

// Expected Output if new score is lesser than high score
bundle.format("score", 1, 5);
>> Score: 1

// Expected output if new score is greater than high score
bundle.format("score", 7, 5);
>> Score: 7 New high score!

But this throws an exception since it is invalid formatting. So my question is: Is it possible to compare two input parameters to each other when using ChoiceFormat?


texts: How do I create this underwater effect with Cocos2D?

texts:
http://vimeo.com/2461697

Hi everyone, I'm trying to create an effect like this, the underwater effect (water distortion). I've looked around and I've seen references to "water caustics" but I'm not sure how to create this in Cocos2d or if it's done with obj-c only.

Thanks.


texts: Libgdx AtlasTmxMapLoader with multiple tilsets

texts:
I am working on a Libgdx game which loads Tiled maps. The current map I am working on makes use of two tilesets, one for shadow/light and another for terrain and buildings. The general process I do, that has been working fine, is that I receive the sprite sheet from the artist, design the maps, then take the spritesheet file and split it using ImageMagick. From there I take the split images and create an optimized png and atlas file with TexturePacker.

However, this is the first map I have made that makes use of multiple tilesets. The issue I am having is when loading the map with AtlasTmxMapLoader it relies on a single atlas file property in the map. I tried to merge my 2 images into a single atlas/texture (keeping the same names/indexes) but it only seems to render by first tileset tiles.

Perhaps I am missing something simple. What is the correct way to handle multiple tilesets (how exactly should my atlas file be setup)?


texts: GameObject not exiting through leftScreen

texts:
I'm trying to wraparound game object so that, it exits through right screen and enters through left and vice versa.
The code snippet below is what I'm working on.

Vector3 Pos = mainCam.WorldToScreenPoint(transform.position);
Vector3 LS  = mainCam.ScreenToWorldPoint(new Vector3(-1, 0f, 0f));
Vector3 RS  = mainCam.ScreenToWorldPoint(new Vector3(1, 0f, 0f));

if (Pos.x > Screen.width)
        transform.position = new Vector3(LS.x, transform.position.y, transform.position.z);

if (Pos.x < 0)
        transform.position = new Vector3(RS.x, transform.position.y, transform.position.z);

So far, exit through right and re-enter through left works, but the gameObject does not exit through the left screen, there seems to be a barrier preventing it, or maybe my parameters for the second if statement are wrong.


texts: Gamification: designing cooperation in an RPG like game based on Scrum methodology

texts:
I have implemented with 3 friends a gamified system at my work (development company) which builds an fantasy rpg game over scrum project methodology. Generally, the tasks are the missions, each player is represented by a character. They earn XPs for completing tasks and they advance to the next levels which gives them badges, titles and (this is in planning phase) new privileges (e.g. priority in choosing tasks).

Since the very beginning we try to do everything to avoid rivalisation between players because it would ruin the project if the players started to compete. There are no explicit leaderboards, we also plan to give bonuses for helping other players.

I have a feeling that this is still not enough to really encourage cooperation. I would like to ask You for any ideas that come to Your mind that would help.


texts: Simulate Unlit Shader using Physically Base Material Shader

texts:
Is there a way to have a physically based material shader look like an unlit shader?

Note: this question is not unity specific. I am trying to understand in general if it is possible to maybe(?) set the physically based material to a bunch of 0s and black/white maps to "zero it" to unlit.


texts: How do I manage persistence in a 2d tile-based world that uses a chunking algorithm?

texts:
Suppose I have a game that operates on a procedurally generated world that is made of 2D tiles. To save computer resources a chunking algorithm is implemented that slices the entire world in chunks of 32x32 tiles and loads/unloads them  based on the position of the player character. Info about chunks is serialized to files. Suppose a 3x3 grid of chunks with the player character in the middle of the grid are loaded and managed at any given time.

The player finds an animal in a forest, but it runs away. They then decide to chase the animal, but it is at least five times as fast as the player and after a while of following its tracks, the distance between becomes too large to ever catch up with it. If the distance is big enough, the animal could have moved itself out of the chunks that are loaded around the player.

Because the animal leaves tracks, it has followed a certain path, avoiding obstacles like trees and rocks, through unloaded chunks.

How is this being managed by the game?  I am trying this myself but I am stumped as to coming up with a way to manage, modify and read chunks that aren't loaded so that an animal that ran off screen still moves around sensibly and leaves tracks, or a town that gets flooded while the player is away.

I know that sometimes they calculate what should have changed in a chunk since the player's last visit, but that would mean I'd have to save an incredible amount of data if, say, a pack of 5 animals ran away.

I am not sure if an answer to a question like this requires more (technical) details about my game or project but I will provide these if wanted.


texts: Unity Timeline character transform initial values

texts:
I'm trying to make a runtime cutscene in Unity using the Timeline editor. I have a humanoid character with an animation controller, track and a cinemachine track set-up in the playable. The timeline starts playing onTriggerEnter() through script. Initially I applied the track offsets and the timeline plays perfectly in the editor but in play mode the player swaps to random positions in the world and it looks really ugly. So I changed the track offsets to scene offsets and it's almost works perfectly except that the position and rotation of the character are relative to the input just before the character enters the trigger (all input is disabled on trigger entered).

What I intend to do is set a default position and rotation to the character at the beginning of the timeline. Is there any way to achieve that within the timeline editor, if not how else could I do it?


texts:
I successfully draw the model, and made it move forward and backward, but when I try to make it rotates (yaw) its not working correctly, like its moving too instead of only rotate.
Here is my camera code:

public class NewCamera
{
    float aspectRatio;
    public NewPlayer player;
    Matrix viewMatrix;
    Matrix projectionMatrix;
    Matrix terrainMatrix;

    public NewCamera(float aspectRatio, NewPlayer player)
    {
        this.player = player;
        this.aspectRatio = aspectRatio;
    }

    public void Update()
    {
        Vector3 campos = new Vector3(0, 0.2f, -0.6f);
        campos = Vector3.Transform(campos, Matrix.CreateFromQuaternion(player.rotation));
        campos += player.position;

        Vector3 camup = new Vector3(0, 1, 0);
        camup = Vector3.Transform(camup, Matrix.CreateFromQuaternion(player.rotation));

        viewMatrix = Matrix.CreateLookAt(campos, player.position, camup);
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.2f, 500.0f);
    }

    public void SetEffects(BasicEffect basicEffect)
    {
        basicEffect.View = viewMatrix;
        basicEffect.Projection = projectionMatrix;
        basicEffect.World = terrainMatrix;
    }

    public void Draw(Terrain terrain)
    {
        terrainMatrix = Matrix.CreateTranslation(terrain.position);
        SetEffects(terrain.basicEffect);
        foreach (EffectPass pass in terrain.basicEffect.CurrentTechnique.Passes)
        {
            pass.Apply();
            terrain.Draw();
        }
        player.Draw(viewMatrix, projectionMatrix);
    }
}

And here is my player (character) code:

public class NewPlayer
{
    Model model;
    public Vector3 position = new Vector3(8, 1, -3);
    public Quaternion rotation = Quaternion.Identity;
    public Matrix worldMatrix = Matrix.Identity;

    public NewPlayer(Model _model)
    {
        model = _model;
        foreach (ModelBone bone in model.Bones)
        {
            bone.Transform *= Matrix.CreateScale(0.01f);
        }
    }

    public void RecreateWorld()
    {
        worldMatrix = Matrix.CreateRotationY(MathHelper.Pi)
            * Matrix.CreateFromQuaternion(rotation)
            * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix viewMatrix, Matrix projectionMatrix)
    {
        RecreateWorld();
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index]
                    * worldMatrix;
                effect.View = viewMatrix;
                effect.Projection = projectionMatrix;
            }
            mesh.Draw();
        }
    }

    public void MoveForward(float speed)
    {
        Vector3 addVector = Vector3.Transform(new Vector3(0, 0, 1), this.rotation);
        this.position += addVector * speed;
    }

    public void MoveBackward(float speed)
    {
        Vector3 addVector = Vector3.Transform(new Vector3(0, 0, -1), this.rotation);
        this.position += addVector * speed;
    }

    public void Yaw(float amount)
    {
        this.rotation *= Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(amount), 0, 0);
    }
}

So, whats wrong at the Yaw function??

EDIT:
Adding some SS to show what I mean, it appears that it yaws around camera and not player


texts: Random position of object in foreach loop

texts:
i need help with some "scary" thing.
I'm creating some objects in foreach loop. Each object has implemented in Update function random change of position.
But while i'm creating this objects in foreach loop, each object gets the same random position, and i don't know why.
Please help me.

For better explanation:

List<Object> objects;

in initialization:

objects = new List<Object>();
objects.Add(new Object());
objects.Add(new Object());
objects.Add(new Object());

and Update and Draw function:

foreach(var obj in objects)
    obj.Update(); // obj.Draw();

in Object Update function:

Position.X = rand.Next(width);
Position.Y = rand.Next(height);

The problem comming in launched game, where I can see only one object, instead of three. All that objects has same position, so they are covered by each other.


texts: I made a game in XNA - how can I share it with my friends?

texts:
I've just finished programming a charming (albeit bare-bones) XNA version of arcade classic Tempest.
Hooray!
Given that this was a homework assignment, I'd like to be able to share it with my professor and my friends/classmates to solicit feedback.
(And let's be honest - if I have a question about how to add in an additional feature, it might be nice to be able to share it with folks on this site as well.)
Is there a better way of sharing an XNA game than by shuttling the visual studio - produced  executable around? Some way to host it on a website would be ideal.


texts: Persist emitted particles in scene after particle system has ended/destroyed?

texts:
In Unity, is is possible to persist emitted particles in a scene after the system has ended or even possibly destroyed?

I have a particle system attached to my player prefabs that does a rudimentary blood splatter, and I'd like for the emitted "blood" particles to stay in the scene for as long as the scene is active, even after the player prefab that originally emitted the particles is destroyed.


texts: How to read a data from text file in unity

texts: Can anybody help me out with giving the steps needed for reading data from the text file in unity and how can the script be added.


texts:
Description
I've seen some Unity tutorials and I'm trying to apply good practices to modularize the code. However, I'm running into some issues while trying to use rigidBody2d.MovePosition().
I have two classes: Player (which defines rules and performs calculations) and PlayerController (uses computed data from Player to interact with Unity itself).
Player.cs
using UnityEngine;

public class Player
{
    public Vector2 MoveTowards(Vector2 currentPosition, Vector2 direction)
    {
        return currentPosition + direction * 2f;
    }
}

PlayerController.cs
using UnityEngine;

[RequireComponent(typeof(Rigidbody2D))]
[RequireComponent(typeof(Animator))]
public class PlayerController : MonoBehaviour
{

    public Player player;

    Rigidbody2D rb2d;
    Vector2 movementDirection = Vector2.zero;

    void Awake()
    {
        player = new Player();
        rb2d = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        movementDirection = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    }

    void FixedUpdate()
    {
        rb2d.MovePosition(player.MoveTowards(rb2d.position, movementDirection) * Time.fixedDeltaTime);
    }
}

What happens visually is the player's sprite moves (just a tiny bit) towards the given direction and goes back to (x: 0, y: 0) as soon as I release the movement key.
Player on Inspector:

What I tested
Inside FixedUpdate, it does not work when I use:
rb2d.MovePosition(player.MoveTowards(rb2d.position, movementDirection) * Time.fixedDeltaTime);

Inside FixedUpdate, it does not work when I use:
Vector2 controllerNewPosition = rb2d.position + movementDirection * 2f;
rb2d.MovePosition(controllerNewPosition * Time.fixedDeltaTime);

Inside FixedUpdate, it works when I use:
rb2d.MovePosition(rb2d.position + movementDirection * 2f * Time.fixedDeltaTime);

Questions
Maybe that is being caused by the operator + and not creating a new Vector2, instead mutating rb2d.position? While I'm not new to programming, I have no experience with C#, so I don't know the specifics of the syntax yet.
How could I use player.MoveTowards in this case?
Edit
Feeling dumb. Right after publishing the question I realized the glaring mathematical priority issue. I've been debugging this for hours. I guess it happens to everyone.


texts: how to link a c++ object to a local variable in Lua

texts:
I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which instantiate a new entity from a given entity index:

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
end

create_entity returns a table which is the properties of the created entity. Now how can I make a connection between bullet variable and my newly created object?

Right now for previously added objects to the scene, I simply set a global table for each of them and then after every call to Update(), I go through registered names to find object tables and perform new changes. Like the one below:

function Update()
  if keyboard_key_press(vk_right) then obj_player.x += 3
end

I can get obj_player table because I know its name from C++, plus I can get it as a global table and simply reach for the first instance named obj_player.

Is there any solution for me to make bullet variable act like this?

I was thinking to get all local variables in Update() function and check for every one to see if is it table and it has an unique field attached to it like id, this way I can determine that this is an object table and do the rest of the process.

By the way, is this interface going to work easier with luaBind if I implement it?

Bottom line:

How can I make a local variable in Lua that receives a table from create_entity function and track that local variable to capture it from C++.

e. g.

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
  bullet.x = 10 <== Commit a change in table
end

Now I want to get variable bullet from C++. And it's not just this variable, there might be a ton of these local variables with different names.


texts: Moving sprites using the accelerometer (Android)

texts:
In my previous game, I was moving my sprite like so:

float time = 10f;  //Number of seconds to pass a pre-defined area (using the screen width in this example)
float velocity = 1f/time; //work out velocity based on above time
float realX-=velocity*dt; //Move the sprite to the left (where dt is previously defined delta)
x = realX*screenWidth //convert to screen coordinates so it can be rendered

sprite.draw(x, y); //Working out the y position in the same way

This all works great when using touch controls.  In the above example, the sprite will cross the screen in precisely 10 seconds regardless of the device on which it is running.

However, the game I'm currently developing uses the accelerometer to move the sprite.  (I'm only moving the sprite left/right).  Currently, what I'm doing is this:

@Override
public void onSensorChanged(SensorEvent event){
    tilt = event.values(axis);
}

Once I have the value, I apply it to my sprite movement like this:

float time = 10f;  //Number of seconds to pass a pre-defined area (using the screen width in this example)
float velocity = 1f/time; //work out velocity based on above time
float realX-=(tilt * velocity)*dt; //Move the sprite to the left **Now using the tilt value*
x = realX*screenWidth //convert to screen coordinates so it can be rendered

Although this does work - it gives nice fluid movement of the sprite, when I run it on an old Galaxy Ace, the sprite accelerates way too fast.  This changes the feel of the game - note I'm talking only about acceleration here, so if I tilt the phone from left to right repeatedly, the sprite is extremely (too) responsive on the Ace, but 'just right' on my 10" tablet).

I've tried a couple of other available games and they seem to run pretty consistently across devices.

I'm wondering if my code is correct and if so, what can I do to get all devices running more consistently with regards to the accelerometer?

Edit

Just to clarify what it is I'm asking.  I have a sprite in the middle of the screen sitting on a horizontal platform.  When the device is tilted to the left, the sprite moves to the left.  The rate of movement should be linked to the angle the device is tilted. So, if the device is vertical there should be no movement. If the device is tilted slowly to the left, further and further the sprite should increase in speed also (up to a limit) ie, accelerate.

The other (real world) way to think of it is sitting a ball bearing inside a vertical box (the box representing the device) and then simply tilting the box to the left and right.  The ball accelerates towards to lowest corner.  The sprite should act like a real ball.  If it's accelerating towards to left corner, and the box is tilted in the opposite direction, then the sprite should start to decelerate to a stop, and then srart accelerating in the opposite direction. Just as the real-world ball bearing would.

My Original code achieves this, however, on some devices it's simply too responsive, it will decelerate and accelerate too quickly. And therefore change the 'feel' of the game - making it too easy for one thing.

So basically when I say the sprite movement feels 'natural' I'm referring to how the ball bearing would act/feel in the real-world.

This is exactly what I'm looking for - hope this helps!


texts:
I'm a beginner with OpenGl so please discount my ignorance. I've managed to create a skybox (with a texture mapped cube) and would like to rotate the view (eye) around the center of the box, so I can admire the view :). By changing the X/Y coordinates of eye/camera in GLM.LookAt() I'm able to see most of the faces of the skybox but I'm not able to see the top and bottom faces though I'm sure that they are rendered. In any case what's the best way to rotate around the skybox? What I want to do is exactly shown in this video

Thanks!

EDIT: Sorry for the lack of relevant information.

I'm using OpenGL version 3.3.
Not using immediate mode. Everything is via shaders and VBO/VAO
I have already setup the projection, view and model matrices which I pass to the vertex shader, and obviously have the texture loading also working as I can render the skybox. At the moment i've set the projection and model matrices to Identity for simplicity.
I'm deriving the view matrix from GLM.LookAt(), So initially i thought that to rotate around the view box, I'd just have to change the viewMatrix
I'm working on C# using SharpGL
To draw the skybox, I've set up a VAO to draw a cube with vertices in the range (-1,-1,-1) and (1,1,1). Then I load 6 textures for each cube face to 6 Texture Units. During the rendering I draw the cube and update the texture for each face using a sampler variable. All of this seems to be working OK. I verified this my scaling down the size of the cube and checking if all 6 faces were being rendered properly by rotating the ModelMatrix

I suspect one problem is that I'm not positioning the camera in the center of the cube. At the moment it seems to be viewing the cube from outside. I'm still trying to grasp the usage of GLM.LookAt().

This is how I'm rendering the skybox at the moment. And I can see the front face of the cube, but how do I go about placing the camera in the center of the box and rotating it?

 viewMatrix = mat4.identity();
 projectionMatrix = mat4.identity();
 modelMatrix = mat4.identity();
 viewMatrix = glm.lookAt(new vec3(0f, 0f, 1f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f));

        shaderProgram.Bind(GL);
        shaderProgram.SetUniformMatrix4(GL, "projectionMatrix", projectionMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "viewMatrix", viewMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "modelMatrix", modelMatrix.to_array());

skyBox.renderSkybox(GL);

EDIT #2
I managed to figure out my error. I was trying to look at the Top and Bottom faces by doing
viewMatrix = glm.lookAt(new vec3(0f,-1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); and
viewMatrix = glm.lookAt(new vec3(0f, 1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); which was giving me a blank screen. The reason being that (0,1,0) is collinear with my up-vector and LookAt() couldn't generate the viewMatrix in this case. Changing the UpVector makes it OK!


texts:
I'm currently trying to time different parts of my rendering to see how long it takes. I've got the queries working and I'm getting some results.

My question is where should I actually start and end the query?

If the query is wrapped around the ID3D11DeviceContext::VSSetShader function will this tell me how long it took to set the vertex shader? Or will the tell me how long it took to call the function in c++?

I am trying to query the GPU and as far as I know the pipeline isn't executed until I call the ID3D11DeviceContext::DrawIndexed function.

Do I need to do the queries in the shader code?


texts: Is it efficient to use Lua to store game data?

texts:
I'm new to Lua and I'm wondering, is it efficient to use Lua to store game data (such as monster's description, spells).

My problem is this: when I try to create a monster object every second, I have to run the Lua file and get the data repeatedly, which I think may be not efficient.

Before I try to use Lua, I use XML to store data: at the beginning of gameplay, I read the "monster.xml" file once, and keep it in the memory, and every time I need to create a monster, I just refer to it.

Is this XML approach more efficient than the Lua one ? Or are there other better solutions?


texts: How to use a whole new set of assets (reskinning)

texts:
I need to be able to load my game with a different set of assets, basically reskinning it.

I knew beforehand that I would need a way to do that in the future so right now i'm accessing my assets via a ScriptableObject that I call an "Accessor".

Basically the accessor only hold references to the assets and when I want to get, for example, the sprite for my cards I make a call that looks like that :

Sprite cardSprite = Accessors.Instance.GetCardFrame();

Solution seem simple, I add a layer above the accessors that allow it to choose between differents sets of references.

The problem is that right now I only use the accessors for dynamically generated gameobject ( When I instantiate a card for exemple ). How could I do that with, let's say, UI in the editor ? It will be nearly impossible to work on the UI if I can't see it due to the sprite not being loaded in editor mode.


texts: Can i put the main Love2D functions inside a table?

texts: Instead of having a file with load, update,and draw can i say have a table called player, then put love.update and love.draw in that table to handle the drawing and updating of that particular player?


texts: In Unity, how do I handle very short mouse drags as click events?

texts:
I am trying to recreate a UI menu that has functionality similar to the iPhone's home screen:

If a user drags anywhere on the menu (including on a button), it should drag the whole page left/right depending on the user's drag.
If a user clicks and holds motionlessly on a single button, it "dislodges" the button so that it can be dragged around.

I have all of my functionality working, including the dislodge. The one exception being that I'm running into a situation where I'm not sure how to transfer the drag message consumed by a button onto the backing scroll container if the user has not clicked long enough on a single button to "dislodge" it.

That is, I place my finger onto a button and drag (with the intention of dragging the entire page) but I'm not sure how to redirect the same drag message onto the ScrollRect of my backing container. Instead, my button consumes the OnDrag message and the page is not scrolled. The only method of scrolling the page is simply dragging on an empty part of the container where there is no button.

I'm using UI elements from Unity's 4.6 UI:

I am using a ScrollRect to represent the backing container with all of my buttons
I'm using a GridLayout to resize and pad my buttons
I'm using a regular UI.Button class on each of my buttons
I'm using the following EventSystem interfaces to catch and handle input for my buttons:
IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler

Is there something already built into Unity that can allow me to transfer/redirect the drag message from one GameObject to another while the drag is still in process? Or do I need to rebuild parts of the UI from scratch to support this?


texts: How could I control an air hockey 's AI paddle?

texts:
I am making an air hockey game on Android with Box2D and libgdx. For the manual control, I just use the MouseJoint and it works perfectly. However, for the AI control, there is a problem:

I've made a method predicting the position of the puck in the near future (for example in the next 30 frames). Then I tried to move the paddle towards that predicted position such as: after exactly 30 frames, my paddle will arrive in time at a specified point near that position to hit the puck with a specified velocity.

But the problem is, if using MouseJoint, I can't specify the exact interval 30 frames. The paddle will arrive at the specified position, but it maybe sooner than 30 frames, or later than 30 frames. And I can't control the velocity when it arrive at that point either.

What I need here is a way to control my paddle to arrive at a specified point, with a specified velocity in a specified interval. Or is there any other way to control this AI paddle?


texts: How to clamp a direction vector within a direction pyramid?

texts:
In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional range as a center directional axis with a local y-axis range and a local x-axis range and clamp an arbitrary 3D directional vector within that range. How do I do that?

For example, I want to specify a angle range as axis (1,0,0) with [-30 to 30] as the local y-axis angle angle and [-10 to 10] as the local x-axis range. So that something like (0.95,0.1,0.1).normalized() would not be changed but (-1,0,0) would be clamped to an appropriate vector.


texts: Unity is Single Thread by how do WWW with coroutine work Async

texts:
When I used HttpWebRequest and HttpWebResponse classes for an API calling my game suddenly halt for some seconds but as i used same API calling through WWW with coroutine, it didn't halt.

I heard that unity is single thread but why my game not halt as i used WWW with coroutine? and is i am getting right that  HttpWebRequest and HttpWebResponse are not better than WWW?


texts: How to run DirectX10 on non-compatible hardware?

texts:
I'm going to be away for a little bit, bringing my netbook with me to do some basic DirectX10 stuff.

How can I run DX10 on DX9.0c hardware?


texts:
Say I have a 2D tile based game engine (I don't, but I will soon). I was wondering how I would manage drawing adjacent maps. That is, imagine we have a map that is 50 by 50 tiles wide. Then next to that, we have another map which of the same size - but they are loaded via separate files. So they are visibly next to each other.

Let's call the first map (the one we are on) A, and the second map B. How would I:

Draw the two maps next to each other at the combining point (provided that I have already saved data about what maps are next to each other, and at what point), so they join seamlessly, without the need for a loading screen / "teleport".
Manage entity positions. Positions, currently, are managed relatively. That is, each map has it's own (0, 0) tile. How would I manage this when drawing an entity? I was thinking about storing a pointer to the map the entity, and if it happens to change map, the pointer is updated, and we - somehow - find the tile the entity would move on to.

I should mention that only the player will ever need the use for this movement.

Any ideas? Sorry if I wasn't very clear.


texts:
I've implemented a [basic] FSM in my game and it currently does its job very well. Recently I have come across a "problem" that I need to show a "Loading map. Please wait..." screen for as long the map is being loaded asynchronously. How do people usually do this? Is it considered a State?

For instance, these are the current states (in order):
IntroState (splash) -> LoadingState (loads textures, sounds...) -> PlayingState (optionally goes to PausedState)

The above LoadingState shows some kind of a progress bar while the assets are being loaded in another thread. Another information that might be important is that states operate the machine, for example, when the LoadingState finishes loading all the assets, it tells the machine to go to the playing state. The PlayingState has a Map object. For reference, see here: https://github.com/YvesHenri/Chico/tree/master/Game/Includes/Core/Engine/State

My current approach (which is not yet commited to github) is to make the Map object a "LoadingObservable" and the PlayingState a "LoadingListener" (observer pattern), so that inside the load call it will notify all of its listeners and theyre responsible of telling the FSM to go to the next or to go back to the previous state in the queue. Is this how people usually do that? Are there any easier/better ways to do that?

If this sounds a bit confusing please feel free to ask. Also, I'm always open for criticisms, if you have any, on my code.


texts: Rotate an object to face a point with glm::lookAt

texts:
I want to rotate an object to face a point, such as the monster look at the player.

For that I've decided to use the glm::lookAt function. However the following does not yield good results:

const glm::mat4 transformation = glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0));
ghost.transformation = transformation;

The ghost is correctly oriented to the player but is located to the world origin.
However the following works correctly (position and orientation):

const glm::mat4 transformation = glm::inverse(glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0)))

But I don't get why I need to inverse the matrix ?


texts: Workflow with Flash Pro CS6 and FlashDevelop: Using fla and swc to store assets

texts:
I am using this tutorial:

http://www.flashdevelop.org/wikidocs/index.php?title=AS3:FlexAndFlashCS3Workflow

In the past older versions of Flash Pro I was able to complete these steps:

right-click on the symbol in the Library panel, select "Linkage..." dialog,
check "Export for ActionScript" and fill in the symbol name (ie. MySymbol_design or assets.MySymbol_design),
do not change the base class (ie. flash.display.MovieClip).

Right now, I am stuck at that part. Any hints?

What I wish to do is:

Use fla for the artist to store assets.
Publish to swc
Extract the assets in FlashDevelop by creating an instance of their class.

... How is this done in CS6?

To clear things up, this is what I see when I right click a Flash symbol:


texts: Blender UV unwrapping causes texture to repeat in UDK material

texts:
I've made pillow kinda thing, unwrapped it in Blender and then I imported my mesh to UDK, applied a material:

The material splits, but I don't want that to happen, I want to cover the mesh with only big texture, like this one for example:

How do I do that?


texts:
I am trying to get an image from the user gallery and import it in unity. I have written a native plugin in Android Studio and exported JAR as it’s needed for the native stuff to get working. I am successful in opening gallery but I don’t have an idea how do I get that image retrieved from OnActivityResult in Java File and use it in C# for Unity.
Any help and ideas will be highly appreciated.


texts:
I want to save the state of the game in a file, so I can read it at the next start.
The Problem is, that I get a exception, if I try to save something internal.
If I try to save it local all work fine.
I save the file as a Json.

Bird bird = new Bird();
bird.setName("Foo");
bird.setSkin(new Texture("data/foo.png"));
bird.save(Gdx.files.internal("bird.json"));

The save mthod:

Json json = new Json();
file.writeString(json.prettyPrint(this), false);

  Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: bird.json (Internal)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:349)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:335)
      at com.buschmannmichael.fattybird.core.Bird.save(Bird.java:31)
      at com.buschmannmichael.fattybird.game.FattyBirdGame.create(FattyBirdGame.java:16)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:137)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:115)
  Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Cannot write to an internal file: bird.json
      at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:315)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:346)
      ... 5 more

Whats the problem of LibGDX, where I should save the files, so I can run the game on android, desktop and html ?
(I tested this method I showed above only on desktop, maybe it works on android but I want a solution for all platforms)

Maybe someone can help me :)


texts: How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile

texts:
I know that in OpenGL I can do something like this

glReadBuffer( GL_FRONT );
glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer );

And its pretty fast, I get the raw bitmap in _buffer.
When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this

if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) {
   HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL);

But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this.

EDIT: I am targeting only DirectX applications. Actually DX9 apps. I am doing this through a hook to Present. (I am using Detours if that is relevant), and I am doing this for every frame. I don't need (or want) a particular bitmap format like BMP PNG JPEG etc, and a colorspace of RGB24 is OK. Getting it as YUV480p would be better but definitely not necessary. Thanks everyone for the very helpful answers


texts: Frame Interpolation issues for skeletal animation

texts:
I'm trying to animate in-between keyframes for skeletal animation but having some issues. Each joint is represented by a quaternion and there is no translation component. When I try to slerp between the orientations at the two key frames, I got a very wacky animation. I know my skinning equation is right because the animation is perfectly fine when the animation is directly on a keyframe rather than in-between two.

I'm using glm's built in mix function to do the slerp, so I don't think there are any problems with the actual slerp implementation.

There's really one thing left that could be wrong here. I must not be in the correct space to do slerp. Right now the orientations are in joint local space. Do I have to be in world space? In some other space along the way? I have the bind pose matrix and world-space transformation matrix at my disposal if those are needed.


texts: If and why is randomness a bad thing in competitive games?

texts:
AFAIK it is a consensus within esports that randomness should be reduced? League of Legends has little RNG, Dota has more but both games employ rng smoothing algorithms (details for Dota, LoL).

The rationale is that if there is randomness then random chance can easily determine the outcome of a match (instead of player skill) which is unacceptable for pro play and tournaments. Quoting the articles I linked to above:

  In general Randomness is rejected from competitive gaming since it can decide over loss and defeat without reflecting the actual skill level.

  In League, a single action can determine the outcome of a lane, or even the game. For this reason, randomness in the game is a tricky topic. While landing a huge critical strike (crit) on your opponent can be satisfying, being the victim of a “lucky” crit can be frustrating, or worse: a random event could cause a skilled player to lose to a less-skilled player, even though the skilled player made a better play. In a casual game, the decision to include randomness might be a no-brainer, if it makes the game more fun. However, the decision to include randomness in Esports has the potential to make or break a pro player’s career or determine the outcome of a tournament. As a result, many game developers take measures to reduce the influence of randomness in their games.

Seems reasonable, but... I dont understand, there just seem to be too many counterexamples! Pokemon is insanely random, yet Pokemon is being played competitively as far as Im aware. More traditionally, Poker and Bridge seem to be ones of the most obvious counterexamples. These games would seem to demonstrate that it is not the case that pro play demands little to no randomness?

If and why does it make sense to reduce randomness in games intended to be played competitively?

For the sake of completeness, I feel I need to include two more opinions on the subject I heard/read.

Firstly: On Discord, someone told me that Poker is not really comparable to LoL as it is less popular (I was astonished to learn that LoL tournaments have tens of million watchers while Poker only has hundreds of thousands) and Poker is a gambling game, which is why randomness works for Poker - randomness in games makes them gambling games which presents a problem on its own.

Secondly: Extra Credits made a video on the subject, where they said randomness can work for competitve games (and IIUC implied that the claim that competitive games must have little to no randomness is incorrect) but tournament format needs to be adjusted - instead of single elimination they should make the tournaments in round robin. But doesn't this introduce new problems, since - correct me if I'm wrong - don't most people, both players and spectators, find round robin excessively boring?


texts: Is there any way to verify the GPS location data received from client?

texts:
The answer to this question may be "NO" but it's quite important so I think I might as well ask.

This should be a problem for all client-server location-aware games where player locations in the world are central to the gameplay. Is there any way we can make sure that the location data that's coming from the client is real (i.e. the player is actually there)?

Working on client-server games, we all know that we should never trust any information coming from the client and therefore all important game logic should be done server-side. However with location information, we MUST receive this from the client. Is there a way to double check this to prevent cheating?


texts:
I am trying to decode a map file for Unity which I believe was compressed using Base64 encoding.

The actual data looks like this:

  H4sIAHah5VgA/z2PvQ7CMAyEXyXyjASsXStGeAHEkBRTivJTOQlKW/XdSYKc7dOd7+Tb4CrnmzQIHQzRB2eExi9qOAiQMbwdZeOFdiyCUx/o7mKD6ZnVc5EIfca+JnPTRaNBG459VFjslM1TgYVhZfCJO/zSaG29LUktSi1LfDYyKAbJEDCFSGVXbR5omkP51UZd19n/6PrpLh77D92WFGkKAQAAAA=

And I am expecting an output that looks like:

  custom,cuboid,default,1,1,1,0,1,1,1,1.0,1.0,0,0,0,0,0,0,0;

While Base64 decoding should be an easy feat, this particular case is giving me trouble. I've tried decoding it into several different formats, but all my attempts resulted in garbled messes. I am fairly certain that the file is in a Base64 format, but it shouldn't be this difficult to decode.

Does anyone have an idea of how the file was encoded and how I might go about decoding it?


texts:
I can't figure out why the pixel shader won't run. I'm using the Blinn-Phong per-pixel shader from here. Only change I've made is that I pass an aditional color per vertex which gets multiplied by the light-color in the pixel shader.

So far the Graphics Analyzer shows me a valid IA-result and the same (okay looking) result in the VS-stage. I disabled depth-stencil for testing and though everything looks rather fine I always see "Stage did not run. No output." when I inspect the captured frame.

This is my Projection-matrix:

_projection = Matrix.PerspectiveFovLH((float) Math.PI / 4.0f, viewports[0].Width / viewports[0].Height,
            0.1f, 100f);

Values are Width: 1346, Height: 800

My View is calculated like this:

_rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch, Roll);
Vector3.Transform(ref _target, ref _rotation, out _target);

Vector3 up = Vector3.UnitY;
Vector3.Transform(ref up, ref _rotation, out up);

_view = Matrix.LookAtLH(Position, _target, up);

Whereas Position: X:50, Y:50, Z:-300, Target: X:50, Y:50, Z:0 and Yaw, Pitch, Roll are all 0.

World-Matrix is currently Matrix.Identity.

The quad I try to render spans itself from X:0, Y:0 to X:100, Y:100 with 4 vertices and 6 indices.

I first thought that SV_POSITION must be a normalized value since it's obviously a SV-coordinate and someone posted in another thread that this solved his problem - but then the VS-stage does not show anything at all and PS still won't run.

It's been quite some years since I last worked with DirectX so I'm not sure anymore why this happens.


texts: Unity 3D C# - Setting Material's Emission Texture via Script

texts:
Hi, I just wanted to know if there is a way to set emission's texture via script. I haven't found nothing in the documentation, neither on any forum, except the setting of the emission color setting via script.

Thanks in advance.


texts: An inherited scene component has no details panel and can't be moved

texts:
I'm making an fps, and I'm spawning the gun at a location on the player character.  To do this I added a scene component to the players class, and that is what the gun is attached to when it is spawned.  ( the scene component was added after I had created the blueprint derived from the cpp class).  This worked fine, and the gun is spawing.  Its spawning at the bottom of the character however, so I need to move the scene component to where I want the gun to spawn.  When I try to do this, I notice there's no widget to move the component, and it has no details in the details panel.  I tried creating a new blueprint derived from the class to see if the details would work there, but they didn't.
here's my header file code for creating the object:
USceneComponent* GunSpawnPoint;

And here's my cpp constructor  code:
AGunBase::AGunBase()
{
    // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;
    RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    RootSceneComponent->SetupAttachment(RootComponent);
    GunMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    GunMesh->SetupAttachment(RootSceneComponent);
    BulletSpawnPoint = CreateDefaultSubobject<USceneComponent>(TEXT("Spawn Point"));
    BulletSpawnPoint->SetupAttachment(GunMesh);
}

Is this a bug?  How do i fix this?


texts: C# XNA Rectangle.Contains returns false?

texts:
I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the position of the spritefont. Then I created 2 Rectangles (and took the values of the Vector2s) and 2 Colors that will be given a value if the mouse is/isn't currently hovering the drawn string. My mainMenu.cs class contains these variables:

Vector2 playGameButtonPos = new Vector2(303, 300);
Vector2 exitGameButtonPos = new Vector2(303, 350);
List<string> m_ButtonList = new List<string>();
Rectangle m_ButtonArea0 = new Rectangle(303, 300, 50, 30);
Rectangle m_ButtonArea1 = new Rectangle(303, 350, 50,30);
Color optionsColor0;
Color optionsColor1;

mainMenu.LoadContent(ContentManager Content):

Game1.g_MainMenuFont = Content.Load<SpriteFont>(".\\mainMenu\\mainMenuFontTex");

mainMenu.cs's constructor:

m_ButtonList.Add("Play Game");
m_ButtonList.Add("Exit Game");

mainMenu.Draw(SpriteBatch spriteBatch):

var m_MousePosition = new Point(Game1.g_MouseState.X, Game1.g_MouseState.Y);
if (m_ButtonArea0.Contains(m_MousePosition))
{
    optionsColor0 = Color.Yellow;
}
else
{
    optionsColor0 = Color.CornflowerBlue;
}
if (m_ButtonArea1.Contains(m_MousePosition))
{
    optionsColor1 = Color.Yellow;
}
else
{
    optionsColor1 = Color.Red;
}
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[0], playGameButtonPos, optionsColor0);
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[1], exitGameButtonPos, optionsColor1);

Game1:

public static MouseState g_MouseState = Mouse.GetState();
public static SpriteFont g_MainMenuFont;
mainMenu m_MainMenu;

Game1's Initialize() method:

m_MainMenu = new mainMenu();

Game1's LoadContent() and Draw() methods:

m_MainMenu.LoadContent(Content);

m_MainMenu.Draw(spriteBatch);

But when I hover with my mouse on the position where the Rectangle should be, nothing happens.


texts: How to align FixedUpdate variable change with user input

texts:
I'm creating a small endless runner where the player has to swipe up and down on the screen to move a fish. Imagine Subway Surfers where you travel smoothly as opposed to just jumping a foot to the left or right. Anyway, I am trying to make the fish rotate in the approximate direction of the player's finger and gradually rotate back when the player lets go of the screen. The program was working almost smoothly -- except for the fact that the fish was rotating back to the default position constantly, so it looked really glitchy.

The way this script works is that it takes in two Vector2 variables - the current and previous positions of the fish. It then subtracts these to get a Vector2 denoting the change in position since the last frame. I then feed it into Mathf.Atan to get the direction of this motion. Finally, I rotate the fish by this new amount - minus its current rotation - to get it going in the right direction. I'll show the code down below. Upon investigating why this was causing the fish to consistently rotate back to 0 degrees for a couple frames, over and over, I learned that the Unity thought that the change in y position was the thing switching to zero every other frame. All of my code is operating on FixedUpdate and I don't use Update anywhere, so I have no idea why it is switching so erratically. If user touch input is measured during Update, that might be the source of the problem, but it would be nice if I could find a solution. I'm just kind of confused, and would love if someone could clear this up for me as soon as possible.

Now here's my code for the class "RotateByTouch":

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateByTouch : MonoBehaviour
{
    public TrackObjectMotion trackObjectMotion;
    public GameObject thisObject;

    public float rotationValue;

    void FixedUpdate()
    {

        rotationValue = Mathf.Atan(trackObjectMotion.DeltaY / trackObjectMotion.DeltaX) * Mathf.Rad2Deg;

        thisObject.transform.Rotate(Vector3.forward, rotationValue - thisObject.transform.rotation.eulerAngles.z);

    }

}

And here's my code for the class "TrackObjectMotion":

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TrackObjectMotion : MonoBehaviour
{

    public Vector3 CurrentPosition;
    public Vector3 PreviousPosition;

    public float DeltaX;
    public float DeltaY;

    // Update is called once per frame
    void FixedUpdate()
    {
        PreviousPosition = CurrentPosition;
        CurrentPosition = this.gameObject.transform.position;

        DeltaX = CurrentPosition.x - PreviousPosition.x;
        DeltaY = CurrentPosition.y - PreviousPosition.y;
    }
}

And finally, here's the code I used for the actual moving of the fish:

public void FixedUpdate(){
    foreach(Touch touch in Input.touches){
        if(touch.Phase == TouchPhase.Moved){
            this.transform.Translate(0, touch.deltaPosition.y, 0);
        }
    }
}

That last bit is just leaving out a little bit about multiplying by constants to get the desired result, but that's not important.

Thanks in advance!


texts: Bullet Physics StepSimulation really slow when smaller TriangleMeshShape is inside bigger BoxShape

texts:
I observed that bullet physics StepSimulation is very very slow when a rigidbody with a TriangleMeshShape is fully inside a rigidbody with a simple BoxShape. I noticed that when I move the trianglemeshshape object a bit out of the boxshape my simulation started to run as fast as usual. How can i improve the performance for thats cenario? At some point in my simulation I have to test for all trianglemeshshapes are fully inside a boundingbox. So far i have to do the test on demand and cant just keep the boxshape in the simulation all the time.

I tried using ghostobjects but that didnt help to improve the performance. I assume that the problem lies with the inetrnal working of bullet physics and how the DynamicsWorld performs the collision testing.

Does anyone have an idea how to improve performance for many small trianglemeshShapes inside one big boxshape? all my shapes are kinematic.


texts:
I've constructed a scene using OpenGL/GLUT with a spot light but I'm getting troubles with light shining some of the walls

what is going on and how to solve?


texts: Can I use popular classical music as my game's soundtrack?

texts:
Can I use popular classical music in my game as a soundtrack? I'm concerned about copyright protection. I don't plan to make money off of my game.

Will I break some law if I do that?


texts:
I'm developing a 2D platformer with action-fighter elements. Currently things are working relatively smoothly but I'm having difficulty sorting something out. For the time, keeping my character's states and actions separated and preventing them from stepping on each others' toes is working out well and properly, but I would like to add a feature to my character to get him to behave a little bit more fluidly for the player.

At the moment, he has numerous attacks and abilities that he can execute, all of them being executed with button presses. Here lies the problem: Being as everything is executed through button presses, while an action is in progress I flag the game to disregard further button presses until the action has completed. Therefore, consecutive actions cannot be performed until after the previous action has completed entirely. In runtime this behavior feels very icky, and very ungamelike.

In games that rest most memorably at the forefront of my mind the player is able to execute button commands during the process of actions, and at the end of the current action, the following action is executed (seems like some sort of a queue system or something)

Can anybody offer any guidance with this?


texts: MMO architecture - Highly Scalable with Reporting capabilities

texts:
A friend of mine is asking me to help out on a project of his, I have done a small amount of game development before, but mainly do application and enterprise development these days.

He is asking me to look into some of the networking part of his game. I know that a huge part of this is going to involve reporting/analytics as well as scalability, so it isnt as simple as spamming a server and instantly getting responses.

In the enterprise app/web world we tend to use CQRS pattern or some other similar approach when we need to scale quite well and also take into account reporting on interactions etc.

So I imagine that most typical MMO style games (lets assume mmorpg games akin to WoW), they must employ a heavily distributed and scaleable system. So do they end up using a node system with a messaging fabric behind the scenes?

Sorry for being a bit vague but are there any sort of articles on people discussing the overall architecture for these style games?


texts: Why am I getting errors like these when trying to build my app

texts:
I am currently trying to build and publish my app to the universal windows platform halfway through the process of doing so, during the validation process I got stopped with these errors. The 1st one I am clueless to what I can even do and the second one I don't know why is happening. Please help.

First error:

  Supported API test  FAILED

  Supported APIs

  Error Found: The supported APIs test detected the following errors:

  API D3D12GetDebugInterface in d3d12.dll is not supported for this application type. UnityPlayer.dll calls this API.

  Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements.
  How to fix: Review the error messages to identify the API that is not part of the Windows SDK for Windows Store apps. Please note, apps that are built in a debug configuration or without .NET Native enabled (where applicable) can fail this test as these environments may pull in unsupported APIs. Retest your app in a release configuration, and with .NET Native enabled if applicable. See the link below for more information:
  Alternatives to Windows APIs in Windows Store apps.

Second error:

  App resources  FAILED

  Branding

  Error Found: The branding validation test encountered the following errors:

  Image file SplashScreen.scale-200.png is a default image.

  Impact if not fixed: Windows Store apps are expected to be complete and fully functional. Apps using the default images e.g. from templates or SDK samples present a poor user experience and cannot be easily identified in the store catalog.
  How to fix: Replace default images with something more distinct and representative of your app.

Here is the full output for further details:

1.1.1.0
App Architecture: x64
Kit Version: 10.0.16299.15
OS Version:  Microsoft Windows 10 Pro (10.0.16299.0)
OS Architecture:  x64

Deployment and launch tests
PASSED
Bytecode generation
PASSED
Background tasks cancelation handler
PASSED
Platform version launch
PASSED
App launch
PASSED
Crashes and hangs
Package compliance test
PASSED
Application count
PASSED
App manifest
PASSED
Bundle manifest
PASSED
Package size
PASSED
Restricted namespace
Windows security features test
PASSED
Binary analyzer
PASSED
Banned file analyzer
PASSED
Private code signing
... (error 1 above)
App manifest resources tests
PASSED
... (error 2 above)
Debug configuration test
PASSED
Debug configuration
File encoding test
PASSED
UTF-8 file encoding
App Capabilities test
PASSED
Special use capabilities
Windows Runtime metadata validation
PASSED
ExclusiveTo attribute
PASSED
Type location
PASSED
Type name case-sensitivity
PASSED
Type name correctness
PASSED
General metadata correctness
PASSED
Properties
Package sanity test
PASSED
Platform appropriate files
PASSED
Supported directory structure check
Resource Usage Test
PASSED
WinJS background task

**


texts: Approximating strength and hardness of alloys

texts: I do not have any formal education in metallurgy, but I am trying to make a game mechanic based on it. I need to be able to alloy together different metals and alloyable materials such as carbon in different percentages, and get an approximation of the strength and hardness of the resulting alloy. If anyone has any ideas how what I would need to do to calculate such a thing I would be very appreciative, thanks!


texts: GameObject keeps snapping to camera size on play

texts:
I'm in the process of making my GameObject move when I drag it across the screen using touch. But my current issue is when I press play to test the game, game object snaps to the size of my camera on the Y. The camera by default is set to a size of "5" but I have mine set to "5.194104". The GameObject will snap to this position on play. I cannot figure out why. Instead of the object staying at the -4.5f like I have in the Vector3, it jumps to the camera size.

Here is what I have:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PaddlePosition : MonoBehaviour
{
     void Update()
     {
         OnFingerDrag();
     }

     private void OnFingerDrag()
     {
           Vector3 fingerPosition = new Vector3(Input.mousePosition.x, -4.5f, 0.0f);
           Vector3 objectPosition = Camera.main.ScreenToWorldPoint(fingerPosition);

           transform.position = objectPosition;
     }
}


texts:
I'm looking to make a multi-player platforming game using UDK.
I'm currently doing feasibility research, to make sure I will reasonably be able to do all of the technical things I want to do. The first major hurdle I've come across without being able to find as answer, are one-way platforms.

That is to say, platforms through which a player can jump up, but not fall through (unless they choose to).
These are commonly seen in games like Mario, Kirby and Smash Bros.

Does anyone know how such a system would work within UDK? I can think of solutions that might work for single-player, but not multi.


texts: As a matter of habit I always shrink UVs to just below the full texture space, even for single island things like sprites. Can I have my UVs touching the actual border or is this bad practice?


texts: Creating colour spectrum by light flux values

texts:
I am using radiosity method to compute the inter-reflected light within a room. The room is gridded into small patches and the light flux in lumen is calculated for each. This part is done. Now I want to change the colour of each patch so that the room surfaces show a continuous colour banding contours like this image, but have no clue how to this.

Update:

Here is a sample data for a room surface. The data is in this format:
(x, y): value


texts:
So, I would like to add my own chat filter to my game, how would I do this?

eg:
Player says: "DIE"
Goes through chat filter and comes out as: "###" or any other string I specify.


texts: How would I add a sound variable to my code?

texts:
I am writing some code in JavaScript for a ray cast shooting program. I have all the variables I need except for sound, and I'm not too sure on how to add that variable into my code. I would really appreciate any help people can give to solve this problem, and show me how to add a sound variable to my code.

#pragma strict

var Effect : Transform;
var Damage = 100;

function Update () {

 var hit : RaycastHit;
 var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));

 if (Input.GetMouseButtonDown(0))
 {
  if (Physics.Raycast (ray, hit, 100))
  {
   hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
  }
 }
}


texts:
I rotate each piece by rotation formula. More detail, because rotation angle is 90 so :

xNew = y;

yNew = -x;

But my method has met two problems :

1) Out of box : each type of pieces is fit in square 4x4. (0,0 at under left) But by this rotation, at some case they will out of this box. For example, there is a point with coordinate (5,6) So, please help me how to fit these coordinate into 4x4 box again, or give me another formula for this.

2) at I case : (4 squares at same row or same column), just has two rotations case. but in method above,  they still has 4 pieces. So, how to prevent this.

Thanks :)


texts: 'No Platforms Found' error in Unity Android

texts:
I am having a problem with Unity Android - every time I try to "build", a 'No Platforms Found' error pops up.

Thing is that I already have Android SDK in my computer (copied it into my G drive from the official .zip download). JDK is installed too.

I use Unity 4.0.0f7 Pro version, and have SDK Platforms 2.1 (API 7), 2.2 (API 8), 2.3.3 (API 10), 3.0 (API 11), 3.1 (API 12), 3.2 (API 13), 4.0 (API 14), 4.0.3 (API 15) and 4.2.2 (API 17).

How can I remove this error and build successfully?

P.S.  I have already had a look at some of the threads in Unity website regarding this matter. None of the suggested answers has worked for me.


texts:
(I know this site doesn't give legal advice, but what I'm dealing here with isn't anything serious at all. Also, I apologize to JP for being annoying over this.)

Someone found a game I made on the Internet, and expressed interest in buying it. We agreed upon a price, and, in the meantime, I removed the game's source from the Internet, just to be sure.

Now, I'm wondering what to do next.

These are the terms:

He gets the game's source code, and only that, without the graphics (which weren't made by me).
He gets the right to develop and sell the game.
I get to keep the ownership of the original game, meaning that I can use it in my portfolio when applying for jobs, for example.
The game gets to stay on its original site.

But I am not sure how can I legally realize this. Which license can I use?


texts: Unity - adding camera constraint to prevent the player from seeing beyond the scene

texts:
Like the title says, I'm after some kind of constraint for the camera to prevent the player from seeing beyond the scene and seeing the Skybox. I came across the code to add a Mathf.Clamp, but I can't get it to work.
I'm currently trying to make a 2.5D platformer in which the camera follows the player (ahead), which leads to seeing beyond the scene to the far left and right. I already have an invisible wall in place to prevent the player from falling off, but I would love to also clamp the camera from going any further.

This is the script I have at the moment:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour
{
    [SerializeField] GameObject player = null;
    [SerializeField] [Range(0.1f, 2f)] float followAhead = 2f;
    [SerializeField] [Range(0.1f, 2f)] float smoothing = 1f;

    //public PlayerController playerController;

    private float minPosition = -9.37f;
    private float maxPosition = 4.68f;
    private Vector3 cameraClamp;

    const float m_minY = 2f;
    Vector3 targetPosition;
    Vector3 cameraOffset;

    void Start()
    {
        cameraOffset = transform.position - player.transform.position;
    }

    void Update()
    {
        targetPosition = (player.transform.position + (player.transform.forward * followAhead)) + cameraOffset;
        //smoothedForward = Vector3.MoveTowards(smoothedForward, playerController.GetTravelDirection(), 0.5f * Time.deltaTime);
        //targetPosition = (player.transform.position + (smoothedForward * followAhead));
        //transform.position = player.transform.position + cameraOffset;
        targetPosition.y = Mathf.Min(targetPosition.y, m_minY);
        transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing * Time.deltaTime);
        cameraClamp.x = Mathf.Clamp(transform.position.x, -9.37f, 4.68f);
    }
}
```


texts: How to Store AI Knowledge about the Game-World for AI Decision Making

texts:
I have a game-world with a fair amount of AI that have some Senses, like vision, hearing, touch, smell, etc.

But I'm not sure how to put that information in a single place for the individual AI to then iterate over it and make a decision.

For example, each sense (emitter and receiver) currently returns a structure called a Stimulus with information like position, direction, stimulus type (sight, sound, smell, etc), npc type (human, animal, monster, etc), and so on.

And currently, the monster AI just have a hard-coded hierarchy of preference - touch (e.g., damage events) > sight > sound > smell, so if you fire a gun it'll try to follow that noise but if he then sees you, he'll switch to tracking you visually and forget about the noise.

However, this isn't very robust. It doesn't deal with repeated damage events or one player kiting or stale stimuli vs new stimuli very well. Ideally I'd want to use some sort of utility evaluation so that I can get more complex and dynamic behaviour out and I can fix edge cases where it feels like the AI isn't interacting right (e.g., ignoring stimuli that it shouldn't be).

I'm not sure how to approach that implementation. Should I just have an array of every stimulus the AI encounters and loop over that every tick? But then how do I prune that list since it'd get very large very quickly and might contain really old stimuli (currently the AI only has one "target stimuli" and new stimuli go through that hierarchy of preference before being either discarded or replacing the target stimuli).

(As a side note, this GDC Talk about Creating the Living, Breathing World of Hitman has provided some great information about how they deal with Knowledge, but I wasn't able to discern how they store it and iterate through multiple Knowledge fields of a single AI and so on).

(I'd also love any advice on the Knowledge/Stimulus data structure itself; to be modular enough to hold different types of information, instead of having a bunch of unused fields; say how a sound might need only type and direction, but a visual stimulus might only need type and position and so on)


texts: My game seems to be incompatible with recording software. What could be causing this?

texts:
I've just finished a little Game-Dev project for university and I need to record a video to accompany my submission (just in case they can't get my source to work). Basically my game doesn't work at all when FRAPS or Bandicam attempts to attach to it, I get a black screen and a stream of GL INVALID OPERATION messages from my error reporting code. Dxtory can't seem to hook into it correctly at all, it doesn't display it's FPS counter or anything. My game logic appears to be running correctly from the debug traces, it just seems like all the gl library calls break.

I don't know a huge amount about how these programs operate so I don't really know what I could be doing to cause this. I've heard they read from the OpenGL frame buffers so maybe I'm doing something wrong there? I'm letting GLFW and GLEW do all the low level initialization, but I have successfully recorded projects with the same setup and recording software.

Essentially, has anyone ever run into something like this before or do you know anything about how these programs work that could give a clue as to the cause of the issue?


texts: Any tips on developing an RTS unit movement collision?

texts: so I am developing an RTS and I am a little stuck at this. I am not talking about pathfinding algorithms like A*. The problem is moving units in bulk and their collision along the way. Can anyone give me some pointers or tips on how to start working on this. Older RTSs have a lot of problems in this. Warcraft 3 for example. When playing it now after some SC2 it is excruciating when units collide and block each others path and so on. I really want to avoid that. Thanks.


texts: Is it bad practice to use the entire map image as a tilemap?

texts:
I made a map in photoshop which I want to use as a map in my game. The question is should I try to cut it up to pieces, or is it bad (performance wise) if I use  the way I made it. The picture itself is really specific without any repeatable part so I'm not sure if I can cut it up to smaller parts.

I'm kinda new to game developement, so pls forgive me if I asked something stupid here.


texts: Discoordinated Chromatic Aberration Effect

texts:
The game Teleglitch heavily utilizes the CA effect with screen distortion.

I am trying to achieve this effect.

Issue 1. How to not apply the effect onto the floor? (solved)

They render the screen then apply the CA effect.  However, the floor is not rendered with the post processing effect.

Issue 2. How to have discoordinated position for each rendered CA effect?

Currently I have three offsets for each channel: red, green, and blue.  However, I cannot assign different offsets for the channels for certain areas only.  What would be a way to have discoordinated positions?


texts:
I have a 3d scene and a camera; I want to create video file from camera pre-set movements.
If it is possible, running application by command line (without needed to "show" at video, my camera) .

Is it possible in Unity ?

If yes what's the best approach ?

Thanks


texts: Control Two agents separately with one script?

texts:
I have two characters"agent" moving them on terrain by mouse. My script for both of them is...

public Vector3 point_;
public float mark;
public float mark;
public UI_Button _active_character; // butoon select script

void Update
{

  Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit mousePoint;
    if (Input.GetMouseButtonUp(0))
    {
        if (Physics.Raycast(mouseRay, out mousePoint, 100) )
        {
            point_ = mousePoint.point;
            mAgent.SetDestination(mousePoint.point);
            mark = Vector3.Distance(point_, gameObject.transform.position);
        }
    }
 }

Here script for character buttons. Every character has it own button.

public bool character1, character2;

void Start()
{
    character1 = true;

}

   void Update()
{

    if (character1 == true)
    {
        character2 = false;
    }

    if (character2 == true)
    {
        character1 = false;
    }

   if (character1 == fale && character2 == false)
    {
    // Later. free cam moving...
    }

}

public void avatar1_click() // button
{
    character1 = !character1;
    character2 = false;

}
public void avatar2_click() // button
{
    character2 = !character2;
    character1 = false;
}

It's possible to control both of them separately by one script by click on button to chose character ?


texts: How do I connect circuit to PC so that I can use it to play a game?

texts:
I made a circuit, which acts like a digital dice using diodes 1N4148, IC 555, IC 4017, 8 & 16 pin IC socket, LED, push-to-on switch, resistors & connecters.

By pressing the push button, 4017 counter toggles between 0 & until released. Once released, a random number is displayed. This is determined by the clock pulse generated by IC 555, which determines the state of 4017 counter.

Now I am thinking of making an application so as to capture this value(LED's lit) so that it can be used in a game like monopoly.

Is there any way I can achieve this ?


texts: How can I automate high-level user interactions to test correctness of my game?

texts:
I am trying to automatically simulate the game experience in my programming game. I think Expect is the way to do it because it creates its own tty for the process, becoming independent process of the main process but I want that some key sequence is pressed down in some pattern, such as press the key Z down every minute or press this that with this that pauses, without really expecting any specific file descriptors. Is there some ready programs to automate this kind of high-level debugging?

I have access to obsd and ubuntu.


texts: SailsJS + Rotational direction coordinates calculation issue

texts:
I'm creating a small game to learn how NodeJS & Sails work (and by extension Waterline, Socket.io, Express, and all their components).

I'm using websockets to make the server calculate the coordinates. Everything is handled server-side.
The client only receives serialized data in order to redraw the whole canvas.

For debugging purposes, I decided not to redraw but simply "draw" (leaving the old canvas visible) to show you the result.

See below for situation, issue and code.

The issue

I'm having trouble when calculating coordinates.

What I need is a simple forward/backwards system, and when pressing left or right keys, change the direction angle so the character can move in the canvas.

Kinda like the good'ol Asteroids retro games.

The issue is the following:

The drawn loops you see shouldn't exist. In fact, they should be circles. I drew this by simply pressing either up or down key, combined with one of left or right keys.

I think there is an issue in the calculation system...

This shouldn't be a performance issue because each tick occurs at the same interval, so even if it was a performance issue, it should only be related to delay when redrawing the canvas, not such an offset in coordinates calculation...

Any idea ?

Info about code api

moves contains a javascript object like this:
{ left:false, right: false, up: false, down:  false }
It is used to check whether the user is "pressing" associated arrow keys.
It is updated each time there is a keyUp or keyDown event client-side.
user.pick contains the "physical object" to be rendered in the canvas, which contain x, y coordinates, and information about movement speed and rotation speed.

Here's the code that handles the coordinates calculation.

// Change angle if "left" or "right" is pushed
if (moves.left || moves.right) {
    // let PI2 = 2 * PI;
    let angle = user.pick.angle;

    if (moves.left) {
        angle += user.pick.angleSpeed;
    } else if (moves.right) {
        angle -= user.pick.angleSpeed;
    }

    // Use this to avoid having huge integers to manage
    if (angle < 0) {
        angle = 360 - angle;
    }
    if (angle > 360) {
        angle = angle - 360;
    }

    user.pick.angle = parseInt(angle);
}

// Up and down allow us to move either forwards or backwards.
if (moves.up || moves.down) {

    let moveRatio = moves.up ? 1 : -1;

    let angleRadians = user.pick.angle * (PI / 180);
    let x = user.pick.x + moveRatio * user.pick.speed * Math.sin(angleRadians);
    let y = user.pick.y + moveRatio * user.pick.speed * Math.cos(angleRadians);

    // Avoids collisions with canvas walls
    if (x > 0 && x < user.map.width) {
        user.pick.x = parseInt(x);
    }
    if (y > 0 && y < user.map.height) {
        user.pick.y = parseInt(y);
    }
}


texts:
Spot It is a card game 55 cards. Each card has exactly 8 symbols on it (though the total number of different symbols used in the 55 card set is 57). For any two cards in the deck, they share exactly one symbol. For example:

What is the algorithm behind building this deck? Intuitively I think there is a formula for creating a deck of N cards, with I symbols per card and using J total symbols.

For the life of me I cannot figure it out.

Can it be done?


texts: How do the Box2d and Bullet physics simulations work internally?

texts:
I've seen box2d and bullet ported into JavaScript, but neither of them attracted me, except for the source code. It all seemed quite simple, once I looked inside.

What are they doing within each of those libraries to get nice physics simulation? I can not find any explanation.


texts:
I'm developing a dll that is to be used in two Unity projects.

I've read that the way to reference a dll is to drag it into a 'plugins' folder so that it is added to the Unity project's dependencies, as their is no "add reference" available for this project in Visual Studio.

But doing that the Unity project does not take into account that the dll evolves (as it is still in development).

What I'd like (if possible) is to set up an automatic way so that the Unity projects update their dependencies when the shared dll is updated.

I've try the reimport option (right click on the dll in Unity) but it seems that it is not working.

What is the best way to manage this situation?


texts: Do I, and how, separate the concerns of input and game objects?

texts:
In probably every game a developer has to somehow deal with input, may it be simple keyboard and mouse events, touch events or something as accelerometer input. This input directly of indirectly effects objects in the game. Sometimes the same input can effect diffent objects. Now I've been thinking about how to model this. The way I see it there are two different approaches.

Let the game object itself handle it, subscribe to the events and call it's own methods.
This has the advantage of letting the game-objects themselves decide which inputs cause which action. A disadvantage seems to be that the input code gets mangled with the "core" game object code. Also the game objects are unaware of the state of the rest of the game, and should sometimes maybe not act upon input events. This doesn't seem right.
Have a general input-controller take care of all the input and make decisions about who gets to handle what event.
This seems to separate concerns better, but tighly couples the input-controller class to the game-objects. It somehow need to know who wants to receive which event and in which state. This doesn't seem right either.

What strategies are you using to handle this?


texts: 2D sprites not drawing at correct depths?

texts:
I've been having some problems with getting my sprites to draw in the correct order.

Right now there are 2 types of objects: nodes and paths. I always want the nodes to draw over the paths so I have set the depths of the nodes to 0 and the depth of the paths to 1. They're being drawn in the same SpriteBatch call and I'm using SpriteSortMode.Deferred yet the paths are still being drawn on top of the nodes.

I've tried swapping the depths of these and they still draw in the wrong order. I've also tried switching the sort mode to BackToFront and FrontToBack but both of those mess up the graphics for the rest of the game so it's not really worth switching to either one of those.

Is there something obvious that I'm doing wrong? Is changing the draw order (paths are always drawn after nodes) the only way to get the nodes drawing on top of the paths?

Thanks!


texts: How can I traverse a scene graph and hit only nodes in the view frustum?

texts:
Scene Graph seems to be the most effective way of representing the game world.

The game world usually tends to be as large as the memory and device can handle. In contrast, the screen of the device captures only a fraction of the Game World/Scene Graph.

Ideally, I wish to process(update and render) only the visible game objects/nodes on per-frame basis. My question therefore is, how to traverse the scene graph so, that I will focus only on the game notes that are in the camera frustum?

How to organize data so that I can easily focus only on the scene graph nodes visible to me?
What are techniques to minimize scenegraph traversal time?
Is there such way as more effective traversal, or do I have to traverse whole scene graph on per-frame basis?


texts:
Many java games use thread.sleep() to controll fps. Since the server does not display graphics, should the server game loop keep running just calculating delta time? Like this example:

long lastLoopTime = System.nanoTime();
final int TARGET_FPS = 60;
final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

while (gameRunning)
{
   long now = System.nanoTime();
   long updateLength = now - lastLoopTime;
   lastLoopTime = now;
   double delta = updateLength / ((double)OPTIMAL_TIME);

   doGameUpdates(delta);
}


texts: Where should complex state logic in an ECS reside?

texts:
I've been using ECS for a while, at the moment I'm using my own, but it's pretty standard.  Components are data only, Entities pretty much just a Map with some additional metadata and Systems that match combinations of components and contain the logic.

You have combinations of components that result in the more general functionality.  For example Position + Graphics gives me some nice static background image.  Position + Graphics + Physics gives me a entity that can move around etc etc

This question is about the various options for implementing more specific game logic.

But say I want to implement a Door.  It has Position, Graphics and a Collidable Hull but it needs 2 states, open and closed.  When its open it has texture A and its Collidable Hull is disabled, and when its closed it has texture B and its Collidable Hull is enabled.  Lets say the state change should be triggered across some internal channel in the engine.

What are the options for implementing this state change?

Option 1 is to create Door component, with say 2 variables, door state and state change channel. I'd also need a door system that handled the logic to manipulate the components when it receive the open/close message.

Option 2 would be to create a FSM.  The FSM is probably also a component with a corresponding FSM System.  Logic and state would need to reside somewhere, possibly by sub-classing the FSM or having a generic property map in the FSM and static logic functions for the Door defined elsewhere.

There are more exotic alternatives to FSM's i.e. Actions Lists or Behaviour trees, but they are similar to option 2.

What considerations are there for choosing a full component/system over an more generic FSM type solution?  What if I had 100 different game objects with different behaviours? Would you really expect 100 component/system pairs for each one or would you try and create a more generalized solution? Are there any other options?


texts: GameMaker Studio: fullscreen vs. dialogs

texts:
When setting my game to fullscreen, I get problems with dialogs:

"get_save_filename" opens in the background, and when I close it, the game doesn't react anymore.
Asking the user a yes/no question exits fullscreen mode and does not enter it again afterwards.
"window_set_fullscreen" doesn't seem to do anything either...

Can anyone help?


texts: Is it a bad practice to add helper methods if the class is intended only for data?

texts:
For example, if I have something like:

class ItemData
{
    public int cost;
    public int level;
    ...
    public List<ItemData> childItems;
}

And I'm aiming to separate data from logic, is it ok if I add methods to ItemData such as:

class ItemData
{
    ...
    public void AddChildItemData(ItemData childItem);
    ...
}

that are helper methods for setting or manipulating the data? Or should these be moved elsewhere to service classes?


texts: How can you merge the geometries of cloned objects in Three.JS?

texts:
So I'm testing the best non-voxel way to display a lot of objects at once and so I found how to merge geometries.

Now, I can easily merge most geometries, but I can't seem to merge the geometries of cloned objects.

I've noticed that by simply using cloned objects, I can nearly get the same performance I get when merging geometries.

Is there a way to combine these two things for even better performance?

Here is a sample of my code, with the broken methods commented out.

var testGeo = new THREE.BoxGeometry( 1, 1, 1 );
var testMat = new THREE.MeshLambertMaterial( {color: 0xffff00  });
var testMesh = new THREE.Mesh( testGeo, testMat );
testMesh.position.set(1, 5, 1);
testMesh.castShadow = true;
testMesh.receiveShadow = true;
scene.add( testMesh );

//Testing with 900 objects.
var iterLength = 30;
for(var i = 0; i< iterLength; i++) {
    for(var j = 0; j< iterLength; j++) {

        var testGeo2 = new THREE.BoxGeometry( 1, 1, 1 );
        var testMat2 = new THREE.MeshLambertMaterial( {color: 0xffff00  });
        var testMesh2 = new THREE.Mesh( testGeo2, testMat2 );
        testMesh2.position.set(i, 2, j);
        testMesh2.castShadow = true;
        testMesh2.receiveShadow = true;

        //Clone Test (This won't work)
        /*
        var testMesh2 = testMesh.clone();
        testMesh2.position.set(i, 2, j);
        */

        //Reference Material/Geo test. (This also doesn't work)
        /*
        var testMesh2 = new THREE.Mesh( testGeo, testMat );
        testMesh2.position.set(i, 2, j);
        testMesh2.castShadow = true;
        testMesh2.receiveShadow = true;
        */

        //Merge.
        testMesh2.updateMatrix();
        testGeo.merge(testMesh2.geometry, testMesh2.matrix);
    }
}


texts:
I am trying to set the path for the android SDK in GameMaker: Studio, but I am having an unexpected ammount of difficulty with this. Initialy, I installed Android Studio and tried setting it's directory, but got the "Cannot find Android SDK in this directory C:\Program Files\Android\Android Studio" error. So I tried going deeper into the program's directory but continued to get the error.

I went online and did some research which yielded several different options (none of which worked). The first thing I looked into was this link in the YoYo Game's GMS community. Then I tried downloadong all SDK packs in android studio, then moving the SDK folder to:

C:\Android\android-sdk

This also did not work.

I even went through every single android related folder and came across three additional "SDK" directories. Again, none of them worked. I even tried downloading an archived version of the SDK that did nothing. I have been attempting to set up my android SDK for over an hour!

Is there something I'm missing here? Do I need to update something? Does Android Studio no longer include the necessary SDK files?


texts: How do you setup a scrollable overworld map on an HTML/JQuery based game?

texts:
Problem and Requirements

I'm putting together a simple game that will involve an overworld map consisting of 12px x 12px square terrain tiles.  These maps may be as large as 500x500 in size (so 250k tiles).  I would like the player to be able to drag their way around this map quickly and easily, much like you can in Lords Mobile or other similar mobile games.

It would be preferable if the user could easily zoom in and out.  I will also be placing interactive 'nodes' of various sorts on this map.

Technologies and Stats

Languages:

Lucee backend to generate these maps
HTML and JQuery for display
I'm willing to use other Javascript libraries, but would prefer not to have to learn some whole new framework unless absolutely necessary.

Devices:

Game will be designed primarily for mobile devices, but should run in any browser on any device.
Due to mobile support, resources will be limited.
I will likely create an Android app made up of a splash screen and a webview.  My Java skills are lacking (and I dislike Java) so I really don't want a Java based solution.

Map Stats:

Maps are expected to be between 200x200 and 500x500.
They may need to be larger, possibly in excess of 1200x1200.  So I would like a scaleable approach.

Possible/Rejected Solutions

The obvious first thought was to create a large container div, and an < img > for each tile absolutely positioned within that container.  However, a quarter of a million img tags, each with events attached, is insane, so I rejected this almost as soon as I thought of it.  I tested it anyway on my gaming PC just in case and memory usage shot through the roof and there was significant lag.  This would be completely impractical on a phone or other mobile device.

So then I thought that since the world map won't really ever change, maybe I could create one large image, and just pickup where the player taps via the click event properties and calculate the tile from that.  However, for a 500x500 map of 12x12 tiles, that would be a 6000x6000 image (36 megapixel).  Again, I would be concerned about a mobile device handling that, especially with hundreds of 'nodes' and other 'stuff' dropped on top of it.

So I thought maybe I could just build a container div at the full 6000x6000 size, and then load terrain tiles just for the 30-40 terrains within (and surrounding) the viewport.  As the user tries to scroll I could dynamically generate the other img tags based on data either from an AJAX call or an array that holds all of the terrain data (if it's not too resource intensive).  This seems overly complex, though, and I'd prefer a simpler solution, especially if this is going to lead to any sort of lag.

Question

How do other HTML/Javascript based games handle this sort of large scale overworld map?  I can try to muddle through this myself, but this must be a very common need and I'm sure there are great solutions already out there.


texts: Multilingual data bases for most common words and phrases used in games

texts:
Games tend to have easy to understand instructions/menus/tutorials and so on, so I was wondering whether...

Are there multilingual data bases, built-in with the most common phrases used in games?

For instance Start, Resume, Play, Pause, Edit Profile, Awards, etc.

Any info is appreciated.