texts: Authenticate player on backend server with google login

texts:
I would like to create a mobile game which communicates with my own backend server.

For authentication I want to use google Sign-in(https://developers.google.com/identity/sign-in/android/backend-auth), so users don't need to create an account.

My backendserver uses a TCP connection to communicate with the client and I don't want to send the google login auth code unencrypted over the network. I read alot about SSL encryption, but I'm not sure if it is the thing I need and if this is sufficient.

Another question I would like to ask is do I need to encrypt all packets my client is sending to the server. Because when I just do authentication over an encrypted connection, potential hackers could simply perform a man-in-the-middle attack to access the account of a player after they logged in.

So what would be the best way to send this token to the server, is SSL sufficient for this and do I need to encrypt the whole traffic my game creates?


texts:
I'm making a multiplayer game, where players are separated in to rooms that would ideally have about 20 players.

So I need a few pointers on an algorithm to distribute the players in to these rooms.

A few more constraints:

When a players gets in to a room, he should stay there until he decides to exit (the room itself changes levels)
There may be more room servers, every server should create more rooms until near full capacity
There's a central server that manages all the room servers, and directs the players towards their room

EDIT

Because the question is too specific to my game and it is very likely that I will never mention all the details necessary (because they are hidden in my brain until someone asks) I'm considering deleting this question.

I'm not deleting it any longer because I've received an interesting answer.

Although for now I'm implementing a trivial solution, and I will improve it later if needed.


texts:
I tried a lot of things to fix texture bleeding, but nothing works. I don't want to add a transparent border around my textures, because I already got too many and it would take too much time and I can't do it with code because I'm loading textures with slick. My textures are seperate textures and they seem to wrap on the other side (texture bleeding).

Here are the textures that are "bleeding":

The head, body, arm and leg are seperate textures.

Here's the code I'm using to draw a texture:

public static void drawTextureN(Texture texture, Vector2f position, Vector2f translation, Vector2f origin,Vector2f scale,float rotation, Color color, FlipState flipState)
    {
        texture.setTextureFilter(GL11.GL_NEAREST);

        color.bind();
        texture.bind();

        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);

        GL11.glTranslatef((int)position.x, (int)position.y, 0);
        GL11.glTranslatef(-(int)translation.x, -(int)translation.y, 0);
        GL11.glRotated(rotation, 0f, 0f, 1f);

        GL11.glScalef(scale.x, scale.y, 1);

        GL11.glTranslatef(-(int)origin.x, -(int)origin.y, 0);

        float pixelCorrection = 0f;

        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0,0);
        GL11.glVertex2f(0,0);
        GL11.glTexCoord2f(1,0);
        GL11.glVertex2f(texture.getTextureWidth(),0);
        GL11.glTexCoord2f(1,1);
        GL11.glVertex2f(texture.getTextureWidth(),texture.getTextureHeight());
        GL11.glTexCoord2f(0,1);
        GL11.glVertex2f(0,texture.getTextureHeight());

        GL11.glEnd();

        GL11.glLoadIdentity();
    }

I tried a half pixel correction but it didn't make any sense because GL12.GL_CLAMP_TO_EDGE. I set pixelCorrection to 0, but it still wont work.


texts: How to display sprites on a 2D canvas, using Unity 5 and C#

texts:
I want to show a mini-map on the screen, but I don't have any idea to how to paint something in a panel on a canvas by code. The mini-map would look like this prototype I made some time ago, in Visual Studio.

I've tried instantiating a prefab image, but couldn't get it to work. I have two problems.

Firstly, I have 25 Image objects created in the scene, and 25 in the PlayerController script, but I can't get it to change the sprite. I am currently declaring them as follows:

public Image minimap0, minimap1, minimap2, minimap3, minimap4, minimap5,
        minimap6, minimap7, minimap8, minimap9, minimap10, minimap11,
        minimap12, minimap13, minimap14, minimap15, minimap16, minimap17,
        minimap18, minimap19, minimap20, minimap21, minimap22, minimap23,
        minimap24;

Lastly, I don't know how to change all 25 object sprites with a for loop, similar to the code that follows:

public void DrawMiniMap() {
    // mapXCord = miniMapPanel.transform.position.y;
    // mapXCord = 0;
    // mapYCord = 0;

    mapY = playerYPost - 2;
    int contadorArray = 0;
    Vector2 position = new Vector2 (mapXcord, mapYCord);

    for(int i = 0; i < 5; i++) {
        mapX = playerXPos - 2;
        string actualMiniMap = "minimap" + contadorArray;

        // mapXCord = miniMapPanel.transform.position.x;

        for(int j = 0; j < 5; j++) {
            position = new Vector2 (mapXCord, mapYCord);

            if (MapCreator.mapa [mapX, mapY] == 0) {
            } else if (MapCreator.mapa [mapX, mapY] == 1) {
            } else if (mapX == playerXPos && mapY == playerYPos) {
                if (playerOrientation == 'n') {
                } else if (playerOrientation == 'e') {
                } else if (playerOrientation == 's') {
                } else if (playerOrientation == 'w') {
                }
            }
            // mapXCord += 15;
            contadorArray += 1;
        }
        // mapYCord += 15;
    }
}

The map is stored in an array for checking positions.


texts:
If I set the directx feature level to D3D_FEATURE_LEVEL_9_3 but I have a graphics card which supports D3D_FEATURE_LEVEL_11_0 does that prevent directx11 features from working even though my graphics card supports them?

I want to ensure that my game works on 9.3 level hardware but don't have such a card to test it on. If I accidentally use higher features in my code, will setting the feature level lower when creating the device prevent those features from working even though my physical graphics card supports them?


texts: What is the purpose of adding non-gameplay elements to a game?

texts:
As an example, I'll reference scientists in Jetpack Joyride.

I do understand there are achievements that involve scientists, that you can kill them or you have a nerd repellent, but I am not asking about any of those.

I want to understand whether there is any very important reason to have such an element in a game, since (at least initially) it seems quite insignificant.

More precisely, does the presence of scientists (or any equivalent, apparently insignificant "actor" in a game) has any psychological effect or influence of any kind to the players? Or they are simply there as a small little feature of the game that barely makes any difference to the player's feelings & attitude whilst playing the game?


texts: How to discourage micromanagement in strategy games?

texts: When designing a strategy game (or one in a similar genre), how do you avoid having your players focus almost entirely on micromanagement? What should be done and what avoided in gameplay mechanics?


texts: How can I use Cinema 4D models in Android and iOS games?

texts:
How can I convert Cinema 4D animation or models to use in games for Android and iOS SDK?What kind of format is required for developing games for these platforms?
If I make a dancing character, do I need to make separate animation for all the steps and moves?


texts: Is there any way to automaticaly rig a sprite?

texts: I'm making an AR test where the player takes a photo, them i get the bones from the pose and set a t-shirt sprite's bones position to match the ones from the photo. I was wondering if there's any way to make the sprite rigging process, with just the main bones like LRshoulder,LRelbow and LRHip, automatic in Unity.


texts: MMORPG Server architecture: How to handle player input (messages/packets) while the server has to update many other things at the same time?

texts:
This is more or less like what I'm thinking up to now:

while(true)
{
    if (hasMessage)
    {
        handleTheMessage();
    }
}

But while I'm receiving the player's input, I also have objects that need to be updated or, of course, monsters walking (which need to have their locations updated on the game client everytime), among other things.

What should I do? Make a thread to handle things that can't be stopped no matter what? Code an "else" in the infinity loop where I update the other things when I don't have player's input to handle?
Or even: should I only update the things that at least one player can see?
These are just suggestions... I'm really confused about it.
If there's a book that covers these things, I'd like to know.

It's not that important, but I'm using the Lidgren lib, C# and XNA to code both server and client.


texts: Coding style about collisions with geometry

texts:
Let's say I'm writing 3D Pacman.  I have "Dot" objects throughout my maze, that are structured as follows in the Inspector:

Dot (GameObject)
- Sphere w/Collider

When I run into the sphere trigger, I can trivially say:

"Get me your parent and check if it's a Dot"

However, I hate baking in the knowledge that some spheres have parents that are Dot objects.  If the trigger were on the Dot itself that problem would solve itself, as I could just call GetComponent().

What's a good programmatic style approach to finding out what logical Game Object actually owns the geometry you've collided with?  I could add a Tag of "Dot" to the sphere but that's just a level of confirmation, I still would have to walk up to it's parent and check.


texts: Unity - Odd distortion on default material cube

texts:
Does anyone know what causes this strange effect that looks like ripples? This is simply the default material on a cube and should be perfectly smooth. (Clear example at top right of image)

Another example:


texts:
I am using the following code which works, But the first time i press escape nothing happens, if i press it again then the game object shows. Does anyone know why this is?

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

public class PauseScript : MonoBehaviour
{
    public GameObject PauseMenu;
    bool Paused = false;

    // Start is called before the first frame update
    void Start()
    {
        PauseMenu.gameObject.SetActive(false);

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("escape"))
        {
            if (Paused == true)
            {
                Time.timeScale = 1.0f;
                PauseMenu.gameObject.SetActive(true);
                Paused = false;
            }
            else
            {
                Time.timeScale = 0.0f;
                PauseMenu.gameObject.SetActive(false);
                Paused = true;
            }
        }
    }
}


texts: Which parts of game should belong to engine and which should belong to scripts?

texts:
Often, a game is split into engine code (i.e. C++) and scripts (i.e. Lua).

Which parts / modules of game code should typically belong to engine, and which should belong typically to script-domain code?

For example: AI for characters is typically put in scripts. What about GUI, sound, asset / resource management, levels / maps, quests etc?


texts: Efficient way to check collision with potentially hundreds of objects

texts:
I am trying to make a top down shooter that could potentially have hundreds of objects at once at one point. I need to check collision with projectiles, walls, and enemies. I am currently using ArrayLists which probably won't suffice later on and was wondering if someone had a good method or knows a good method for checking all of those objects at once. This is going to be a game for smartphones and is built in java. Any ideas would be great or if you could point me in some direction that would be fantastic.

Thanks in advance!


texts: Method for interpolation between 3+ quaternions?

texts:
I'm currently using spherical linear interpolation (slerp) to interpolate between two quaterions with a weighted value. But, I'm having a difficult time coming up with a method to interpolate between 3, 4, 5, etc quaternions with normalized weights.

I.E. I want a final quaterion which is 60% of QuaterionA, 30% of QuaterionB and 10% of QuaterionC.

Thanks,
Cameron


texts:
I am trying to create a virtual 3D chat room based on character interaction (just like in Sims2), so I have added a collider on the "user's in-game character". The problem is that when I enable the box collider, the character movement looks like it's freaking out (the character is seen as if it is moving fast from left to right & the movement is not smooth).

When I remove the box collider, the player moves smooth and no other fake-movement can be seen. What is the problem??

Thank you


texts: Using Tile Maps with cocos2d - how do I handle a large amount of images?

texts:
I am building a game where the users (players) can build their own town. There they can build houses, add furniture to the houses etc etc. Basically similar to The Sims.

I am using the Tiled Map Editor to create a basis for each town. There I define the following layers

ground
floor
walls and furniture (basically everything)

All these layers are initially empty. It is up to the user to fill them.

I am using cocos2d v2 and its CCTMXTiledMap to render this tile map in my project.

One thing that I realised is that the layers defined in the map, CCTMXLayers, only support images from one tileset (#).

This has led to the following questions that I need to have answered before digging in to some serious game development.

Question 1. This game would be no fun if all my houses had the same walls. I really need numerous different kind of walls in the "walls and furniture" - tileset. How big can a tileset be? Note that I need to store not only different wall-textures here but also textures representing the furniture due to (#).

Question 2. The way you change the tiles in a CCTMXTiledMap is (as far as I know..?) using the setGID method for that particular layer. Going back to the example with different walls. Lets say the player can choose among different walls from a scrolling HUD-Layer menu. When a player selects a certain wall - how do I know which GID that particular wall has (during runtime)?

P.S I am very new to both cocos2d and Tiled so if I have taken the wrong approach here, please tell me what approach I should take in a game like this. I've been looking into Kobold Touch as well - perhaps that better suits my needs?


texts:
I need to keep the client updated on data that's rarely changed (like health) or when an event occurs (like when a player is attacked and should have "-10 hp" above him). Those 2 specific part should be interdependent btw.

I need a way to instantly send this data to clients (or just without big lag), without resending it too many times and I need to be sure the clients received it.

I cannot just send a request to the client when something happens, because I'll just be sending a lot of tiny messages to a lot of clients and that's bad for performance.

I was thinking of accumulating packets of data (per client) and sending them no more often than 5 times a second and then if the client doesn't say he got a package just resend it. This way if nothing happens there is no overhead and if a lot of events are going on I'm sending them in bigger packets.

Is my solution good?
Is there a better, more popular way of dealing with this?


texts: Is there a fundamental technical reason for Flash being a more popular game platform than JavaScript?

texts:
Both Javascript and AS3 are implementations of ECMAScript.

Is there a fundamental technical reason for Flash being so much more prevalent as a game-publishing platform, when compared to Javascript?


texts:
I have a scene.  Sometimes I draw untextured, coloured, semi-transparent triangles, sometimes I texture them, and I draw a lot of both in a fairly interleaved manner.

In a fixed function pipeline the difference would be if I had set the GL_TEXTURE_2D to be 0 or a texture handle.  My codebase is being migrated from FFP to OpenGLES 2, so these bindings to 0 already exist everywhere they are needed.  My ambition is for my generic OpenGL code to run on both OpenGL 1.x and OpenGLES 2.  So I'm looking for shaders that are a cut-down FFP imitation.

How can an OpenGLES 2 shader know if the Sampler2D is set to 0 or has a valid texture?

My reasoning is that an if-statement that all fragments take the same branch is much cheaper than switching program pretty much every other statement as I alternate between textured ops and fixed-colour ops.

If I add a uniform then I have to go visit my code and each time I bind a texture I'll have to add a call to set the uniform flag.  I have a large codebase that I have to ensure I am strictly setting it appropriately.

If I introduce a opaque white 1x1 texture this is like the uniform - I have to go everywhere in the code base ensuring I am binding it instead of binding to 0 to get colour-only primatives.

So I'd much prefer an approach where the sampler is interrogated in a shader.  Is this possible?


texts: Why does ForceMode.VelocityChange work but not Rigidbody.velocity = ... in script?

texts:
I have a FPS movement script that I created that has a jump function that looks like this
public void Jump()
{
    if (jumpAble && grounded)
    {
        jumpAble = false;
        gameObject.GetComponent<Rigidbody>().velocity = (Vector3.up * jumpForce * Time.deltaTime);
    }
}

For some reason, this does not make the player jump. However, replacing the .velocity =... to
gameObject.GetComponent<Rigidbody>().AddForce(Vector3.up * jumpForce * Time.deltaTime, ForceMode.VelocityChange);

makes the player jump. Why is this? I'm under the impression that the two are essentially the same thing, but is there a slight difference?
Also, not sure if it affects the function, but this is the whole script
public class Player_Movement : MonoBehaviour

{
public Transform camera;
public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
public bool grounded;

public GameObject joystick;
public bool isWalking = false;
public bool isRunning = false;
public float walkForce = 12f;
public float runForce = 30f;

public float jumpForce;
public bool jumpAble = true;

public GameObject playerRotationHandler;
public float cameraTouchSensitivity;

public Animator animator;

// Update is called once per frame
void Update()
{
    grounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if (grounded)
    {
        jumpAble = true;
    }

    Vector3 direction = joystick.GetComponent<Joystick>().inputDirection.x * transform.right + joystick.GetComponent<Joystick>().inputDirection.y * transform.forward;

    if (isRunning)
    {
        gameObject.GetComponent<Rigidbody>().velocity = (direction * runForce * Time.deltaTime);
    }

    else if (isWalking)
    {
        gameObject.GetComponent<Rigidbody>().velocity = (direction * walkForce * Time.deltaTime);
    }

    else
    {
        gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
    }
}

public void Jump()
{
    if (jumpAble && grounded)
    {
        jumpAble = false;
        gameObject.GetComponent<Rigidbody>().velocity = (Vector3.up * jumpForce * Time.deltaTime);
        gameObject.GetComponent<Rigidbody>().AddForce (Vector3.up * jumpForce * Time.deltaTime, ForceMode.VelocityChange);
    }
}

public void Rotate(float xMoveValue, float yMoveValue)
{
    float xRotation = Mathf.Atan2(yMoveValue, cameraTouchSensitivity) * Mathf.Rad2Deg;
    float yRotation = Mathf.Atan2(xMoveValue, cameraTouchSensitivity) * Mathf.Rad2Deg;

    playerRotationHandler.transform.Rotate(xRotation, 0, 0);
    transform.Rotate(0, yRotation, 0, Space.World);

    if (playerRotationHandler.transform.localEulerAngles.x < 300 && playerRotationHandler.transform.localEulerAngles.x > 60)
    {
        if (xRotation < 0)
        {
            playerRotationHandler.transform.localEulerAngles = new Vector3(300, playerRotationHandler.transform.localEulerAngles.y, 0);
        }

        if (xRotation > 0)
        {
            playerRotationHandler.transform.localEulerAngles = new Vector3(60, playerRotationHandler.transform.localEulerAngles.y, 0);
        }
    }
}

}


texts: Finding out what pixel on the screen the fragment falls on

texts:
In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen.

Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so that it knows what pixel on the scren it will fall on. That way I can do per pixel lighting.

Currently I only get the UV coord relative to the texture, not the screen.

Thanks

Using ps 2.0


texts:
I created an engine which draws 2D planes in the Stage3D API in Actionscript 3. And my question is, how do I turn all anti-aliasing off, because when I scale it all the pixels get really blurry, and I'm trying to use pixel-art for this.

This is the code I use:

protected function setupShaders() {
        var vertexShaderAssembler:AGALMiniAssembler = new AGALMiniAssembler();
        vertexShaderAssembler.assemble( Context3DProgramType.VERTEX,
                "dp4 op.x, va0, vc0 \n"+
                "dp4 op.y, va0, vc1 \n"+
                "mov op.z, vc2.z    \n"+
                "mov op.w, vc3.w    \n"+
                "mov v0, va1.xy     \n"+
                "mov v0.z, va0.z    \n");

        var fragmentShaderAssembler:AGALMiniAssembler = new AGALMiniAssembler();
        fragmentShaderAssembler.assemble( Context3DProgramType.FRAGMENT,
                "tex ft0, v0, fs0 <2d,clamp,linear, nomip>\n"+
                "mov oc, ft0 \n");

        shader = context3D.createProgram();
        shader.upload(vertexShaderAssembler.agalcode, fragmentShaderAssembler.agalcode);
    }

public function draw() {

        context3D.setProgram(shader);
        context3D.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA);
        context3D.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, parent.modelViewMatrix, true);
        context3D.setTextureAt(0, sprites.texture);

        if (updateVBOs) {
            vertexBuffer = context3D.createVertexBuffer(vertices.length / 3,3);
            indexBuffer = context3D.createIndexBuffer(indices.length);
            uvBuffer = context3D.createVertexBuffer(UVs.length >> 1, 2);
            indexBuffer.uploadFromVector(indices, 0, indices.length);
            uvBuffer.uploadFromVector(UVs, 0, UVs.length >>1);
            updateVBOs = false;
        }

        vertexBuffer.uploadFromVector(vertices, 0, vertices.length / 3);
        context3D.setVertexBufferAt(0, vertexBuffer, 0, Context3DVertexBufferFormat.FLOAT_3);
        context3D.setVertexBufferAt(1, uvBuffer, 0,  Context3DVertexBufferFormat.FLOAT_2);

        context3D.drawTriangles(indexBuffer, 0, nChildren << 1);
    }

public function configureBackBuffer(width:uint, height:uint) {
        context3D.configureBackBuffer( width, height, 0, false);
    }


texts: How can I port an XNA game to iOS and Android?

texts:
I made a little Windows Phone game with XNA and Farseer Physics engine and I want to port that game to iOS and Android.
Is Monogame the only software that I can use or are there alternatives?

I don't want to change my entire code. It should be easy to port the game.

Is it possible to use Unity to port the game or is it better and easier to use other software?


texts: Physics Body editor loader collision detect

texts:
In my game I use the Physics Body Editor to add custom shapes to my bodies. In my show() method I use the follownig code to create my Jetski Body:

BodyDef jetskiDef = new BodyDef();
    jetskiDef.position.set(new Vector2(2, WATER_HEIGHT));
    jetskiDef.type = BodyDef.BodyType.DynamicBody;

    jetskiFixture = new FixtureDef();
    jetskiFixture.density = 0.25f;
    jetskiFixture.friction = 0.5f;
    jetskiFixture.restitution = 0.5f;
    jetskiFixture.isSensor = false;

    jetski = world.createBody(jetskiDef);
    jetski.setUserData(jetskiTexture);

Using bodyEditorLoader.attachFixture(jetski, "jetski", jetskiFixture, 1, JETSKI_BOX_WIDTH, JETSKI_BOX_HEIGHT); I add the custom shape to the fixture.

I try to render the jetskiTexture in my render() method like this:

for (Body body : worldBodies) {
        if (body.getUserData() instanceof Sprite) {
            Sprite sprite = (Sprite) body.getUserData();

            Vector2 position = body.getPosition();

            sprite.setPosition(position.x, position.y);
            sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
        }

In my beginContact() method I check if one of the fixtures is the fixture from a dynamic body and if the other one is a sensor, in order to add them to my BuoyancyController for the buoyancy effect.

public void beginContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    if (fixtureA.isSensor()
            && fixtureB.getBody().getType() == BodyDef.BodyType.DynamicBody) {
        buoyancyController.addFixture(fixtureB);
    } else if (fixtureB.isSensor()
            && fixtureA.getBody().getType() == BodyDef.BodyType.DynamicBody) {
        buoyancyController.addFixture(fixtureA);
    }
    }

If I now start my game I can see the custom shape but there is no jetskiTexture and it also doesnt float, like it is supposed to.
I tried changing the beginContact() method but it didn't work either.

public void beginContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();
    String userDataA = contact.getFixtureA().getUserData().toString();
    String userDataB = contact.getFixtureB().getUserData().toString();

    if (fixtureA.isSensor()
            && userDataB == jetskiTexture) {
        buoyancyController.addFixture(fixtureB);
    } else if (fixtureB.isSensor()
            && userDataA == jetskiTexture) {
        buoyancyController.addFixture(fixtureA);
    }
    }


texts: What would be a suitable way to model projectiles in an action game?

texts:
I'm designing a 2d fighting game in which characters can shoot out some projectiles like arrows, ninja knives, Hadouken (like the one in Street Fighter), etc...

My current character design is actually in a component based manner, however, I've no idea about how to model these projectiles. I've thought about treating each single projectile as a single object, but I'm afraid that there will be performance problem as long as I keep creating these projectiles in the game.

I've read this question also, but it seems that it's to quite suitable to my situation

Bullets and projectiles in component based entity systems

Any comments would be appreciated! :)


texts:
I'm looking into building my own simple RTS game, and I'm trying to get my head around the movement of single, and multi selected units. (Developing in Unity)

After much research, I now know that its a bigger task than I thought. So I need to break it down. I already have an A* navigation system with static obstacles taken into account.

I don't want to worry about dynamic local avoidance right now. So I guess my first break down question would be:

How would I go about moving mutli units to the same location. Right now - my units move to the location, but because they're all told to go to the same location, they start to 'fight' over one another to get there.

I think theres two paths to go down:

1) Give each individual unit a separate destination point that is close to the 'master' destination point - and get the units to move to that.

2) Group my selected units in a flock formation, and move that entire flock group towards the destination point.

Question about each path:

1a) How can I go about finding a suitable destination point that is close to the master destination? What happens if there isn't a suitable destination point?

1b) Would this be more CPU heavy? As it has to compute a path for each unit? (40 unit count).

2a) Is this a good idea? Not giving the units themselves a destination, but instead the flock (which holds the units within). The units within the flock could then maintain a formation (local avoidance) - though, again local avoidance is not an issue at this current time.

2b) Not sure what results I would get if I have a flock of 5 units, or a flock of 40 units, as the radius would be greater - which might mess up my A* navigation system. In other words: A flock of 2 units will be able to move down an alleyway, but a flock of 40 wont. But my nav system won't take that into account.


texts:
I have a fire particle system in my game. I want to over the game when player collides/triggers with that particle system. As I've researched for this on google, I came to know that I can use World Particle Collision component for that. By sending Collision message on colliding, collision can be detected. I've put following snippet in player's script to detect particle collision.

void OnParticleCollision(GameObject TargetedParticle)
{
    Debug.Log ("Collided with particle");
}

Am I doing this in a right way? Because This code is not enable to detect collision. Help me please.


texts: Shader graph in Oculus (Screen position)

texts:
I have created a blur shader graph to blur a material. It works perfectly fine in the scene mode and also in windows application. However it does not work as expected in Oculus VR. That is, the texture in the material shakes/moves with the camera. I am aware that the problem would be with screen position node with tiling and offset since the Oculus works differently. Has anyone faced this issue and found a solution?
EDIT: It is related to rendering issue. Oculus Quest has multi-pass rendering so the left eye works fine but the right eye has issues. Any solution?


texts: How to detect collision on specific part of the sprite node

texts:
I have a spike and a ball is falling down, when the ball touches the top point of the spike, I want to make the ball invisible, and when it touches on the other part i.e on the sides I don't want to make it invisible.

I have two sprite nodes - Ball and spike.

How can I make the collision detect only on specific part i.e only on top of the spike in spritekit?


texts: How do I make sure everyone sees the same distance across different resolutions?

texts:
Hello game dev community. I have recently got into making games in a browser window, and me and a friend ran into a common problem. Let's say I have a game like diep.io, where users can control their tank and move across a large grid. Each player can only see a certain distance, even if they moved the window to a larger monitor, like from 1080p to a 4K monitor.

I've created a game in HTML5 canvas, but the problem is that it depends on the browser's window.innerWidth and innerHeight properties. I can tell that this is an issue, because if I drew a grid, one player on a 1080p monitor could only see x distance but a player on a 4K monitor with a larger width and height could see x * 2 distance (or how much larger it actually is), meaning that the player on a 4K monitor has an advantage, by seeing players in a larger distance.

How exactly could I tackle this problem? My friend has the same issue, and I hope this answers it.


texts: What are the hot dev positions in game industry?

texts:
What are the hot postions which are hard to get in game industry?
Client/Server/Game Engine/Networking and database or else?


texts:
I have an object in 3D space with a certain height (y) component that I wish to remain constant.

The object is a rigidbody, kinematic, affected by gravity and a trigger. So I tried this method following a similar StackOverflow answer:

public class ZigZagSun : MonoBehaviour
{
private Vector3 pos1 = new Vector3(0f, 1.1f, 0);
public float speed = 1.0f;
public float amplitude = 8.0f;
float t = 0f;
//resets position of the ZigZagSun
void Awake()
{
    transform.position = pos1;
}
// moves object from pos1 to pos 2
void Update()
{
    pos1.x = amplitude * Mathf.Cos(t);
    pos1.y += speed * Time.deltaTime;
    t += Time.deltaTime;
}
}

However instead of moving my Object remains still in space at (0,1,0)
I am wondering what exactly it is that I have done wrong? is it to do with the object being static?


texts:
I'm trying to create a infinite racing game. I have a RoadSystem game object that instantiates a slab of road. On awake about 8 slabs are created. I'm trying to create a system where once the car passes the second or the third slab, the first slab is destroyed and then a new one is added at the end. I'm unable to get the index of the slabs. This is the code I have attached to a trigger which is just an empty gameobject with a box collider attached:
public class AddRemoveRoadSlab : MonoBehaviour {

  Public Road road

  private void OnTriggerExit(Collider other)
   {
      if (other.gameObject.tag == "RoadSlab"){
      Debug.Log(road.GetComponent<Transform>().GetSiblingIndex());
   }
}

What the debug.log statement is printing is the index of the Road gameobject in the Hierarchy that includes the camera, direction light etc. I want to get the index of the children of the Road gameobject.
Can someone please help?

EDIT
Here is a screenshot of how the Road and slab are configured. The road script generates the slabs. The slabs are just unity plane objects.


texts: Visual effect with dark overlay gradient surrounding the center of the screen

texts:
How is it called, what is it used for, and what is the most common way to implement it?

I know these are three question in one, but since the first and second are just one-liners I decided to make them into one.

The following images are two screenshots showing the visual effect; (A) show the zones that are darker and (B) the normal zones


texts: How do you make lights affect 2D sprites in a 3D environment using Unity's URP render pipeline?

texts:
I'm using Unity, URP and have 2d sprites characters in a 3D environment. I want 2D sprites to be affected by lights/shadows like the rest of the environment.

-I know if I use a 2D renderer I can use 2D lights but then I lose the projected shadows from both 3D objects and 2D Sprites.
-If I use the standard render pipeline i can make it work but I don't want to miss on all the tools that URP brings to the table.

In summary, is it possible to use 2D lights or any light that affects 2D sprites in URP ?

Thanks!


texts:
So am am making a unity program, where if you click 2 different objects, 2 different windows are supposed to pop up.

To make them, I use private

private bool showPopUp = false;
private Rect rectangle = new Rect(int, int, int, int);

Both have a collider so that I can use OnMouseDown() to set showPopUp to true.

the onGUI class simply says

void OnGUI()
    {
        if (showPopUp)
        {
            rectangle = GUILayout.Window(0, rectangle, ShowGUI, "Prescription");
        }
    }

and my showGui looks like this

void ShowGUI(int windowID)
    {
      //some GUILayout things like textboxes and stuff are in here too

        GUILayout.BeginVertical();
            if (GUILayout.Button ("Okay"))//(GUI.Button(new Rect((Screen.width/4)-30, (float)(Screen.height/1.2)-30,60, 25), "OK"))
            {
                showPopUp = false;
            }
        GUILayout.EndVertical();

        GUI.DragWindow();
    }
}

These are two totally different classes, and on two completely different objects. However, if I have one of the popup windows open., and the to open the second, the first one goes blank, the second doesn't even show up, and I get this error:

  ArgumentException: GUILayout: Mismatched LayoutGroup.Repaint
  UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle
  style, UnityEngine.GUILayoutOption[] options, System.Type LayoutType)
  (at
  C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/GUILayoutUtility.cs:210)
  UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIContent content,
  UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at
  C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/GUILayout.cs:235)

What do I need to change to allow me to open 2 windows at once?


texts: Movement on the X an Z axis are combined?

texts:
This is probably a stupid question, but I'm trying to simply move a 3D object up, down, left, and right (Not forward or backward).

The Y axis works fine, but when I increment the object's X position, the object moves BOTH right and backwards! when I decrement X, left and forwards!

setPosition(getPosition().X + 2/*times deltatime*/, getPosition().Y, getPosition().Z);

I was astonished that XNA doesnt have its own setPosition function, so I made a parent class for all objects with a setPosition and Draw function. Setposition simply edits a variable "mPosition" and passes it to the common draw function:

    // Copy any parent transforms.
    Matrix[] transforms = new Matrix[block.Bones.Count];
    block.CopyAbsoluteBoneTransformsTo(transforms);

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in block.Meshes)
    {
        // This is where the mesh orientation is set, as well
        // as our camera and projection.
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index] *
                Matrix.CreateRotationY(MathHelper.ToRadians(mOrientation.Y))
                * Matrix.CreateTranslation(mPosition);
            effect.View = game1.getView();
            effect.Projection = game1.getProjection();
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }

I tried to work it out by attempting to increment and decrement the Z axis, but nothing happens?! So using the X axis changes the objects x and z axis', but changing the Z does nothing. Great.
So how do I seperate the X and Z axis movement?


texts: How do you create an outdoor map without letting in leaks?

texts: With the Source engine, I want to make a map in the outdoors (similar to something like Dust2 or Inferno) but not let in leaks due to the open top part of the map. Is there a way I can do it without the leaks?


texts:
I'm developing a game in Java for Android, using LibGDX.
I'm using Nexus 5 to test my game most of the time and it works great (Minimum FPS it gets is 57 out of 60).

Recently I ran my game in Galaxy S2 and found out the FPS gets to 45-55 most of the time.
I started checking what causes it using PerformanceCounter and I couldn't find the reasons that cause this slowness.

Later on I decided I'll disable everything in the game's render() and check one by one what could create this problem. I managed to get to a very minimal code in the render() and still the FPS can get to low values.

This is my render() in it's minimal form:

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, Rules.System.HEIGHT_TARGET_RESOLUTION - 100);
    batch.end();

I didn't give much attention to the create() because it only happens once in the beginning so I guess it's not supposed to affect.

I downloaded other games from the Play Store to my Galaxy S2 and they seem to work fine, no noticeable lags (So the device is not that bad).

BTW, I also tested my game in Galaxy S3 and it worked better but still had some lags (not as much as in the S2).

Am I missing something? Maybe you have some tips for me on this? I checked every where for documentation about performance in LibGDX but there aren't much.

Thanks!


texts: Organize different layers of repeating texture

texts:
I'm using Blender for creating assets for a 3D video game (FPS). Particularly i have to create a long wooden fence and i'd like to use one 700*700 texture for the entire fence so different part of fence would just have different UV coordinates. This scenario looks ok to me so far.

Meanwhile i'd like to bake Ambient Occlusion, and different panels must have different AO, so i need another UV Map here.

I don't know much about influence of multiple UV maps on performance (if there's such influence at all or that's very engine dependant). Could you please advice me what option to choose (or at least any pros and cons):

Use two different UV maps: one for colour/spec/normal and one for AO (and maybe shadows). I heard this approach is bad because different UV layers slow down pipeline.
Bake colour/spec/normal on the same UV map that AO uses. This way leads to a great redundancy, but i will have one UV map.


texts: How do you calculate if 2 lines are facing toward or away?

texts:
Given the 4 points describing 2 line segments, how do you calculate if line A is towards or away from line B?

The 2 lines have a fixed length, and can be measured as distance from x1/y1 to x2/y2.


texts: Is there any performance difference between using multiple textures and using texture atlas in splatmapping? I would want to use multiple ones beacouse tiling and changing them would be easier but performance is more important.


texts: Unity question on OnTriggerStay() function

texts:
I'm currently working on a soccer game.I have a script for the ball that whenever the ball collides as trigger with the goal line,the ball will return to the middle point.But seems like the ball doesn't Lerp() back,afterward I tried to check if Unity counts it as collide or not with Debug.Log("Goal"); but nothing is logged to the console.Please help me with that.Here is the first code:

public var smooth : float;

private var newPosition : Vector3;

function Awake ()
{
    newPosition = transform.position;
}

function OnTriggerStay (ball : Collider)
{
    var positionA : Vector3 = new Vector3(0, 0.3, 0);

    newPosition = positionA;

    transform.position = Vector3.Lerp(transform.position, newPosition, smooth * Time.deltaTime);
}

Here is the second code (after changing to Debug.Log()):

function OnTriggerStay (ball : Collider)
{
    Debug.Log("Goal");
}


texts: Standard unit value for 3d game character height?

texts:
Basically I'm building a first person shooter game using DirectX9. And now, I'm working on the modeling side. But before I start modeling, I have to make sure that I create all the models with accurate size. So it doesn't look too big or too small in the game. But I'm having problem deciding the characters height value including the main character and the NPC characters. I think it would be easy to measure other models/houses/walls/doors size if I have the characters height. Otherwise, I will messed up everything.

I assume that all the characters are 1.8 meter in height, including the main one. Though not sure that how to represent that value in DirectX vector ( DirectX unit == ? ) but If I set the camera height that value, it looks too low from the ground ( in my eyes ). Now what is the next value? Should I switch to fit? Which would very big value like 6. Or is there any standard value for that case which I don't know?

I hope you guys have understand my situation. Actually I'm very new to this kind of stuffs. So hopping to get some help or suggestion which would be great for me.


texts: Unity - resizing particles dont mantain collisions properly

texts:
I am trying to make particles for blood on death. This is what I got so far:

Which looks fine and all. But now I also wanted to make the blood particles turn smaller over their lifetime, so I checked "Size over lifetime" and this is what happens now:

See the problem? As they shrink, they seem to float a little, giving some space between the floor they are laying on. This behaviour is not really desired.

How could I solve this?


texts: LWJGL: Camera distance from image plane?

texts:
Let me paste some code before I ask the question...

public static void createWindow(int[] args) {

    try {

        Display.setFullscreen(false);
        DisplayMode d[] = Display.getAvailableDisplayModes();
        for (int i = 0; i < d.length; i++) {
            if (d[i].getWidth() == args[0] && d[i].getHeight() == args[1]
                    && d[i].getBitsPerPixel() == 32) {
                displayMode = d[i];
                break;
            }
        }

        Display.setDisplayMode(displayMode);
        Display.create();

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }

}

public static void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) displayMode.getWidth()
            / (float) displayMode.getHeight(), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

So, with the camera and screen setup out of the way, I can now ask the actual question: How do I know what the camera distance is from the image plane? I also would like to know what the angle between the image plane's center normal and a line drawn from the middle of one of the edges to the camera position is.

This will be used to consequently draw a vector from the camera's position through the player's click-coordinates to determine the world coordinates they clicked (or could've clicked).

Also, when I set the camera coordinates, do I set the coordinates of the camera or do I set the coordinates of the image plane?

Thank you for your help.

EDIT: So, I managed to solve how to calculate the distance of the camera... Here's the relevant code...

private static float getScreenFOV(int dim) {
    if (dim == 0) {
        float dist = (float) Math.tan((Math.PI / 2 - Math.toRadians(FOV_Y))/2) * 0.5f;
        float FOV_X = 2 * (float) Math.atan(getScreenRatio() * 0.5f / dist);
        return FOV_X;
    } else if (dim == 1) {
        return FOV_Y;
    }
    return 0;
}

FOV_Y is the Field of View that one defines in gluPerspective (float fovy in javadoc). This seems to be (and would logically be) for the height of the screen. Now I just need to figure out how to calculate that vector.


texts:
I am making a 2D mobile game and it runs really well (60 fps) on my phone. However, in some cases the performance goes down drastically to the point where it runs at 20 fps or even less. It happens at random times so I can't pinpoint what is causing this. During the performance decrease Gfx.WaitForPresent appears in my profiler which eats a lot of power. I am aware that this might be because of Vsync being turned on, but I have it disabled, along with shadows, AA and everything else that absolutely kills mobile performance. What else can be the problem? My game relies heavily on good performance for gameplay so this needs to be resolved ASAP.

Edit: I also noticed that the GPU stays at 0 ms which is really odd as well.


texts: World Space canvas rendering in front of line mesh

texts:
I'm attempting to attach a pointer to my steamvr controller to simplify world interactions. I'm very new to unity, but found a nice volumetric line asset (VolumetricLines) that aesthetically is exactly what I want. However, it seems to be rendering behind my canvas, as you can see here:

The canvas is set to world space with the event camera set to the VR camera, and renders properly for all world objects except this line. The line also renders properly with all objects except this canvas.

What exactly is the mechanic that causes the line to render behind the canvas, when it renders in front of other game objects, and what could I do to fix the render order?


texts:
I'm trying to create a mute button (that goes both way, e.g mute and un-mute) using button onclick

So far I'm not having the greatest luck. I made this:

  mute = !mute;
    if (mute){
        gameObject.GetComponent<Gamestartsound>().volume = 0;
    }else
    {
        gameObject.GetComponent<Gamestartsound>().volume = 0;
    }

To achieve what I'm trying to do but getting errors:

error CS0118: UI_ManagerScripts.Gamestartsound' is afield' but a `type' was expected

and

error CS0118: UI_ManagerScripts.Gamestartsound' is afield' but a `type' was expected

anyway this is my full UIManager script, I did the audio like that because I was having some issues earlier but it's better now so yeah:

public AudioClip Gamestartsound;
public GameObject Music;
public PlayerMovement playerMovementRef;
private bool mute;

public void DisableBoolAnimator(Animator anim)
{
    anim.SetBool ("IsDisplayed", false);
}

public void EnableBoolAnimator(Animator anim)
{
    anim.SetBool ("IsDisplayed", true);
}

public void NavigateTo(int scene)
{
    Application.LoadLevel ("Game Level");
    Movement.Restart ();
}
public void Mute ()
{
    mute = !mute;
    if (mute){
        gameObject.GetComponent<Gamestartsound>().volume = 0;
    }else
    {
        gameObject.GetComponent<Gamestartsound>().volume = 0;
    }
}

public void ExitGame()
{
    Application.Quit ();
}
public void PauseGame()
{
    Time.timeScale = 0;
    playerMovementRef.enabled = false;
}

public void UnPauseGame()
{
    Time.timeScale = 1;
    playerMovementRef.enabled = true;
    AudioSource.PlayClipAtPoint (Gamestartsound, transform.position);
}

}


texts: Is it more performant to index in the vertex shader or fragment shader?

texts:
I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the following would swap the red and green channels:

0 1 0 0 0
1 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1

I only need a few of these transformations, so my plan is to provide them to the GPU as a uniform and then index into this by passing an attribute to my shader for each quad. I think there are two approaches I could take:

Look up the 5x5 matrix once in the vertex shader and pass it to the fragment shader as a varying
Pass the index to the fragment shader as a varying and look up the matrix in the fragment shader

I'm not sure which of these approaches would be more performant. My inclination is 1, because then the lookup only has to happen once per instance, but does that mean there's more overhead in passing 25 floating point numbers via the varying?

By the way, my graphics pipeline is WebGL if that makes a difference.


texts: How can I generate my puzzle game's result tables?

texts:
I have a pattern game and it is almost done however I am stuck on the last part.

I have a screen with 25 blocks (in a table format 5x5) and the user clicks on it to turn over the blocks, I need to see if the user has turned over a line of blocks.

So I created a bunch of options and I am trying to compare it to the table of the current system (1 = not turned over and 0 = turned over). But the problem is my table looks like

local level1o1 ={ 0,0,0,0,0,
                  0,1,1,1,1,
                  1,1,0,1,0,
                  1,1,1,1,1,
                  1,0,1,1,1 }

And when I do the compare it doesn't say it is the same because of the other random 0's in the table. I don't want to make every single possible result table, so any ideas of how I could do this?

Compare function

-- Table Compare
local function deepcompare(t1,t2,ignore_mt)
    local ty1 = type(t1)
    local ty2 = type(t2)
    if ty1 ~= ty2 then return false end
    -- non-table types can be directly compared
    if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end
    -- as well as tables which have the metamethod __eq
    local mt = getmetatable(t1)
    if not ignore_mt and mt and mt.__eq then return t1 == t2 end
    for k1,v1 in pairs(t1) do
        local v2 = t2[k1]
        if v2 == nil or not deepcompare(v1,v2) then return false end
    end
    for k2,v2 in pairs(t2) do
        local v1 = t1[k2]
        if v1 == nil or not deepcompare(v1,v2) then return false end
    end
    return true
end

Example list of possible answers

local level1o1 ={ 0,0,0,0,0,
                  1,1,1,1,1,
                 1,1,1,1,1,
                 1,1,1,1,1,
                 1,1,1,1,1 }

local level1o2 ={ 0,1,1,1,1,
                 1,0,1,1,1,
                 1,1,0,1,1,
                 1,1,1,0,1,
                 1,1,1,1,0 }

.. etc


texts: Dealing with numerous, simultaneous sounds in unity

texts:
I've written a custom class that creates a fixed number of audio sources. When a new sound is played, it goes through the class, which creates a queue of sounds that will be played during that frame. The sounds that are closer to the camera are given preference.

If new sounds arrive in the next frame, I have a complex set of rules that determines how to replace the old ones. Ideally, "big" or "important" sounds should not be replaced by small ones. Sound replacement is necessary since the game can be fast-paced at times, and should try to play new sounds by replacing old ones. Otherwise, there can be "silent" moments when an old sound is about to stop playing and isn't replaced right away by a new sound. The drawback of replacing old sounds right away is that there is a harsh transition from the old sound clip to the new one.

But I wonder if I could just remove that management logic altogether, and create audio sources on the fly for new sounds. I could give "important" sounds more priority (closer to 0 in the corresponding property) as opposed to less important ones, and let Unity take care of culling out sound effects that exceed the channel limit. The only drawback is that it requires many heap allocations.

I wonder what strategy people use here?


texts: Can I use multiple OpenGL version together

texts: I want to use GLSL but keep my current OpenGL 1.1 setup. The thing is that can I use OpenGL 2.0 shaders on OpenGL 1.1 renders?


texts: What would be the problems with using a singleton design pattern for my engine?

texts:
I'm desiging an HTML5 2D game engine in JavaScript, and currently, I use the singleton pattern.

There is only one global object in the namespace called simply Engine. All other objects are instantiated through this one, for example:

var scene = new Engine.Scene();
var renderer = new Engine.Renderer();

This works great, but I started expanding and actually adding methods to the Engine object, not just classes (on a conceptual level, I know that they're technically different).

Now, the Engine object has an update() method, which should be called by the user (game) each loop, and some other properties such as updates per second, etc. Different objects (scenes etc) register some of their own update methods to the Engine.update() method, which just serves to call them.

What are the dangers of a such design? I've heard many people badmouthing the singleton design pattern, does it apply here?


texts: Why do I get this compile error when using InputComponents in UE4?

texts:
I'm following this documentation, but it doesn't compile cause of "InputComponent". Unfortunately the error is not that clear even in my language.

Here's the error:

  CompilerResultsLog: Error: C:\Users\Paradisee\Desktop\C++\Paper\Source\Paper\PlayerTile.cpp(83) : note: I tipi a cui si punta sono privi di relazioni. La conversione richiede reinterpret_cast, cast di tipo C o cast di tipo funzione
  CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: C:\Users\Paradisee\Desktop\C++\Paper\Binaries\Win64\UE4Editor-Paper-583.dll

Here's the code:

// Called to bind functionality to input
void APlayerTile::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // Respond every frame to the values of our two movement axes, "MoveX" and "MoveY".
    InputComponent->BindAction("MoveX", IE_Pressed, this, &APlayerTile::MoveX);
    InputComponent->BindAction("MoveY", IE_Pressed, this, &APlayerTile::MoveY);
}

This is the definition of the method MoveX():

void APlayerTile::MoveX(float AxisValue)
{

}


texts:
So I've been looking around, but it seems that information on this is scarce.

If one wants to develop an arcade game (as in, coin operated), ignoring the software side, where does one start on the hardware side?

I mean, is there some kind of company that sells arcade systems with some kind of spec for you to develop things on, etc?

I suppose this question is asking a lot more about the entrepreneurial side of stuff, but it's probably still related to game development..


texts: UI Button OnClick not playing AudioClip on gameObject

texts:
Basically, I am loading an Audio Clip onto a game object's Audio Source in the Awake function when the game starts. When I click on the game object a UI comes up that basically has a Play button attached and all I want to do is play the Audio Clip on the Audio Source. The problem is I can see that there is an Audio Clip on the Audio Source at runtime and I can play it in the inspector at runtime but, when I click the button nothing happens. I have tried just referencing the gameObject in the OnClick() of the UI button and that doesn't work and I have also tried going through and getting the gameObject through GameObject.Find

public void PlayMe()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("Voice_log");
        foreach (GameObject obj in objs)
        {
            if (obj.layer == LayerMask.NameToLayer("Selected"))
            {
                Debug.Log("Found it");
                if (obj.GetComponent<AudioSource>().clip.loadState == AudioDataLoadState.Loaded)
                {
                    obj.GetComponent<AudioSource>().Play();
                    Debug.Log("Should Play");
                }
            }
        }
    }

Both of my Debugs print when I click the Play button.


texts:
I'm quite new to game development. I was pretty impressed with the elastic effect I saw in this flash game when the ball hits the trampolines and I'm wondering how to recreate it.

I've done some poking around and I've heard the term "vertlets" come up lots, but I think that's more for rope physics, not something with two anchor points.

How should I approach this?


texts: How to resolve penetration of two colliding bodies

texts:
I've implemented simple 3D game physics engine. I already have decent collision detection in place, now I'm trying to figure out the collision response part. I'm using impulse based method to calculate the post-collision velocities. This works pretty well, however, it does not completely prevent the bodies to keep interpenetrating. So I have additional piece of code to resolve the penetration. Currently, I just move the bodies along the contact normal by half the penetration depth - first body in the direction of the contact normal, second body in the opposite direction.

This is ok most of the time, but there are some undesirable effects. For example, imagine a narrow corridor and an object moving through it. If the object hits one of the walls of the corridor, the penetration resolution moves it into the opposite wall, then in the next frame back into the first wall and so on. The effect is the object is kind of vibrating really fast between the walls which is not pretty.

So my question is whether there is a better way to resolve the penetration? Perhaps not move the bodies, just somehow adjust their velocities (in addition to the impulse computation) so they stop moving toward each other and the penetration resolves itself in the next couple of frames. I'm just guessing here. Any ideas?


texts: Limit Quaternion/vector3 axe in a certain interval

texts:
I have some trouble to understand, and handle Quaternion and Vector3. I'm improving the tutorial Tank of Unity:

EDIT: Because a video explain so much better, there is a link to the 30 secondes video I made:
https://www.youtube.com/watch?v=nNrmlfbHNTI&feature=youtu.be

In the first part, the turret turn with restriction made with the both line newRotation.z = 0.0f; and newRotation.x = 0.0f; (see code bellow).

In the second part, I just comment this two line.

My probleme is: i want to be able to look up and down (like in the second part of the video, but with a DEPRESSION LIMIT (don't look too much high and too much down)

I try soo manny case and can't manage the thing i want to do...
there is the code of the script in ref to the Tank turret:

public float m_TurnSpeed = 8f;
private Transform m_Transform;
private int floorMask;
private float camRayLength = 100f;

void Awake()
{
    floorMask = LayerMask.GetMask ("Ground");
    m_Transform = GetComponent <Transform> ();
}

void FixedUpdate()
{
    Turning ();
}

void Turning()
{
    Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit floorHit;

    if (Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
    {
        Vector3 playerToMouse = floorHit.point - transform.position;
        Quaternion newRotation = Quaternion.Slerp(m_Transform.rotation, Quaternion.LookRotation(playerToMouse), Time.deltaTime * m_TurnSpeed);

/////////////////////////////////////////////////////////////////////
////////// EDIT 2: probleme solved with the following line //////////
/////////////////////////////////////////////////////////////////////

        //block totaly Z and X quanta
        //newRotation.z = 0.0f;
        //newRotation.x = 0.0f;

        m_Transform.rotation = newRotation;

        float tmpX = m_Transform.localEulerAngles.x;
        if (tmpX > 20.0f && tmpX < 90.0f)
            tmpX = 20.0f;
        else if (tmpX < 315.0f && tmpX > 280.0f)
            tmpX = 315.0f;
        m_Transform.localEulerAngles = new Vector3(tmpX , m_Transform.localEulerAngles.y, 0.0f);
    }
}

Thanks !


texts: How can I randomize my speeds just once, each time values are changed in the Inspector?

texts:
private void SpeedUpdater()
    {
        if (changeSpeedOnce == false)
        {
            foreach (WaypointsFollower follower in waypointsFollowers)
            {
                if (randomSpeed)
                {
                    follower.speed = Random.Range(minRandomSpeed, maxRandomSpeed);
                }
                else
                {
                    follower.speed = speed;
                }
            }

            changeSpeedOnce = true;
        }
    }

I'm calling SpeedUpdater from inside the Update.
The problem is that if I'm not using the private flag bool changeSpeedOnce it will give each follower speed a random value every frame but I want that when it's random it will give each follower speed only one random speed value that is why I'm using the changeSpeedOnce flag.
but then I can't change the speed in run time when the game is running because changeSpeedOnce is false now.
I'm stuck here. From one side I want to give only one random speed value to each follower but I also want to do it any time in the run time when I'm changing the speed value in the Inspector.


texts: How to control jump strength by how long the player presses the jump button?

texts:
In a platformer game I am working on, I want my character to have controlled jumps. If I simply tap the jump key it will jump a just a little or if I hold it for a time it will jump higher.

What do I need to do?


texts: How can I Serialize other MonoBehaviour class for showing in inspector?

texts:
I have variables in my script but I can access these variables from other script but I want see them in other script without define again.
I know about [System.Serializable] but I don't know how can I use for MonoBehaviour classes

like this:

using UnityEngine;
using System.Collections;

public class variables : MonoBehaviour {
    public static variables instance;
    public int health;
    public int bullets;

    void Awake(){
        instance = this;
    }
}

I want show variables class in below class's inspector

using UnityEngine;
using System.Collections;

public class access : MonoBehaviour {
// I have to define again variable for showing in inspector
public int bulletsAccess;
public int healthAccess;

void Update () {
    variables.instance.bullets = healthAccess;
    variables.instance.health = bulletsAccess;
  }
}


texts: How can I implement a "disable ads" purchase in my game?

texts:
I would like to add a "no ads" service to my game such that ads can be removed with a single payment. How can I implement this correctly?

If I just save the fact that the service was paid for locally on the device, the user would have to pay again if they somehow erase the application's data.


texts: Tangent plane vectors smoothing with vertex normals

texts:
I'm trying to find a way to smooth out normals obtained from cross product of tangent and bitangent vectors calculated per face basis. I've already asked a similar question on SO, however with no answers so far.

Trying to come up with a solution (and also being bad at math) I decided to use the normals I obtain from the model file, since they are already given per vertex and transform each of the tangent plane vectors by rotation matrix obtained from dot and cross products of the calculated and loaded normals.

Now, this looks ok and the lighting is nice and smooth, however I have no idea if this solution is actually correct and, if no, what may be the problem with it. I assume it's not best as I haven't seen anything like it elsewhere.

Here's the part of the code which implements the idea. tangent bitangent and normal are the vectors computed per face. normal1 normal2 etc. are vertex normals.

    D3DXVECTOR3 axis;    // rotation axis
    D3DXVECTOR4 temp;    // temporary vector for rotation result
    D3DXMATRIX rotation; // rotation matrix
    float cosAngle, angle;

    // Vertex 1
    // Find rotation axis and angle between face normal and vertex normal
    cosAngle = D3DXVec3Dot(&normal, &normal1);
    angle = acos(cosAngle);
    D3DXVec3Cross(&axis, &normal, &normal1);
    D3DXVec3Normalize(&axis, &axis);

    // Create rotation matrix
    D3DXMatrixRotationAxis(&rotation, &axis, angle);

    // Transform each of the vectors
    D3DXVec3Transform(&temp, &normal, &rotation);
    normal1.x = temp.x;
    normal1.y = temp.y;
    normal1.z = temp.z;

    D3DXVec3Transform(&temp, &tangent, &rotation);
    tangent1.x = temp.x;
    tangent1.y = temp.y;
    tangent1.z = temp.z;

    D3DXVec3Transform(&temp, &bitangent, &rotation);
    bitangent1.x = temp.x;
    bitangent1.y = temp.y;
    bitangent1.z = temp.z;

    // do the same for vertices 2 and 3...


texts: How to create a shader for this hue change effect?

texts:
In this cut scene from Shovel Knight, the individual pixel art tableaux don't merely fade in and out. Rather, they fade in and out as well as undergo various hue changes.

Here's an example:

The changes in color appear to be discrete, and follow some kind of pattern.

I want to achieve a similar effect using a GLSL shader, but I am having trouble discerning exactly what pattern the colors follow. It seems like lighter colors in the palette are progressively swapped for darker colors in the same palette.

Any ideas how to achieve a similar effect?

Would achieving a similar effect require predefining palette swaps as well as creating gray scale masks of the areas that eventually get blacked out? I would prefer it if there was an easier solution, for example, identifying some general pattern in the color changes that could be used for any palette.


texts: Should I distribute shaders in a compiled form or in plain text?

texts:
Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile?

I'm aiming to distribute this in a binary form or as plain serialized text, i would like a good suggestion on this.


texts:
I recently added the Lightweight Render Pipeline to my project as I'd like to start experimenting with Shadergraph to see if I can get a better basic understanding of shaders.

Everything has gone pretty smoothly except the Shader used by my Projectors, the Projection Shader Standard asset no longer works (does not project the texture) and I have very little experience with Shaders.

The main concern for me is that I cannot find anyone else who seems to be having this problem.

I have tried reading through the older shader and recreating it in ShaderGraph but I'm out of my depth.

So could anyone provide me with a simple projection shader or materials on where I could learn to write one, or just learn more about them projection specifically.

thanks

edit: To clarify I was using the Projectors to project a simple square texture on to each tile that I could tint, to show selectable/current/target tiles.

Old shader that no longer works under Lightweight Render Pipeline From DevGuy @ Unity Forums

// Upgrade NOTE: replaced '_Projector' with 'unity_Projector'
// Upgrade NOTE: replaced '_ProjectorClip' with 'unity_ProjectorClip'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

  Shader "Projector/AdditiveTint" {
     Properties {
       _Color ("Tint Color", Color) = (1,1,1,1)
       _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0
       _ShadowTex ("Cookie", 2D) = "gray" {}
     }
     Subshader {
       Tags {"Queue"="Transparent"}
       Pass {
         ZWrite Off
         ColorMask RGB
         Blend SrcAlpha One // Additive blending
         Offset -1, -1

         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #include "UnityCG.cginc"

         struct v2f {
           float4 uvShadow : TEXCOORD0;
           float4 pos : SV_POSITION;
         };

         float4x4 unity_Projector;
         float4x4 unity_ProjectorClip;

         v2f vert (float4 vertex : POSITION)
         {
           v2f o;
           o.pos = UnityObjectToClipPos (vertex);
           o.uvShadow = mul (unity_Projector, vertex);
           return o;
         }

         sampler2D _ShadowTex;
         fixed4 _Color;
         float _Attenuation;

         fixed4 frag (v2f i) : SV_Target
         {
           // Apply alpha mask
           fixed4 texCookie = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
           fixed4 outColor = _Color * texCookie.a;
           // Attenuation
           float depth = i.uvShadow.z; // [-1 (near), 1 (far)]
           return outColor * clamp(1.0 - abs(depth) + _Attenuation, 0.0, 1.0);
         }
         ENDCG
       }
     }
  }


texts: What are the restrictions of 3g online games

texts: I am looking into make a 3g online multiplayer game for the iphone. Multiplayer is my main focus but I have noticed all game apps require wi-fi. Dose anyone know if this is simply an issue with the speed of the 3g network or dose apple put restrictions on their 3g network that prevents developers from doing this?


texts: How does DrawProceduralIndirect use MeshTopology.Triangles?

texts:
I'm working on a voxel terrain generation system. Currently I'm running into issues using DrawProceduralIndirect. In the call, you are able to choose how the GPU should render the data you are passing. In my case I want to render triangles, so I set the MeshTopology parameter as MeshTopology.Triangles.
The weird thing, however, is that on NVIDIA GPU's my mesh seems to render correctly. However, on my AMD GPU, the triangles are all scrambled. When rendering it with MeshTopology.Points on the AMD GPU, it seems that all of the vertices are in the correct spot, but there are a couple of extra vertices that the NVIDIA GPU's don't render.
My question is: could there be some fundamental difference on how AMD and NVIDIA GPUs handle the ComputeBuffers I'm passing into the material's shader? Also, does DrawProceduralIndirect with MeshTopology.Triangles read every three vertices in the ComputeBuffer and form a triangle with them?


texts:
What is more efficient in Unity recorded animation or Slerp/Lerp? What will be faster?

It is obvious that the animation will take a lot more space.


texts: In LIBGDX how to give different frametime to animations

texts:
As of now I've been using Gdx.graphics.getDeltaTime() to achieve this but I think this shouldn't be the correct way.

Let's say I have 3 images/sprites and I want the first one to stay for 1 second, the second sprite for 0.5 second and the third sprite for 3.5 seconds, so it combines a 5 second animation.

As of now I've been using "ifs", as in

if time <= 1 second, draw first image

if time > 1 && time <= 1.5, draw second image

if time > 1.5 && time < 5, draw third image

I've followed 2D Animation tutorial, but to run multiple sprites in order, they all have the same time between them and I want it to have different frametime.

Any idea that might I would be apreciated.

The idea is to run timed based animations for a certain amount of time.


texts: How to add state to the custom inspector in Unity

texts:
I'm writing a custom inspector for my asset (by deriving from Editor),
and I have a few variables controlling the state of the inspector (like whether a foldout is opened or not), that I'd like to be saved. I don't want to put them on the object, since then it would end up as junk inside the game state, but I also don't want it to be reset every time I click away from the object and then click back.

Do you guys have an idea where could I put the data so it gets persisted?


texts: GameMaker: how to make one non-physical object collide with a fixture?

texts: I've searched a lot and i couldn't find the answer. I'm developing a platformer game where i need the player to stay on ground but i don't want to use build-in physics to make him move. The ground is a multi-point fixture, since i've read using objects lowers performance. However, if I set the player as non-physical object, he doesn't collide with the ground.


texts: How can I find an optimum set of colors for 10 players?

texts:
I want to give each of 10 players a unique identifying color. Is there an optimum set of colors for this? How do I create one?

Every set I've come up with contains colors that are too similar.

Update: I was asked below what this is for (fair question). Now I can tell you - Windwardopolis and the colors worked great.


texts:
I have code that calculates a position like this in HLSL:

output.ShadowPos = input.VertexPos;
output.ShadowPos = mul(output.ShadowPos, gWorld);
output.ShadowPos = mul(output.ShadowPos, lightArray.lightView);
output.ShadowPos = mul(output.ShadowPos, lightArray.lightProject);
output.ShadowPos = mul(output.ShadowPos, T);

This works fine, but I would like to multiply the matrix together first

matrix m = gWorld * lightArray.lightView * lightArray.lightProject * T;
output.ShadowPos = input.VertexPos;
output.ShadowPos = mul(output.ShadowPos, m);

Yet this doesn't work, why?


texts: click event not registered for an actor inside stacked cell within a table in libgdx

texts:
In the following code segment, the click event for image element is not registered. However, if i comment out stack.add(shapeLabel) statement, then the image button is able to register the click event. Why is it so ?

        private Array<Shape> tableShapes;
        private Array<Stack> tableofStackedShapes;
        ....
        ....
        Stack stack = new Stack();
        Label shapeLabel;
        colorIndex = MathUtils.random(colorsList.size - 1);
        cellShape = shapesList.get(MathUtils.random(shapesList.size - 1));
        String filename = cellShape + "/" + cellShape + "_" + colorsList.get(colorIndex) + ".png";
        img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));

        if (this.currentLevel > 2) {
            int randomNumber = MathUtils.random(0, 9);
            img = new Shape(cellShape, colorsList.get(colorIndex), null, randomNumber, new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
            shapeLabel = new Label("" + randomNumber, new LabelStyle(new BitmapFont(), com.badlogic.gdx.graphics.Color.BLACK));
            shapeLabel.setAlignment(Align.center);
            shapeLabel.setBounds(img.getImageX(), img.getImageY(), img.getWidth(), img.getHeight());
            stack.add(shapeLabel);
        }   else {
            img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
        }
        stack.debugAll();
        tableofStackedShapes.add(stack);
        tableShapes.add(img);
    }

My suspicion is on chaining of events, and that the label is restricting the click events to be detected by the img element. But I don't know what exactly is triggering this and how to fix it. Thanks for any inputs .


texts: What does "~" in front of a function name inside a class mean?

texts:
I added a class using the 'add class' item in Visual Studio Express and it generated two functions in the .cpp file with the same names. But the second has the ~ character in front of it.

What does it mean?


texts: How can I repeat a portion of a texture on a quad?

texts:
I want to repeat a selected part of the texture into a quad.

I was looking at this thread, however the solution involved changing my HLSL.

Is there any way to do it without changing my shader settings?

SamplerState SampleType
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};

float4 TexturePixelShader(PixelInputType input) : SV_Target
{
    float4 textureColor;

    // Sample the pixel color from the texture using the sampler at this texture coordinate location.
    textureColor = shaderTexture.Sample(SampleType, input.tex);

    return textureColor;
}

And here's my current texture calculations:

// Get desired texture coordinates.
tLeft = (float)relTextureX / aTextureWidth ;
tRight = (float)(relTextureX + relTextureWidth) / aTextureWidth;
tTop = (float)relTextureY / aTextureHeight;
tBottom = (float)(relTextureY + relTextureHeight) / aTextureHeight;

// Create the vertex array.
vertices = new VertexType[m_vertexCount];
if (!vertices)
{
    return false;
}

// Load the vertex array with data.
vertices[0].position = D3DXVECTOR3(left, top, 0.0f);  // Top left.
vertices[0].texture = D3DXVECTOR2(tLeft, tTop);

vertices[1].position = D3DXVECTOR3(right, bottom, 0.0f);  // Bottom right.
vertices[1].texture = D3DXVECTOR2(tRight, tBottom);

vertices[2].position = D3DXVECTOR3(left, bottom, 0.0f);  // Bottom left.
vertices[2].texture = D3DXVECTOR2(tLeft, tBottom);

// Second triangle.
vertices[3].position = D3DXVECTOR3(left, top, 0.0f);  // Top left.
vertices[3].texture = D3DXVECTOR2(tLeft, tTop);

vertices[4].position = D3DXVECTOR3(right, top, 0.0f);  // Top right.
vertices[4].texture = D3DXVECTOR2(tRight, tTop);

vertices[5].position = D3DXVECTOR3(right, bottom, 0.0f);  // Bottom right.
vertices[5].texture = D3DXVECTOR2(tRight, tBottom);


texts: is it possible to render one pixel using DirectX 11? if its possible how to do it ?


texts:
I'm trying to implement a small game using AndEngine and I have a question about the Text. More specifically, I'm wondering if it is possible to deform the text so that you can have a "curved" text or something like this.

I have searched on the Internet but I couldn't find an answer about this. I have seen that there exists a class Transformation in AndEngine but I don't know if its purpose is what I want to do.


texts: Simulating flight dynamics in two dimensions

texts:
I have decided that in order to improve my math skills and game programming skills I am going to work on a two-dimensional space simulator. The view of the player or camera will be from inside the cockpit of a spaceship. This presents quite a few challenges which I am looking to the gd.net community for help with. I'm not asking for any code or any specific answers, just suggestions on what subjects to research.

My first challenge is going to be related to perspective correction. Since I'm only working with two-dimensions I need to fake flight dynamics. If you imagine that you are sitting in a cockpit of a spaceship, when you move the flight stick to the right or left the ship would yaw in either direction. Simulating this in two dimensions is much more difficult than in three dimensions, as you have to apply some sort of perspective correction.

The same is true if you were to pitch the nose of the spacecraft up or down. Simply moving the camera along the x / y axes won't be enough. I need to correct the perspective of my camera so that it appears that the aircraft is actually yawing / pitching in the desired direction and not just panning upwards / to the side.

What is the basic mathematical formula for applying this kind of perspective correction? If a formula is too much to ask for, where can I read about examples of this being done / read about the basic concepts I need to understand to accomplish this?

Thanks!


texts: rendering a spritebatch to a temporary buffer and then offset that to the main screen

texts:
I've been trying to figure out how to do this but I have a bunch of screens, each with their own Draw method. However, I'd like to render all sprites offset by the screen position without altering their locations before I do the drawing.

So, if I render a sprite on a screen at 0,0 but the screen itself is offset to 50,50 it still renders to a window position of 0,0 instead of to the window position of 50,50.

I've been thinking about rendering each screen to their own texture and then rendering that texture to the main spriteBatch - but reading another question you could lose a lot of information such as alpha transparency

Any help will be appreciated to get me on the right path. Thanks.

Update: Also I'd prefer it to be recursive so that screens within screens are also offset appropriately.


texts: What are the legal considerations with using spritesheets?

texts:
If you google for sprites sheets, you'll find a lot of sprites sheets.
As far as I can remember, industrial patents (the terms may not be the right ones I'm sorry), after 20 years, fall into public domain. For music it's 100 years. How about sprites sheets?

I'd like to know if I can use some of them directly?
If I spend a lot of time to take them, rework them as SVG and they will look modern but exactly the same as the original ones?

What is the general rule of thumb to follow to know if I can use a sprite sheet?


texts: How to make score counter independent of framerate

texts:
I have a score counter, but I've noticed that the lower the framerate is, the slower it counts. How can I make it so it ignores the framerate?

using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class Score : MonoBehaviour {
    private Text scoreText;
    private static int score;
    private static int finalScore;
    private static bool count;
    public static int scoreMultiplier;

    private void Start() {
        scoreText = GetComponent<Text>();
        count = false;
        scoreMultiplier = 1;
    }

    public static void StartCounting() {
        count = true;
    }

    public static void StopCounting() {
        count = false;
    }

    public static void Reset() {
        count = false;
        score = 0;
    }

    public static IEnumerator MultiplyBy(int scoreMultiplier) {
        Score.scoreMultiplier = scoreMultiplier;
        yield return new WaitForSeconds(6f);
        Score.scoreMultiplier = 1;
    }

    private void Update() {
        if (count) {
            score += scoreMultiplier;
        }

        // Slice the score so the number doesn't get too big
        finalScore = score / 4;

        scoreText.text = finalScore.ToString("00000");
    }
}

Edit: Fixed by adding Time.deltaTime and putting it in FixedUpdate instead of Update

private void FixedUpdate() {
    if (count) {
        score += scorePerSecond * Time.deltaTime * scoreMultiplier;
    }

    finalScore = Convert.ToInt32(score);
    scoreText.text = finalScore.ToString("000000");
}


texts: Can't run Nvidia PracticalPSM sample in debug mode

texts:
I want to add PSM (Prespective shadow map) to my engine but I have problems with that.
I think the problem is somewhere in my math code so I want debug Nvidia PracticalPSM sample and compare the math result in the sample and in my engine so maybe I could find the bug

When I want to compile the sample with VS2005 I get some linker error with DXUT functions maybe it is due to that the static lib DXUT.lib that included is compiled with VS2003 and dose not work probably with VS2005 then I added DXUT source codes from SDK 9.5 to the solution and the sample compiles this time.

When I hit F5 to run the sample it complains about nv_nvb.dll but only release version of nv_nvb.dll is included in the sample and I copied that to debug folder when the program starts it crashes in NVBscene9.cpp line 283.

I don't know why it crashes here.

you can download the sample code from here


texts:
I'm developing something similar to Galaga and I'm not entirely sure how to "manage" the bullets i.e. what data structures/algorithms/approaches to use when rendering them on the screen. Let's forget collision detection for now. The way I'm thinking of implementing this is:

When the application starts, create an array of bullets. Make sure this is at least as big as the total number of bullets you want to have on the screen at any given time. Initialize all the bullets to some default settings. Also create a list of the bullets that are on the screen at any time. Obviously this will be empty initially.
When the user shoots, get an element of the array and add it to a list of bullets that are currently rendered.
When drawing, iterate the list of bullets and render each of them. If a bullet gets out of the screen (say y > 1.0f) then remove it from the list and reset it to default position.

Is this a sensible approach to the problem? Are there alternatives I should consider?

P.S. This question is language/framework (etc) agnostic, but if you think it makes a difference, I'm using OpenGL ES 2 on Android.


texts: Can you write games for Rock Band or Guitar Hero controllers in XNA?

texts: Can you use the XNA framework to write games for XBox Live Arcade that require Rock Band or Guitar Hero instruments?


texts: Why does my libgdx app just display the badlogic.jpg instead of my start screen?

texts:
I have been looking at example libgdx games.  It looks like https://github.com/libgdx/libgdx-demo-cuboc is the closest thing to a game I would like to make.  I am able to download, compile and execute the Cuboc game no problem.  So I follow the instructions for creating a libgdx project (https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle) and I am able to compile and execute the resulting project which just displays the badlogic.jpg file.

So I start aping the code from Cuboc into my game, which I am calling Malfunction. All I want to do is display my "MainMenu" screen which simply display a png file which I copied from the Cuboc game.

Here's what I have in my Malfunction project:

// Malfunction.java
package com.redcricket.malfunction;

import com.redcricket.malfunction.screens.MainMenu;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;

public class Malfunction extends Game {
    private String TAG = "MAL";

    @Override
    public void create () {
        Gdx.app.log(TAG, "MainMenu (Game)");
        setScreen(new MainMenu(this));
    }
}

... and this java file ...

// MainMenu.java
package com.redcricket.malfunction.screens;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class MainMenu extends MalfunctionScreen {
    TextureRegion title;
    SpriteBatch batch;
    float time = 0;
    private String TAG = "MAL";

    public MainMenu(Game game) {
        super(game);
        // TODO Auto-generated constructor stub
        Gdx.app.log(TAG, "MainMenu (Game)");

    }

    @Override
    public void show () {
        Gdx.app.log(TAG, "show()");

        title = new TextureRegion(new Texture(Gdx.files.internal("data/title.png")), 0, 0, 480, 320);
        batch = new SpriteBatch();
        batch.getProjectionMatrix().setToOrtho2D(0, 0, 480, 320);
    }

    @Override
    public void render (float delta) {
        Gdx.app.log(TAG, "render (float)");

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();
        batch.draw(title, 0, 0);
        batch.end();

        time += delta;
        if (time > 1) {
            if (Gdx.input.isKeyPressed(Keys.ANY_KEY) || Gdx.input.justTouched()) {
//              game.setScreen(new IntroScreen(game));
                Gdx.app.log(TAG, "all done ...");
            }
        }
    }

}

... and this java file ...

// MalfunctionScreen
package com.redcricket.malfunction.screens;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Screen;

public abstract class MalfunctionScreen implements Screen {
    Game game;

    public MalfunctionScreen (Game game) {
        this.game = game;
    }

    @Override
    public void resize (int width, int height) {
    }

    @Override
    public void show () {
    }

    @Override
    public void hide () {
    }

    @Override
    public void pause () {
    }

    @Override
    public void resume () {
    }

    @Override
    public void dispose () {
    }
}

Update: I also have this java code ...

package com.redcricket.malfunction.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.redcricket.malfunction.Malfunction;

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        new LwjglApplication(new Malfunction(), config);
    }
}

So why does this screen appear when I run my modified version of Malfunction?

Also none of my calls to Gdx.app.log ever show up in logcat.

Thanks!


texts: How to know if an actor is touched in libgdx?

texts:
I am using "Gdx.input.isTouched()" in the render method of my Screen method, to know where is touched, but when the touch is dragged in the screen, it also activates the events i want only when an actor is touched.

Is there any listener to know when an Actor is touched, but the event is not the dragged one, im doing it with sprites.


texts:
Fairly new to XNA and not an expert on C# either. So I was following a tutorial, specifically this one http://rbwhitaker.wikidot.com/texture-atlases-1, and there is a bit of code I am unfamiliar with.

public void Draw(SpriteBatch spriteBatch, Vector2 location)
{
    int width = Texture.Width / Columns;
    int height = Texture.Height / Rows;
    int row = (int)((float)currentFrame / (float)Columns);
    int column = currentFrame % Columns;

Mostly all of this I am familiar with. However, the line that says

int row = (int)((float) currentFrame / (float) Columns);

This line is not familiar to me and I would appreciate if someone could explain what this does. Clearly it is designed to find out what row the program is on in the texture atlas but what how does it do that with that code? What is it calculating?


texts: Quantity of dropped/spawned items in container

texts:
I'm having trouble figuring out how to spawn more than one item in to a container with a weight limit. What I'm having trouble with is the understanding, rather than what statements to write;

My items are composed of weight, type and foundIn, among other things. My containers are items, with some minor changes. foundIn is an array of strings which match "container" items, and should be either "world", "container-name", or empty ([]). "container" items follow a similar structure, with slight deviance.

Whenever I want to drop an item, I get a pool of items in a foundIn location, make a Math.random check against the commonRate, and if that item is a type = "container", I try to fill the container.

Here is where I have my problem; I can not figure out how to decide if multiple items of the same type should be dropped inside the container, and if so, how many. If I can figure this out, I can have monsters carry their own drops, instead of having to write a whole monster drop-table with levels and oddities.

The following is my code. The last method, dropItem, glues the displayed methods together.

placeExists(place) {
    return this._itemPlaces.indexOf(place) > -1;
}

getItemsOfType(arrayOfTypes, inList) {
    if (!Array.isArray(arrayOfTypes)) throw new Error('Index must be string');
    let pool = this.list;
    if (inList) pool = inList;

    return pool.map((item => {
        if (arrayOfTypes.indexOf(item.type) > -1) {
            return item;
        }
    }));

}

populateContainer(container, pool) {
    let chance = Math.random();
    pool = pool.map(item => {
        let canBeFound = item.foundIn.indexOf(container.name) > -1
                || item.foundIn.indexOf('world') > -1;
        if (item.commonRate >= chance && canBeFound) return item;
    });

    this.getItemsOfType(container.availableTypePool, pool).some(item => {
        if (container.capacity.freeSpace <= 0) return true;
        if (item.commonRate >= Math.random()
                && item.weight <= container.capacity.freeSpace) {
            container.addItem(item);
        }
    });

    return container;
}

getItemsOfPlace(place) {
    return this._LIST.map(item => {
        if (item.isFoundIn(place)) {
            return item;
        }
    })
}

dropItem(fromPlace) {
    if (this.placeExists(fromPlace)) return [];
    let foundItem = [];

    let pool = this.getItemsOfPlace(fromPlace);
    pool.some(item => {
        let chance = Math.random();
        if (chance > item.commonRate) {
            if (item.type == 'container')
                foundItem.push(this.populateContainer(item, pool));
            else
                foundItem.push(item);
            return true;
        }
    });

    return foundItem;
}

// container abstracted method of adding an item

container.addItem = (item = new Item()) {
    if (item instanceof Item === false) throw Error('item needs to be of type Item');
    if (item.type == 'container') throw Error('Yo dawg, I heard you like containers...');

    this._contained.push(item.code);
    this.carryingWeight = +item.weight;
}

How do I decide if I should drop multiple items, and how do I randomly select that amount?

Note that this.list and this._LIST are the same list. For some reason, WebStorm seems to lose track of one or the other when inside certain callbacks, so I switch to avoid losing autocomplete. For reference, this.list is get list() { return this._LIST }, and is obtained from extending a custom List class.


texts: Unity3D Sprite tearing on Android Smartphone

texts:
The game was running on Samsung Galaxy Trend 2.

On other smaptphones and emulator it seems running properly without glitches.

Sprites import settings are following:

Could someone explain why this happens?


texts:
could someone explain me about isometric games ? i'm unity beginner and want to know about game development.

i read that its 2.5 d , that all the objects is actually 2d sprites,
is that true ?
can we combine it (i use isometric camera, pan only, no rotation) ? ,i mean can we use 2d (for buildings) and 3d (characters) ?
i recently play android games (Fun Hospital Tycoon), anyone know the
game ? are they using full 2d or combined ?

thank you.


texts:
I'm creating a 3D game, and I need to know how to push a player (axis aligned box/cube) outside a triangle.

How can I get get the push direction?


texts: How to set the object's world position in bullet?

texts:
In my Ogre3d application I am first changing the parent of a node like this:

// save object "Cube" into node*; then ...
Vector3 absPos(node->_getDerivedPosition());
Quaternion absOrient(node->_getDerivedOrientation());
node->getParent()->removeChild(node);
m_pSceneMgr->getRootSceneNode()->getChild("NewParentNode")->addChild(node);
node->_setDerivedPosition(absPos);
node->_setDerivedOrientation(absOrient);

The idea is that after the parent node has been changed the object's position and orientation should remain the same. However, even though this is working fine, it seems that afterwards bullet is again overwriting the object's position. If I remove the object's rigid body from bullet, then everything works fine. If not, then as soon as I change the parent the object's position is changed.

So I thought I simply need to update bullet as well:

btRigidBody* rigid = getBtRigid(String("Cube"));
btTransform tr = rigid->getWorldTransform();
tr.setOrigin(BtOgre::Convert::toBullet(absPos));
tr.setRotation(BtOgre::Convert::toBullet(absOrient));
rigid->setWorldTransform(tr);

However, that doesn't work, the object still jumps to another position after the parent is changed. But it is related to bullet for sure, because as said if I remove the object from bullet physics, then it works.

Any ideas what I am missing here?


texts: 3d Maya object mesh problems when used in Unity

texts: Asking for help to solve a problem 3d Maya objects imported in Unity to make an ios app. Maya object change when imported on Unity mesh attributes disappears and mesh structure comes evident. Has anyone some suggestion to fix this problem?


texts: Writing to a structured buffer with a compute shader (D3D11)

texts:
I have some problems writing to a structured buffer. First I create a structured buffer that is filled with float values beginning from 0 to 99. Afterwards a copy the structured buffer to a CPU accessible buffer is made to print the content of the structured buffer to the console. The output is as expected (Numbers 0 to 99 appear on the console). Afterwards I use a compute shader that should change the contents of the structured buffer:

RWStructuredBuffer<float>   Result : register( u0 );

[numthreads(1, 1, 1)]
void CS_main( uint3 GroupId : SV_GroupID )
{
    Result[GroupId.x] = GroupId.x * 10;
}

But the compute shader does not change the contents of the structured buffer.

The source code can be found here (main.cpp):
https://bitbucket.org/Vertexwahn/cmakedemos/src/4abb067afd5781b87a553c4c720956668adca22a/D3D11ComputeShader/src/main.cpp?at=default

FillCS.hlsl:
https://bitbucket.org/Vertexwahn/cmakedemos/src/4abb067afd5781b87a553c4c720956668adca22a/D3D11ComputeShader/src/FillCS.hlsl?at=default