texts: What 3D engine supports real-time editable 3D terrain loaded in from a server?

texts:
I'm currently having a problem choosing an engine for a game project I have since a few years.
What I'd need is to be able to load a terrain from a remote server (which I can take care of) and display it dynamically, if possible with paging.
The terrains should also be able to be edited in realtime (locally or remotely and transmitted by the server).

I can take care of the network part but need a 3d engine flexible enough to support the terrain features detailed above.
Would you know a 3D engine which could support this ? I'd prefer programming with .NET but C++ is also fine.


texts:
I have been reading the documentation about Physics materials, and it really seems very incomplete to me. When I try to work with it, I get so many questions... Maybe can someone help me wrap my head around how it works?

Why is there a physics material field for the Rigidbody2D, but also another in the BoxCollider2D?
Do they work differently, depending on which you put it?
What happens if you put different materials, one on the RB and one in the collider with different settings?
If a player is standing in a platform, and you want it to bounce, or slide... do you set that on the player? Or in the platform?

Update
As suggested in the comments, I did some experimenting and this is what I saw:

When I put contradicting materials in the RigidBody2D and the Collider2D, the one in the collider seems to take precedence. Not sure what is the purpose of the one in the Rigidbody.
If both are the same, well, they just behave like one of them alone. The value isn't added


texts: How can I change the rendering backend on Windows in Monogame?

texts: I'm using MonoGame with Visual Studio 2013 Express. I'd like to switch from a SharpDX backend to OpenGL and OpenAL. How do I achieve that?


texts: Strange effects (inadvertently dividing edges) when doing Maya's extrusion

texts:
Firstly, I thought this was the best place to post my question, since there isn't a Maya section or a generic 3-D modeling section, as far as I saw.

I am following a tutorial which can be found here https://www.youtube.com/watch?v=fhPWIDX5iQ0

Currently, I am struggling to figure out what setting I messed with to create such weird effects when I am trying to extrude. Apparently it is dividing every edge connected to the four vertices I am trying to extrude in half, then connecting the new vertices together. You can see the vertices I am extruding in yellow.

Any suggestions on what I may have messed up? I am clueless, and probably don't even know what to search for other than "Strange Maya Extrusion" and "Maya Extrusion Dividing Edges", without any luck. So, anyone know why this is happening or how to fix it?

Thanks


texts: Same premise as this question. When the ball bounces off of a wall, I want the ball to temporarily ignore all further collision events of the wall it just collided with, for three seconds for example. What's the best way to accomplish this?


texts:
I'm pretty new to Unity and after a bit of googling around I have come up with this code to draw my tilemap (the script is attached to my camera).

I am simply trying to use nested for-loops to draw a grid of grass tiles, here is my code:

public class DrawMap : MonoBehaviour {

    // Use this for initialization
    void Start () {

        Sprite grass = (Sprite)Instantiate(Resources.Load("Grass"));
        float x, y;

        for (int i = 0; i < 20; i++) {
                        for (int j = 0; j < 20; j++) {
                            x = i * 1.28f;
                            y = j * -1.28f;
                            Instantiate(grass, new Vector3 (x, y, 0f), Quaternion.identity);

                        }
                }
    }

    // Update is called once per frame
    void Update () {

    }
}

I keep getting an error where I initialize "grass" saying the it cannot cast the source type from the destination type. I created "grass" to be a prefab from a slice of a spritesheet that i imported.

Any help would be greatly appreciated


texts:
TL;DR: What approach should i use for streaming a maps assets?

My Unity project so far saves terrain meta data (in a flat file for now) and then streams the map as the player moves.

Upon completing this, it was clear that if I wanted to stream anything, its information would need to be stored somewhere.

With all this said, do I store my entire map's information in a local db or something?

For example, where object X must be, where objects C must be, etc etc. Instantiate everything at run time when that particular tile gets streamed.

This seems like a solution an inexperienced game dev (me) would come up with.


texts: How do I create a custom "Google Maps" visualisation from game map images?

texts:
I am attempting to create the equivalent of a Google Maps map for a private Ultima Online server, with a custom map replacing the default map.

I'd like to allow players to pin important locations on the map and post screenshots of their play activity at a particular location.

I've seen this done in other games like Wurm Online. Does such a version of Google Maps (or a similar service) exist? Or would I have to build it myself?


texts: How can I modify how my scene is drawn to make it look like it's taking place at different times of day?

texts:
My game has a day-time association with the scene, that the morning light will be different from the afternoon and the night. But I don't know how to make this difference.

Here is an example in Pokemon game:

I have an idea that put a layer on the top of the game with the transparency about 10 - 20%, and change its color depends on the time, but I don't know which color is good.

Are there any other mechanisms to do some kind of day/night cycle in a game of this style?


texts: How to move a sprite automatically using a physicsHandler in Andengine?

texts:
I use a DigitalOnScreenControl (knob with a four-directional arrow control) to move the entity and the entity which is bound to a physicsHandler.

physicsHandler.setEntity(sprite);
sprite.registerUpdateHandler(physicsHandler);

From the DigitalOnScreenControl, I know which direction I want my sprite to move. Inside its overridden onControlChange function, I call a function animateSprite that checks which direction I chose. Based on the direction, I animate my sprite differently.

Problem: I want to automatically move the sprite to a specific location on the scene, say at coordinates (207, 305). My sprite is at (100, 305, which means it has to move down by 107 pixels.

How do I tell the physicsHandler to move the sprite down by 107 pixels? My animateSprite method will take care of animating the sprite's downward motion.


texts: How can I use ARB_debug_output with SDL on Windows?

texts:
I'm trying to port a small GL program that I've been working on from Linux to Windows. I have the following:

window_ = SDL_CreateWindow(...);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
glContext_ = SDL_GL_CreateContext(window_);
glewInit();
if (GLEW_ARB_debug_output)
{
    glDebugMessageCallbackARB(&DebugCallback, nullptr);
}

I was surprised to find out that GLEW_ARB_debug_output evaluates to false. Could it be that ARB_debug_output not supported on Windows, with the latest drivers for my video card (an older Radeon HD540v)? Am I doing anything wrong? I thought this extension was rather old, and it would probably be supported everywhere by now.

Update: I added my SDL initialization code, as I needed to pass SDL_GL_CONTEXT_DEBUG_FLAG. Unfortunately, ARB_debug_output is still not supported.

Update: After initializing the context with the debug flag through SDL, I manually queried the available extensions (bypassing GLEW) and ARB_debug_output is not available! Again, could this not be supported on my implementation?


texts:
We have an app with several mini-games in it and in each a highscore can be achieved. The score gets submitted by requesting an endpoint and passing the score as a json in the body. How can we be sure that the client is sending us the correct score? Our current solutions:

we're using wss, so man in the middle should be not possible
the client can access the endpoint only after authenticating with his device (over gamesparks)
at least on Android we're obfuscating the code
we're saving each score in two different variables and comparing them before sending one of them

Is there anything more we can do to secure the game? It seems to be quite effective to just submit the player interactions and calculate the scores server-side, but that seems - because of our several completely different games - to complicated in our case. What is about creating a hash of the score and comparing it on the server?


texts: How can I store game metadata in a .png file?

texts:
Spore allows player-created creatures to be shared by exporting a .png file. That .png is a photo of the creature, but if it's imported into the game, the creature's information (such as textures, size, and shape) also come with it.

How can I implement such a feature?


texts:
In my top down 2D shooter game the player has a shoulder mounted gun which rotates and aims automatically at enemies - that part is all working fine. Since the player can rotate as well, the gun is constantly updating it's angle to keep aim on the enemy.
But this causes a problem where the gun aims at the player's own head...! It doesn't have any practical consequences in the game, but obviously looks weird and unrealistic. So I need to create a 'dead zone' angle range where the gun cannot aim. It will have to aim as best it can at an enemy up to just before it aims at the player's head.
It seems tough to calculate since there are two angles in play. The dead zone will have to update itself as the player turns.

EDIT: This is what I had so far but I can't update the angle range since it then wouldn't work with the min max:
private float normaliseAngle(float angle) {
    return angle - (float) Math.floor(angle / 360f) * 360f;
}

private float clampAngle(float aimAngle) {
    float tempAngle = normaliseAngle(aimAngle);
    return (float) Math.min(Math.max(tempAngle, 45), 315);
}

This gives a dead zone between 315 and 45.


texts: In RecastNavigation, how can I make an agent idle after reaching its destination?

texts:
This question is specifically about dealing with the Recast Navigation library.

I have added an agent with addAgent and set its target with requestMoveTarget.
When agent reaches its destination, it stops, but when being pushed out of the way (by another agent) it will try to return back to its target. Instead,  want it to stop and become idle, so that when other agent walking by push it aside and it wont return back.

I have tried calling resetMoveTarget upon agent.npos being close to agent.targetPos (as if agent has reached its destination), but that seems to break the inner logic of the crowd simulation - the agent would just keep walking in old direction, never stopping.

How do I properly tell an agent to stop and become idle (yet pushable) in RecastNavigation?


texts: LibGDX hexagonal tilemap getting adjacent tiles

texts:
How do I get all adjacent tiles to a hexagonal tile, my tile map is using a staggered co ordinate system with an odd stagger index and I am using libgdx java.

if (x % 2 == 0) {
            hexAdj[0] = new Vector2(x    , y + 1);
            hexAdj[1] = new Vector2(x + 1, y + 1);
            hexAdj[2] = new Vector2(x + 1, y    );
            hexAdj[3] = new Vector2(x    , y - 1);
            hexAdj[4] = new Vector2(x - 1, y    );
            hexAdj[5] = new Vector2(x - 1, y + 1);
        }else{
            hexAdj[0] = new Vector2(x    , y + 1);
            hexAdj[1] = new Vector2(x + 1, y    );
            hexAdj[2] = new Vector2(x + 1, y - 1);
            hexAdj[3] = new Vector2(x    , y - 1);
            hexAdj[4] = new Vector2(x - 1, y - 1);
            hexAdj[5] = new Vector2(x - 1, y    );
        }


texts: Unity Cinemachine+URP : 2D pixelPerfect zoom issue?

texts:
There are many PixelPerfect component that exists and it confuses me.
The CM PixelPerfect component doesn't work in my 2D Tilebased game.

So I use the Camera component named "Pixel Perfect Camera (Experimental)".

I feel that the right PixelPerfect component because it seems that it's the only one working for my project ahah.
(note : I'm aware there's another PixelPerfect component in the "2D pixel perfect" package, but it's only compatible with LWRP projects if I'm right.)
The camera :

The hierarchy :

CM vcam1 and CM vcam2 are used to make transitions between Areas.
Now, I need to make a zoom on the player.
To achieve that, I have added a 3rd "CM vcamZOOM".
But nope, it's not working at all. I mean, everything else works, the rotation, etc, everything but the zoom. Even if it's the only vcam enabled, it's not zooming.
I found out that disabling the "Pixel Perfect Camera (Experimental)" component on the Camera solved the problem.
That's not a real solution since I need to use a PixelPerfect component (with the ability to Zoom).
Am I using the right PixelPerfect component for my needs?
Is this a compatibility bug between URP camera pixelperfect component and CM zoom ?
Thanks for reading and for your answers.


texts: Where to start with hardware-specific low-level programming?

texts:
Seeing as today's machines have insane computing power and near endless memory, it's tough for a hobbyist programmer to actually hit the limits of his machine without doing something totally boneheaded. This raises a question: Is there a machine (be it a computer or a console) from the past that would be a good learning platform for someone that has never touched low-level code? I'm very much looking at this from the perspective of someone that wants to understand exactly how to get the best out of the specific set of hardware a machine has.

I'd imagine that the internet probably has manuals for most well known older machines, and it shouldn't be too hard to find an emulator of some sort either. I'm just at a little bit of a loss when it comes to actually choosing a good platform to go for. Any ideas?

Obviously if someone has ideas that don't fit the exact parameters of the question, I'm open for that as well.


texts: How can I stop showing camera image in my Scene? Unity

texts: How can I stop showing camera image in my Scene in Unity? As you can see on the screenshot there is an image of a camera inside a player in the Scene view. How can I disable the image?


texts: How do I implement a "sliding out of / into" effect on a settings menu similar to that in Angry Birds?

texts:
I'm trying to implement a settings menu component similar to that in Angry Birds - a button control that makes an options menu slide out of it and back into it when clicked on.

I use scene2d.ui to build the UI components: a Button in a Table to implement the button control, a Table to implement the options menu, and a Stack to lay these out one on top of the other and at this moment I have the following behavior:

When the user hits the button control for the first time, then the alpha of the table component is set to 1;
When the user hits the button control the second time, then the alpha of the table component is set to 0;
And so on.

Any ideas how I can get the sliding out of and into effect on user clicks with libgdx? Similar to what Angry Birds provides.

Maybe using the TweenEngine, actions, interpolations, combinations of these?

Thanks in advance.


texts:
I would like to be able to draw primitives in unity 2d to define my game objects. I have tried the following example:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Material mat;
    private Vector3 startVertex;
    private Vector3 mousePos;
    void Update() {
        mousePos = Input.mousePosition;
        if (Input.GetKeyDown(KeyCode.Space))
            startVertex = new Vector3(mousePos.x / Screen.width, mousePos.y / Screen.height, 0);

    }
    void OnPostRender() {
        if (!mat) {
            Debug.LogError("Please Assign a material on the inspector");
            return;
        }
        GL.PushMatrix();
        mat.SetPass(0);
        GL.LoadOrtho();
        GL.Begin(GL.LINES);
        GL.Color(Color.red);
        GL.Vertex(startVertex);
        GL.Vertex(new Vector3(mousePos.x / Screen.width, mousePos.y / Screen.height, 0));
        GL.End();
        GL.PopMatrix();
    }
    void Example() {
        startVertex = new Vector3(0, 0, 0);
    }
}

However I cannot find information on setting the Materical element of a game object anywhere. I am trying to create a simple 2d game using GL to draw the sprites instead of textures. My questions are:

What is the material object reference used for and is this required for unity 2d games?
Is using GL the easiest way to draw primitives in unity?


texts: How can I apply Pixel Perfect by script in Unity? All I could find on the web is this which does help at all..


texts:
I'm coding an isometric game in c++ with SDL.  My question is this:
At the moment, every cycle the game redraws the entire map layer by layer, inserting actors and cursors and so on at the appropriate time.  Would it be substantially faster (or better for some other reason) to instead have a big surface for each level generated at the beginning, and blit each layer all together instead of drawing it tile by tile.

Thanks for any responses!


texts: What is the process to start developing games for the PS Vita?

texts:
Let's assume a solo/indie developer using Unity and targetting the PS Vita. Let's also assume that the developer's region is Europe.

What does the developer need to start developing (only developing, not publishing) on the PS Vita?
Which Unity version/license?
What needs to be done on the Playstation side? (registration etc)

As an extra point:

What extra steps are needed for the said developer be able to distribute an alpha/beta version of the game? (for a gamejam and feedback)


texts:
I've recently come on to an error when loading fonts in my game, some letters show up perfect while others have artifacts around them. Here's an example of this:

While some letters are perfectly normal, others are being unstable.

My options menu:

This is what my loader method looks like. (Yes i've tried other fonts)

private static int loadTexture(BufferedImage image) {
        int BYTES_PER_PIXEL = 4;
        int[] pixels = new int[image.getWidth() * image.getHeight()];
        image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

        ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL);

        for(int y = 0; y < image.getHeight(); y++){
            for(int x = 0; x < image.getWidth(); x++){
                int pixel = pixels[y * image.getWidth() + x];
                buffer.put((byte) ((pixel >> 16) & 0xFF));     // Red component
                buffer.put((byte) ((pixel >> 8) & 0xFF));      // Green component
                buffer.put((byte) (pixel & 0xFF));             // Blue component
                buffer.put((byte) ((pixel >> 24) & 0xFF));     // Alpha component. Only for RGBA
            }
        }
        buffer.flip();

        int textureID = glGenTextures();
        glBindTexture(GL_TEXTURE_2D, textureID);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
        return textureID;
    }


texts: Optimizing UV Map Sheet Based On Surface Area?

texts:
I am trying to get my UV Map Sheets Optimized Based On Surface Area , I need Them optimized cause my scene area is huge and i want to use them in UDK so i am trying to get maximum possible optimization and i am running out of time

Here is What i Try TO Achieve :

Default 3DS Max :

Optimized By HAND THIS IS WHAT I WANT  Or Even Better If There Is Automated Intelligence Tool

Also I know this Tools Flatiron , UVPacker But They Are No Use


texts: How come these 2 lines of code are causing a memory leak?

texts:
I'm confused, I commented these 2 lines out resulting in no memory leaks, and when I added them again it's leaking.

However I can't understand why it's actually leaking?

This is the 2 lines of code one of them or both are leaking :

m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);

And here is the declaration of the 2 variables :

SDL_Surface* m_surface = nullptr;
SDL_Texture* m_texture = nullptr;

 I'm not sure what else is needed to figure out why it's leaking.


texts: Communication in a simple GUI (C++ / SDL2)

texts:
I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games.

Right now I'm really struggling on figuring out how I should handle communication between the GUI and the other parts of the game / engine that might want to use it.

For example, the "shop" game state may have a list of items that I want to display on a shop GUI, along with their prices and quantities, i.e "Wooden sword / 30GP / 5". Obviously I need to get this information to the GUI in order for it to be useful, along with a way of notifying the shop component which item has been clicked/given focus. Seeing as the internal representation of an object such as an "item" or an "inventory" can vary wildly, how do I get the data I want to/from the GUI in a way that doesn't require excessive coupling between the two components?

I'd really appreciate anyone's advice on how to approach this issue, and I fully appreciate that my understanding is flawed.

Finally, I'm set on developing it from the ground up as a learning exercise, so I'm not really interested in GUI libs for SDL (it seems none of them are updated for SDL2 anyway).

Thanks in advance


texts: Find a unit vector exactly halfway between two connected line segments

texts:
Seems like a quick and easy question but I haven't been able to find exactly what I'm looking for so:
How to calculate a unit length vector that is pointing along the line which is exactly 50% of the angle of two connected line segments?
A picture speaks a thousands words (that are also better than my explanation!)

So basically I want to calculate the blue unit vector given the two red line segments (which are actually 3 points and are therefore guaranteed to be connected)
The red segments are of arbitrary length, and the result doesn't have to be a unit it would just be easier for me.
It would also be handy to have a way to force the resultant vector to point in a certain direction (relative to the input segments), this isn't essential as I think I can work this one out - as the input line segments ultimately form an n-gon.
Any examples would be ideal in C++ please, but other languages welcome.
Many thanks for any pointers.


texts: Different ways to store a 2D map/landscape in XNA

texts:
I was looking around at this site about eight months ago and wish I saved the location of this topic but I was wondering the different map rendering styles that you can do in XNA.  The one style I looked at was using a text file to pull characters like "X" would be a monster and "O" would be the player.  Is there another way with out an external file that I can put tiles from a sprite sheet to randomly create a map.  Of course when dealing with random buildings I would have certain building designs so that if some one was playing they wouldn't see a building with half a wall missing.

This is for a top down 2D game.


texts: How do I convert a partially transparent image into polygons?

texts:
I'm using GLEE2D, a level editor allowing me to import images, scale them, rotate them, and position them onto layers and export the data into XML format. However, it does not tell me objects' boundaries. I can calculate them, but only given the original image's polygons.

How do I get polygons of objects in a transparent image?

An example object (I outlined it):

How would I turn the object, knowing the scaled size of the image, into polygons? Is there an algorithm for this? I'll use OpenGL to draw them.


texts: Dijkstra's algorithm null hypothesis pathfinding without navmesh

texts:
I am having trouble understanding how to implement dijkstra's algorithm for a path finding assignment, here's what the layout looks like:

Each node has a List of neighbours which are found using raycasting. Now the issue i am having is how to weight each node.... I understand Dijkstras maintains a list of visited nodes and an open list. I just don't understand how to weight them individually based on where i want to go.

Right now i'm weighting them all by a distance of 1. But this seems to be incredibly redundant and is going to take an extremely long time to find the shortest path because it's going to check every possibility of a paths to the endNode....

Can someone help me understand the logic of how to implement dijkstra's algorithm in this environment?


texts:
I have been playing with OpenGL for a while and I came into the wall that I don't know how to pass. I am trying to render a model of an object based on a .obj file. In that file I have position coordinates, uv coordinates and indices of a positions and uv coordinates (faces). I am trying to render the model like so:

Get all the positions from the files
Get all the uv coordinates from the file
Get all the faces.
Generate array of vertices with all the positions and uv coordinates in order defined by indices.
Index the vertices 0,1,2,...
Draw the indexed vertices.

I got blocked when I tried just to render the model without the texture. I have been shown a monstrosity instead of what I am trying to achieve. When I have been drawing the model in the other way (get all the vertices and index them in the order they should be drawn) everything is fine but in this way I cannot texture the model the way I wanted. I am adding the code below:
Reading from the file:
std::vector<float> verts; //container for vertices
std::vector<unsigned int> inds; //container for indexes of vertices
std::vector<unsigned int> texinds; //container for indexes of textures
std::vector<float> texs; //container for textures

bool LoadFromFile(const std::string& path) {
    std::ifstream f(path);
    if (!f.is_open())
        return false;
    while (!f.eof()) {
        char line[128];
        f.getline(line, 128);
        std::strstream s;
        s << line;
        char junk;
        char junk1;
        char junk2;
        char junk3;
        if ((line[0] == 'v') && (line[1] == 't')) {
            float Textu[2];
            s >> junk >> junk1 >> Textu[0] >> Textu[1];  //ingoring the first 2 characters (vt) before data
            texs.push_back({ Textu[0] });
            texs.push_back({ Textu[1] });
        }
        if (line[0] == 'f') {
            unsigned int Index[6];
            s >> junk >> Index[0] >> junk1 >> Index[1] >> Index[2] >> junk2 >> Index[3] >> Index[4] >> junk3>> Index[5]; //ingoring f and every / between indexes
            inds.push_back({ Index[0] - 1 });
            texinds.push_back({ Index[1] - 1 });
            inds.push_back({ Index[2] - 1 });
            texinds.push_back({ Index[3] - 1 });
            inds.push_back({ Index[4] - 1 });
            texinds.push_back({ Index[5] - 1 });
        }
        if ((line[0] == 'v') && (line[1] == ' ')) {
            float Vertex[3];
            s >> junk >> Vertex[0] >> Vertex[1] >> Vertex[2];
            verts.push_back({ Vertex[0] });
            verts.push_back({ Vertex[1] });
            verts.push_back({ Vertex[2] });
        }
    }
}

Creating array of vertices and idexing them:
        float Vertices[89868];
        for (int i = 0; i < inds.size(); i++) {
            Vertices[i] = verts[inds[i]]; //Creating array with the vertices in order defined in the index vector
        }
        unsigned int indices[89868];
        for (int i = 0; i < inds.size(); i++) {
            indices[i] = i;
        }

I understand maybe I have made a stupid mistake somewhere but I am literally incapable of finding it.


texts: Entity Components Ids and Max Integer Values

texts:
I have been studying several entity component systems (Anax and EntityX) to get an idea of how they work.

For Entity ids, both use 2 numbers. The first number is basically a position in an array, and a second number is the "version" for the entity at that index. If a handle to an entity at a given index has a "version" older than the the version the container currently has, the handle is considered invalid. This would occur when an entity is deleted from the world and its index becomes free for a new entity.

This approach seems to suggest the maximum number of times an index can be reused is limited to whatever the max number a uint32_t (or whatever the system chooses to use) can hold.

In practice, I suppose this wouldn't occur often, but it doesn't seem impossible. If I made a simulation that endlessly spawned entities, moved them around on the screen a bit, and deleted them once they were off screen, then the program would eventually crash, or exhibit strange behavior, once the version number for an index reached the max for an int.

Here are some of the specific lines I've been looking at for each:

https://github.com/miguelmartin75/anax/blob/master/src/anax/detail/EntityIdPool.cpp#L66
https://github.com/alecthomas/entityx/blob/master/entityx/Entity.h#L614

Is this a shortcoming of reusing indexes, and needing to invalidate old handles? Is there any real practical concern since even a 32bit in has a max value of 4 billion or so? Could these systems be broken by a soak test with a long, ongoing stream of short-lived entities?


texts: Distortion of color space in UDK (material editor)

texts:
Question

Using UDK's material editor, I wish to use a texture as a two-dimensional array of values for mathematical computations (basically, the color components of each pixel in the texture alter the behavior of some transformations applied to another texture).

I want to retain rather precise color values for my mathematical operations to keep their meaning, but in my experiments I noticed a heavy distortion of the color space: dark colors are darker than they should be, and light colors are lighter than they should.

Additional information

This effect is best shown by the following material, which takes a simple linear gradient texture, and applies a rounding operation on the colors:

If the colors were correctly preserved, the preview on the left should have 10 bands of equal length (a black band, a 10% gray band, a 20% gray band etc. with each band being 10% of the width of the image), however the black band is huge, the next (10% gray) one rather large, and the bands get smaller and smaller as they get lighter.

In this example, I take the red channel of the image, but taking the other channels gives similar results: The red and blue channels are identical, and the distortion is slightly different with the green channel, and taking the combination of these logically produces small bands of purple and green between any two bands.

I guess this is a compression issue with the original texure, but I don't know which parameters I should change so the colors are preserved when I use the texture in the material editor.

Above is the texture I used, created with The Gimp. The colors are correct, it is a linear gradient: the color of the pixels in column 0 is (0,0,0), the pixels in the column 255 are (255,255,255) and I manually checked at many points in the image that the pixels in the column x are (x,x,x)).

Above are the properties for this texture. Nothing special here, just the defaults. Specifically, the Adjust Brightness Curve and Adjust RGB Curve properties are set to 1.0 (by default), which seems correct since they are the power to which the HSV and RGB curves must be elevated. The distortion I observed looks a lot like if the values were raised to a given power.


texts: Get all objects of Additively loaded Scene? (LoadSceneMode.Additive)

texts:
I learned how to Load and unload scenes in unity. using LoadSceneMode.Additive.

I like to spit up my scenes as much as possible and retain the stuff I need as I go along.

I'd like to be able to find all objects loaded from a specific scene. Obviously Unity knows but I can't find how to get them.

For now, my workaround is to put them in a specifically named empty or have them tagged in a certain way, but that is a workaround.

Is there an easier way?


texts: How to draw a polygon with picture in libgdx?

texts:
I'm working around a simple rectangle game, It just split the rectangle in to a lot of polygon debris. I use Pixmap and Texture to draw the edges of each polygon.

...
 for (GraphEdge e: _edges) {
    pixmap.drawLine((int) e.x1, (int) e.y1, (int) e.x2, (int) e.y2);
 }
...
@Override//In an actor class
public void draw(Batch batch, float parentAlpha) {
    region = new TextureRegion(new Texture(pixmap));
    region.setRegionWidth((int)width+1);
    region.setRegionHeight((int)height+1);
    batch.draw(region, this.getX(), this.getY());
}

it works well,but I want to add some pictures to adjust those polygons to make it looks better than some tedious lines, how should I implement it?


texts: How can I determine an appropriate frame count for various fighting game animations?

texts:
I am currently starting to outline a fighting game I'm doing with a friend. The biggest obstacle for me now is determining frames for every move.

How can I determine how many frames should a quick jab have, a grapple, combination, how many frames of no-action should be allowed between one and second button input for a combo, et cetera? Below is basically the only thing I found:

  Startup frames (also called Impact frames) are the time before the
  move actually makes contact with your opponent, Active Frames are the
  frames that a attack would occur, and Recovery frames are the time
  after the hit. You cannot block during all the time intervals, but
  getting hit during the Impact frames hurts more and can put you in
  more funky stuff like stuns or even a juggle, depending on the move
  that hit you.


texts:
I have a 2D square grid of values representing terrain elevations, and I want to generate triangles from that grid to make a 3D view of the terrain. My first thought was to split each square diagonally into 2 triangles, however the split diagonal can clearly be seen, especially from the top :

Is there a recommended way to generate triangles to remove/reduce this effect ?


texts: Realtime local reflections of particle system

texts:
I'm finding my way around CryEngine 3 (through Steam) and want to create a simple effect where a fire on shore is reflected in a body of water.

For testing purposes, I've made the water dead calm...

(Note Dx11 on 2nd line of debug info)

As you can see, the terrain is reflected properly, but the flame particles aren't reflected. It's my understanding that this should be possible.

NB: I've created an appropriate cubemap for the water environment, although I don't believe it comes into play here.

I've seen a number of posts saying Glossiness > 50 (or 50%) and a light specular color are required. I've got 100% and white...

And for completeness, the water volume properties...

Can someone please tell me what I need to enable to get this working? Thanks.


texts:
What are some solid techniques to account for the gap between processing time and frame update ticks? In other words, the game/render loop looks like this:

Some important points:

Tick timings are determined by the web api (roughly 16ms consistently)
Workers could either be triggered at the start of each tick (first checking if the previous one finished) or run continuously in their own loop.
I think running continuously is better if we can account for the gap, so as to not waste time being idle which could lead to skipped frames.
Either way - the size of the gap will vary between updates. It's not constant

note this article is a good reference: https://gafferongames.com/post/fix_your_timestep/ ... I haven't really tried applying it yet and I'm not sure if it fits the web constraints exactly.


texts: How to resolve collision when both of the intersecting bodies were moving?

texts:
Suppose there are two quadrilaterals A and B.  A is stationary but B is moving. They collided. Now B is inside A.

To check if they are intersecting I can use 2d separating axis theorem (SAT). To push B out of A so that they are not intersecting anymore, I can again use SAT to get the Minimum Translation Vector(MTV) and project B out of A using it.

My problem is, what should I do when both A and B were moving, and then they collided? I can't project A out of B or B out of A alone since both of them were moving. How should I separate them?


texts: I have a model which has textures in DDS format, but my game takes textures in TGA format.  How can I convert the textures from DDS to TGA?


texts: Debugging built-in physics components in Unity

texts:
I have a particular GameObject with Rigidbody which I'm trying to move over time. If I move the object using its transform.position, it works fine. However, if I move the object using rigidbody.position or rigidbody.MovePosition(), it does not move as expected. It should be moving up and forward (+Y and +Z). Instead, it oscillates up and down but does not move on the X or Z axis.

I do not have any constraints enabled on the Rigidbody, and I can't find anywhere in my code that would freeze or alter its position, besides the line of code that's supposed to move it, and its behavior is the same whether or not gravity or colliders are enabled.

Is there some way to view a list of inputs that are affecting the position and movement of a particular Rigidbody each frame?


texts: I'm looking to learn how to apply traditional animation techniques to my graphics engine - are there any tutorials or online-resources that can help?

texts:
There are many traditional animation techniques - such as blurring of motion, motion along an elliptical curve rather than a straight line, counter-motion before beginning of movement - which help with creating the appearance of a realistic 3D animated character.

I'm looking to incorporate tools and short cuts for some of these into my graphics engine, to make it easier for my end users to use these techniques in their animations. Is there a good resource listing the techniques and the principles behind them, especially how they might apply to a graphics engine or 3D animation?


texts: How to track if an action is executing with IEnumerator and StartCoroutine

texts:
My code:

public class CharacterBehaviour: MonoBehaviour {

bool isExecuting=false;
Action action;

void Start{
action=new Action();
}

void Update{
//Other methods
if(!isExecuting)
{
StartCoroutine(action.execute(out isExecuting));
}
}

public class Action: MonoBehaviour
{
IEnumerator execute(out isExecuting)
{
return YieldReturnNull)();

//Execution

isExecuting=false;
}

public IEnumerator YieldReturnNull()
{
yield return null;
}
}

I am using IEnumerator to start a coroutine right? But I need this out value to do not start a lot of coroutines in Update, just when it finalizes I must start another. The problem it's that I need to return of yield of course in the beggining (The YieldReturnNull method is a trick because IEnumerator does not accept out or ref as parameter in a method returning yield) but it returns for me this error:

The out parameter `isExecuting' must be assigned to before control leaves the current method.

How to solve it? I need to return yield in the beggining and apply the bool in the end. Thanks. :)


texts: WebGL CORS error loading simple texture in Chrome

texts:
Here's my code:

function loadTexture() {
    textureImage = new Image();

    textureImage.onload = function() {
        setupTexture();
    }

    textureImage.src = "jumper2.png";
}

function setupTexture() {
    texture = gl.createTexture();

    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

    // this next line has the error: Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, textureImage);
    gl.texParameteri(gl.TEXTURE_2D, gl.OES_TEXTURE_FLOAT_LINEAR, gl.NEAREST);

    if (!gl.isTexture(texture)) {
        alert("Error: Texture is invalid");
    }

    glProgram.samplerUniform = gl.getUniformLocation(glProgram, "uSampler");
    gl.uniform1i(glProgram.samplerUniform, 0);
}

I've researched it and it is a CORS error a "Cross-origin resource sharing" error, but it's a local file! I can't figure out what's wrong.

I did make the picture using gimp, and I'm not sure the coding was right on the export, but I eliminated a previous error using "gl.OES_TEXTURE_FLOAT_LINEAR".


texts: How to reduce the total time spent checking against my world bounds?

texts:
I'm making a game engine and currently I use a function for checking a new position after movement to prevent game objects from escaping the world:

const boundary = function (min, max) {
    return Math.min( Math.max(this, min), max );
};

I've noticed that it consumes around 9-10% of my game loop (testing with 4500 objects). Is there a better way to handle this? Do I generally need to make my world finite?

To clear this up, this is not an object-object collision detection question. For that I have a grid, and this grid is based on the size of the world, which is why I check that objects don't escape the world size limits.


texts: Spaceship acceleration for following waypoints

texts:
I'm creating a turn based space ship strategy game with simultaneous turn resolution similar to Steam Birds. After all the orders are given, the ships run through a real time simulation where they rotate, accelerate and shoot each other.

The physics work similar to the old asteroids game. At the beginning of each turn the ships can be given a constant acceleration, they will then rotate into position so that their engines will be pushing them in the acceleration direction, and they will maintain the acceleration for the rest of the turn. Each ship has a maximum acceleration value based on their engine strength and mass.

I'm having trouble calculating the proper accelerations for the AI ships to get them to go where they need to go.

I had a diagram here, but this video makes it much more clear what I'm trying to do. This is a player controlled ship moving through some asteroids in the same way I need an AI ship to move.

I've got a ship moving through some obstacles, there are waypoints defined that will guide the ship through the obstacles. There are a couple of things I'm trying to calculate:

I need to calculate how much the ship has to slow down to make a fairly tight turn so that it doesn't run into obstacles
I need to calculate the acceleration to get the ship to change directions at the waypoint, again making sure that the turn is fairly tight
Between the waypoints I would like the ship to accelerate to as high a speed as it can and still have time to slow down to make the turn

Any help here would be greatly appreciated. Thanks.


texts: How i can sign and/or group a specific set of vertices in a 3D file container like OBJ ? - in Blender

texts:
I would like to export a 3D model with each part having a name or a label if you will.

For example i would like to export a model of an human body and name each part in specifics vertex groups like: left hand, right hand, right foot, head, ears, ... and you got the idea; so i can have a single 3D model that i can explode in various parts if needed.

If there is a better technique about how to mark vertex groups in a 3D file please share your solution. As 3D editor i use Blender.


texts: How do I identify mouse clicks versus mouse down in games?

texts:
What is the most common way of handling mouse clicks in games?

Given that all you have in way of detecting input from the mouse is whether a button is up or down.

I currently just rely on the mouse down being a click, but this simple approach limits me greatly in what I want to achieve. For example I have some code that should only be run once on a mouse click, but using mouse down as a mouse click can cause the code to run more then once depending on how long the button is held down for. So I need to do it on a click!

But what is the best way to handle a click? Is a click when the mouse goes from mouse up to down or from down to up or is it a click if the button was down for less then x frames/milliseconds and then if so, is it considered mouse down and a click if its down for x frames/milliseconds or a click then mouse down?

I can see that each of the approaches can have their uses but which is the most common in games? And maybe i'll ask more specifically which is the most common in RTS games?


texts: Separate loops for logic (tps) and rendering (fps)

texts:
I'm converting a game that was using a very basic game loop that executed update/render methods 20 times per second to lwjgl. I'm using the fps loop examples in their wiki, but have found that while this is great for rendering, it's not where I should be running game element movement logic.

What I'd like to do is use this logic for rendering only (variable fps), but also have a loop that calls game update logic 20 times per second.

I'm still somewhat new to java, but it seems to me like the best way to do this is to have two loops. One runs the rendering code ~60 fps, and one runs the game logic at 20 tps.

A few sites recommend multiplying all game element movement values by the fps delta, but I'd rather not have to remember to always multiply movement values by this, and I'd like to have an update() and render() method to keep logic separate.

Is this an acceptable way of handling this?


texts: Clientside interpolation - update rate fixed to client framerate

texts:
I am trying to implement client side prediction as in this article http://www.gabrielgambetta.com/fpm2.html

Currently I'm doing it like this: the game runs at 60 FPS. 60 times per frame I check if an arrow key is pressed, if so, I move the player character slightly and send the message about the movement done to the server (direction + delta time). The server applies the movement. On the next player positions broadcast, the server also sends the ID of the last_received_input. Client then updates the state based on what it received from the server, then reapplies all the inputs after the last_received_input.

It works in general. The problem is, that now client packet send rate is tied to the client framerate. If I keep rendering at 60 FPS, but check inputs/send input packets at only 30 FPS, I will start to experience jerky movement on the player character. How is it done properly? How to reduce the client tickrate, but still achieve smooth movement?


texts: Unable to select MonoDevelop to open XML file from Unity project

texts: I am developing games in Unity but I have encountered a problem. After updating Unity I can no longer find MonoDevelop for editing XML files like my Android Manifest:


texts: Coordinate transformation in voxel ray-tracing?

texts:
I am implementing voxelization. I can't understand the coordinate transformation through shader.

I have read some papers and code, the first step in the geometry shader is project the triangle along its dominant axis.

What's the difference between this method and using projection matrix?

In usual ways, we transform data from local space,world space, view space,
then to projection space.

Does project the triangle means we transform from view space to projection space ?
What should we get after these process, in the end of pixel shader?


texts: Some sprite renderers in a for loop not changing

texts:
I am using OnValidate() to help me speed up my design process. In the code below (which is in OnValidate()), if strictly one enemy has a weapon and the weapon is a sword or spear I change the Sprite for all enemies (the are of type Blue). I am having two issues:

The sprite renderer doesn't change until I run the Application though the code is in OnValidate()
Even when I run the application, not all Sprite Renderers for enemies change. I checked the number with a Debug.Log, which prints the right number, but I consistent number of Sprite renderers don't change.

    if (enemies.Count (x => x.hasWeapon) == 1) {

    if (enemies.Count (x => x.weaponType == Enemy.WeaponType.Sword) == 1) {

        for (int i = 0; i < enemies.Length; i++) {
            if (enemies [i].enemyType == Enemy.EnemyType.Blue) {
                Debug.Log (enemies.Length);

                enemies[i].GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/greenEnemy");
            }
        }

    }

    if (enemies.Count (x => x.weaponType == Enemy.WeaponType.Spear) == 1) {

        for (int i = 0; i < enemies.Length; i++) {
            if (enemies [i].enemyType == Enemy.EnemyType.Blue) {
                enemies[i].GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/blueEnemy");
            }
        }
    }

}

How can I solve these issues?


texts: Creating 3D gravity in zero-G tied to mass in unity with c#

texts:
As a total beginner,
I've been working on a patch-job script for a gravity mechanic in an open space sim, I want to derive all my objects from this "Block ALPHA" object and its' set of variable attributes, so it's important that I get it right before moving on.

The idea is simple enough, call an array of all interactive objects' coordinates and apply a basic equation to simulate gravitational pull.

After some tinkering I have a piece of code that ticks all the boxes AFAIK, but I can't for the life of me figure out the syntax error I've made... I've been up all night massaging the script to fit my needs, but in the best cases it only raises one error:
"expected '}'"

Maybe I'm just tired, maybe I broke the code, but trying to place parentheses only seems to bring more errors :/

Here's the code as it is so far complete with the compiler error and suggested fix (in red), which does no good whatsoever:

using UnityEngine;
using System.Collections;

public class DynamicWeightAnalysis : MonoBehaviour
{

//Strength of attraction from your game-object, ideally this will be derived from a calculation involving the objects volume and density eventually
public float RelativeWeight;

//Here, we name our target objects
GameObject[] blockALPHA;

//Initialise code:
void Start ()
{
    //here, we define our target objects further by searching for the predefined tag
    blockALPHA = GameObject.FindGameObjectsWithTag("Block ALPHA");
}

//Use FixedUpdate because we are controlling the orbit with physics
void FixedUpdate ()
{ "} EXPECTED"

    //this is where we define the graverage coordinates
Vector3 graverage (Vector3[] blockALPHA)
    {
        if (blockALPHA.Length == 0)
            return Vector3.zero;
        float x = 0f;
        float y = 0f;
        float z = 0f;
        foreach (Vector3 pos in blockALPHA)
        {
            x += pos.x;
            y += pos.y;
            z += pos.z;
        }
        return new Vector3(x / blockALPHA.Length, y / blockALPHA.Length, z / blockALPHA.Length);

        Vector3 offset;

    //here we get the offset between the object and the average position of all objects
    offset = graverage - transform.position;

    //This is the variable for square magnitude calc
    float magsqr;

    //Offset Squared:
    magsqr = graverage.sqrMagnitude;

    //Check distance is more than 1 to prevent division by 0 (because my blocks are all 1x1x1, any closer and they'd be intersecting)
    if (magsqr > 1f)
        {
        //Create the gravity- make it realistic through division by the "magsqr" variable

            GetComponent<Rigidbody>().AddForce((RelativeWeight * graverage.normalized / magsqr) * GetComponent<Rigidbody>().mass);
        }
    }
}

I don't doubt that I've overlooked something stupid, but it's my first stab at proper coding, so, no shame in asking

Thanks :D


texts: What's causing this stutter when framerate fluctuates?

texts:
I'm working on a class responsible for arm sway in an fps engine, and am having an issue with a stutter that appears to be related to fluctuating framerate. However I have also noticed it when locking the framerate, but to a much lesser almost unnoticeable degree (so maybe NOT related to framerate variance). As far as I can tell I have everything setup the way it should be to account for framerate fluctuations, but apparently I've missed something?? Curious if I've made a glaring oversight that might jump out at someone. I have uploaded a video where you can see exactly what it is I'm talking about.
Any ideas? update() is where the magic happens.
#include "glm/gtx/string_cast.hpp"
#include "vel/App.h"
#include "vel/helpers/functions.h"

#include "ArmSwayController.h"

ArmSwayController::ArmSwayController() :
    input(vel::App::get().getInputState()),
    swayXYPos(glm::vec2(0.0f, 0.0f)),
    maxSwayDistance(0.1f),
    swaySpeed(0.0f),
    mouseBufferSize(44),
    firstMouseInput(true),
    currentMousePosition(glm::vec2(0.0f, 0.0f)),
    lastMousePosition(glm::vec2(0.0f, 0.0f)),
    mouseDelta(glm::vec2(0.0f, 0.0f)),
{};

glm::vec2 ArmSwayController::getAverageMouse()
{
    glm::vec2 out;

    for (auto& x : this->mouseXBuffer)
    {
        out.x += x;
    }
    out.x = out.x / this->mouseXBuffer.size();

    for (auto& y : this->mouseYBuffer)
    {
        out.y += y;
    }
    out.y = out.y / this->mouseYBuffer.size();

    return out;
}

void ArmSwayController::bufferMouse(glm::vec2 in)
{
    if (this->mouseXBuffer.size() == this->mouseBufferSize)
        this->mouseXBuffer.pop_front();
    if (this->mouseYBuffer.size() == this->mouseBufferSize)
        this->mouseYBuffer.pop_front();

    this->mouseXBuffer.push_back(in.x);
    this->mouseYBuffer.push_back(in.y);
}

void ArmSwayController::bufferMouseXSpeed(float in)
{
    if (this->mouseXSpeedBuffer.size() == this->mouseBufferSize)
        this->mouseXSpeedBuffer.pop_front();

    this->mouseXSpeedBuffer.push_back(in);
}

void ArmSwayController::bufferMouseYSpeed(float in)
{
    if (this->mouseYSpeedBuffer.size() == this->mouseBufferSize)
        this->mouseYSpeedBuffer.pop_front();

    this->mouseYSpeedBuffer.push_back(in);
}

void ArmSwayController::updateMouseDelta()
{
    this->currentMousePosition.x = this->input.mouseXPos;
    this->currentMousePosition.y = this->input.mouseYPos;

    if (this->firstMouseInput)
    {
        this->lastMousePosition = this->currentMousePosition;
        this->firstMouseInput = false;
    }

    this->mouseDelta.x = this->currentMousePosition.x - this->lastMousePosition.x;
    this->mouseDelta.y = this->lastMousePosition.y - this->currentMousePosition.y;

    this->lastMousePosition = this->currentMousePosition;
}

glm::vec2 ArmSwayController::update(float dt) // called once per tick
{
    this->updateMouseDelta();

    this->bufferMouse(this->mouseDelta);
    this->swaySpeed = 0.00000625f / dt;

    glm::vec2 vecToAdd = vel::helpers::functions::invertVec2(this->getAverageMouse());

    // X
    this->bufferMouseXSpeed(vecToAdd.x);

    float pullBackAmountX = this->mouseXSpeedBuffer.size() > 1 ? this->mouseXSpeedBuffer[this->mouseXSpeedBuffer.size() - 2] : this->mouseXSpeedBuffer[0];
    pullBackAmountX = pullBackAmountX < 0 ? fabs(pullBackAmountX) : (-1.0f * pullBackAmountX);

    this->swayXYPos.x += ((vecToAdd.x + pullBackAmountX) * this->swaySpeed);

    // Y
    this->bufferMouseYSpeed(vecToAdd.y);

    float pullBackAmountY = this->mouseYSpeedBuffer.size() > 1 ? this->mouseYSpeedBuffer[this->mouseYSpeedBuffer.size() - 2] : this->mouseYSpeedBuffer[0];
    pullBackAmountY = pullBackAmountY < 0 ? fabs(pullBackAmountY) : (-1.0f * pullBackAmountY);

    this->swayXYPos.y += ((vecToAdd.y + pullBackAmountY) * this->swaySpeed);

    return this->swayXYPos;
}


texts: How to create texture coordinates for a spritesheet with lwjgl

texts:
Using lwjgl and slick-util I've been trying to use certain pieces of a spritesheet as textures. lwjgl uses glTexCoord2f(); to map coordinates to individual vertices, and the coordinates it takes in are normalized (between 1 and 0), so I've been using this code to make the coordinates only use a small piece of the full Texture:

glTexCoord2f(0 / 128, 0 / 128); glVertex2f(0, 0);
glTexCoord2f(0 / 128, 8 / 128); glVertex2f(0, 32);
glTexCoord2f(8 / 128, 8 / 128); glVertex2f(32, 32);
glTexCoord2f(8 / 128, 0 / 128); glVertex2f(32, 0);

but whenever I used normalized coordinates that are a fraction of the images size I just get a solid square that had 50% alpha.

My question is: what am I doing that's making the texture coordinates screw up? Is there a better way to go about this?

Any help is appreciated, thanks in advance!


texts: My logic in collision detection in diagonal code correct?

texts:
I made this code to detect collision from the diagonal(top left). I'm trying to find the problem on what I'm doing wrong. Is it necessary to have a diagonal collision for the wall?
Player class:

if(key == KeyEvent.VK_LEFT && key == KeyEvent.VK_UP)
  {
      if(checkWallColl(World.player, World.topLeftColl))
      {
        return;
      }

       dx = -2;
       dy = -2;
       move(dx, dy);
    }


texts: How to spin Imported FBX model 360* in unity3d

texts:
I have been trying to spin my imported wheel from blender 360* but when I do it, it doesn't rotate on the center (on one spot). I'm using C#.

I have tried this:

transform.Rotate(Vector3.forward, 5f - 90);

But this doesn't spin on one spot.


texts:
Using 3ds Max 2012, I've been able to use the "render to texture" function to successfully bake my lighting.  The only problem is that these image files are always output to TGA files.  I need PNG files.  If I select all of my objects I want to bake, the option button with [...] that opens up the "file name and type" selection menu is GREYED OUT.

If I select ONE object and try to export only that one object then the "file name and type" menu becomes clickable and I can select my file type. But when I click "render" I get an error message "The following nodes output to invalid directories and will not be rendered" with my one object listed below and it's output directory which is "sceneassets\images"

What am I doing wrong here?

Thank you.


texts: How can I get a raycast to hit navmesh only?

texts:
In Unity, I'm trying to get the raycast to hit the navmesh only, but I cannot find an option to place navmesh on a specific layer.
Is there a way to raycast to the navmesh itself?


texts: Import Unity Package Into Specific Folder

texts:
Everytime i do import custom unity package file, I alwasy get Messy Folder and files in root of Asset Folder.

Any Idea how to solve this ?

Many Thanks in advance...


texts: Algo for rotating tower towards enemy - Unity

texts:
I have made a grid and placed towers and moving a enemy on it. Now i want to rotate towers face towards enemy when enemy comes in the range of tower.

I have a solution that whenever enemy comes to its range ( 2 grids far ) it starts do something, lets say when tower finds enemy is on left side it starts firing like that when enemy moves up/down ( when it finds there is a tower on very next tile) tower starts rotating with enemy position uniti enemy's range that is 2 grids far. So its mean tower has to rotate whenever enemy comes to its range and moves up/down.

What would you people suggest me a optimized way or any helpful scripting function ?..thnx


texts: Movement within a circle, but the circle bends around obstacles?

texts:
I wish I knew a better way to phrase this, but I want to make an object move from point to point inside a circle. But I also want that "circle" to bend around obstacles, so that no matter what path the object takes inside the circle, the maximum distance traveled remains constant.
To try and simulate what this shape might look like, I wrote a simple program that creates random lines from a center point to the edge of a circle that represents the maximum distance. If the line collides with an obstacle (represented by a smaller circle), it randomly changes direction until it no longer collides. Some of these lines get all the way around the obstacle, but leave a "shadow" behind the obstacle. So far, it looks like the size of the shadow is about equal to the size of the obstacle, but I'm not a good enough mathematician to prove it, or even to know how to describe this problem better.
Here is an image from my program so you can get some idea of what I'm talking about.

This problem might be similar to that of calculating what's visible from a point, but I want the unit to be able to move behind the obstacle, so I think it's a little different.
EDIT: The shape reminds me of a cardioid.


texts:
I wonder how idle games, games where players only make a few clicks to get a game progress, work. These games appear to be running in the background, even when the app is closed. Therefore these games may be implemented on the server side and run on it accordingly. I'm interested in the kind of implementation.

Is there a program running on the server that creates a separate
instance for each player and performs the actions accordingly?
Or is this realised via a database?

Furthermore I ask myself where the data is stored, on the client (susceptible to manipulation) or on the server (high memory requirements).

Maybe one of you has experience in this area and can give me more information, insights or explain how it works. I am also happy about further reading or links.


texts: Stat Multipliers: from Base Value or Iterative

texts:
I'm aware similar questions have been asked before but this time I'm asking about a specific issue with the maths of stat modifiers.

I have a stat system that applies a list of modifiers to a stat, modifiers can either shift of scale a stat. Shifting is easy, you either add or remove a set value, scaling involves multiplying that value by a factor.

What I'm struggling to work out is the best way to multiply. The simple method is to let each scaling modifier simply stack, e.g. if we have 2 modifiers: x1.5 and x2 to a stat of 1 we get:

Stacked

(1 * 1.5) * 2 = 3

The alternative is to have each modifier apply to the base number and then be added, soas with the previous example we get a situation where we workout how much the base is multiplied by and then remove the base to get the new addition:

From Base

1 + ((1 * 1.5) - 1) + (1 * 2) - 1) = 2.5

In this way each modifier acts on the base value so that you can guaranty a 50% increase in a stat won't cause a ridiculous increase and that a modifier isn't affected by the order that it's applied in. Mainly it's this ordering I'm worried about, this becomes evident when you add shifting, e.g. we have 3 modifiers: +1, x1.5 and x2, with the first method:

Stacked

((1 + 1) * 1.5) * 2 = 6

Where as with the second method:

From Base

(1 + 1)  + ((1 * 1.5) - 1) + ((1 * 2) - 1) = 3.5

It doesn't take too much to see that in the stacked method if the shift/addition were applied after the multipliers it would not result in the same value.

How do other games approach this problem? What is the best decision to make here?


texts: I am developing an RPG for Windows Phone 8 using XNA. I have a map screen and a fight screen. I want to use XNA for both to utilize the graphics helpers and because XNA is awesome. My question is, how do I save the map state between the two screens? That is , how do I save the location of the PC and the enemies when I travel back and forth between the two screens?


texts: Is nVidia's CUDA suited to performing pathfinding calculations?

texts:
I want to know if it would be worth executing pathfinding on the GPU (using nVidia's CUDA, or an equivalent) in certain situations, or whether it would be a wasted effort. The situation I imagine would be a headless multiplayer server responsible for finding paths for bots.

I'm specifically interested in A* pathfinding using navigation meshes, but if there is another pathfinding algorithm that would benefit more from GPU execution I'd love to hear it.


texts: Text-based game using JavaScript and/or PHP

texts:
I'd like to make a simple text-based game using either JavaScript or PHP. Ideally I'd like to be able to render ASCII text in a kind of blackscreen "console" style (think console roguelikes such as Crawl or Nethack, or old Infocom text adventure games). The game would be simple, mostly text entry and menu choices.

Is this easily done using JS or PHP; if so, could you give me some pointers, and if not, what could I use to have this kind of game running from a browser rather than an executeable?


texts: How can I simulate the sun's position for 3D lighting?

texts:
I'm using a directional light as a light source. It dosn't have a positon, only a direction, represented by a vec3.

I'm trying to figure out how to make the light direction to simulate sun movement and I'm clueless where to start. There's a related question here on gamedev but its 2d and only on suns position, which I am not interested in. Any suggestions on how to start?


texts:
Intro:

I want to convert a Voronoi Graph made with this awesome library by jceipek on GitHub into something I can work on.

So far so good, this user provides with a demo to start with and shows how to generate the VG.

Question:

How do I convert the VG (made by edges and that dot in the middle) into something that I can work with?

Such as, after you generate some noise and apply to it (height), you colour the polygons based on it.

Thoughts:

Something comes to my mind about instantiating meshes and tiles based on the edges and the position of the dot as a start, but it won't work if I can't "detect" the polygon.

Expected result:

Image from this blog about Voronoi Mapping link

What I have:

It is drawn with Gizmos (for visual debugging in Unity)

I want to know how to color my polygons as in the expected image above. So I thought about doing a mesh or individual tile (and color it based on height afterwards but that is sauce for another question if needed)

Edit of my progress:

To further explain this question I provide the next image.

The image shows that I could use that position data somehow and turn that random polygon shape into a "tile" that will have a colour (mesh?) and possible data in it (script).

I hope this helps otherwise let me know in the comments.


texts: Use pathfinding algorithm in a navmesh with several endpoints

texts: I need to implement a pathfinding algorithm in a navmesh with several endpoints, and I would like to find the path to the closest endpoint. I suppose that Dijkstra algorithm is the best solution for that but it needs some adaptation. Is someone could help me please ?


texts: In Adobe CS5 you can export games to iOS, but all my research in the past indicated that Apple was not going to support Flash. It's my understanding that Adobe and Apple were working on this at one point and then Apple terminated the project. I was chatting with some other developers about this and one mentioned they were porting an AS3 project to their iPhone. Is there a way to get a Flash App on to the iStore? I don't think so.


texts: Show icon at screen edge when corresponding object is out of view frustum

texts:
If an object moves out of the view frustum of the camera, I want to display an icon on one of the edges of the screen to indicate the rough direction where it is.

Unfortunately I have not come up with an idea yet how to do this. Can you please point me into a direction? Is there a special name for this?


texts: Moving with rotating in 3D world in Libgdx

texts:
I'm trying to create a first person system in my game which consist of a big cube with grass texture , so the problem happens when I move and try to rotate the camera the world rotate and I'm not on the main axis this is code

Vector3 position = new Vector3();

private void movement() {
    block.transform.getTranslation(position);
    position.x = x;
    position.z = z;
    position.y = y;
    block.transform.setTranslation(position);

}

private void rotate() {
    //camera.rotate(Vector3.Y,angleX);
    //block.transform.rotate(Vector3.Y,360.0f - angleY);
    block.transform.setFromEulerAngles(angleY, 0, 0).trn(position.x, position.y, position.z);
    carinstance.transform.rotate(Vector3.Y,angleY);
}

@Override
public void render () {
    Gdx.gl.glClearColor(.5f, .7f, .9f, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT|GL30.GL_DEPTH_BUFFER_BIT);

    movement();
    rotate();

    modelBatch.begin(camera);
    modelBatch.render(modelInstance,environment);

    modelBatch.end();
    camera.update();

}

I know that we must rotate the world and move it not the camera and I did this in openGL so I used

glrotatef(anglex,0,1,0);

To rotate the all world but in libgdx I can't find a way to do this .

I just want a way to move and rotate camera in libgdx.


texts: Texturing different block types on an optimized voxel mesh

texts:
I have a cubic world (like Minecraft) where I'm generating chunks. In those chunks, only visible vertices and faces are generated.
Currently, it means that if I have a 2x2x1 chunk, it will generate 8 triangles for the top part (2 for each block). I'm trying to generate only two following this greedy meshing method:

If I combine adjacent faces together, I'd still like to be able to draw transitions in materials between adjacent blocks, something like this:

As you can see it has 3 different tiles: grass, dirt-grass transition, and dirt.
Currently, my shader looks like this:
Shader "MultiTexture_Diffuse_Worldspace"
{

    Properties
    {
        _Color ("Main Color", Color) = (1,1,1,1)
        _TexAbove ("Above texture", 2D) = "surface" {}
        _TexSide ("Side texture", 2D) = "surface" {}
        _TexBelow ("Below texture", 2D) = "surface" {}
        _TexTopSide ("Top side texture", 2D) = "surface" {}
        _Scale ("Texture Scale", Float) = 1.0
    }

    SubShader
    {

        Tags
        {
            "RenderType"="Opaque"
        }

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float3 worldNormal;
            float3 worldPos;
        };

        sampler2D _TexAbove;
        sampler2D _TexSide;
        sampler2D _TexBelow;
        sampler2D _TexTopSide;
        float4 _Color;
        float _Scale;

        void surf (Input IN, inout SurfaceOutput o)
        {
            float2 UV;
            fixed4 c;

            if(abs(IN.worldNormal.y > 0.5))
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexAbove, UV* _Scale);
            }
            else if(abs(IN.worldNormal.x) > 0.5)
            {
                UV = IN.worldPos.yz;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else if(abs(IN.worldNormal.z) > 0.5)
            {
                UV = IN.worldPos.xy;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexBelow, UV* _Scale);
            }

            o.Albedo = c.rgb * _Color;
        }
        ENDCG
    }
}

How would I modify this shader to work with faces that have been merged together? Or would I have to keep separate faces per block and handle them individually?


texts:
It seems like different controllers have their buttons mapped differently. I was wondering if there was some sort of standard. X is the first button, then A, then B, then Y. I looked and couldn't find any standards anywhere.

EDIT: I'm specifically talking about controllers used with computers. Usually with 2 joysticks, a hat, 4 letter buttons, 2 triggers, and 2 bumpers.


texts: Jumping to land x pixels ahead while not really moving (2D)

texts:
The player object in my game has its x-axis locked. It can only jump on Y. It's the ground that constantly moves to the left so that it appears like the player is moving to the right.

The ground is moving left at a speed of 240 pixels per second.

Whenever the player falls and hits the ground, I want it to jump so that it hits the ground again when it has gone 180 pixels to the left.

So, it should jump, the ground should get to move 180 pixels and then the player should hit the ground at that moment and jump. Then repeat. 180 pixels each time.

Oh and, the jump height may be variable. Specifically, there will be two jumps: a small jump and a big jump. Both need to land after the ground has moved 180 pixels.

I'm bad at math, so I can't figure it out. I would appreciate any help!


texts: Android Build Failing Game Maker Studio 1.4

texts:
In Game Maker Studio 1.4 I'm trying to export my game to Android API 29. Whenever I start to compile, the build fails because the API 28 support library is too low for the Target API 29. I have the latest Android Studio and SDK's installed. I don't know how to fix it.
Here's a pic of my target sdk settings:

Here's my lint file saying what the error is:


texts: How to make controlled exchanges in an online-game?

texts:
There is an online game in which you can collect things of different values: ordinary, epic, legendary. The cheapest things are ordinary, the more expensive are epic, and the most expensive are legendary.

If you have collected 10 things of the same value, then you can exchange them for one thing with a value higher. For example, if you collected 10 things of epic value, then you can exchange them for one legendary thing.

After such an exchange, the user can go into minus or plus, because 10 things with a value lower can total be worth more than one thing with a value higher or vice versa. The user can drop a thing worth 25% to 400% of the exchange value.

How can I make such exchanges controlled so that someone can get a good profit from these exchanges, someone stay at zero, and someone go minus? But the most important condition is that, as a result, the online game is in plus with exchanges.


texts: How to check battery usage of an iPhone/Android app?

texts: I think the title says Enough. For example Unity can generate you a report how much CPU/GPU power it's using or how fast it's going to drain device battery, but what about the applications developed using Cocos2d or the ones you develop directly using OpenGL? How should you profile them? In general what should you profile? or Should I simply run the application and wait for it's battery to run out?


texts:
I'm using Box2D for physics in my game, and one of the things it needs to know when creating a shape for a physics body is the shape's density. I had no idea what value I should specify, so I went to the header file where it's defined, and it says:

  The density, usually in kg/m^2.

I took that to mean that you could find the density for an object by dividing its weight by its size in metres squared. If I do that for a square crate, which I want to weigh 20 kilograms and have a width of 0.72 metres:

float32 weightInKg = 20;
float32 metresSquared = 0.72 * 0.72;
float32 density = weightInKg / metresSquared;

The density is 38.5802. Is this correct? It also results in a computed mass of 20, which is correct, as the Box2D documentation says the mass is in kg. I've got gravity set to zero if that matters, as the game is top-down.

If I do a similar calculation for the character, a human whose shape is a circle with a radius of 0.5 metres:

float32 weightInKg = 80;
float32 metresSquared = pi * (0.5 * 0.5);
float32 density = weightInKg / metresSquared;

The density is 101.859. Again, this doesn't seem correct. I've read that a density of 1.0 makes sense for a human in the context of Box2D, so if that were true, I'm just slightly over. I've also read that the average density of the human body is 985 kg/m3, but I'm not even sure if my density calculation is correct, so I'm not sure how that figure translates to kg/m2.


texts:
I am currently designing the rendering system for a 2D game built in C++ and OpenGL, and am unsure about how to go about implementing a sorting procedure to maximise efficiency and minimize OpenGL texture changes. Currently my system looks something like this:

void Renderer::draw(Sprite sprite)
{
    for (Batch b : m_batches) {
        if (sprite.getTexture() = b.getTexture() && b.enoughRoom(sprite)) {
            b.submit(sprite);
            return;
        }
    }

    m_batches.push_back(Batch(default_size, sprite.getTexture());
    m_batches.top().submit(sprite);
}

void Renderer::display()
{
    for (Batch b : m_batches) {
        b.draw();
    }
}

However, this feels like a pretty naive implementation, and what worries me is that every time I submit a sprite into a batch using b.submit(sprite), I am calling glSubBufferData(); (So say for drawing 2000 sprites, thats 2000 calls to glSubBufferData per frame which feels very slow).

What I feel would be better is to only call glSubBufferData once with all of the vertex data that would go into that buffer. How would I go about doing this? I though about giving the Renderer class a RenderQueue vector, which when sprites are submitted are pushed back into the queue, but how would I go about sorting this vector and then splitting it up into all of the different Batches, while keeping in mind that a Batch size cannot exceed a limit? (As in, I don't want too many vertices in a single VBO).

EDIT: Also, I understand that it would be very easy to implement this if I used simply one texture atlas, however I would not like that limitation and would prefer to implement a system that allows for 2 or 3 different atlases.


texts: Why is the origin in computer graphics coordinates at the top left?

texts:
From what I've seen almost all things use coordinates where (0, 0) is at the top left and the positive Y-axis goes in the downwards direction of your screen.

Why is it like this? Why not the conventional positive Y-axis going upwards like shown in graphs in simple math classes?


texts: Where is the best place to find modeling artists that are loyal?

texts:
For the past 3 years I have been working on my first indie game with a few friends but had to learn how to do everything myself, from coding, to creating models in blender and how to use Unity.

After a while I found a few people to help but they're either young or busy and I would like to find dedicated members for my game who won't leak or share things online.

I'm new to this and I would love some advice on where I can recruit members for my team who are loyal and dedicated to my game and it's cause.

(also if I posted this in the wrong place or said something odd I'm sorry, I don't know where else to ask as I've been stuck trying to find help for a good while now)

My biggest worry is that someone will steal or copy my idea if I post anything about the game online(we've had a few scares like that before) so it's the biggest thing for members to be loyal and not leak anything.


texts:
When player's computer stutters/he tabs out of game stopping requestAnimationFrame calls, movement system tied to the delta time creates a huge leap, bypassing probable collisions. This allows player to cheat, for example avoiding projectiles by tabbing out and tabbing back in. What are solutions to such a problem, other than pausing the game when delta time is too high?

Attached simple system suffering from this problem - run the code, tab out, wait a while, then tab back in - you shouldn't see the "PEW" in console.

function Box(x, y, w, h, moving) {
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    this.moving = !!moving;
    this.colliding = false;
}

Box.prototype.move = function(dx, dy) {
    this.x += dx;
    this.y += dy;
};

Box.prototype.testCollision = function(target) {
    return (Math.abs(this.x - target.x) * 2 < (this.w + target.w)) &&
           (Math.abs(this.y - target.y) * 2 < (this.h + target.h))
    ;
};

var boxes = [
    new Box(0, 0, 100, 100, true),
    new Box(200, 200, 100, 100)
];

function updatePosition(dt)
{
    var time = dt / 1000;

    for (var i = boxes.length - 1; i >= 0; i--) {
        if(boxes[i].moving) boxes[i].move(100 * time, 100 * time);
    }
}

function updateCollision()
{
    for (var i = boxes.length - 1; i >= 0; i--) {
        for (var j = boxes.length - 1; j >= 0; j--) {
            if (i === j) continue;

            if(boxes[i].testCollision(boxes[j])) {
                boxes[i].colliding = true;
                boxes[j].colliding = true;
                console.log("PEW");
            } else {
                boxes[i].colliding = false;
                boxes[j].colliding = false;
            }
        }
    }
}

var canvas = document.getElementsByTagName('canvas')[0];
var ctx = canvas.getContext('2d');

function render()
{
    ctx.clearRect(0, 0, canvas.width, canvas.height);

    for (var i = boxes.length - 1; i >= 0; i--) {
        var box = boxes[i];
        if (box.colliding) ctx.fillStyle = '#FF0000';
        else ctx.fillStyle = '#BADA55';

        ctx.fillRect(box.x, box.y, box.w, box.h);
    }
}

var lastTime = 0;

function update(time)
{
    var dt = time - lastTime;

    updatePosition(dt);
    updateCollision();
    render();

    lastTime = time;
    requestAnimationFrame(update);
}

requestAnimationFrame(update);
<canvas width="500" height="500"></canvas>


texts: Are Texture2D objects stored on the graphics card or on system memory? I am thinking that the backbuffer is located on the graphics card (by default) and that the textures are on the system memory. I am using a spritebatch class that writes the textures to the backbuffer which are then rendered when the Present() function is called. Is this how XNA does it or am I completetly off?


texts: Is it clever to use some engine to start game developing?

texts:
I started C# programming, in order to later develop games with XNA. I read a good game development book for C#. Since I already knew other languages, I could quickly learn C# features and syntax code. I then stepped over into XNA. Since the book I was reading was a bit old, I put it aside, and started to look at game development tutorials about XNA over the Internet. I could accomplish and understand most of them, using 2D graphics. I created animated sprites, made my characters move in any direction, scrolled my background together with my characters movement, and so on. Everything was done with "raw" XNA.

I found some of those things hard to understand, and I found that some things wee already be built into the framework. I found other game engines, which I could clearly understand at least the simple line codes, such as "FlatRedBall", "Axiom" and "Quick Start Engine". I already knew of the famous ones, like "OGRE", "Unreal" and "Unity". At the same time, I was tempted to throw it all away, and start learning some famous game engine programming. I wanted to stay with XNA, as it took me time to learn; time I wouldn't like to waste it.

This time, I leave it up to the experienced ones. Can I go through some game engine, and use what it has to offer, even if I'm starting with game development? Some people could think that it is good to get use to the boring routines of a naked framework. If so, what would be the recommended one to start off with? I heard that it varies from market to market. We could perhaps consider that I want an RPG-specific.


texts:
Possible Duplicate:
  Are there any video tutorials available for game programming with Max?

Suppose i have model of simple 3d ball made in 3ds max. i just want to make simple game for fun . the scene will have only one ball , which will move with cursor.

I know there may be other tools for game but i just want to know how to export 3ds max model in game


texts: Re-using one texture for multiple OpenGL Quads

texts:
I've been looking over my code and I'm just wondering, when I set a texture for say, 20 quads that need to use the same texture, it seems as though I'm creating a new texture each time...... surely this isn't efficient?

How can I make sure that 20 quads that use the same texture do just that, use only 1 rather than creating 20 copies of it?

I just can't work out how I can do this.  I know I can change the texID after applying the texture so that all quads that use the same texture, will have the same Texture ID, but this isn't really the issue I'm facing.

Of course, I may be completely misunderstanding how OpenGL deals with textures and my code may be OK :-/

Code:

    public void setTexture(GLSurfaceView view, Bitmap imgTexture){
        this.imgTexture=imgTexture;
        //Create program from Utils class
        iProgId = Utils.LoadProgram(strVShader, strFShader);
        //Return location of u_basemap
        iBaseMap = GLES20.glGetUniformLocation(iProgId, "u_baseMap");
            //Return location of attribute variables
        iPosition = GLES20.glGetAttribLocation(iProgId, "a_position");
        iTexCoords = GLES20.glGetAttribLocation(iProgId, "a_texCoords");
        //Return usable texture ID from Utils class
                texID = Utils.LoadTexture(view, imgTexture);

}

And....

public static int LoadTexture(GLSurfaceView view, Bitmap imgTex){

    //Array for texture
    int textures[] = new int[1];
    try {
        //Return texture name in textures Array
        GLES20.glGenTextures(1, textures, 0);
        //Bind textures
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        //Set parameters
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);

        //Apply the texture to the image loaded
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, imgTex, 0);

        //clamp the texture
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,GLES20.GL_CLAMP_TO_EDGE);
    } catch (Exception e){
    }
    //Increase texture count by one
    textureCount++;
    return textures[0];
}

Edit

I've attempted the suggestion below (just calling glBindTextures()) however, I'm not having any luck.  Clearly I'm not understanding this correctly.

Lets say I have 2 sprites, Object1 and Object2.

I call the following:

object1.setTexture(this, myAtlasTexture); //Calls setTexture (See above)

This works and sets the texture on this sprite, so I can now draw it.

Now I want object2 to use the same texture.  So I don't want to call this again and create a new texture (I believe this is a bad idea) - I simply want to use the texture that was previously created when I called setTexure on object1.

So, instead of calling setTexture on object 2, I do the following:

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureIDOfObject1);

(Note textureIDOfObject1 is just that, I just query object1 to obtain its texture ID).


texts: Database & Physics in hand. How do render through web?

texts:
I'm developing a football management game.

It is to be browser based.

For the moment a turn based strategy that in the future I'd like to develop with more javascript interactivity.

I am competent with mySql and Php set ups and currently the game logic is set out for Php. (where the ball is, where the player should be etc etc)

But as it is my first game I'm not sure how to render the information as a sequence of animations?

Shall I look into SVG and XML manipulation? Then output it as frames?

Let me know if I am asking the wrong questions or info is lacking.


texts: How to figure out why a given shader compilation causes an invalid operation error?

texts:
I have 2 versions of a program. The only difference being that in one, a geometry shader is compiled and in the other it is not.

In all other regards both programs are identical, character by character. The only change is whether there is a geometry shader in the main shading program or not.

The geometry shader in question is:

#version 450

layout (triangles) in;
layout (triangle_strip, max_vertices=136) out;

uniform  float height = 128;

void main()
{
   for(int layer = 0; layer < int(height); layer++)
    {
        gl_Layer = layer; // built-in variable that specifies to which layer we render.
        for(int i = 0; i < 3; i++) // for each triangle's vertices
        {
            vec4 pos = gl_in[i].gl_Position;
            pos.z = 0.5;

            gl_Position = pos;
            EmitVertex();
        }
        EndPrimitive();
    }
}

I am checking for compilation errors. As a matter of fact if I were to add a random string to the shader I will get a full explanation of where the error occurred (i.e a message saying that the compiler did not understand the random string).

I am also calling glError() extensively to check when something goes wrong and it does not return an error upon compilation but it does return an error ont eh first opengl operation attempted after it.

If I comment everything in the sahder so that it looks like an empty function:

void main(){}

The error still happens. But, once again not having the shader causes no issue.


texts:
I am trying to persist objects on scene loading, but the objects always get deleted when the scene does load.

LevelManager.CS

public void LoadLevel(string name){
    if (name == "Main")
    {
        SceneManager.LoadSceneAsync(name);
        GameManager.LoadState();
    }
    else
    {
        GameManager.SaveState();
        SceneManager.LoadScene(name);
    }
    Debug.Log("the scene is: " + name);
}

I placed the LoadScene method ontop in the hopes it would complete loading the scene before moving onto the next method call.
In the next method call, I restore objects to their state.

GameManager.CS

public static void LoadState()
        {
            ES3.Load<Dictionary<Vector2, Building>>("Buildings");

            foreach(Vector2 v2 in buildingPositions.Keys)
            {
                Building b = buildingPositions[v2];

                if(b.GetType() == typeof(Farm))
                {
                    newFarm = Instantiate(farmPrefab) as Farm;
                    Debug.Log("Build: " + newFarm);
                    newFarm.transform.position = v2;
                    Debug.Log(newFarm.transform.position);
                    newFarm.level = b.level;
                    **//newFarm.name = b.name;**
                    newFarm.levelText = newFarm.GetComponentInChildren<Text>();
                }
            }

            CheckTheCall();
    }

What actually happens is when the scene is changed, the LoadState code is run at the same time, which then causes my object to be deleted after the scene has finished loading, because its created before the scene changes.

The third last line "newFarm.name = b.name" gives me an error that newFarm was destroyed. The last line "CheckTheCall()" calls newFarm (which I declare at the top of the script to ensure scope wasn't the issue) and that shows newFarm exists as a farm. THEN after all this, the scene changes, so my instantiated object is deleted.

I'm so confused I tried with just SceneManager.LoadScene(name) but the result is still the same. It's like the entire function completes and then the scene loads.

Any ideas on how to get around this one? I need the objects to spawn back into the main scene in the same state they were.


texts: Can I write code from 2 computers at the same time?

texts:
So I know it might not be that related to game dev, but I'm now starting a project with friends and we want to code. Thing is, we are not living close, and when several programmers write different classes or parts of code, syncing is a problem. Skype is not fast enough, it actually makes it worse (you need to pack and unpack .zip solution file), nor email.

Any one got a software that can connect 2 (or more) computers, and when we write code it will show up (simultaneously) on one of them/both?

I don't care much for lags, if we need to wait few secs till it shows up, it's fine.

I thought about TeamViewer, but as far as I remember only one can write/do an action at a time.

Thanks!


texts: How do i set conditions for an IF statement as the game progress through "difficulty"?

texts:
This is code that I wanted to put in my IF statement
    public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;

//Spawn Positions
Vector2 SpawnPosition;
float nextSpawnTime;

void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        randX = Random.Range(-5.6f, 5.6f);
        randY = 5.57f;
        SpawnPosition = new Vector2(randX, randY);
        Instantiate(fallingRockPrefab, SpawnPosition, Quaternion.identity);

    }

}

This is the code from my "Difficulty.GetDifficultyPercent"
    public static class Difficulty{
static float secondsToMaxDifficulty = 30;

public static float GetDifficultyPercent()
{
    return Mathf.Clamp01(Time.timeSinceLevelLoad / secondsToMaxDifficulty);
}}

I'm planning to make a certain event happen when my game bypass a certain stage of a difficulty as it progress but I just don't know what to put it as.
My guess is this,
if(Time.time > Difficulty(25))
but didn't work.


texts: 2D Infinite Runner : how to manage background layers?

texts:
First of all, sorry for this post, I guess this already has been discussed. I browsed stackexchange and the web but I couldn't seem to find a clear information for my case, with always mixed results.

So I'm making a mobile game with Unity, and am re-starting the development from the beginning in order to have smooth performances. The game is a 2D runner (Canabalt style).
Though there will be two modes :

One story mode with about 12 levels precisely designed which will be
always the same
One arcade mode with randomly generated level (platforms).

Main features :

Back and Foreground Parallax (5-6 layers totally, with different
movement speed)
Automatically running, manually jumping over holes    and attacking
ennemies

So I have a few interrogations :

The classic question : should I make it like a theadmill, having a
fixed player position, and making the level move forward. Or should I
be moving the character as the camera follows him ? Given the fact
that I want multiple parallax background. Are there differences
performance-wise ?
A linked question : should I use the perspective camera and play with
the Z axis ? or keep the orth camera ? I'm not sure how it affects
the performances.

Then, having read many topics, I guess I should try to move back the objects and backgrounds, instead of instantiating and destroying them all the time when doing a random level, right ?
And for my pre-designed levels (not random) should I split the background to display it step by step, in terms of performance ?

I already know how to scroll my backgrounds, make a parrallax effect with my 5-6 layers, here I'm looking for tips to start clean with the smartest development style, especially in terms of performances and would like to have some hints on which are the best practices to follow

Maybe you have other good practices to share with me... I'm hoping I'm not asking too much, thanks for any insights !

Have a good day


texts: How to animate the sprite along with action in Cocos2d?

texts:
Cocos2d-android - I have an animation which has 5 Frames they are close cropped images. Now I want Sprite to do animation as well as Move in X direction.i.e. I have a player running which gets collided with obstacle and falls down .. Now I want sprite to run animation as well as moveBy in -ve x direction

gameOverAnimation =CCSprite.sprite("gmovr00")
gameOverAnimation.setAnchorPoint(0, 0);
gameOverAnimation.setPosition(340.0f, 200.0f);
addChild(gameOverAnimation,10);
CCIntervalAction action1 = CCAnimate.action(mEndAnimation, false);
action1.setDuration(1.0f);
CCIntervalAction delay = CCDelayTime.action(0.68f);
CCMoveBy actionBy = CCMoveBy.action(1.0f, CGPoint.ccp(-340,0));
CCIntervalAction seq1 = CCSpawn.actions(action1,actionBy);
//CCSpawn spawn = CCSpawn.actions(action1, actionBy);
                CCSequence sequence1 = CCSequence.actions(seq1,CCCallFuncN.action(this,"gameOver"));
                gameOverAnimation.runAction(sequence1);

Above code makes animation run first then moved in y direction

Thanks for the help..
And can some one explaing me the concept of time with frame Animation or good example ?


texts:
I'm creating an attack boat game in c++ and I have an issue with my boat following the mouse around the screen. My plan is to have the boat follow the mouse more like a boat (slow rotations, instead of instantaneous whilst taking about 4 seconds to do a 360 turn) and for the most part it does what it should.

The bug happens when the mouse is on the left side of the screen (as soon as my mouse crosses the -x axis),  as the boat follows the mouse, the boat turns in the wrong direction and does a 360, instead of following the mouse.

This is the code i'm using to do my boat turning.

        angle = atan2(delta_y, delta_x) * 180.0 / PI;

        //Rotate the boat towards the mouse and
        //make the boat turn more realistically
        if (angle - rotate > 0) {
            rotate += 1.0f; // turns left
        } else if (angle - rotate < 0) {
            rotate -= 1.0f; // turns right
        }
        if (angle - rotate >= 360.0f) {
            rotate = 0.0f;
        }`


texts: I am creating an 2D XNA Tile Based Platformer. I have a tile engine and a world/terrain generator. However, I am trying to create biomes or areas, For example, Desert in one part of the world, ocean on the ends, City in the middle, forests scattered around etc. I can easily make it generate them, but My problem is defining the actual areas to be generated in.


texts: What is a currently a good game stack for simple Javascript 2D multiplatform game?

texts:
I'm looking for advice from someone can help me avoid common pitfalls in developing light weight, quick-to-market games. Yeah, I've heard of Google ;-), but a trip down Google lane does not beat solid experience from someone who has been down this path. I'm looking for advice from someone who works alone, or in a small team, and has developed some 2D games for mobile.

My game ideas don't require intensive graphics, just simple arcade style glyphs and collision detection. My experience is mostly with Scala, Java and web technologies (Javascript, CSS, SVG, HTML, etc).

My question is: Is there a nice stack that someone can suggest that will be a good fit for my skillset?

I'm considering Javascript for simple 2D shooter games with simple multiplayer games being supported with a Scala server-side written on Spray. Is this silly? Should I rather look into things such as Unity 3D, and use it in 2D mode?

For the actual game engine, something like the Sparrow Framework would be great, but it needs to be multiplatform.