texts:
I have a box model in my DirectX application, stored as 8 vertices:

MyVertex vertices[] =
{
    { DirectX::XMFLOAT3(  - 1.0f,  + 1.0f,  - 1.0f ), /*,tex coord...*/}, //0
    { DirectX::XMFLOAT3(  + 1.0f,  + 1.0f,  - 1.0f ), /*,tex coord...*/}, //1
    { DirectX::XMFLOAT3(  + 1.0f,  + 1.0f,  + 1.0f ), /*,tex coord...*/}, //2
    { DirectX::XMFLOAT3(  - 1.0f,  + 1.0f,  + 1.0f ), /*,tex coord...*/}, //3

    { DirectX::XMFLOAT3(  - 1.0f,  - 1.0f,  - 1.0f ), /*,tex coord...*/}, //4
    { DirectX::XMFLOAT3(  + 1.0f,  - 1.0f,  - 1.0f ), /*,tex coord...*/}, //5
    { DirectX::XMFLOAT3(  + 1.0f,  - 1.0f,  + 1.0f ), /*,tex coord...*/}, //6
    { DirectX::XMFLOAT3(  - 1.0f,  - 1.0f,  + 1.0f ), /*,tex coord...*/}, //7
};

And for the index buffer I use:

WORD indices[] = {
    3,1,0,2,1,3, //top
    0,5,4,1,5,0,
    3,4,7,0,4,3,
    1,6,5,2,6,1,
    2,7,6,3,7,2,
    6,4,5,7,4,6,
};

It works just fine, but now I want to add a texture to the faces of my box.

Which would be the best approach?

The options I see:

Use 24 instead of 8 vertices -- four for each of the box's six faces. Some of these will have the same position/normals, but different texture coordinates.
Use 8 vertices and texture coordinates like here:

MAYBE there is a way to provide different sets of texture coordinates for a single vertex, so I can provide different texture coordinates on different faces of the box?  If so, how can I do that?

The disadvantages (for the options with the same numbers):

16 additional vertices (3 as many), all the benefits of using a index buffer to have less vertices are wasted - maybe this means I shouldn't use an index buffer at all, under this approach?
Texture with odd proportion (2:3), texture must be six times the size for the same resolution.
None?

In option 2. I can use one texture to create different images on each box's face, but I'm not interested in that benefit.

Additional question (!!!):

How is this done in 3d software and mesh formats?

When I create a box in 3ds Max, create a material with a texture and apply it to the box, each side of box has the same texture (like option #1), with good texture coordinates (impossible to achieve with 8 vertices and a single square texture?), and the statistics says "8 VERTEXES".

How is it possible? Did they achieve option #3?


texts: Creating trading card board layout in libgdx

texts:
I wanna make a trading card game using libgdx. I have a general idea about how to implement the server side of the game and the game rules, but I don't know how to design the visual interface of the game (in the client side). I want to
create a layout similar to the one in the image below, but quite a bit simpler. I don't have an idea of how to do it though. I'm thinking of using scene2d and Table  and have a row the opponent, one for the player and two for the creatures and then each cell is a card/creature. Is that a good way or is there a better way?


texts: Fixing game loop to 60fps makes animation very jittery

texts:
ns is 1000000000 / amountOfTicks;

    long now = System.nanoTime();
    delta += (now - lastTime) / ns;
    lastTime = now;

    if (delta >= 1) {
        tick(glad);
        updates++;
        delta--;
        fps_counter = 0;
    }

    if (delta >= fps_counter / FramesPerTick) { // render
        fps_counter++;
        frames++;
        render(glad);
    }

    if (System.currentTimeMillis() - timer > 1000) {
        timer += 1000;
        frame.setTitle("Ticks: " + updates + " Fps: " + frames);
        updates = 0;
        frames = 0;
    }

So if i have 20 ticks and 3 FramesPerTick i get 60fps
it checks whenever delta is bigger than 1/3, 2/3 and 3/3, so every tick has 3 frames

Everything is jittery, movement, mouse look.
Animation gets more and more jittery the lower the FPS, i dont understand why.

Also when i take the render(glad) method out of the if, it goes up to 400 fps and runs very smoothly.

EDIT:
If i put Thread.sleep(13) instead of if (delta>=fpscounter/FramesPerTick){} i get around 60 fps and smooth animations.


texts: How to implement "model quality" in OpenGL

texts:
In many games, there is an option named: "Model Quality", which ranges from Low to High. Low model quality simply removes a lot of vertices from the model, to make it faster, while High preserves the original model vertices (I think).

So I'm wondering, how do I implement this in my game?


texts: Resolving bounding box collision detection

texts:
I'm working on a simple collision detection and resolution method for a 2d tile-based bounding box system. Collision appears to work correctly, but I'm having issues with resolving a collision after it has happened.

Essentially what I'm attempting to do is very similar to this approach. The problem I'm experiencing is that because objects can be traveling with both horizontal and vertical velocity, my resolution code causes the object to jump incorrectly.

I've drawn the following annotation to explain my issue. In this example, because my object has both horizontal and vertical velocity, my object (which is heading upwards and collides with the bottom of a tile) has it's position altered twice:

To correctly adjust it's vertical position to be beneath the tile.
To incorrectly adjust it's horizontal position to be to the left of the tile.

Below is my collision/resolution code in full:

function intersects(x1, y1, w1, h1, x2, y2, w2, h2)
{
    w2 += x2;
    w1 += x1;
    if (x2 > w1 || x1 > w2) return false;
    h2 += y2;
    h1 += y1;
    if (y2 > h1 || y1 > h2) return false;
    return true;
}

for(var y = 0; y < this.game.level.tiles.length; y++)
{
    for(var x = 0; x < this.game.level.tiles[y].length; x++)
    {
        var tile = this.game.level.getTile(x, y);
        if(tile)
        {

            if(
                this.velocity.x > 0 &&
                intersects(this.position.x+dx+this.size.w, this.position.y+dy, 1, this.size.h, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.x = ((x*tileSize)-this.size.w);
                hitSomething = true;
                break;
            }
            else if(
                this.velocity.x < 0 &&
                intersects(this.position.x+dx, this.position.y+dy, 1, this.size.h, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.x = ((x*tileSize)+tileSize);
                hitSomething = true;
                break;
            }
            if(
                this.velocity.y > 0 &&
                intersects(this.position.x+dx, this.position.y+dy+this.size.h, this.size.w, 1, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.y = ((y*tileSize)-this.size.h);
                hitSomething = true;
                break;
            }
            else if(
                this.velocity.y < 0 &&
                intersects(this.position.x+dx, this.position.y+dy, this.size.w, 1, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.y = ((y*tileSize)+tileSize);
                hitSomething = true;
                break;
            }
        }
    }
}

if(hitSomething)
{
    this.velocity.x = this.velocity.y = 0;
    dx = dy = 0;

    this.setJumping(false);
}


texts: Do Gradle 'implementation' replace Unity Jar Resolver dependencies?

texts:
I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.


texts: Does Direct3D have hardware-dependant extensions like OpenGL?

texts:
I am not familiar with Direct3D and I want to know if it has hardware and vendor dependant functions like the extensions in OpenGL?

A program written by a friend fails on certain computers while it runs perfectly on others. Also a simple program to get a list of supported extensions would be helpful (like
glGetString(GL_EXTENSIONS) in OpenGL).


texts:
I have a libGDX game, in which I'd like to make some ice breath like effect using particles. So far we made a cone like effect. I can obtain and render it on the screen with this.

ParticleEffectPool.PooledEffect effect = breathPool.obtain();
effect.setPosition(x,y);
ps.add(effect);

But I don't really see any way to rotate the entire particle system in a given direction. Is there any way to achieve this?


texts:
I want to create a game where you walk around in 3D, and sometimes you can activate some kind of 2D puzzle. For example - you walk up to the door, and you can open it using lockpicks. The lockpick part is 2D. There's plenty of games which could be example of that, like Assassin's Creed 3, Skyrim or possibly the new Thief?

While lockpicking the door, you lose control of the character, you use mouse or buttons to move the lockpicks. The visible elements would be moving.

How would you do that? Should I use UMG objects like images and buttons, or should I use some other kind of 2D graphics drawing? Or something even else?


texts: What is the best practice to resize game views-assets in WPF/silverlight?

texts: I am working on simple game using WPF/C#, and I am wondering what is the best practice to resize the game (views, assets…) when user re-sizes the game window? Is it good practice to use the ViewBox control for this job?


texts: Is there a centralized database of game names and IDs?

texts:
Given two games with very similar names:

Alien Shooter II - Vengeance

Alien Shooter: Vengeance

Is there some place that I can go to get an ID or the 'canonical' name for these games? I suspect that they are the same game, but it's very hard to say for certain.


texts: Where can I find OpenGL state changes profiling?

texts:
Is there any benchmark that actually measure state changes cost in OpenGL 3.x/4.x and gather an average statics for all graphics cards? (I don't want to optimize only for my old AMD card, I'm not even sure I'm profiling it correctly).

I found some profile data but is dated against fixed function pipeline wich is somewhat obsolete.

Actually seems FBO setup is the slowest operation (after swapping buffers wich is done only once), but I want to know in average "how much slower" it is compared in example to a texture binding. So that I can take says a 10% error treshold and try to organize up-front gl calls.


texts:
I'm trying to implement pathfinding in my game, I'm using navmesh with triangles.

I'm able to find a path but I want to simplify the path. This is what I have right now :

Green quad is start position and blue quad is the destination, the path taken by my character is in white.

Wireframe :

Node 1 and Node 2 are in differents triangles, I want to delete Node2 and go from Node1 to final destination.

How can I simplify this path ?


texts:
I'm developing a 2D Zelda game with LibGDX in Java using TileD maps. I am now adding NPCs to the engine and I'm thinking about how to make them so it's going to be easy for me to add/edit their custom dialog/behaviour conditions/interaction/etc in the future,

I don't really know how I should implement it all but I have an idea.
I do not want to make subclasses for each NPC or each type of NPCs or whatever.
I want to only have one NPC class. My current idea is to write a basic script for each NPC (in Groovy for example) and save it as a file in my resources, and then, to execute this script in Java in the corresponding NPC's "core" game loop code.

I'm not sure about how it's going to work, what should be aware of, or if there are any better solutions...
So I'm asking some advice about how should I proceed to implement this.
I don't know yet how limited the NPCs will be later but I want to guarantee maximum control over them, still being able to have them all unique if necessary.


texts: SDL_DisplayFormat works, but not SDL_DisplayFormatAlpha

texts:
The following code is intended to display a green square on a black background.  It executes, but the green square does not show up.  However, if I change SDL_DisplayFormatAlpha to SDL_DisplayFormat the square is rendered correctly.

So what don't I understand?  It seems to me that I am creating *surface with an alpha mask and I am using SDL_MapRGBA to map my green color, so it would be consistent to use SDL_DisplayFormatAlpha as well.

(I removed error-checking for clarity, but none of the SDL API calls fail in this example.)

#include <SDL.h>

int main(int argc, const char *argv[])
{
    SDL_Init( SDL_INIT_EVERYTHING );

    SDL_Surface *screen = SDL_SetVideoMode(
        640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF
    );

    SDL_Surface *temp = SDL_CreateRGBSurface(
        SDL_HWSURFACE, 100, 100, 32, 0, 0, 0,
        ( SDL_BYTEORDER == SDL_BIG_ENDIAN ? 0x000000ff : 0xff000000 )
    );

    SDL_Surface *surface = SDL_DisplayFormatAlpha( temp );

    SDL_FreeSurface( temp );

    SDL_FillRect(
        surface, &surface->clip_rect, SDL_MapRGBA(
            screen->format, 0x00, 0xff, 0x00, 0xff
        )
    );

    SDL_Rect r;
    r.x = 50;
    r.y = 50;

    SDL_BlitSurface( surface, NULL, screen, &r );

    SDL_Flip( screen );

    SDL_Delay( 1000 );

    SDL_Quit();

    return 0;
}


texts: Unity saving and loading of images in game

texts:
So I'm planning out this game for unity but I don't know how feasible it will be with all of the image loading and saving.  I've worked with some other coding, and while I am in the process of learning C# and Unity I don't have a very informed base for my opinion.

Basically the game will be inspired by the base mechanics of the Chaotic tv show where you have to adventure to take scans of creatures and these scans will be used in another aspect of the game as cards.  The creatures will be randomly generated.  The problem is I want the scans to be like actually taking a picture (A picture that includes all the stats of the creature).  This means I want to be able to save a picture of the scene with the creature in it as well as the stats associated with said creature which means I would have to have some sort of data base capable of storing hundreds (Possibly thousands if you include player made and prebuilt cards) of cards and the data associated with them.  The scans take a picture and record the stats of the creature at that point in time so they're only highly usable for the game when the creature is in near perfect condition (Not yet defeated or attacked).  I would have to be able to store scans of creatures, scans of the environment, and possibly scans of items found while adventuring.  I think it would work best if only a small picture of the actual scene is saved with the stats instead of the full card and the stats, with it rebuilding the card each time it's loaded into memory.  The small picture would also cut down on storage space (Possibly so small as to be high res pixel art)

Would it be unrealistic to save all of this data?  Aswell, does Unity/C# even have the capabilities to take screenshots from specifically defined areas of the screen/players view and then reuse them in another area of the game instead of saving them in some predefined screenshot area?

(This game will be entirely offline so no data will need to be transferred to a different system)  (Said game will also be 3d with the card playing area in 2d)


texts: Given a base class and many derived classes with additional features, what's the best practice for accessing those features?

texts:
This might sound strange, but let me explain. Say I want to write a safari program.
In this safari there is an object pool of 10 animals (Animal*): 2 ostrich, 5 mosquitos, 2 spiders and a snake. Each of these inherits Animal. Both snake and spider are venomous so they have data reflecting it—let's say they additionally inherit IVenomous. The mosquito inherits IFlyer. The ostrich is left out in the cold with none of these additional features.
With venomous animals around, we'd want to prepare antivenom for the safari. So let's have prepareAntidote(). This function's job would be to check what kind of antivenom is needed and simply print it out. As part of implementing IVenomous, spider and snake each have the method const std::string& getVenomName(). The base animal class doesn't have this feature.
The issue then becomes: how do we access the getVenomName() method when all we know we have is a list of Animal, and we don't know which ones implement IVenomous and have a getVenomName() method available? What's considered good practice here?
I've considerd a brute force approach of making use of dynamic_cast<IVenomous*> while iterating over all animals, but this seems wasteful. And as bad is the fact that prepareAntidote() function needs to know what an animal is to handle the pool. So it would most probably be better for it to work on a container<IVenomous*>&, wouldn't it?
My idea is to have each interface's constructor register itself with some storage class which keeps a container of pointers for each interface, and de-registers itself on destruction, so we could access a list of IVenomous animals directly. So far an unordered_map looks the most reasonable for that job, with roughly constant time for access and removal, as well as not invalidating anything except on rehash. The pointer being its own key value.
It's actually the same problem with composition like components for example in games. (That's why I'm writing it here, because of that, chances may be higher to find answers here.) In this case it screams for "object pooling" of course, but let's cast aside memory locality in this case, that should be quite easy to add in later with overloading operator.


texts: Draw line inwards in Unity using Line Renderer

texts:
Is there a way to draw the line inwards instead of from the center using Line Renderer in Unity?

Another option would be to move the Vector points inwards by half the width of the line, but If I have a complex polygon how do I do it uniformly?

EDIT: Found this https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons which may be useful


texts: Getting the tile over wich the mouse cursor is

texts: Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, so that I can draw a rectangle around that tile, so that I can later do stuff with that tile (e.g. if its stone Ill break it if I click...) I draw the map at an offset so the player is always in the middle of the screen, the upper left corner coordinates Ive called xot and yot, the offsets xOff and yOff, and yea. If anyone knows what math I need to use to get the propper tile x and y.


texts: Calling Prefab MonoBehaviour Method before Start()

texts:
I'd like to do the following:

void Update()
{
   GameObject gob = Instantiate(Prefab);
   MyContainer comp = gob.GetComponent<MyContainer>();
   comp.SetName("something dynamic"); // We'll get an error here
}

The problem is, in the below class, SetName is accessing an object that is only instantiated in Start(). Unity's order of events won't have MyContainer.Start() called until the next frame (see example implementation below).

class MyContainer : MonoBehaviour
{
    TextMeshProUGUI textObj;
    void Start()
    {
        textObj = GetComponentInChildren<TextMeshProUGUI>();
    }
    void SetName(string name)
    {
        // Null Reference Here
        textObj.text = name; // textObj isn't set yet;
    }
}

Is there a recommended/sane way to go about dealing with objects in a scenario like this? I'd like to prevent too much boilerplate code in all my MonoBehaviour subclasses while mainting a solid separation of concerns.

The options I've thought of thus far are:

Use flags:

a. OnEnable, if name is set, set the text

b. On SetName, if isActiveAndEnabled, set the text
Change SetName to a coroutine and add a yield return null statement at the top.
Similar to 2, use Invoke

None of these seem ideal.

1 requires spaghetti-style state checks on every method.
2 requires the return values of methods to be IEnumerator even though nothing is actually intended to be returned.
3 requires an extra, 0-argument method for each public method and extra state in the MyContainer class to store the arguments.


texts:
I'm trying to join the mode7 algorithm with RayCasting. For mode7, I'm using a simple rotation matrix to implement the rotation. The result is a little strange and I can't fix it. Do you know what is the problem of the alignment of the algorithms? See the gif below to understand:

The code I'm using is:

function mode7() {
    let _x = 0;
    let _y = 0;
    let z = 0;
    let sin = Math.sin(degreeToRadians(data.player.angle));
    let cos = Math.cos(degreeToRadians(data.player.angle));
    for(let y = data.projection.halfHeight; y < data.projection.height; y++) {
        for(let x = 0; x < data.projection.width; x++) {
            _x = ((data.projection.width - x) * cos) - (x * sin);
            _y = ((data.projection.width - x) * sin) + (x * cos);

            _x /= z;
            _y /= z;

            if(_y < 0) _y *= -1;
            if(_x < 0) _x *= -1;

            _y *= 8.0;
            _x *= 8.0;

            _y %= data.floorTextures[0].height;
            _x %= data.floorTextures[0].width;

            screenContext.fillStyle = data.floorTextures[0].data[Math.floor(_x) + Math.floor(_y) * data.floorTextures[0].width];
            screenContext.fillRect(x, y, 1, 1);
        }
        z += 1;
    }
}

Is there someway or a tutorial to teach how to fix this issue? I tried to find it but i didn't find anyone about RayCasting with mode7.


texts: How to determine what hexes are in an area bounded by 3 hexes

texts:
I've been searching for hex grid algorithms for a while now, but I'm not having much luck.

I'm working on a game that will be using hex grids for the board.  There seems to be sufficient resources to manage the A* path finding routines, but trying to find something as simple as determining a set of hexes within a triangle seems to be a real challenge.

An example of what I'm looking for is that I want to have a starting coordinate.  I want to get a hex that is 3 hexes to the north/east away from the source hex.  I want to get a hex that is 3 hexes to the south/east away from the source hex.  I then want to produce a list of all hexes bounded by these 3 hexes.

It should be simple enough, but the fact that rows are staggered is completely confounding me.

Thanks


texts: Graphics messed up when I try to reskin the game in Android Studio

texts:
I need a little help. I'm new in Android Studio, I have a game where I want to reskin the design. First of all when I install it on my phone with the original files the game run perfectly without problems. When I try to reskin the photos in my assets folder, I save it, build it in APK file, I install the game and then the graphics is messed up. Here is screenshot of the game after the reskin.
Sorry for my bad English...


texts: How to change FPS when using a sprite sheet and AnimationPlayer?

texts: With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer?


texts: Unity: How to apply bloom to only some objects in the scene?

texts:
In my game I want to apply bloom, from the standard assets, to only a few objects in the scene. To do that, I set up 2 cameras at the same position and orientation, one with the bloom component and the other without. Then I put the blooming objects on a "Bloom" layer, set the blooming camera to only render objects on this layer, and the main camera to render everything else.

Then I noticed that, if the main camera has a depth lower than the bloom camera, then the bloom camera will apply bloom to everything in the scene. I guess that's because the bloom effect works on everything rendered up to the point the script is executed.

So I made sure that the bloom camera has the lowest depth and clears with a solid color. Main camera does not clear. However, now I lose the illuminated pixels around the blooming objects. I guess they are overwritten by the main camera, since the blooming camera probably did not give them any depth.

Here's a simple scene to illustrate the problem:

Currently the game looks like this:

If I swap the configuration of the 2 cameras (Main camera: lower depth, clear with solid color; Bloom camera: higher depth, don't clear), the game looks like this (exaggerated for demonstration):

What I want is the yellow object to look like that in the last image, and the purple object to look like that in the second last image. How?

Because of company policies, I am limited to Unity 5.4.1f1, and cannot use anything not made by Unity in the Asset Store.


texts: Why does my rectangle move faster in one direction than in the opposite?

texts:
I am using Slick2d to create a top-down game, however an rectangle than I am drawing to the display is moving faster to the left than to the right, and faster up than down.

I am updating frames like so:

public void update(GameContainer gameContainer, int delta) throws SlickException {
    player = new Rectangle(playerX, playerY, 10, 20);

    if (gameContainer.getInput().isKeyDown(Input.KEY_LEFT)) {
        x -= delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_RIGHT)) {
        x += delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_UP)) {
        y -= delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_DOWN)) {
        y += delta * 0.1f;
    }
}

I then simply draw the rectangle to the display. It is noteworthy that the rectangle class is aorg.newdawn.slick.geom.Rectangle.

Why are the speeds for the movement different, and how can I fix this?

EDIT: I have fixed the problem by slowing the movement to the left and up, but this does not explain why the problem occurs


texts: 2D Infinite Runner: how to manage the generation of dynamic terrain?

texts:
I'm creating a infinite runner game with Unity3d, i've been using math to generate the terrain by calculating the size/pos of the terrain and place the new one next to it, and it's working correctly, but i think it's a overkill, so the question is, Is there a better way(performance) to generate terrain/floor in 2d scrolling infinite runners?

I also tried this method which consist of using empty gameobject, and when you hit them it create the terrain it was okay, but then problem started when i started using different terrain generation


texts:
I'm making a bunch of 2D games (now and in the near future) that use a 2D, RPG-like interface. I would like to be able to quickly paint tiles down and drop character sprites to create concept art.

Sure, I could do it in GIMP or Photoshop. But that would require manually adding each tile, layering on more tiles, cutting and pasting particular character sprites, etc. and I really don't need that level of granularity; I need a quick and fast way to churn out concept art.

Is there a tool that I can use for this? Perhaps some sort of 2D tile editor which lets me draw sprites and tiles given that I can provide the graphics files.


texts: Unity - Instantiated prefabs do not adapt to UI Layout

texts:
I have a small container, where I want listed a series of buttons. I try to fill them at Runtime like this:

using UnityEngine;

public class FillWithGearData : MonoBehaviour {
    public Transform SelectGearButton;
    public Transform GearPanel;

    void Awake() {
        Transform button = Instantiate(SelectGearButton, new Vector3(0, 0, 0), Quaternion.identity) as Transform;
        button.SetParent(GearPanel);

    }
}

But the buttons added at Runtime are not adapting to the Layout, even though the ones added before runtime seem to adapt without a problem.

Demo:

What is going on?


texts:
So I have a bullet script that fires a bullet straight in the Y direction that gets called as the bullet is instantiated. The plan is to always shoot in the same direction, straight in the Y, but to just rotate the bullet upon instantiation so that the straight is the right kind of straight if that makes sense? What i really want to know i think is how to work out the value for the 3rd property of the instantiate based on the key pressed before the fire, what makes it worse is that i dont even know how to create a rotation variable.

Instantiate(Resources.Load("P1Bullet"), transform.position, transform.rotation);

this is how i move my bullet in the bulletmove script

void Update () {
    Vector3 pos = transform.position;
    Vector3 vel = new Vector3(0, speed * Time.deltaTime, 0);
    pos = pos + transform.rotation * vel;
    transform.position = pos ;
}


texts: Is there a way to invert the scaling of the axis and keep the orthogonality?

texts:
Recently I ask question and since then been decide to find solution by dividing scale matrix to two part GlobalScale and ModelScale so full model transform looks like this now (left to right):
m4x4 Transform = Model->ModelScale * Model->Axis * Model->GlobalScal;

With this transform order I face with the same problem but maybe now it's more clear what problem is for someone
So I have unscaled cube, axis that I show bellow on this cube is axis that I want to get after inverting global scale or somehow mapping from that space.

I scale this cube on the global X axis and check the axis obtained after applying the inverse transform. The faded axis is what I need, the brighter one is what I get.

Is there a way to somehow map axis to unscaled space so they will save orthogonality?
Whant add thet:

Using inverse transpose result will be as on the second image.
Inverted axis not necessary should be line up with basic axis I mean (1, 0, 0) (0, 1, 0) (0, 0, 1)
Axis can go in very different direction, for example Z can be averaging of normals from selected model elemets, I take model face for siplicity of testing


texts: Can COLLADA be used for partial animations / animation blending?

texts:
I am making a game engine, using the COLLADA format for my models. Part of the requirement for my models is partial animations, for example if the model was a person, an animation could only affect the upper body and have no effect on the lower body.

I would guess this is accomplished by having a scalar value associated with each animation-bone pair that represents the weighting of the animation applied to the bone, but in the COLLADA documentation I didn't notice any such field. So is it possible to do this with COLLADA?

And as an ancillary question, is blender able to create and export such animations?

Basically, what all do I need to know to have this type of feature in my engine?


texts:
I have a script like this:

public class A: MonoBehaviour {
   public bool x = false;
}

... and a Custom Editor like this:

[CustomEditor(typeof(A))]
public class A_E: Editor
{
   public override void OnInspectorGUI()
   {
      A a= target as A;
      if (a== null || a.gameObject == null) return;
      a.x = !EditorGUILayout.Toggle("x", !a.x);
   }
}

When I enter play mode, the property resets.

I tried fixing it by adding:

if(GUI.changed) EditorUtility.SetDirty(a);

However this only fixed it for play mode.
If I save and close the scene, it resets to the default.
Also, the scene is not set to dirty, if I make changes to the component through the custom editor.


texts: How to clamp the rotation between two values in unity 3d

texts:
How can i clamp the rotation of cube between two values and then rotate between them gradually

Details Of what i Want
When I press A or D keys cube should Rotate On Y Axis  from 0 to 13 deg gradually and when key is released cube back to straight position


texts: How to Keep Unity From Changing Sprite When Changing Orthographic Size?

texts:
so I have a simple X animation, and at the end (when it looks like a full X), it looks good on one orthographic size, but bad on another. Here's what it looks like when the size is 3:

Now you can notice, there are a few pixels that look a bit off, but it still looks pretty good. Here's what it is supposed to look like:

So if you look closely, it is a bit different, and that's the point. However, if you change the orthographic size to.. say 5, you get this horrid thing:

Why is Unity doing this, and how can I fix this so that it looks how it's supposed to? Also, in this, my X is upscaled x2. Would it fix it just to have it made to the right size, and then upscaled x1 (e.g none)?


texts:
I also asked about this over on the UDK forums, but haven't had much luck getting any responses. Basically, I have some experience with UT3 modding, but I'm just getting started with the UDK, and I have a few questions about the degree of control over the rendering you have.

I gather that, despite the presence of several HLSL shader files in the UDK distribution (with the extension .usf), there is no means of implementing your own shaders outside of the material editor; is this correct? (I know about the Custom node in the material editor, but it's very limited, and unwieldy for all but the simplest logic.)

I understand that UE3 employs deferred rendering. I know you can access the color and depth at the current pixel in a post process. However, is there any way to access these or other G-buffer attributes in a more general way? (Normals, position, values at neighboring pixels...)

Are render targets supported in a general way? For the sake of argument, would it be possible to set up a camera to render depth from an alternate POV, then do shadow map-style depth comparisons while rendering the main view?

Is it possible to override all the materials on the client (en masse), such as those being used for the terrain or BSP geometry in the current level? (For implementing alternate vision modes and things of that nature.)

The tools that come with the UDK are of course very polished, and it's hard to beat free Scaleform and SpeedTree, but I'm starting to think the platform is a terrible fit for anyone who wants to go above and beyond drag-and-drop material editing in terms of graphics. I feel like I have much more control over the rendering in a Source engine mod, for example.


texts: Programming logic to 2D point and click adventure/puzzle?

texts:
I am totally new to game development. I want to create a 2D Puzzle/Adventure point and click game similar to like 'Rooms' but scenes are connected. I have already done the inventory system but currently lack the functionality to be used with an object in a scene.

My question is how do I approach creating a system that will take in dynamic number of events?  For example, I have key that will unlock the door, and the next scene I want to use it again without pre-programming this action specifically. I want to approach this in an efficient way so that I can use the system again for future games similar to this.

Can someone give me an idea because I am really stuck at this point. I don't want to program the game assigning individual scripts to each objects but rather do this systematically.

I am using Unity and C#


texts:
I'm thinking of picking up the book called "Killer Game Programming" by Andrew Davidson, but its pretty old, now. I know Java, and I've been messing with jMonkeyEngine for a few days, but I'm curious to see if I would benefit from the 3D chapters of this book.

The book was published was in 2005. Has Java changed to the point where this book would now be obsolete, assuming it was up to date at time of publication?


texts:
I am building a software system (game engine with networking support ) that is made up of (roughly) these layers:

Game Layer
Messaging Layer
Networking Layer

Game related data is passed to the messaging layer (this could be anything that is game specific), where they are to be converted to network specific messages (which are then serialized to byte arrays).

I'm looking for a way to be able to convert "game" data into "network" data, such that no strong coupling between these layers will exist.

As it looks now, the Messaging layer sits between both layers (game and network) and "knows" both of them (it contains Converter objects that know how to translate between data objects of both layers back and forth).

I am not sure this is the best solution.

Is there a good design for passing objects between layers? I'd like to learn more about the different options.


texts: Fast(er(est)) fullscreen/scene collision detection technique ("selection buffer")

texts:
My vertex format has a float4 Flags element used to pass miscellaneous data to shaders.
Each mouse-collidable object that is rendered has a unique ObjectID that is written to an ObjectID-rendertarget which can be CPU-sampled to index the hovered object. The remaining render targets are geometry/lighting data.

I've found this has advantages:

I set (Flags.x = ObjectID) upon object creation so the vertex buffer only needs an initial upload and updates only when new ObjectID's (that will be rendered) are created. Everything else is per-object/instance. Essentially, "no" overhead added by using a Flags component for ObjectID.
I'm semi-certain that, since I have to render everything anyway, outputting one additional color to one additional rendertarget is already cheaper than ANY clever bounding/container collision testing algorithm. Currently, I copy the entire ObjectID-rendertarget back to the CPU, but even that could be further optimized.
The depth buffer (that I'm using anyway) automatically ensures that the pixel I sample is the ObjectID of the top-most, visible, mouse-collidable, object. I don't have to check if the mouse position/ray is within the bounds of anything, intersects with anything, visibilities, nothing. All of that is already sorted out by rendering the scene properly.
Rendering the interface components first and reusing the ObjectID depth-buffer to render the world, reduces the fill-volume for the 3D scene; drastically, if a lot of interface is visible.

I've found only one disadvantage:

Since I render the interface first, if the camera has moved (the world hasn't been rendered yet), the WorldCoordinate available during Update() is incorrect. If the camera hasn't changed, the coordinate is correct. Immediately after rendering to the geometry buffers, but before any cursor-dependent shaders are invoked, I update the CPU-buffer and WorldCoordinate. The CPU-buffer is only updated when necessary and, at most, once per-frame. The "second sample" is during the following Update() and just re-reads the (wrong if the camera has moved) value from the byte array. Still, no significant overhead and this is basically just a slight annoyance because I'm just debugging the value anyway. Currently, when the WorldCoordinate is usefully-used (during render), it is correct.

Overall, I've got pixel-perfect, anything-on-the-screen, mouse-collision detection, with zero* additional overhead beyond standard rendering.
*Minimal and/or approximately-fixed, regardless of screen/scene complexity

Why is this method not popular and/or tutorialized?
-I assume most new-ish games post-process geometry buffers but I found nothing similar to this and just worked my way through the issues as they came up. To me, it appears as though I've got collision detection working for all of the objects/classes that I haven't even written yet. All of the "tech" involved here is obvious and easy, so I feel like I must be missing something; a future problem that I can't think of yet.

-Comments/critiques of the "algorithm" are welcome. Best answers would point out critical flaw(s) and, for bonus points, work-arounds.

-If this has been done before, is there an accepted best-practice? Links to similars would be ok.


texts: How would I go about adding a tooltip to a Unity UI Image?

texts:
I'm going to try out the community here once more, I haven't had very good look in the past with getting help.
I'm iterating through a series of List() and I'm creating a bar graph and a line graph based on those values, Later I'll replace the List with a file which it retrieves the values from. I'm having a problem though with creating a tooltip. I know how to add them to buttons created under OnGui() but that's about it. I've spent the past 2 days trying to figure this out and I'm just not sure how to go about making the bar images and dot's show up under public void OnPointerEnter(PointerEventData eventData) {} and OnPointerExit()
I know that print(eventData.pointerCurrentRaycast.ToString()); will display the item I'm hovering over and it seems to work fine for everything except the GameObjects that are created by my script:
        private GameObject CreateBar(Vector2 graphPos, float barWidth)
    {
        GameObject gameObject = new GameObject("bar", typeof(Image));
        gameObject.transform.SetParent(graphContainer, false);
        gameObject.GetComponent<Image>().color = barColor;
        RectTransform rectTransform = gameObject.GetComponent<RectTransform>();
        rectTransform.anchoredPosition = new Vector2(graphPos.x, 0f);
        rectTransform.sizeDelta = new Vector2(barWidth * barWidthMultiplier, graphPos.y);
        rectTransform.anchorMax = new Vector2(0, 0);
        rectTransform.anchorMin = new Vector2(0, 0);
        rectTransform.pivot = new Vector2(.5f, 0f);

        return gameObject;
    }

If anyone could give me a hand on how to make this show up under eventData I can figure the rest out from there. Or if you have a better method you wouldn't mind sharing I would appreciate that.


texts: Scene's network objects are disabled when building server separately

texts:
If one of the clients is also the server then this situation does not happen and networked scene objects are visible. But when building the server separately and then when a client is connected, all the network objects are disabled. I have read the documentation but still can't figure it out. I am loading the level scene additively. Here is the related documentation:

Scene-based Network Game Objects
You can also network game objects that are saved as part of your Scene (for example, environmental props). Networking game objects makes them behave slightly differently, because you need to have them spawn across the network.
When building your game, Unity disables all Scene-based game objects with Network Identity components. When a client connects to the server, the server sends spawn messages to tell the client which Scene game objects to enable and what their most up-to-date state information is. This ensures the client’s game does not contain game objects at incorrect locations when they start playing, or that Unity does not spawn and immediately destroy game objects on connection (for example, if an event removed the game object before that client connected). See Networked Scene Game Objects for more information.

From Network Identity

Network Visibility
Multiplayer games use the concept of network visibility to determine which players can see which game objects at any given time during game play. In a game that has a moving viewpoint and moving game objects, it’s common that players cannot see everything that is happening in the game at once.
If a particular player, at a certain point in time during game play, cannot see most of the other players, non-player characters, or other moving or interactive things in your game, there is usually no need for the server to send information about those things to the player’s client.
This can benefit your game in two ways:

It reduces the amount of data sent across the network between
players. This can help improve the responsiveness of your game, and
reduce bandwidth use. The bigger and more complex your multiplayer
game, the more important this issue is.
It also helps prevent some cheating. Since a player client does not
have information about things that can’t be seen, a hack on that
player’s computer cannot reveal the information.

The idea of “visibility” in the context of networking doesn’t necessarily relate to whether game objects are directly visible on-screen. Instead, it relates to whether data should or shouldn’t be sent about the game object in question to a particular client. Put simply, if a client can’t ‘see’ an game object, it does not need to be sent information about that game object across the network. Ideally you want to limit the amount of data you are sending across the network to only what is necessary, because sending large amounts of unnecessary data across the network can cause network performance problems.
However, it can be also be resource intensive or complex to determine accurately whether a game object truly visible to a given player, so it’s often a good idea to use a more simple calculation for the purposes of determining whether a player should be sent networked data about it - i.e. whether it is ‘Network Visible’. The balance you want to achieve when considering this is between the cost of the complexity of the calculation for determining the visibility, and the cost of sending more information than necessary over the network. A very simple way to calculate this is a distance (proximity) check, and Mirror provides a built-in component for this purpose.

From Network Visibility


texts: Concept of "scene" in Godot, misunderstanding

texts:
Could anyone clarify a beginner's question in Godot?

As in this 3D video tutorial (https://www.youtube.com/watch?v=-D-IcbsdT04), the guy creates one scene for the floor, another scene for the wall, and so on.

But from the concept I have of "scene," everything that appears at the same time should be part of just ONE scene.

Why this technique of creating multiple scenes for objects that will all appear together in one (and real) scene?


texts: Scaling background without scaling foreground in platformer?

texts:
I'm currently developing a platform game and I've run into a problem with scaling resolutions.

I want a different resolution of the game to still display the foreground unscaled (characters, tiles, etc) but I want the background to be scaled to fit into the window.

To explain this better, my viewport has 4 variables: (x, y, width, height) where x and y are the top left corner and width and height are the dimensions. These can be either 800x600, 1024x768 or 1280x960. When I design my levels, I design everything for the highest resolution (1280x960) and expect the game engine to scale it down if a user is running in a lower resolution.

I have tried the following to make it work but nothing I've come up with solves it so far:

scale = view->width/1280;
drawX = x * scale;
drawY = y * scale;

(this makes the translation too small for low resolution)

and

scale = view->width/1280;
bgWidth = background->width*scale;
bgHeight = background->height*scale;
drawX = x + background->width/2 - bgWidth/2;
drawY = y + background->height/2 - bgHeight/2;

(this makes the translation completely wrong at the edges of the map)

The thing is, no matter what resolution the game is run at, the map remains the same size, and the foreground is unscaled. (With a lower resolution you just see less of the foreground in the viewport)

I was wondering if anyone had any idea how to solve this problem?

Thank you in advance!


texts: What's a good way of implementing traits/promotions/buffs?

texts: I basically need something that modifies existing code without the need to go back and change it. So for instance, if I have a game where the player or NPS can eat food to gain health back, and eating a banana gives five health, how can I make a trait that will make the banana gives ten health instead of five without going back into the original code that makes the banana award five health? Thanks.


texts: How to prevent overlapping of gunshot sounds when using fast-firing weapons

texts:
So I am now trying to find sounds for my guns but when I grab a gun sound effect and play it in my game a lot of the sounds are either terrible sounding or have this horrible echoing effect because as a gun shoots sometimes the previous sound is playing still.

public void shoot(float x, float y, float direction){

    if(empty){
        PlayHUD.message = "No more bullets!";
        return;
    }

    if(reloading){
        return;
    }

    if(System.currentTimeMillis() - lastShot < fireRate){
        //AssetsLoader.lmgSound.stop();
        return;
    }

    float dx = (float) (-13 * Math.cos(direction) + 75 * Math.sin(direction));
    float dy = (float) (-14 * -Math.sin(direction) + 75 * Math.cos(direction));

    float dx1 = (float) (-13 * Math.cos(direction) + 75 * Math.sin(direction));
    float dy1 = (float) (-14 * -Math.sin(direction) + 75 * Math.cos(direction));

    PlayState.effects.add(new MuzzleFlashEffect(x + dx1, y + dy1, (float) Math.toDegrees(-direction)));

    PlayState.projectiles.add(new Bullet(this, x + dx, y + dy, (float) (direction + (Math.toRadians(MathUtils.random(-accuracy, accuracy))))));

    if(OptionState.soundOn){
        AssetsLoader.lmgSound.play(OptionState.volume);
    }

    bulletsInClip--;
    lastShot = System.currentTimeMillis();

}

Here is the code for where the sound plays. Every time this method is called the sound is called but it happens so often in this case that there is this terrible echoing. Any idea on how to fix this?


texts: Rendering Mode transparent is not applying in webgl build

texts:
I am using this method to convert opaque rendering mode to transparent.
item.color = new Color(1, 1, 1, value);
item.SetFloat("_Mode",3);
item.SetOverrideTag("RenderType", "Transparent");
item.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
item.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
item.SetInt("_ZWrite", 0);
item.DisableKeyword("_ALPHATEST_ON");
item.DisableKeyword("_ALPHABLEND_ON");
item.EnableKeyword("_ALPHAPREMULTIPLY_ON");
item.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;

This is working fine but not working in my webgl build.


texts:
I know Game Maker's surfaces exist in XNA (It's more the othe way around, XNA's surfaces exist in Game Maker), same thing for blend modes, since (I think) they both use DirectX.

This is the question: "Where can I find a good tutorial to replicate Game Maker's surfaces and blend modes in XNA?"

I'm using XNA 4.0 and Game Maker 8.1 Pro.

Background

I'm slowly moving from Game Maker to... Something else.

I've learned some good C++ but DirectX is hardcore and OpenGL needs some pretty good understanding of the language to be able to use it correctly.

XNA and C# together seemed like a good middle but the documentation is hard to understand for a newb like me.

In the end, I chose to focus on XNA.


texts: Recently, I was going to implement and options menu into my game, but I haven't been able to figure out how changing resolution, conceptually, would work.  Do I have multiple versions of the same texture at different resolutions, do I just change the area of which the texture would render, or some other option?


texts: How can I make a gate with two cubes that close/open nonstop?

texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gate : MonoBehaviour
{
    public GameObject[] gateParts;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < gateParts.Length; i++)
        {
            gateParts[i].transform.position = Vector3.MoveTowards(gateParts[i].transform.position, gateParts[i + 1].transform.position, Time.deltaTime * 3f);
        }
    }
}

I want to make both cubes to move each other when they collide or touch each other by distance then move them far from each other. close/open the gate nonstop.


texts: Vectorial clothes / hair cuts that adapt on any character size, how is it done?

texts:
Rimworld characters are simple but very nice to watch.
They have different sizes, hair cuts, clothes...
And everything seems to adapt to everyone. How does that work technically ?

For example, any vest will adapt to every characters sizes.
I highly doubt that the artists designed every vests for every body shape as it would be a tremendous amount of work.

I think they use vectors, and somehow get it to work. But how ?

See Veli & Baldwin or Tau & Kish below:

Or Flebe and maria below, they both wear a lightleather parka.


texts: Alternative ways to make a battle system in a mobile indie game more fun and engaging

texts:
I'm developing an indie game for mobile platforms, and part of the game involves a PvP battle system (where the target player is passive). My vision is simple: the active player can select a weapon/item, then attack/use, and display the calculated outcome. I have a concept for battle modifiers that affect stats to make it more interesting, but I'm not convinced this by itself will add enough of a fun factor.

I've received some inspiration from the game engine that powers Modern War/Kingdom Age/Crime City, but I want more control to make it more fun. In those games, you don't have the option to select weapons or use items, and the "battling" screen is simply 3D eye candy. Since this will be an indie game, I won't be spending $$$ on a team of professional 3D artists/animators, so my edge needs to be different.

What are some alternatives to expensive eye candy that you or others have used to make a non-3D PvP game more fun and engaging? Did the alternative concepts survive the release?


texts: In which directory to write game save files/data?

texts:
I need a definite list of directories, one or more per platform, of where to put game save files and other game generated data. Either based on the OS developer specification, or because it is common usage if there is no recommendation.

Please provide one answer per platform, with different directories. Also, example of how to get the directory location in C++ or C is best, as it's the language you'll have more hard time.

Locations:

Player's game data (saved games, config).
Shared game data (like high-score or config for all computer users).
Temporary game data (aka cache directory).


texts: libgdx - collision detection with tiled map java

texts:
currently, I am working on a 2d rpg game which is similar to final fantasy 1-4. I can load up a tiled map and the sprite can walk freely on the map. However, I will like to create a wall for it to stop walking through it.

I created three tiled layer Background, Collision, Overhead and one  Collision object layer with rectangles only.

"How do I handle collisions with the object layer in the tiled map?"

"Do I have to create every single rectangle that is in the object layer with Rectangle rectangle = new Rectangle() and rectangle.set(x, y, width, height)in the code?"

Thank you very much in advance. Any help is greatly appreciated!


texts:
I don't know how to copyright a video game idea.

I don't know if I should make a game document and get that copyrighted first or make the game then copyright it.

The main gist is.. I am lost.


texts: How do I implement deceleration for the player character?

texts:
Using delta time with addition and subtraction is easy.

player.speed += 100 * dt

However, multiplication and division complicate things a bit. For example, let's say I want the player to double his speed every second.

player.speed = player.speed * 2 * dt

I can't do this because it'll slow down the player (unless delta time is really high). Division is the same way, except it'll speed things way up.

How can I handle multiplication and division with delta time?

Edit: it looks like my question has confused everyone. I really just wanted to be able to implement deceleration without this horrible mass of code:

else
    if speed > 0 then
        speed = speed - 20 * dt
        if speed < 0 then
            speed = 0
        end
    end
    if speed < 0 then
        speed = speed + 20 * dt
        if speed > 0 then
            speed = 0
        end
    end
end

Because that's way bigger than it needs to be. So far a better solution seems to be:

speed = speed - speed * whatever_number * dt


texts:
I'm using this code in my script to move a gameobject:

void Update () {

    // Move the object forward along its z axis 1 unit/second.
    transform.position = new Vector2(transform.position.x , transform.position.y - 0.2f);

}

On screen the movement is a bit jaggy and not fluent.

Is there a different approach?

Hint: Please do not suggestion to use rigidbody functions since adding rigidbody would disrupt everything I did.

Can I use FxedUpdate?

Mirza


texts: Blender to UDK 3 How to smooth Static Mesh

texts:
I've created a bed cover model for my small game and here is how it looks like in blender:

http://imgur.com/T88Mnbs

but whenever I import it to UDK it looks like this:

http://imgur.com/OMXBno3

it looks smooth in Blender but when I import to the Udk it doesn't
Why is this happening? And
I use .fbx to export from blender...


texts: Why are most characters all the same height in games?

texts:
In the majority of video games I play, I notice that NPC's are the same height. What's up with that?

It kinda takes me out of the experience, when I see ten people in a row that are 5 foot 8. Anyone else notice this, or am I crazy?


texts: Initiated a animation in unity via use of an animator component

texts:
I've written a coroutine that starts an animation.

GameObject.FindWithTag(names[number]).GetComponent<Animator>().StartPlayback();

This is the line of code that I wrote to  start the animation. However, the animation does not start. I've even replaced the GameObject.FindWithTag(String) method with a reference to the actual object by declaring a GameObject in the script and setting it to a particular object in Unity's IDE. The animation still didn't start. Also, I must say the GameObject does have an animator component, you can see it in the inspector panel. No error messages can be seen in the console during play  mode. What can I do to get the animation to play when I want it to play.


texts: Help finding coordinate for left of screen in this frustum

texts:
I have a frustum with l=-2, r=2, n=0.5, f=10, corresponding to left, right, near, far respectively. I also define top and bottom too.

I've set the camera eye up at (0, 0, -2.5), looking directly at (0, 0, 0) with up (0, 1, 0).

Suppose I want to position an object centred at z=-1. I want to find the x coordinate so that under this frustum it appears exactly centred on the left edge of the screen.

I set up the following diagram to help me:

                       +z
                       |
            \          |          /
     -x<_____\_________|_________/______>x
              \____x___|-1      /
               \       |       /
                \      |      /
                 \_|l|_|     /
                  \    |    /     |near dist=n=0.5
                   \   |   /      |
                    \  |  /       |
                     \a| /        |
                      \|/         |
                       |-2.5
                       |
                       -z

So to find x I can use simple trig. Since tan a = |l|/n and tan a=x/1.5 then the formula for x is x=|l|/n*1.5=2/0.5*1.5=6, where |.| is the absolute value.

But when I use this x value to draw an object left of the centre, it does not appear centred at the edge of the screen. I can see the object but it's not on the edge. Moreover, if I increase n then the gap between the object and the left edge increases. What am I doing wrong?

UPDATE

Empirically I have discovered that if I compute x=|l|/n*2.5 then my object is correctly centred on the left edge of the device screen, and works for any n value I choose. Not sure why 2.5 works...

SOLUTION

Not really worthy of an answer, but I found in some legacy code that the renderer was set up to transalte the z forward by 1 unit, so this was undoing my -1 z value, hence why multiplying by 2.5 worked and not 1.5.

Despite this annoying fact, I'm now confident I fully understand how the frustum fits into OpenGL.


texts: Looking for a tournament system for the group of semi-anonymous players some of which may ignore specific matches. How can I do that?

texts:
I need to implement a tournament system for a one-time tournaments between a finite sets of anonymous players.

Single-elimination or a Groups-system tournament (for a bigger number of players) would have been enough, but there is a twist.

When the match is assigned, the participants are free to organize it in a place or time they agree on.

If the game was assigned to be played by two participants and it didn't happen in a predefined amount of time (say, a week), than we need to expire it and move on to the next round so as to not to delay the tournament overall.

But with our implementation of getting the match results (external API), we can't tell if one of the supposed players of this game ignored the challenge while another was looking for him to play the match. And if one did, which one of the two did it. So just writing the game off as a draw seems extremely unfair for the player who was looking to play the game, since in a non-anonymous tournament with the set dates of matches and attendance control, he would have been judged a winner due to opponent's absence.

So we are looking into round-robin systems giving points for matches (3 for win, 1 for draws, and so on), considering the possibility of giving a variable amount of points for the "expired" matches depending on their quantity.

Like, if you only missed one match, while your opponent for that match have missed three others, than chances are high that it was you who showed up, so you get 2 points while he gets 0. But even that approach seems questionable and open for abuse.

I am looking for the algorithm that will allow me to implement the tournament system like that without sacrificing too much fairness. Maybe it is a known solved problem so I won't need to invent a mathematical bicycle here?


texts: Get JSON property dynamically in Unity C#?

texts:
I'm saving game data into JSON, however basically I can't get property with just string just like in JavaScript.

This makes my code to write so many if/switch statements, looks very not clean, hard to read.

For instance, if I have this struct to save data as JSON:

public struct PlayerData {
    public int compensator;
    public int silencer;
    ...
}

I want to do something like this:

string attachmentName = "compensator";

if (PlayerData[attachmentName]) {
    weapon[attachmentName].gameObject.SetActive(true);
}

This part:

weapon[attachmentName].gameObject.SetActive(true);

Can do with Dictionary, but this part can't, because it's C# struct/class:

if (PlayerData[attachmentName]) {

Is there a way to access JSON data dynamically in this case?


texts: Structure game database to store player info and items

texts:
Recently I started developing my tiny html5 multiplayer game made in Node.js, Express.js, MongoDB(Mongoose), Socket.io and using Phaser.js.

I am quite new to these frameworks and especially new to database structuring/management.

My struggle comes when I think about how can I structure the database to store things as player username, password and general preferences (basic user info); and then things as player equipment such as items and currency.

I can figure out how to do the code part but what I do not know how to handle is the process I should follow.

I thought of the structure like so:

//Users Document
{
    "_id": "randId",
    "username": "ArthurConan",
    "password": "aquamarine12345",
    "credits": 20,
    "equipment": [
        {
            "name": "Sword of the Forsaken",
            "equiped": true,
            "slot": "weapon",
            "id": "itemId",
        },
        {
            "name": "Meteor Katana",
            "equiped": false,
            "id": "itemId"
        }
    ]
}

//Items Document
{
    "_id": "itemId",
    "name": "Sword of the Forsaken",
    "atk": 1400,
    "value": 500
},
{
    "_id": "itemId",
    "name": "Meteor Katana",
    "atk": 200,
    "value": 50
}

As I am using MongoDB the structure would be more or less similar to that.

With the code above then I would do the following:
 - Player Registers and his basic info(username, password, ...) is added to the database and he will also get one weapon to start with.
 - Player adventures into my world and gathers credits and equipment. Those items are stored in his inventory.
 - Player can equip/use/sell/destroy/upgrade some of those items. Upgraded items will have its stats upgraded based on preset stats.

As a side-note I would like you to know I am not the best at explaining myself, I hope you understand what I am trying to achieve. Also any suggestions are appreciated, have a good day :)


texts: Transformation by right vector using TransformPoint return an identical position

texts:
I think the following code should work. I'm trying to set the position of a GameObject where the pointer currently is, I mean, where the player is looking currently:

public void SetTransform (Transform callerTransform) {
   Debug.Log("original position: " + transform.position);
   Debug.Log("caller GameObject position: " + callerTransform.position);
   transform.position = callerTransform.TransformPoint(Vector3.right);
   Debug.Log("result position: " + transform.position);
}

Unfortunately it seems that TransformPoint is doing absolutely nothing as we can see on the logs. Vector3.right has been not change the position:

original position: (0.0, 1.2, 1.0)
caller GameObject position: (0.0, 1.0, 0.2)
result position: (0.0, 1.0, 0.2)

I also have tried the following code with the same result:

GetComponent<RectTransform>().position = callerTransform.TransformPoint(Vector3.right);

But it seems senseless for me (callerTransform is not a RectTransform, gameObject.transform is a canvas).


texts: Pong in assembly waiting for input instead of moving the ball

texts:
I am writing pong in assembly x86 with TASM and I have a problem.

The program is waiting to get input from the user to move the paddle (int 16h ah=0h) and while it is waiting the ball and the other paddle doesn't move.

What should I do?


texts: How to simulate car drivetrain (in Unity)?

texts:
One of my hobby projects involves cars. Up until now I had a quick and dirty "one class" implementation of engine+gearbox+wheels, but I thought that this is ugly, and I want to go a bit more realistic. Sadly I couldn't find much on Google (either wrong search terms or there really isn't anything that is what I want). It seems like

Setup in scene: Four wheelcolliders attached to a big boxcollider.

Things that I want in the system:

Separate classes for engine, clutch, gearbox, differential and wheels (and whatever else does stuff with torque). Throttlecontrol with revlimiter (works!), steering (works too!), brakes (not yet made, but also not very complex and will likely work).

First thing I tried:

Mainly this rotates around how I tell the engine that the wheels are actually using or giving (engine braking) power to the system. so first I created all the classes each with their own updatemethod (not called directly by mainloop, but from a fixedupdate of a controllerclass). updatemethod of engine calculates engine torque from throttle, torque curve (animation curve) and engine friction. This is then used to speed up the virtual crankshaft which has its own inertia. But before speeding up the shaft, I decided to put some feedback torques on the engine torque, so if the wheels can't keep up, the engine can't speed up, or even slows down. Such a feedback torque is added for example by the gearbox, which in turn also has feedback forces from the differential and with that the wheels. The wheels calculate the torque needed to spin up to the speed of the shaft coming out of the gearbox and then it propagates all back to the engine over a few updates.

Problem was, the torque feedback didn't really do engine braking, but catapulted it to several million RPM in a split second. Dividing the feedback torque by 1000 did work, but then the car didn't move at all. So this is fail number 1.

Fail number 2:

Okay screw this, I thought, and tidied up all the stuff. This doesn't use several updatemethod anymore, but recursive updating. Basically I call update on the engine, which in turn then calculates what torque it has available. With that it tells the transmission that it has t torques at r RPMs. The gearbox changes the values according to the current gear and then again puts the values into the differential. The differential SHOULD split the torque between its outputs. To do this I calculate how much torque the output (in this case wheels) would need to speed up to r RPMs. I do this for each output and make a list of it for each output. I also save the sum of these values. With this I can get a value of 0...1 for each output, that determines how much torque each output gets in its updatemethod. Its basically an intelligent differential that gives the output which needs more torque, more torque. I guess modeling a real differential would involve some more complex stuff. Now the torque is at the wheels and gets put into the motorTorque property of the wheelcollider. Up until here it works. If I throttle up and then let go of it the wheels start turning backwards. It's basically another feedbackloop just like with the first try. So also fail

And fail 3:

Instead of returning the torque that's left, I tried backpropagating the RPMs to the engine instead. So I apply torque, and get RPMs back. But again everything tries to move the car in the opposite direction that I want it to go.

Here is where I'm out of ideas. I want a relatively realistic drivetrain, that is modular and can do enginebraking. A bought asset will most probably not solve my problem, and I also want to understand how it works, and not just use it.

Does anybody have experience with how to properly model a drivetrain?

If I forgot to mention something, please ask.


texts: How do I import a Spine animation project into DragonBones when DB cannot read the atlas file?

texts:
I found 2 interesting Spine projects that I would like to import into DragonBones, but their texture atlas is in .atlas format, which cannot be read by DragonBones.  I don't know how to convert .atlas files to .json files that DragonBones understands.

How should I proceed?


texts: How does a game's frame rate change for each missed vsync?

texts:
I seem to remember reading somewhere that a game's frame rate is halved each time it misses a vsync. In other words, the number of frames per second decreases to 1/2, 1/4, and 1/8 the normal rate for the first, second, and third missed vysnc cycles (respectively) rather than to 1/2, 1/3, and 1/4 the normal rate.

Is this correct? If so, why?


texts: Allow player to restart animation after it plays fully

texts:
I have this code that plays an animation when the player touches the screen. The animation lasts 3 seconds.
public class canCDanim : MonoBehaviour
{
    public Animator anim;
    private void Start()
    {
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        Touch touch = Input.GetTouch(0);
        if (touch.phase == TouchPhase.Began)
        {
            anim.Play("CanReload");
        }
    }
}

The trouble is that if the player touches the screen again, the animation will not play again.
How can I make it so that I can restart the animation, but only after it's finished playing?


texts: Move gameobject from fixed position to pointposition following curve Unity2d

texts: I want to move the object from the fixed position to the mouse position according to the curve as shown in the illustration. The altitude is the same and the horizontal distance is equal.


texts: How to get the loudness of the real world environment using the device's microphone in Unity?

texts:
I am trying to create a game where the character's movement is dependent on the loudness of the real world environment. So if the person playing the game screams or do something loud the character will move accordingly.

What I need is a function returning the loudness of the real world environment and use it in the Update() to control the character.

Is there such a function or if not how can I make one?


texts: Game synchronisation in peer-to-peer online multiplayer game

texts:
I am developing an online real-time multiplayer game using Google Play Game Service and Cocos2D-X. The game has two players where each player control their own ball.

The each player sends their own ball’s velocity and position to the other connected device. In my game, all the physics calculations are done locally on each devices i.e. ball velocities after physical calculations are calculated locally on each devices.

Issue:

When fast moving ball collides wth the opponent’s ball, there is no change in the movement velocity of the opponent’s ball. (According to real world physics, the fast moving ball should be able to push the opponent’s slowly moving ball.)

Reason:

During my code analysis, I understood that the velocity calculated by the local physics engine are overwritten by the data received from the opponent’s device.

For e.g.

Solution I tried:

To fix the problem, whenever the collision between balls occurs I am creating one of the device as server and other device as client. All the physics calculations occurs on the server device and data is send to the client device.

I have following questions:

Is the solution tried by me is optimal solution to fix the issue?
What other approaches can be tried to fix such type of issue?

I would appreciate any suggestions/thoughts on this topic. Thank you.


texts: Play video from StreamingAssets folder in Windows Media Player?(Unity 3D)

texts:
I can play video which is there in my StreamingAssets folder. But is there a way in which I click a button and the same video gets played in the Windows Media Player. I researched a lot on this but could not find any solution.

This is the code for playing video normally,

   using UnityEngine;
using System.Collections;

public class VideoDemo : MonoBehaviour
{

public string filePath;
public string result;

void Start() {
    filePath = System.IO.Path.Combine (Application.streamingAssetsPath, "Demo.mp4");
    result = "";

}

void OnGUI() {
if(GUI.Button(new Rect(10,10,100,30),"Click Me"))
    {
        StartCoroutine(Example());
    }
}

IEnumerator Example ()
{
    if (filePath.Contains ("://")) {
        WWW www = new WWW (filePath);
        yield return www;
        result = www.text;

    } else
    {
        result = System.IO.File.ReadAllText (filePath);

    }
}

  }

Kindly share some ideas.


texts: Usage of math.Atan2 in a 3D coordinate system with Unity

texts:
I have a simple question on usage of math.Atan2 function with Unity in a 3D environment.

I found this code on Unity's documentation for Math.Atan2. I changed it a bit to fit my
needs.

Vector3 waypoint = Random.insideUnitSphere + new Vector3(Random.Range(minX+1.5f, maxX-1.5f),prevPosY,Random.Range(minZ + 1.5f,maxZ - 1.5f));  //waypoints are generated based on random unit sphere + ( bounds of the plane they are on )
Vector3 relative = transform.InverseTransformPoint (waypoint);
float angle = Mathf.Atan2 (relative.x, relative.z) * Mathf.Rad2Deg;

I know how it works in a normal 2D coordinate system, however when switching to a 3D coordinate system, if I would want to move my character on the x-z plane, then how does this actually work mathematically?

I am assuming that it would be the angle between z and x axis?
so in a mathematical equation would it be, angle = Atan2(z/x) or Atan2(x/z)? Would both of them work?


texts:
I have a weird issue that when I try to draw a Stage with only an Actor, a Label to be more precise, added to it and nothing seems to be getting drawn.

This is how my setup goes:

I have a Sprite (player) being drawn and in another class, which is the HUD, that I draw in a separate SpriteBatch, now in the same class I am trying to draw the Stage, I have ensured that the Stage is outside of the HUD's SpriteBatch.begin()/.end() calls and that the Stage is being drawn after, which should be "above" the HUD.
I have also set the position, of the Actor, to be in the middle of the Stage

I just can't seem to get this to work.

This is my code for the Player class:

public void update(SpriteBatch spriteBatch, float delta){
    // *** REMOVED FOR CLARITY ***
    spriteBatch.setProjectionMatrix(camera.combined);
    camera.update();
    hud.render(delta);
}

And this is my code for the HUD class

public void render(float delta){
    spriteBatch.begin();
    spriteBatch.draw(hudBackgroundTexture, position.x, position.y, size.x, size.y);
    // *** REMOVED FOR CLARITY ***
    spriteBatch.end();
    labelLives.setPosition(size.x/2, size.y/2);
    hudStage.act();
    hudStage.draw();
}

I'm not receiving any errors, and I know I have initialised my Stage and Label.

Thanks in advance =]]


texts:
Hy,
I want to build some geometry with a geometryshader in Unity.
I took a look at this. I want to create my geometry just in context of one point in 3D space (x,y,z). Can i somehow use the transform position vector as input value for the shader? Or is there Something like a one vertex mesh I could use? I tried this in Blender, but coulnd't import that single Vertex mesh into Unity.
Thanks for your help!


texts:
I want to box select a section of my screen and then zoom in that selection. So I have four corner points (my rectangle which I can drag with the mouse) in pixel coordinates. I have a perspective projection.

How can I create the camera view that has these four corner points as the corner points for the view? I guess that I have to calculate maybe a view frustum for my section?


texts: Recommended 3D camera settings and model sizes for an FPS

texts:
I'm making a simple FPS and I can't decide on the size of my models and my camera settings. Could someone please recommend a good combination of:

camera field of view
near and far planes
model proportions (such as 1 unit = 1 meter)

so that the game looks realistic enough and the numbers are easy to work with?

EDIT: I know I can use whatever dimensions I want, but I'd like to know what is most commonly found in games.


texts: Drawing order of 2D tiles with 3D bounding volume

texts:
I'm wondering which algorithm was used to draw the sprites of the video game Commandos in the correct order. Each sprite has a 3D bounding volume (either a polygon or a cylinder), this is how the developers stored the information:

POLY "NONAME",73,987,0,54,7,1   ;Name,CenterX,CenterY,CenterZ,Height,#Vertices,#Tiles
POINT        0,-37              ;Coord. X, Coord. Y
POINT        36,-18
POINT        36,-1
POINT        28,28
POINT        -21,37
POINT        -36,1
POINT        -36,-9
TILE          37, 581,  74,  83,   0,   0, 0,"ROC10010.RLE","   "   ;PosX,PosY,Width,Height

POLY "NONAME",70,816,0,120,4,1
POINT        0,-8
POINT        8,6
POINT        0,10
POINT        -8,-3
TILE          48, 434,  50,  98,   0,  41, 0,"POST0001.RLE","   "

POLY "NONAME",1557,4094,0,44,0,1
RADIO       17
TILE        1539,2588,  37,  55,   7,   0, 0,"DEPT0000.RLE","   "

POLYRAMPA "NONAME",626,952,0,48,40,4,1  ;Name,CenterX,CenterY,CenterZ,Height,HeightOff,#Vertices,#Tiles
POINT       43,-8
POINT       2,29
POINT        -36,-7
POINT       1,-45
TILE         590, 515,  85, 111,   0,   0, 0,"CASA0003.RLE","   "

The last object named 'POLYRAMPA' is used for stairs and ramps.
Edit: All bounding volumes are convex and don't overlap each other.

And here are some in-game screenshots:

The first three screenshots show the same map. Of course it's possible to fake the drawing order of this 'flat' map by sorting the sprites by their y-value.

But this approach won't work if the map is more complex, like the one at the bottom right.

So my question is: Which algorithm did the developers use?
Bonus question: Is there some source code available? (pseudocode or any object-oriented programming language would be great)

Edit: Sorting by the XYZ-coordinates of the bounding boxes center point doesn't work.For example:

The objects on the left side have the same center points as the objects on the right. The cylinder on the left should be in the background but the one on the right in the foreground.


texts: Proper way to wrap sprite for Z dimension

texts:
I am using SFML, but I need to add some emulation of 3D by wrapping the sprite with a Z component. When sprites are drawed (or when objects moved?), their X and Y will change depending on Z.

My question is, which component should hold the sprite, and the wrapped x, y, z coords?

Supossing I have objects that inherit from Sprite, GameObject and Collider (and I am not yet sure about this or if I rather should have used compositio), I could have:

A wrapper for Sprite, which could be Sprite3D. Sprite would be the holder of the coords used also for game logic and collision detection. In this case, how do I give access to base class/component(?) Collider of Sprite?
Collider (inherited or composed?), holding x, y, z. In this case, how Collider would have access to Sprite in order to update it, by having a pointer to parent object/casted base class/Sprite? Or should the Sprite3D have a pointer to the collider and update its own x,y only when drawing?
Wrapper for Both Collider and Sprite. I will need to do this with more drawable types, so this would force me to make other base class Graphic for Sprite. (Yes?)

Colliders are drawables?

Make each entity have their own x, y, z, and update their sprites and hitboxes


texts: (Pygame) Sprite disappearing on collision

texts: I am making a game, and when the player runs into a certain block it changes the size of a circle on the top. The problem is, whenever the player runs into the block it disappears. How can I fix this?


texts: I recently started exploring the wonderfull world of audio in unity. I noticed that you can add a bunch of effect modules to a mixer. Now I'm wondering if you can add your own custom effects( for example export a plugin from a audio program or something) and add them to the list. I cant seem to find anything related to the question.


texts: OpenGL FBOs and rendering scene in layers

texts:
I have three different layers in which my scene is organized, meaning I can place different entities in different layers. The layers are rendered in order, let's call them LAYER_1, LAYER_2, and LAYER_3.

Each layer is rendered to a separate FBO that has a color attachment (texture) and a depth attachment (an RBO for now, didn't need to sample it in the shader just yet). Each layer can have different post-processing effects applied to it or none at all.

Just for clarity, maybe let me describe a simple use case for that setup: I want to render UI elements on top of the scene. I don't want any post-processing to occur on the UI layer, only the scene (for example, bloom).

Now what I want to do is to get the output of the three layers and draw them to a single quad. Getting the output is the easy part - it's basically those three color attachments that I can sample in the fragment shader. But how do I actually combine the results?

Thanks!


texts: How does Raycasting work in XNA Farseer and player collision?

texts:
Wanting to know how to figure out if player's bottom is colliding with object so that I could allow the player to jump. I was trying to use OnCollision but was referred to ray-casting, I looked through the Testbed of Farseer to try and understand ray-casting better but am still lost.

I know what each return for the method does but how would I use it for player collision?

In this answer the person uses this function to find out if player is in the air. Is this the best way to find out if player is colliding with the ground?

In the testbed there is a fixture called f, two vectors call p and n, and a float called fr. What do these four things do?

Example:

case RayCastMode.Closest:
    bool hitClosest = false;
    World.RayCast((f, p, n, fr) =>
    {
        Body body = f.Body;
        if (body.UserData != null)
        {
              int index = (int)body.UserData;
              if (index == 0)
              {
                  // filter
                  return -1.0f;
              }
        }

        hitClosest = true;
        point = p;
        normal = n;
        return fr;
    }, point1, point2);

    if (hitClosest)
    {
         DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
                    DebugView.DrawPoint(point, .5f, new Color(0.4f, 0.9f, 0.4f));

                    DebugView.DrawSegment(point1, point, new Color(0.8f, 0.8f, 0.8f));

                    Vector2 head = point + 0.5f * normal;
    DebugView.DrawSegment(point, head, new Color(0.9f, 0.9f, 0.4f));
    DebugView.EndCustomDraw();
    }
    else
    {
        DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
        DebugView.DrawSegment(point1, point2, new Color(0.8f, 0.8f, 0.8f));
        DebugView.EndCustomDraw();
    }

break;

Also Were is World.RayCast Coming from?

Note

If some one has a better way of detecting collision I would love to hear it.

EDIT: 3/7/14

I found that World.RayCast is located in the testbed in the Farseer Physics XNA project, Collision Folder, Collision.cs. The RayCastInput and Output are located on lines 200, and the bool on 444.

So if there located in the engine then I should be able to call on the function when I make my own project with it.

I make a class called Ray.

I then add the following code:

using System;
using System.Collections.Generic;
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Common;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using FarseerPhysics.Collision;

namespace FarseerPhysics.TestBed.Tests
{
    public class Ray
    {
        private float angle;

        public override void Update(GameTime gameTime)
        {
            const float l = 11.0f;
            Vector2 point1 = new Vector2(0.0f, 10.0f);
            Vector2 d = new Vector2(l * (float)Math.Cos(angle), l * (float)Math.Sin(angle));
            Vector2 point2 = point1 + d;

            Vector2 point = Vector2.Zero, normal = Vector2.Zero;

            World.RayCast((f, p, n, fr) =>
            {
                Body body = f.Body;
                if (body.UserData != null)
                {
                    int index = (int)body.UserData;
                    if (index == 0)
                    {
                        return -1.0f;
                    }
                }
                point = p;
                normal = n;
                return fr;
            }, point1, point2);
        }
    }
}

I create this little thing but World.RayCast has an error:

An object reference is required for the non-static field, method, or property 'FarseerPhysics.Dynamics.World.RayCast(System.Func<FarseerPhysics.Dynamics.Fixture,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Vector2,float,float>, Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2)'

What have I done wrong?


texts: How to implement app indexing plugin, by using Prime31 UnityPlayerActivity?

texts:
I am implementing the App indexing plugin, using Prime 31 UnityPlayerActivity which is implemented by overriding Androinds onCreate, onStop methods etc, but when I use this keyword in onCreate method it is showing me an error.

private GoogleApiClient mClient;
private String mUrl;
private String mTitle;
private String mDescription;

@Override
protected void onCreate(Bundle savedInstanceState)
{
    Log.d("onCreate","in oncreate method");
    super.onCreate(savedInstanceState);
    mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();

at Builder(this) it is showing syntax error ..

Currently I am developing an App indexing Auto complete feature in to my game, for that I created a demo Unity project created the plugin for app indexing, and while creating the plugin I extended my class with UnityPlayerActivity which is came from il2cpp's classes.jar, but in our game we used Prime 31 plugins, prime31 documentation says that,

  "Any other third party (non prime[31]) plugins that do override the main Unity Activity will not work in the same game. In order to facilate compatibility for all Unity plugins we developed an Activity sharing system that is freely available for anyone (including other plugin vendors) to use."

so I included prime31UnityActivity.jar in libs directory of Android but I am not able to find instance of the extended class, I am getting a syntax error at keyword this.

public static void onCreate(Bundle savedInstanceState)
{

    Log.d("onCreate","in oncreate method");

    //super.onCreate(savedInstanceState);

    mClient = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}


texts: Architecture for html5 multiplayer game?

texts:
Hello I want to write a HTML5 multiplayer game in which there are rooms with two players answering a series of questions with 3 possible answers, 10sec/question, which are being downloaded from a server. It will have some ratings and so on.

I want to make it as scalable as possible.
I wonder what technologies to use to accomplish that. HTML5, CSS3 and JavaScript obviously. But what about the server-side? I have been researching and found that Socket.IO + Node.js + mongoDB would do the job but after doing some more research it maybe not.

Can you suggest me some kind of architecture for doing this game? Free technologies, if possible. Or what to read and from where to start in order to understand how to do it.

Thanx in advance!

P.S. I have an experience with HTML5, CSS3, JavaScript, C#, ASP.NET MVC and relational db's.


texts: Does level streaming in games load directly from the HDD?

texts: I wondered if the level streaming loads directly from the HDD. My first thought was if that would not be to slow, or if the chunks are just loaded into RAM and asynchronously processed if appropriate or something I didn't thought of yet.


texts:
I am working on a personal project of developing a simple 3D strategy game. I am working on my own game engine (let's assume that I have to have my own) and I have one theoretical question. How to develop a suitable coordinate system, which would be scalable and provide the best versability?

I am deciding between a X,Y coordinate system (different units cover different space - simply rectangle shaped) and a hexagonal system (bigger units take more hexagons).

I am working here with a simple concept of three different units of three different sizes for every player (maybe even buildings) and collision detection with conflict resolution. Thanks.


texts: Does Unity animation event send a message to every object which owns it?

texts:
I made game objects A, B. And each has animator, and it has the same animation. And they are inherited class of Base class.

I trigger animation on A object, and the animation has callback and invoke it when the animation ends. The callback sets bool value true.

My expectation was, the callback will only change bool value in A. But bool value in B was changed. Is this natural?

public class BaseClass
{
    public bool triggered;
}

public class A : BaseClass
{
    public void OnAnimEnd()
    {
        triggered = true;
    }
}

public class B : BaseClass
{
    public void OnAnimEnd()
    {
        triggered = true;
    }
}


texts: Unity transform.rotation not giving real value

texts:
i confused , when the object is at 0 rotation ( not rotated yet )  , it giving real value ( 0 ) , but when the object is rotated 180 degree , transform.rotation is giving false value ( 1 ) , this is the screenshot :

If the picture is not clear enough , go here https://i.stack.imgur.com/miWIE.png .

Then this is my script that debugged the code and rotate the object :

void RotateFlip() {
    GameObject databasegameobject = GameObject.Find ("database");
    database databasechange = databasegameobject.GetComponent<database>();
    Debug.Log ("current object rotation is " + theiconarrow.transform.rotation.z + " degree ");
    if (databasechange.pengertianmenustate == 2) {
        if (theiconarrow.transform.rotation.z == 0 ) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }

    }

    if (databasechange.pengertianmenustate == 1) {
        if (theiconarrow.transform.rotation.z == 180) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }
    }
}

I don't understand why this thing happened , is this a kind of bug or what ?

I am sorry if this already asked somewhere , but i just don't know how to find it at search engine ( neither here ) .

Extra question ( optional ) : is there any application to build app with easy coding and not an game engine ?


texts:
I am beginner in unity .
and now i am trying to write my first game.
the game is includes appear random coins in random place on the screen , after passing a certain amount of time.(one coin will be appear and then after for example 2 seconds it will be destroyed and the other coins will be appear in another place ).
there is a  counter  which calculate the  number of click on coins which appear in scene and counting number  of clicks on screen The coin is a prefab .Now i need to count the number of coins that will be disappear after certain amount of time.
can someone help me how i can write the code.


texts: How can I resolve component types in a way that supports adding new types relatively easily?

texts:
I am trying to build an Entity Component System for an interactive application developed using C++ and OpenGL. My question is quite simple. In my GameObject class I have a collection of Components. I can add and retrieve components.

class GameObject: public Object
{
public:
    GameObject(std::string objectName);
    ~GameObject(void);
    Component * AddComponent(std::string name);
    Component * AddComponent(Component componentType);
    Component * GetComponent (std::string TypeName);
    Component * GetComponent (<Component Type Here>);
private:
    std::map<std::string,Component*> m_components;

};

I will have a collection of components that inherit from the base Components class. So if I have a meshRenderer component and would like to do the following

GameObject * warship  = new GameObject("myLovelyWarship");
MeshRenderer * meshRenderer =  warship->AddComponent(MeshRenderer);

or possibly

MeshRenderer * meshRenderer =  warship->AddComponent("MeshRenderer");

I  could be make a Component Factory like this:

 class ComponentFactory
 {
 public:
     static Component * CreateComponent(const std::string &compTyp)
     {
         if(compTyp == "MeshRenderer")
             return new MeshRenderer;
         if(compTyp == "Collider")
             return new Collider;
         return NULL;
     }
 };

However, I feel like I should not have to keep updating the Component Factory every time I want to create a new custom Component but it is an option. Is there a more proper way to add and retrieve these components? Is standard templates another solution?


texts: Image-Space coherence of the z-buffer algorithm

texts:
I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that

  traditional Z buffering makes reasonably good use of image-space coherence in the course of scan conversion.

I don't see how the z-buffer algorithm that I know makes use of image-space coherence at all. In the paper, they state that

  implementations usually do a set-up computation for each polygon and then an
  incremental update for each pixel in the polygon.

How exactly is this "set-up computation" and "incremental update" defined?


texts:
I want to develop a simple multi-Activity Android game using Marmalade SDK.
I looked at the SDK samples and found that most of them are a single view (Android Activity) apps.

The Navigation model in Android is a stack-like model where views are pushed and popped.

I can't find whether Marmalade has a similar model or it uses a different approach.

would you please explain this to me and provide tutorials and samples to navigation in Marmalade if possible ?

Thanks


texts:
I need to import model in OpenGL via Fbx SdK, and for testing purposes I created a simple box centered in the (0, 0, 0), length 3, in 3ds max. Here's the image:

But when i exported it, and imported in the OpenGL it wasn't in the center. Then I exported it in ASCII format, and opened the file in Notepad, and really Z coordinates were 0, and 3.
When I converted model to editable mesh and checked every vertex in 3ds max it had expected (+-1.5, +-1.5, +-1.5) coordinates. Can anyone help me with this one? I'm really stuck. I tried to change whole bunch of parameters in 3ds max export, but every time it changes Z koordinate.


texts: Godot 3, multiplying by delta not making the object to move

texts:
I have a simple code which makes a sprite rotate and move,

extends Sprite

var vel = Vector2(1,1)

func _ready():
    print(position)
    pass

func _process(delta):
    rotation += PI * delta
    position = position + vel * delta
    pass

But in the line

position = position + vel * delta

when I multiply by delta, the sprite doesn't move, when I remove the delta, the sprite moves, why is that? I saw this tutorial and it seems to work fine.


texts: Chartboost Adds are not showing up in android

texts:
I am testing chartboost example but no adds are being shown up. I have added app ID and signature. and Even test mode is enabled still its not showing up.

I am using chartboost SDK Provided by chartboost, also I am getting this warning

CHARTBOOST: You are using a Chartboost example App ID or App Signature! Go to the Chartboost dashboard and replace these with an App ID & App Signature from your account!

Though I have added correct ID and Singnature.

Note: Adds are showing up if I build for iOS. I have added app in dashboard for both iOS and android.