texts: What is wrong with my technique for transmitting server and client game state?

texts:
I'm doing a network implementation of a fast-paced game. I have a puck on bot the server and client side of the simulation. I want to update the client puck position only if they are on the same direction and the server's puck is ahead of the client's puck. If the message comes with a delay and the server's puck is behind client's puck I will keep that way.

So I tried this, which is not working properly and sometimes causes some glitches.

b2Vec2 puckLocal = b2Vec2(puck->GetLinearVelocity().x, puck->GetLinearVelocity().y);
b2Vec2 puckServer = b2Vec2(vx, vy * -1);

puckLocal.Normalize();
puckServer.Normalize();

float_t dotProduct = puckLocal.x * puckServer.x + puckLocal.y * puckServer.y;

if (dotProduct < .9) {
    return;
}

Is it correct? I have read that if I normalize two vectors, and do the dot product I get their direction. Which -1 means opposite direction, 0 perpendicular and 1 same direction. Is that correct?

What is the best solution when the angles differs a bit? Like the result is .85 which means that they are 30 degrees from each other? Should I interpolate it? Any suggestions on that?


texts: Finding line of best fit demarcating national borders

texts:
Per title, what algorithms are available for defining borders for states (or other entities) based on certain nodes in the world (eg. cities or armies) with varying weights?

For example, there are three non-equidistant city-states and a bunch of military vehicles of varying strength nearby representing each city-states' military power. I would like to be able to draw a border that accounts for the fact city-state A has a huge great army on their outskirts, projecting their power outward.

Ideally the optimal algorithm would be able to calculate a series of connected lines with a high level of precision for multiple states and a large number of nodes (let's say three dozen, for the sake of argument). Speed isn't too much of a factor, since the results would be cached and I'd need to apply a function to 'curve' it anyway.


texts: What is the value range from a dot-product between two normalized vectors?

texts: I've recently learned about the existence of dot product and I was wanted to know how to determine the value range between two normalized vectors.


texts: 2D motion synthesis for a human character

texts:
I want to make the player controlled character of my two dimensional sidescroller responsive to environmental forces, while still being controllable.

I read about the commercial software product Euphoria, which is used to synthesize the motions of characters for example in GTA IV.

I realize that three dimensional motion synthesis is so complex that I will not be able to use it in my games. Luckily I am creating a two dimensional sidescroller. I assume that it is a lot easier to synthesize motion in two dimensions.

Actually I found a relevant scientific paper from 1994 about exactly this topic. After a quick flip it is a rather complicated and not a fully complete (ready to be ported to C#) concept. But is it outdated? What are common approaches to solving this problem in the 21st century? Do you know 2D games using a motion synthesis concept?


texts:
How to implement Unit Testing with Cocos2D framework?
What are the good practices?

Is there any testing framework like JUnit Framework at Eclipse for Android?


texts:
Note, this happens on click and not in the update cycle
I have a game object that i rotate at a given angle, around a point without a time component like this(works as intended):
void Rotate(a)
{
    var parent = transform.parent;
    Vector3 point = new Vector3(0, 0, 0);
    Vector3 axis = new Vector3(0, 0, 1);

    parent.transform.RotateAround(Pivot.bounds.center, axis, a);
}

note that the parent is an empty to manipulate the anchor point
I wish to animate the rotation over time, however each method produces an inaccurate result. The two functions I have tried:
IEnumerator RotateOverTime(float byAngles, float inTime)
{
    var parent = transform.parent;
    Vector3 axis = new Vector3(0, 0, 1);

    var stepAngle = byAngles/ (inTime/ 1000f);

    float timer = 0;
    while (timer <= (inTime/ 1000f))
    {
        parent.transform.RotateAround(Pivot.bounds.center, axis, stepAngle * Time.deltaTime);
        timer += Time.deltaTime;
        yield return null;
    }
    yield return null;
}

IEnumerator RotateMe(Vector3 byAngles, float inTime)
{
    var parent = transform.parent;
    var fromAngle = parent.transform.rotation;
    var toAngle = Quaternion.Euler(parent.transform.eulerAngles + byAngles);
    for (var t = 0f; t < 1; t += Time.deltaTime / inTime)
    {
        parent.transform.rotation = Quaternion.Lerp(fromAngle, toAngle, t);
        yield return null;
    }
}

The Problem:
The above two methods doesn't rotate the object by the exact amount of degrees, see image below where the angle in question is 90deg. You can clearly see by the grid what the issue is


texts: A logic error. canvas: balls physics, bounce

texts:
Hi I was making a program that simulate a bunch of balls bouncing, but the problem is some balls got stuck to the floor. Since it's a logic error, it is kind of difficult to find. Can someone help, I let the snipper code below thanks.

var output = document.getElementById('output');
var canvas = {};
var ball = [];

canvas.obj = document.getElementById('canvas');
canvas.ctx = canvas.obj.getContext('2d');
canvas.width = canvas.obj.width;
canvas.height = canvas.obj.height;
canvas.clear = function() {
  canvas.ctx.clearRect(0, 0, canvas.width, canvas.height);
};
canvas.preferences = function() {
  canvas.ctx.strokeStyle = 'rgb(210,210,210)';
  canvas.ctx.lineWidth = 1;
};

const FRICTION = .9;
const MIN_ACCELERATION = 1;
const FRICTION_INCREASE = .015;
const DIST = 20;
const N_BALLS = 50; // BALLS NUMBER
const GROUND = canvas.height;

var Object = function() {
  this.yVel = 0;
  this.gForce = 0.2;
  this.friction = FRICTION;
  this.full = false;
  this.run = true;

  this.draw = function() {
    canvas.ctx.beginPath();
    canvas.ctx.arc(this.x, this.y, this.radio, 0, Math.PI * 2);
    canvas.ctx.stroke();
  };

  this.physics = function() {

    this.y += this.yVel;

    if (this.y + this.radio < GROUND) {
      this.yVel += this.gForce;
    } else if (this.y + this.radio > GROUND && this.yVel > MIN_ACCELERATION) {
      this.yVel *= -this.friction;
      this.y = GROUND - this.radio;
      this.friction -= FRICTION_INCREASE;
    } else {
      this.yVel = 0;
      this.y = GROUND - this.radio;
      this.run = false;
    }
  };
};

var generateBalls = function(p) {

  var i, random;

  for (i = 0; i < N_BALLS; i++) {
    p[i] = new Object();

    random = Math.floor(Math.random() * 18) + 5;
    p[i].radio = random;

    random = Math.floor(Math.random() * 22) + 1;
    p[i].x = DIST * random;

    random = Math.floor(Math.random() * 15) + 1;
    p[i].y = DIST * random;

  }
};

var drawBalls = function() {
  var i;

  for (i = 0; i < N_BALLS; i++) {
    ball[i].draw();
  }
};

var applyPhysics = function() {
  var i;

  for (i = 0; i < N_BALLS; i++) {
    ball[i].physics();
  }
};

generateBalls(ball);
canvas.preferences();
var program = setInterval(function() {

  canvas.clear();
  drawBalls();
  applyPhysics();

}, 1000 / 60);
canvas {
  border: 1px solid rgb(210, 210, 210);
}

body {
  background: black;
  color: rgb(210, 210, 210);
}
<canvas id="canvas" width="450" height="400"></canvas>


texts: Are realtime lightning calculated every frame , also the ones not 'visible'?

texts:
I've a big scene, with a lot of realtime light.

I noticed a big drop in FPS after finished to add lights, so I suppose that too many realtime light are a 'bad practice'.

But my question is: are all realtime light calculated every frame despite they are not visible from player camera ?

Is there any option to specify the behaviour of that calculation ?


texts: Calculate diameter of sphere large enough to encompasss a frustum

texts:
I'm attempting to speed up box-to-box collision checks by first testing if two spheres large enough to encompass each (respectively) would collide (because I'm using separating axis theorem and it's slower than I'd like it to be).

This is fine for equilateral boxes (ie, cubes) since I can just take two opposing corners and the line between them is the exact diameter of a sphere big enough to encompass the whole thing properly; and also the point in it's middle is the origin of the sphere. I add an epsilon just to avoid any glitches with colliding with the corners of the cube, but theoretically it shouldn't be necessary.

But for non-equilateral boxes, such as frusta, this method does not work. I've pondered it over and nothing I can come up with is a quick enough calculation for my taste. The best I've come up with is to take two opposing edges (diagonally through the box) from the near face to the far face, get their individual lengths and sum them; then do the same thing for the left-to-right faces and top-to-bottom faces. with these three sums, take the largest and just use that.

Anyway, that method works but it's too much calculation, involving 6 square roots. I need something faster and preferably more accurate. I've googled and haven't found much on this subject at all. I'd like the solution to work for boxes of any shape (as long as faces are valid) and frustums of unknown orientation (meaning the large face could be any side, not a known one).

It's also important to know the origin of the sphere (which is the dead center of the frustum). Which if there is no faster calculation, this is just the sum of all 8 verts divided by 8.

Any ideas?


texts:
I've seen the term "casual" used to describe games at times, and have seen people refer themselves or others as "casual gamers."

What exactly is a "casual" game? Is there any real difference between them and regular games? If so, what makes a game "casual?"


texts: Unity text component not updating text properly

texts:
It was worked fine previously, but after some point, it's not working.

This is the code. It's not a pseudo code, actual code in game:

public Text healthText;

void Start() {
    healthText = GameObject.Find("UI/InGameUI/CharacterStatus/HealthText").GetComponent<Text>();
    }

void Update() {
    if(healthText) {
        print(health);
        // healthText.text = Time.deltaTime.ToString();
        healthText.text = "HP: " + health.ToString();
        // healthText.text = "HP: " + health;
    }
}

variable "health" is float value. I just want to print it to the screen, but it's always prints "Health: 100" even it changes.

So I printed the value to the console, but it prints well in the console and only text components was not printed properly.

So I printed Time.deltaTime instead of the health and it works!

Seriously, what the hell is happening? Is this a bug? If health variable wasn't changed, it should be also printed 100 in the console, but it's not!

Try this to another text component, still not working.


texts:
I have a question regarding model imports using ASSIMP. I've been working on an Entity and Component (e.g. unity gameobject component) based game engine for fun and to learn in my spare time. I've decided to tackle frustum culling, because it interests me and seems like a relatively simple optimisation to make. I had the algorithm implemented and noticed a problem, while the culling works as expected, the entire sponza scene i have loaded disappears when looking in certain orientations. This happens because it uses the entity the mesh is attached to's position, which in all cases is (0,0,0) or something similar.

This means, despite the fact each mesh of the sponza scene is drawn using it's own model matrix and each entity has the same position (Meaning each mesh should be overlapping surely?) the scene looks entirely normal. Now i know ASSIMP does provide you the transformation for each note (guessing this would be what im looking for) but I can't figure out why the scene just looks normal, does assimp pre-offset the vertices based on the node transform? if so how can i disable this feature?

Any and all literature / tidbits would be welcome, Apologies for not being a super well defined question.

TLDR; How do node transformations work in Assimp


texts:
I'm trying to use the draco library in a Unity project. I've a lot of obj files with models of a person in different positions. When I encode these models with the draco_encoder command I obtain a lossy conversion, and a lot of parts of my original models get lost.

I tried to play around the parameters -qp and -cl in order to change the quantization and the compression level, but also with qp at its maximum and cl to its minimum some parts get lost.

In this image the left model is the original one. The right model is the one converted with draco_encoder by using cl 0 and qp 21. As you can see some parts are missing.

Do you have any suggestion on how can I obtain a lossless (as lossless as possible) conversion?


texts: How can I get a background image and game objects to fill black areas of letterbox or pillarbox?

texts:
I have used the Aspect Ratio Enforcer to force my game's aspect ratio to remain as 9:16. I need to prevent some game objects and the backgrounds from being affected by the enforced aspect ratio to cover the black areas that result from other aspect ratios.
How can I prevent some game objects and background images from getting affecting by the Aspect Ratio Enforcer?


texts: determine collision angle on a rotating body

texts:
update: new diagram and updated description

I have a contact listener set up to try and determine the side that a collision happened at relative to the a bodies rotation. One way to solve this is to find the value of the yellow angle between the red and blue vectors drawn above. The angle can be found by taking the arc cosine of the dot product of the two vectors (Evan pointed this out). One of my points of confusion is the difference in domain of the atan2 function html canvas coordinates and the Box2d rotation information. I know I have to account for this somehow... SS below

questions:

Does Box2D provide these angles more directly in the collision information?
Am I even on the right track? If so, any hints?

I have the following javascript so far:

Ship.prototype.onCollide = function (other_ent,cx,cy) {

  var pos = this.body.GetPosition();

  //collision position relative to body
  var d_cx = pos.x - cx;
  var d_cy = pos.y - cy;

  //length of initial vector
  var len = Math.sqrt(Math.pow(pos.x -cx,2) + Math.pow(pos.y-cy,2));

  //body angle - can over rotate hence mod 2*Pi
  var ang = this.body.GetAngle() % (Math.PI * 2);

  //vector representing body's angle - same magnitude as the first
  var b_vx = len * Math.cos(ang);
  var b_vy = len * Math.sin(ang);

  //dot product of the two vectors
  var dot_prod = d_cx * b_vx + d_cy * b_vy;

  //new calculation of difference in angle - NOT WORKING!
  var d_ang = Math.acos(dot_prod);

  var side;
  if (Math.abs(d_ang) < Math.PI/2 )
    side = "front";
  else
    side = "back";

  console.log("length",len);
  console.log("pos:",pos.x,pos.y);
  console.log("offs:",d_cx,d_cy);
  console.log("body vec",b_vx,b_vy);
  console.log("body angle:",ang);
  console.log("dot product",dot_prod);
  console.log("result:",d_ang);
  console.log("side",side);
  console.log("------------------------");

}


texts:
I am a beginner-intermediate C++/Java programmer and my long term goal is to be a game programmer.

I have decided to start off with 2D and work my way towards 3D.

I would like to use SDL to start off with, but I am wondering if it is maybe not such a great idea.

Given the fact that I am working towards 3D, would it be advisable to use SDL or jump into OpenGL without the Z axis?


texts: Why isn't my Blender FBX not appearing in XNA?

texts:
I am trying to display a simple cube in XNA. The cube is the default Blender cube exported to a .fbx. Re-exporting the cube has had no effect. I have also varied the camera's z-distance from 5 to 1000, to ensure the cube is not too small or too big. However, the cube does not display and I noticed that the meshes.Count is 0.

Would appreciate some advice.

This is the very basic code that draws the cube:

protected Vector3 cameraPosition = new Vector3(0f,0f, 10f);

protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            Matrix[] transforms = new Matrix[cubeModel.Bones.Count];
            cubeModel.CopyAbsoluteBoneTransformsTo(transforms);

            // TODO: Add your drawing code here
            foreach (ModelMesh mesh in cubeModel.Meshes)
            {

                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = transforms[mesh.ParentBone.Index];
                    effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero,
                       Vector3.Up);
                    effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                       MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
                }

                mesh.Draw();
            }

            base.Draw(gameTime);
        }


texts: Reducing total file size of multiple Unity games

texts:
Our product consists of many small stand-alone games, some made in Unity and some made in other languages. These games can be launched from a hub. The file size of the Unity games is quite large, since each game is being build to work as a stand-alone game. When looking inside the folders, I can see that many of the files, folders and dlls are the same, so I thought that it would be possible to re-use these across all the games to reduce the file size of our installer.

So far I have successfully moved the games' exe and _Data folders into one folder so they can re-use the MonoBleedingEdge and UnityPlayer.dll, but I was hoping to be able to share even more resources than this. All the games are built using Unity 2019.1 and all of them are using many of the same libraries and dlls.

Does anyone have experience bundling many Unity games like this? Is there some configuration for Unity that will help with allowing shared resources?


texts: Unity: SpritePacker Atlas with Dynamic Access

texts:
Here are current conditions for a game I'm building in Unity 5.6.3:

SpritePacker is used to create atlases (it would be ideal if that didn't change, but it could, if no other options become evident).
Config file describing game state which specifies IDs referring to specific sprites, is loaded.
Resources.Load() worked fine with individual sprites, but doesn't work properly with SpritePacker - can't access elements by ID, programmatically.
Programatic access to SpritePacker sprites is done via an object in the scene that has inspector-set arrays of all correctly-named assets. From these, the script on that object creates a public static dictionary keyed by those IDs. This dictionary supplies sprites, by key, to rest of game.
Memory use and draw calls are reduced, but Android crashes about 50% of the time on startup (game killed by the OS), which seems to result from a delay caused by loading the large Atlas element in the scene... could be wrong though.

So...

How do I use SpritePacker AND get dynamic access to atlas entries? (AFAIK, it is not possible in 5.6)

OR

What other solutions can solve this without a major overhaul?


texts: Most common format & good practice for 3D models for a placeholder in a PC game

texts:
I'm soon starting programming my first 3D game in OpenGL, C++, for PC. It's going to be a top-down space-based game.

Early on I want to create basic placeholder 3D models for my objects, and then in later stages (if I prove able to write C++ game mechanics successfully...) I'll collaborate with / employ a 3D model artist for the full textured models.

What's the best format to create these placeholders in for optimum integration later on?

Any particular advice for how to program it from the start to make it easier to work with the artist later on?


texts: Using enemy, player and gun position can player shoot enemy?

texts:
I was asked this question in an interview last week and I've been thinking about it but I'm unsure how to solve it.
You are on a spaceship and want to shoot the enemy space ship. You have the enemy position, your position, your gun position, the radius of the enemy and the radius of your gun. Assume the normal is facing forward.
So basically the function is like canHit(Vector3 enemyPosition, Vector3 playerPosition, Vector3 gunPosition, float enemyRadius, float bulletRadius)
I figured I would have to subtract the vectors and get the dot product to check if the enemy was in front of the player. Then I thought maybe I should cross the enemy and the gun to see if they intersect and if they don't check if the radius of the bullet plus the gun position is would reach the enemy. I know this is incorrect, so I'm curious how to go about solving this problem.


texts:
For my first game in LibGDX and Android I got a Problem:

I have a background picture which is 2560px * 720px. The screen is 1280 * 720. How do I have to set the viewport and camera in order to get the following result: The picture is fited in height and shows the first 1280px in width.

I tried so many things and it really confused me.

Gamescreen.java

package com.joelbrun.jetskirider.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

public class Gamescreen implements Screen {

    public Texture jetski, wave, background;
    public SpriteBatch batch;
    public OrthographicCamera camera;
    public Label score;
    public static final int GAMESCREEN_WIDTH = 1920;
    public static final int GAMESCREEN_HEIGHT = 720;
    public static final int OBSTACLE_TYPES = 5;

    Viewport viewport;
    private Texture[] texture;

    @Override
    public void show() {
        texture = new Texture[OBSTACLE_TYPES];
        for (int i=0; i<OBSTACLE_TYPES; i++){
            texture[i] = new Texture(Gdx.files.internal("game/obstacles/obstacle" + Integer.toString(i+1)+".png"));
        }
        background = new Texture("game/background.png");
        jetski = new Texture("game/jetski.png");
        batch = new SpriteBatch();
        float aspectRatio = (float)Gdx.graphics.getWidth()/(float)Gdx.graphics.getHeight();
        camera = new OrthographicCamera();

        viewport = new FitViewport(GAMESCREEN_WIDTH, GAMESCREEN_HEIGHT);
        viewport.apply();
        camera.position.set(GAMESCREEN_WIDTH / 2, GAMESCREEN_HEIGHT / 2, 0);
        //camera.position.set(0,0,0);

    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        camera.update();
        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        batch.draw(background, 0, 0, 5119, 720);
        batch.draw(jetski, background.getWidth()/2, background.getHeight()/2,128,128);
        batch.end();
    }

    @Override
    public void resize(int width, int height) {
        viewport.update(width, height);
        camera.position.set(GAMESCREEN_WIDTH / 2, GAMESCREEN_HEIGHT / 2, 0);
    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void dispose() {
        batch.dispose();
        background.dispose();
        jetski.dispose();
        wave.dispose();
    }
}


texts: Where can I find articles/books on 2D graphics (how it works etc.)?

texts:
After I have been through more intensive C++ studies, I am thinking of giving it a start in my practices of computer game programming. Therefore, I think 2D knowledge (processing images, animating frames, etc.) would be a good place to start. However, I don't seem to find many articles on 2D (mostly 3D), and if found one, it is mostly stuffs like how to use a 2D game engine. I would really want something much more low-level, or "from scratch" ideas.

I want articles/books that would answer something like:

How would I import images into C++? (Let's say, if I want to import jpeg/bmp/etc. file into raw C++ code, what would I do?)

Basically, I just want to have enough low-level knowledge about computer graphics to be able to create something like 2D game engine from scratch.


texts: What are do's and don'ts on published APK for alpha and beta testing and how to manage it in Google Play for developers?

texts:
Before the official public release or publishing the first prototype game, I learned about alpha and beta testing in order to gain feedback and fixes needed to improve or correct the game's system. I have some several questions regarding this feature on development feature on Google Play where game developers can publish games:

Is it okay include the actual ad banner display (via AdMob) on game screen during publishing for alpha or beta testing in Google Play developer section?
My alpha version is published but why I can't see the published app on Google Play store? I set it for open alpha testing, with only 1,000-1,500 random users.
After I published for the alpha testing, I tried this link download it via different user but it appeared nothing (even the URL to the APK install download) except the main Gmail account I used as my main source for collecting feedback and as a username to gain access to Google Play Developer. How will ensure to other users to download and test the app during open alpha testing version via invite links?
Lastly, whatever the APK version no. for alpha would be the same for beta and official release or not?


texts:
I'm looking to take a 2D texture (previously rendered from the user's perspective), and overlay it overtop of a cubemap.

Since a cubemap has 6 textures, I need to run a shader over top of all 6, and use some formula for calculating the UV from a given view.

I'm at a loss for how to calculate this.

Here's an illustration

If the user were to spin around in 1 spot, they would build up full panoramic cubemap.

The intention is to reuse end-of-frame data to update a persistent cubemap that follows the user.

I know how to build manual cubemaps by rendering a scene 6 times, once on all axes, however in this case I wish to take an already rendered view and transplant it onto the correct spots on a cubemap.


texts: Creating 2d array in gamemaker from code

texts:
According to GameMaker2 arrays documentation, GML has 2d arrays. At the same time I could not find any references how can I create 2d array from code. I tried doing

board = array_create(global.MAX_HEIGHT);
for(var i = 0; i < global.MAX_HEIGHT; i++){
    board[i] = array_create(global.MAX_WIDTH);
}

but that seems to have created a 1d array of 1d arrays, meaning I cannot access them using board[x, y] (if I try it doesn't assign values properly) , or even board[x][y] (compilation error). Is there a way to dynamically create 2d array? Or to access this array more elegantly, instead of having to use

inside_array = board[i];
inside_array[j] = value;


texts: How do I handle packet loss in a client-server network model?

texts:
In a client-server network model, the clients only send commands to the server (i.e. coordinates of a click, fire gun, etc.) and the server then runs those commands to produce a game state.

But what if the client sends a command like "fire gun" in one packet which is dropped. Does the user experience that he tapped his fire-button with nothing happening or is there some intelligent way to make sure that such commands are received by the server regardless of packet loss?

I.e continuing to send the old "fire gun" command multiple times to ensure that it at least eventually fires (tagging the command so that the server understands that it is the same command sent multiple times, not a command that is fired over and over).

I've been looking at documentation regarding Quake3, Unreal and Source Network Models but I cannot find anything on this particular problem. I do believe they have solved it though because I never fired my AWP without it actually shooting. If there was lag involved, then it just took a short while before it shot, but it's never lost the command I think.

EDIT: I've found a resource that explains one way to handle this here: http://gafferongames.com/networking-for-game-programmers/reliability-and-flow-control/

They solve it by adding a kind of loose ACK on top of UDP. I feel like there should be a smarter way to go about it however. This way of handling it is ok for the server I guess which mostly needs to make sure that it has a live connection to the and to handle things such as chat messages (which are not really time sensitive but cannot be allowed to get lost) but for the client I believe an ACK creates too much delay when a packet is lost (a full round time latency at the very least).


texts: unable to launch LibGDX Particle Editor.jnlp

texts:
I am not able to launch LibGDX ParticleEditor.jnlp file on my system(win7 64 bit) with java7.

when I execute this file with javaws.exe in jre7/bin folder, it displays splash screen of badlogic games for jst 2-3 sec but after that it gives an alert having error message "Unable to launch application". And the exception is :

com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://libgdx.googlecode.com/svn/jws/gdx-tools.jar
    at com.sun.javaws.security.SigningInfo.getCommonCodeSignersForJar(Unknown Source)
    at com.sun.javaws.security.SigningInfo.check(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I've googled this problem,, but still unresolved. Please help me .


texts: How to measure time interval (different languages)

texts:
What is the recommended way to measure time intervals for a game loop?

Consider the situation in which a developer is writing their own game loop. Using a third party game engine such that you do not write your own game loop is beyond this question.

In general I want the best API from the standard library, unless there is reason to not use it. The exception being well stablished game development libraries that do not force a game loop on the developers.

Ideally the solution is not to use System time. We want something unaffected by time zones, leap seconds, daylight saving, the user messing with the system clock, etc… plus the system time usually has poor resolution for games.

I also found Time a Function - Rosetta Code, it uses system time in some cases.

This is a community wiki.


texts: How to gain visibility on the Play Store?

texts:
Sometime in the near future I'll release my first Android game. It's not going to be anything special, but I'm trying to make it as polished as possible and I would like to know what I can do to prevent it from falling into obscurity.

If you look hard enough, you can find some pretty well-crafted games on the Play Store that, nonetheless, are virtually unknown. I recently came across one developer that has published six well made games that are pretty fun and have good art as well; out of these six, two are moderately popular (10,000–50,000 downloads), while the rest have very few downloads (1,000 or fewer).

What are some techniques to increase your game's visibility on Google Play upon its launch?


texts: How are Tile Collision Slopes done in Game Maker Studio 2 / GML or in general?

texts:
I have been trying to get my slopes to function for almost a month now, doing nothing else with the project.
Rewrote it 6-7 times in different collision styles, sometimes coming close to success while still being stuck with absolutely no help I could find during this month.
Here are the methods that I tried and what happened:
First I followed a video tutorial specific to game maker 2's tile collisions.
It fills an array with how many pixels are filled on the y axis for every pixel on the x.
Then it calculates how deep the player's (bounding box) bottom-center is in the slope tile and pushes him above the corresponding pixel count from the array.
Worked great for my floor slopes, didn't for my ceiling slopes.
So I tried to reverse the way the pixels are counted and got a proper array, however fiddling with this system for 2 weeks alone, I still got stuck, presumably due to a math error.
If you are interested about this system, I basically posted everything there is to it on the yoyogames forums:
Here
I definitely need ceiling slopes to work, since the game is a Metroidvania like game, where there might be a lot more vertical movement going on.
But then I figured, I could simplify this whole procedure, since my pixel art aesthetic currently uses one type of slope (where I potentially would like to keep the system to work with any slope that is a straight line for future additions)
Currently my only slope is 2 tiles wide and 1 tile high.
I tried around with setting the player's y coordinate according to the linear function
y = m*x + b
I tested this by putting in y = -0.5 * current player position + the y coordinate of the slope tile in the room.
However this function sets my player a fair bit above the slope, in the air.
I know this is a lot to ask and maybe I'm totally stupid about this problem but I really tried HARD on this one, with my current knowledge and the one that is readily available I can't solve my issue.


texts: How can I achieve a constant drop rate with a variable frame rate?

texts:
In my game, I have particles that should spawn at random intervals but with an average rate of x per second.

However, the frame-rate varies from around 60 fps all the way to around 3000 fps. I would like to maintain a variable frame-rate to ensure the game looks as smooth as possible, but this means I cannot simply create particles with probability x each frame:

if (random.Next(100) > x)
{
    // Create particle...
}

How can I maintain a constant "real time" drop-rate when the frame rate fluctuates?

Note that I have a variable dt which is the number of seconds since the last frame.


texts: How to use Pixel Bender (pbj) in ActionScript3 on large Vectors to make fast calculations?

texts:
Remember my old question: 2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing?

I figured I could use a Pixel Bender Shader to do the computation for any large group of elements in a game to save on processing time. At least it's a theory worth checking.

I also read this question: Pass large array to pixel shader

Which I'm guessing is about accomplishing the same thing in a different language.

I read this tutorial: http://unitzeroone.com/blog/2009/03/18/flash-10-massive-amounts-of-3d-particles-with-alchemy-source-included/

I am attempting to do some tests. Here is some of the code:

        private const SIZE : int = Math.pow(10, 5);
        private var testVectorNum : Vector.<Number>;

        private function testShader():void
        {
            shader.data.ab.value = [1.0, 8.0];
            shader.data.src.input = testVectorNum;

            shader.data.src.width = SIZE/400;
            shader.data.src.height = 100;
            shaderJob = new ShaderJob(shader, testVectorNum, SIZE / 4, 1);
            var time : int = getTimer(), i : int = 0;
            shaderJob.start(true);
            trace("TEST1 : ", getTimer() - time);
        }

The problem is that I keep getting a error saying:

[Fault] exception, information=Error: Error #1000: The system is out of memory.

Update:

I managed to partially workaround the problem by converting the vector into bitmapData:
(Using this technique I still get a speed boost of 3x using Pixel Bender)

    private function testShader():void
    {
        shader.data.ab.value = [1.0, 8.0];
        var time : int = getTimer(), i : int = 0;
        testBitmapData.setVector(testBitmapData.rect, testVectorInt);
        shader.data.src.input = testBitmapData;

        shaderJob = new ShaderJob(shader, testBitmapData);
        shaderJob.start(true);
        testVectorInt = testBitmapData.getVector(testBitmapData.rect);
        trace("TEST1 : ", getTimer() - time);
    }


texts: Completely Pixelated Font in JavaScript Canvas?

texts:
I'm making a game with a canvas scaled up such that each pixel is pretty big. I want to display some pixelated text without anti-aliasing but I have idea how I would accomplish this.

Is there I way can do such a thing?


texts: Can I develop a game on PC in Java and move it to Android?

texts:
I have fairly good experience with Java, but new to Android development. I would like to develop a 2D game which would have animations and online play.

Can I initially develop this game on my pc using Java and then implement in Android?

Will the canvas in Java be sufficient or should I use a game engine?


texts: How to manage sleep/awake state of physics body

texts:
I have a loop, which updates all the physics, inside the loop I'm updating the position of the objects, first thing is the gravity, which pulls all the objects to the bottom.
Now my question is, how do I manage the sleep/awake state of the object, let's say the object reached some static body, like ground. So it won't continue falling down because of the gravitation pull?


texts:
I am writing an city builder. The graphics should look pretty simple, there are no fancy models or textures. Something like Synekism. Thus I have only simple models for buildings and splines for roads.

What is a good way to render that? I heard about instanced rendering, but my objects are all slightly different (different height/width/depth).

Right now I have a VBO and VAO for each object, and I know I can already speed things up by only using one VAO for all objects, right? But what then?


texts: Why do my character's feet slide when I auto-configure a humanoid rig in Unity3D?

texts:
I've downloaded an FBX animation of someone walking from the "Walking" section here.

I imported that and also a humanoid character and specified the Rig for both as Humanoid (auto-create).

The original animation has very solid foot placement, but whenever I apply it to any character in Unity the feet slide around as if it were walking on ice.

Here is a video demonstrating my issue. Is there something about the way I am getting Unity to auto-rig my character that would cause this problem? It happens no matter which 3D character I use.

Thanks


texts: Card game design, converting cards back into gold

texts:
I'm working on a collectible card game on the card game platform dulst. https://dulst.com/nasuverse

I want to implement a mechanic for players to convert their unused cards back into a currency so that the cards aren't just sitting there doing nothing.

I'm considering allowing them to simply sell their cards for gold. Gold can then be used to buy more packs which give them random cards. Gold is normally obtained by winning games. In the future I would consider allowing real-money transactions to purchase gold.

Another thing I can do is to convert the cards into a separate currency that's not gold. That other currency can then be used to craft more cards. What are some reasons why you would want to use a separate currency instead of straight up gold?

Thanks.


texts: initialising units' properties & upgrades

texts:
I'm making a RTS in which units can get several cyber-upgrades (individual, not as a global tech-tree upgrade like in most RTS games) before they're created. Now, I'm trying to decide how to do this, logic-wise. The system I have right now is that each unit type (walker, car, etc.) is a class, and when I initiate an instance of the class I add all the modifiers to the constructor, and let the constructor handle all the modifications.

This seems to me like the wrong way to do it - it means copy-pasted code in all the constructors. The other idea I had was to have each modification as a static method that takes a Unit class and modifies it - but the modifications might need access to private memebers (health, speed, etc.), and if I write the methods per-class, again I achieved copy-pasted code. As far as I know there's no way that a external static method can access private fields, and I don't want to create properties for every field, so as not to make the classes too cumbersome to use.

Example, to clarify:
let's say I create a new Agent, and I want him to have bionic feet (+5 speed), x-ray vision (change of sight-function) and armored body (change of hit effects). I could use a constructor like Agent(speed, vision, armor), but if I'd later want to create new upgrades, such as fast reactions (+5 initiative), I'd have to change the constructor's signature.
I could use a constructor like Agent(List), and then in the constructor create a giant swtich/case for every available upgrade, but then, I'd have to copy it also to the constructor of Vehicle, and make sure I update both of them, exactly the same.
What I'd like to do is have a basic constructor and after it have a:

internal delegate void Effect(Unit ent);

void setup(List<Effect> list)
{
    foreach(Effect effect in list) effect(this);
}

method, and then run every effect in the list on the new Unit, but then the Effect can't access the unit's private members.

Is there an elegant solution to the problem?


texts: What's the difference between XNA Game Services and glorified global variables?

texts:
The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method.

Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator)

Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything.

So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti-pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services.

So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?


texts:
I have app for Android with OpenGL. It uses GPU-heavy effects and on "slow" GPUs this leads to low FPS. Is there a way, how to detect "slow" GPU during app start and disable those effects and generate low-poly geometry? By "slow" I mean GPUs based on their frequncy, VRAM and info like this. Lower values mean slower GPU. It is quite "easy" way, but it should be enough.

I cannot do it in runtime based on frame time, because it would require reload of geometry, shaders etc. and it would be inconvinient for user.


texts: What is the purpose for multiple windows in games?

texts: A lot of game development APIs recently got support for multiple windows (such as SDL 2, and GLFW 3). But why did they add that feature? I've never seen a game in my life use multiple windows (with the exceptions of a launcher, or a messagebox). Is there something I'm missing here? Is there an actual game development purpose to it? I'm very confused of why they did that.


texts:
How can I prevent the following animation frames from affecting the state of the previous animation frames in Unity?
E.g. I create a frame at 0:20 by moving a character leg. And that is it - that is what I would like my character to look like at the 0:20 and I would like to change nothing more about the current positioning of my character parts and never.
But, here I proceed to the 0:40 and move another part of my character - foot this time. And now instead of starting to move after the 0:20 the foot starts to move from the 0:00.
That drives me crazy, because now I have to go through all of the frames before the 0:40 and modify the foot position. Of course in the presented case there is only one frame to update - that is the 0:20. But when I work with complex and long animations I easily stumble across having to update 10 or even more of the previous frames each time I decide to move a part which I did not move in the previous frames.
I noticed the Add keyframe button in the Animation window. I would expect it to preserve all the character parts in frame and solve my issue. But it does not prevent the case explained above from happening.
Another thing I was thinking about is to develop animations backwards - starting from the last frame and proceed to the first frame. But that feels like a lame user experience from a Unity user point of view.
Any help here would be appreciated.


texts: Confusing with an articles wording on Clamping a Vector2

texts:
I have been reading an article on Collision Detection and how to resolve it.

http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/

In the section describing an AABB vs Circle, it states:

  The first step is to get the centre of the circle and project it on to the boundary of the AABB. Fortunately this is as easy as forming the vector V between AABB and circle and simply clamping it against the half extents of the AABB.

In the picture provided, it makes sense. You get the vector between the two objects, and then get the closest virtice to the circle and use that in your computation.

But, how DO you take the width/height into account to that new vector? He says "..simply clamping it against the half extends of the AABB"

Can anyone clarify what he means?


texts:
I've got animations and simple movements down as well as attacking, although I'm having my difficulties with jumping and I'm not sure how to make it work.

using UnityEngine;

public class Player : MonoBehaviour
{
    private Rigidbody rb;
    public float speed = 100f;
    public float jumpforce = 50f;
    public float movement = 0f;
    public Vector3 jump;
    public LayerMask ground;
    public bool onground;
    public float groundcheckradius;
    public Transform groundcheck;

    void OncollisionStay() { onground = true; }

    void Start()
    {
        rb = GetComponent<Rigidbody>();
        jump = new Vector3(0f, 50f, 0f);
    }

    void FixedUpdate()
    {
        onground = Physics.OverlapSphere(groundcheck.position, groundcheckradius, ground);

        if(Input.GetKeyDown(KeyCode.Space)&& onground) {
            rb.AddForce(jumpforce * jump, ForceMode.Impulse);
            onground = false;
        }

        if (Input.GetKey(KeyCode.W))
        {
            rb.velocity = new Vector3(0, 0, speed * Time.deltaTime);
        }
        {
            if (Input.GetKey(KeyCode.S))
            {
                rb.velocity = new Vector3(0, 0, -speed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.D))
            {
                rb.velocity = new Vector3(speed * Time.deltaTime, 0, 0);
            }
            if (Input.GetKey(KeyCode.A))
            {
                rb.velocity = new Vector3(-speed * Time.deltaTime, 0, 0);
            }
        }
    }
}


texts: Converting eulerAngles to "Inspector rotation"

texts:
The inspector shows certain rotation values for Game Objects.

I would like to work with these instead of the eulerAngles (which are the rotation values that I can access by a script).

To get these rotation values shown by the Inspector, I found out that the eulerAngles of the game object's localRotation could be of help.

I'm not sure if my approach is correct.

Can somebody tell me what I'm actually trying to do here (I guess there is a name for it) and how to do that correctly?

My current approach is this:

private float EulerToRotation(float value)
{
    if (value > 180)
    {
        return value - 360f;
    }
    else if (value < -180)
    {
        return value + 360f;
    }
    else
    {
        return value;
    }
}


texts: Using depth values for fake ambient occlusion

texts: I'm using the normalized distance to the camera to get depth information in the fragment shader. When using this value as fragment color, it looks at lot like ambient occlusion (of course only in the right angle). I want to abuse this method to use it as fast AO approximation for my mobile game, but I don't know how to go on from here. My idea was to substract the distance of each fragment with a value from the projection to only leave the dark areas and remove the depth gradient. How would I procceed with this approach and is it even capable of achieving my desired result?


texts: Is there a way to to count the vertices in a optimised/cooked mesh collider uses?

texts:
I need to get the number of vertices a mesh collider's mesh has. As pointed out in the comments this may not even be a mesh anymore, but is there a way to count the vertices of whatever data structure a MeshCollider uses to store it's 'mesh'?
I'm currently using
MeshCollider.sharedMesh.vertexCount;

But seems to get the mesh that the collider initially uses and has a reference to, not the what actually used by the physics simulation. As cooking -> cook for faster simulation seems to drastically alter this mesh.


texts: What is the impact of adding an emoticon to an app title?

texts:
Is there research that shows that adding an emoticon into an Android app title impacts (positively or negatively) the App Store Optimization (ASO) and conversion rate?

What is the conclusion?


texts:
I wonder if you can create a cube of water within the unity!

I'm starting to use the Unity, and took a sought as to whether there was already something like this ... but have not found any tutorial

The idea is to use the 3D feature of water and turn it into a 2D scenario:

As shown below:

For this result:

The idea would be to make the cube of the material is "water".

Its possible?


texts: HLSL DXGI_FORMAT_A8_UNORM Texture - dark colors appear less opaque than white

texts:
I am trying to render a DXGI_FORMAT_A8_UNORM texture (precisely, a font bitmap) in multiple colors by specifying the color per vertex and then apply the alpha value from the sampled texture in the pixel shader. When white is specified as the vertex color, the rendered texture looks as expected, however with darker colors the texture looks "thinned" or less opaque, as displayed in the attached picture.
These are the used shaders, with fontSampler using D3D11_FILTER_MIN_MAG_MIP_POINT as filter:

Texture2D shaderTexture : register(t0);
SamplerState fontSampler : register(s0);

struct VS_INPUT
{
    float2 pos : POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

struct VS_OUTPUT
{
    float4 pos : SV_POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

VS_OUTPUT VS(VS_INPUT input)
{
    VS_OUTPUT output;
    output.pos = mul(projection, float4(input.pos.xy, 0.f, 1.f));
    output.col = input.col;
    output.tex = input.tex;
    return output;
}

float4 PS(VS_OUTPUT input) : SV_TARGET
{
    input.col.a = shaderTexture.Sample(fontSampler, input.tex).a;
    return input.col;
}


texts: What are the app file size limitations for different smartphone OSes & carriers?

texts:
I know the iPhone App Store limits how large an app can be in general and there are also limitations with AT&T over the size it can be to transmit over a data plan vs WiFi. I have no idea what, if any, these limits are for Android apps and what I'm finding online is a mix of different numbers.

Does anyone know these numbers definitively? The Android game I'm porting is in the 20-30MB range and we'd like to know if we need to further reduce its size.


texts:
I am developing a 2D Java Game with LibGDX. This is what it kinda looks like (simplified):

The big black circle is the player, which you can move by tilting the smartphone. The red circles and blue rectangles are enemies, which will move from the right of the screen to the left. The player has to avoid crashing into them.
Right now I am checking in the Game Loop every enemy against the player, whether they collide or not. This seems kinda inefficient to me, but I don't know how to improve it.
I have tried the Quadtree approach, but it did not really work. The player could easily glitch through enemies and the collision was not detected. Unfortunately, I have destroyed the Quadtree implementation. I used this tutorial/blog as my Quadtree implementation.


texts: Public domain piece found on You Tube but recorded by someone else

texts: I want to use a public domain piece found on YouTube but it was recorded in midi form by someone else.  I only want sections of it, not the whole thing. Do I need permission?


texts:
I'm having some trouble with isometric walls.

I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice grid. The code (and this seems to be pretty much standard for isometric floor drawing) is as follows:

for(int x = 0; x < 6; x++){
    for(int y  = 3; y >=0 ; y--){

        int xCo = (y+x)*(tileWidth/2);
        int yCo = (x-y)*(tileHeight/2);
        tile.draw(g, xCo, yCo);
    }
}

This makes a nice little floor grid. See here.

Unfortunately, when I use the same logic for walls, it all goes right to hell.

for(int x = 0; x < 6; x++){
    for(int y  = 3; y >= 0 ; y--){

        int xCo = (y+x)*(wallWidth()/2);
        int yCo = (x-y)*(wallHeight()/2);
        walls.draw(g, xCo, yCo);
    }
}

I'm using a placeholder as my wall tile (it's a placeholder from google image search, but it should work all the same), and this is the result I get.

The rendering order for my walls is clearly correct, nearer walls render on top of farther away walls, which is what I want, but the positioning is also painfully incorrect, and I don't know exactly how I ought to correct that short of using pixel values.

For reference, I did do a trial using hardcoded pixel vals, because I found that from one wall's right corner to the next wall's right corner, the change was exactly (200, -100) pixels. When I made my rendering loop account for that

int xCo = (x+y)*200;
int yCo = (y-x)*-100;

it worked fine, but that is not a viable solution because it doesn't allow for any versatility.

So, looking for suggestions on how to make my isometric walls line up. What am I doing wrong?

Thanks!


texts: XNA 4.0 How to combine triangles vertices 3D

texts:
Preview for the problem:

I'm making a similar game to Minecraft (a game that it's world is made by cubes), but the fps of the game is getting low only by rendering a little amount of cubes in the world.

So I decided to use the Combine/Margin technique to improve it. I want to combine cubes that are from the same type and there positions are next to each other.

Lets say I have 4 faces of cubes that are next to each other in that order:

[+] [+]

[+] [+]

Right Now: I am rendering each face with 2 triangles so in total I render all of the faces with 8 triangles.

Improvment That I Want To Make: I want to render these faces with only 2 triangles but to keep the textures where they are at. Which means to use only 2 tringles for 4 faces and to use 4 textures in that area.

OUT OF THE TOPIC:

Currently I'm using:

Frustum culling.
Not rendering cube faces that are on each other.

Which fps improvment techniques do you recommend me to use?
Currently when I'm rendering only 1500 faces at the same time [3000 triangles] my game is getting to about 25~ fps.


texts:
I'm designing my assets, and thinking about using a UUID or a name for accessing them. I decided to use UUIDs for identifying them and for storing/accessing the cache, but what if I want to get/use an asset in my script? Do I have to know the UUID of the asset? Having a name identifier will help, but this should also be unique, so I don't know if it's a good idea having both identifiers in the asset.

This seems unintuitive; I have always accessed them by name, like this:

// before:
TextureCache *tc = ...
auto texture = tc->get("Mario");  // (more intuitive)

// now:
TextureCache *tc = ...
auto texture = tc->get(234242423424234);  // (not intuitive)

How do you retrieve assets that have been stored by UUID?


texts: Can someone explain this Pulsate code to me

texts:
// Pulsate the size of the selected menu entry.
double time = gametime.TotalGameTime.TotalSeconds;
float pulsate = (float)Math.Sin(time * 6) + 1;
scale = new Scale(1 + pulsate * 0.05f,1 + pulsate * 0.05f);

I grabbed it from the XNA GameState sample and just curious.


texts: Why is not the projectile going toward the target?

texts:
I have a project where I can shoot (with a simple projectile).

Character Blueprint (generate projectile):

However I would like to be able to make the projectile go towards a specific target.

Projectile Blueprint (target definition):

And I think that with the code below I would achieve the expected effect.

Projectile Blueprint (change projectile rotation):

Some links that helped me get here (I may have let something pass):

https://www.youtube.com/watch?v=oyNzsbTpGqg

https://forums.unrealengine.com/community/community-content-tools-and-tutorials/48896-homing-missile?77586-Homing-missile=

https://answers.unrealengine.com/questions/239188/rinterp-to-doesnt-slowly-change-character-rotation.html

I do not know what I'm doing wrong (based on the links above).

The projectile walks straight and visibly I see no change in its trajectory.


texts: How to perform a sliding collision between a square and a circle?

texts:
Please point me to the duplicate if this has been asked before. I couldn't find it.
Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are represented by 16x16 squares. I have gotten collision detection working, such that the player cannot collide with tiles, by using the following algorithm:
let curPosition = player.position;
let newPosition = player.position + player.velocity;

if (canTouchPosition(newPosition.x, curPosition.y)) {
  player.position.x = newPos.x;
}

if (canTouchPosition(curPosition.x, newPosition.y)) {
  player.position.y = newPos.y;
}

if (canTouchPosition(newPosition.x, newPosition.y)) {
  player.position.x = newPos.x;
  player.position.y = newPos.y;
}

This works, except there's a problem. If the player is on the edge of a tile and moving to the right, I want them to slide past it, instead of getting stuck. Like so:

See how currently the circle is stuck on the corner when trying to move right? Instead I want it to slide along the corner until it is able to move freely, and then continue moving to the right. I can't quite figure this out. I figure a circle would make this easier, but if a square is instead easier to perform this operation on, maybe I'll use one of those instead? I mostly just want to get it working.


texts: Recommended data structure for storage and fast access of infinite chunk-based heightmap terrain

texts:
I'm aiming to create a chunk based heightmap terrain in Unity.
I already have a basic multifractal simplex noise set up and working, able to generate heightfields and meshes at runtime... but only individually for the moment.

I'm attempting to work out how best to store and access each chunk.  I already have a couple of methods worked out to convert global positions to chunk coordinates and chunk-local barycentric triangle coordinates, so I can interpolate heights.  I've used that to build a method to march a camera-space-to-world-space ray across the mesh and iterate through x/z-plane intersections until it finds the height-intersection - for a fast way to look up mouse-position on the terrain without having to attach physics collision meshes for each chunk and use Unity's raycasting.  That's all working nicely.

I'm just a bit stumped now on how to implement the main infinite-grid storage that I'll generate chunk meshes from.

This is planned to be in service of a game with an isometric perspective, revealing the world as units explore fog-of-war over time... with the ability to move the camera around the uncovered terrain fairly quickly, so I'm guessing there might be limited scope for unloading previously generated chunks... it'll be an ever-expanding dataset (so I'll presumably have to be looking for ways to keep it light on memory)

I figure I can either:

Create a 2-dimensional array of float (or perhaps short - 64k height levels should probably be plenty) for the entire terrain, and dynamically resize the array as each x/z boundary is pushed back.  Generate just the terrain mesh in chunks, to keep each mesh chunk under the Unity 64k-vertex limit.
Create a grid manager class, which has some kind of dynamic data structure that stores map-chunk objects, and instantiates them/retains references to them as they're demanded, each of which would contain its own (res*res)-sized heightmap array.
Something else?

I'm assuming option 2 will have the most mileage, but what I'm most unsure about is what kind of dynamic data structure to use.  I'd guess some kind of key/object pair structure, where the key is built from the chunk coordinates?

Assuming I'll want to access height-values quickly and constantly, across chunk-boundaries, for things like my mouse-ray-intersection method, and for pathfinding code, etc... I presume I'll need a way to access chunks that is nearly as fast as looking up arrays by indices, and O(1) complexity.
Or perhaps some way of caching recently-accessed chunks or chunks that the camera is near?  Or pointers to them, or something?

As you can probably tell I'm fairly new to the gamedev side of things, but I have a VFX background, and so know my way around 3D geometry math and basic scripting.  In terms of designing/structuring/implementing a game, I'm a total novice though, so any pointers to relevant tutorials and such would be much appreciated.


texts: Getting warning after importing plugin to unity5 project

texts: I am getting following warning when I import any plugin to my unity5 project.Whats the solution for this warning? Is there any problem with that which will affect my project.


texts:
Right now I am using the following two shaders to render a sprite from a texture used as a sprite atlas onto a canvas that has canvas_size pixels in screen coordinates.

I use a static quad as input vertex coordinates form (0,0) to (1,1) and pass the actual position of the sprite onscreen within the uniform buffer to the shader and call a single glDrawElements for each sprite to draw.

 #version 300 es
 layout(std140) uniform Environment {
    vec2 canvas_size;
 };
 layout(std140) uniform Sprite {
    vec2 sprite_position;
    vec2 sprite_size;
    float sprite_rotation;
 };
 layout(std140) uniform Texture {
    vec2 position_in_texture;
    vec2 size_in_texture;
 };
 layout(location=0) in vec2 vertex;
 out vec2 texture_coordinate;
 void main(){
    /* y is flipped because pictures have their origin at the upper left corner
     * but textures have them at the lower left ... */
    texture_coordinate = vec2(position_in_texture.x + vertex.x * size_in_texture.x,
                         1.0 - (position_in_texture.y + vertex.y * size_in_texture.y));
    vec4 pos = vec4(vertex, -1.0, 1.0);
    /* Rotate sprite around it's center */
    mat4 rotate = mat4( cos(sprite_rotation), -sin(sprite_rotation), 0.0, 0.0,
                        sin(sprite_rotation), cos(sprite_rotation), 0.0, 0.0,
                        0.0, 0.0, 1.0, 0.0,
                        -0.5*cos(sprite_rotation)-0.5*(sin(sprite_rotation))+0.5, -0.5*cos(sprite_rotation)-0.5*(-sin(sprite_rotation))+0.5, 0.0, 1.0);
    /* Move the "stamp" for the sprite to the desired position onscreen */
    mat4 move = mat4(2.0 * sprite_size.x / canvas_size.x, 0.0, 0.0, 0.0,
                     0.0, -2.0 * sprite_size.y / canvas_size.y, 0.0, 0.0,
                     0.0, 0.0, 1.0, 0.0,
                     2.0 * sprite_position.x / canvas_size.x - 1.0, 1.0 - 2.0 * sprite_position.y / canvas_size.y, 0.0, 1.0);
    gl_Position = move * rotate * pos;
 }

Fragment Shader:

 #version 300 es
 precision highp float;
 uniform sampler2D color_map;
 in vec2 texture_coordinate;
 layout(std140) uniform Color {
    vec4 hue;
    vec4 filter_;
 };
 layout(location = 0) out vec4 out_color;
 void main() {
    vec4 tex_color = texture(color_map, texture_coordinate);
    if(tex_color.a == 0.0) {
        discard; /* For stenciling */
    }
    /* Apply a hue to the sprite */
    vec4 hue_color = vec4(mix(tex_color.rgb, hue.rgb, hue.a), tex_color.a);
    /* Apply a filter to the sprite */
    out_color = vec4(hue_color.r * filter_.r, hue_color.g * filter_.g, hue_color.b * filter_.b, hue_color.a * filter_.a);
 }

Since you always learn more and more about OpenGL and GLSL I just found out there are functions textureSize as well as texelFetch to get the size of the texture currently bound and a pixel of a texture at an exact position.

Now I am wondering if I can improve the semantics of my shader by using these functions instead of what I already use. As I am providing the position_in_texture and size_in_texture still in terms of float values, I'd like to also provide these values in pixel values and let the annoying texture coordinate calculation be done wholly by the shader. That can easily be done with textureSize and simple division I hope.

Also, for other shaders that build upon this basic framework to draw pixel perfect images at a pixel perfect position within my canvas, I'd like to be able to sample pixels around a pixel in a texture for blending and blur purposes.

How are fetchTexel pixels arranged? (0,0) at the bottom or top left?

Is there a performance loss using fetchTexel instead of texture?

Do you have any improvement ideas to what I already do, or implementation samples or ideas upon my existing code?


texts: How to setup libGDX project only for Android & iOS?

texts:
I have developed some applications on android.But now i want to learn game development in Android & iOS with libGDX.
I want to only develop for Android & iPhone.I do not want a desktop project.
All tutorials tell me to first create desktop project than write code in main project & than run as Android application.
But i want to write code in android project using both android & libGDX features.
Is this possible ? if yes than how ?


texts: How to implement physics and AoE spells in an MMO game?

texts:
I'm making a game which will be completely centered around PVP battlegrounds and arenas. Think something like WoW, but with the RPG part removed. There will just be a lobby, where you can join a battleground and fight. I plan to use WebGL with the Three.js abstraction.

So, making a game where people can just hit each other isn't my problem - I'd like to have physics play a big role. I simply don't understand how is that possible with open source clients (open source, because it's a website)!

Also, by physics I mean things like burning logs rolling over from a hill, spells that send everything flying around, possibility of dying when hit by a high-velocity object, and so on.

I seem to have only two options:

A, do the calculations on the server

B, do the calculations on the client side

With A, the problem is that I plan to use some plugins for collision detection, and I need to have all the meshes and bounding boxes to test, which I only have access to on the client side! Also, physics might be just a bit too much for my servers to handle.

The obvious problem with B is that you can never trust the client. If I depend on the client telling me that the player got hit really hard and that he did, in fact, throw the player somewhere, that's an obvious security hole. The user can make a simple script that blocks any messages with a "he got hit" header or something, and become invincible.

But, while I was writing this, I came up with a third option, which is to let the client care about others, not just about itself. This falls under the reality checking category, I believe, because if the majority says that someone got hit, and he says he didn't, I'd trust the majority... This option's flaw is that it might be a really big strain on the clients, because this will be a browser game, and my resources are limited.


texts: How do I make my Slick2D game fullscreen?

texts: How do I make my game fullscreen? It's always in windowed mode. I'm using Eclipse on a Mac.


texts: I have an element inside the screen and I want to set my phone's bounds as a wall where elements are bouncing. I want it to be physically correct. How to do this?


texts: How can I implement pathfinding that avoids obstacles on a spherical planet?

texts:
Hi everyone, I am trying to make the enemy go around the planet, towards the player (I am using Faux Gravity for the movement logic).

I tried using Unity's NavMesh tools, but because this is not a flat mesh, they didn't really get the job done;

How can I make my enemies go around the planet towards the enemy in a physics based way?

I thought about calculating the a direction from the enemy towards the player and then moving the player towards a vector perpendicular to the planet's surface (in this case transform.forward) like so:

This way I can correctly move enemies towards the player, but the AI doesn't have any notion of any possible obstacle it should avoid.

I am specifically looking for some sort of A* algorithm, that would work on a spherical surface, like the one of a planet.

Is there a better way to do this?


texts: Should I use a FOV slider or fixed camera fov?

texts: I'm making a single-player third person 3D adventure game, and I was wondering if I should fix the camera's FOV, or if I should create an in-game slider to change it. If I should create a slider, what should I limit the range to, and what should be the default?


texts: Unity FP Character Can't Look Vertically

texts:
I have a FP Character and well, it can't look vertically. Its happened about 3 times now, each time I just replaced it with the standard assets prefab, first few times it worked fine, but then after a little while, I suddenly couldn't look vertically. I have checked and double check the vertical clamping on the prefab and they haven't been touched. I really need my player to be able to look vertically as soon as possible, could someone show me how to fix this?

Thanks in advance!


texts: Algorithms for positioning rectangles evenly spaced with unknown connecting lines

texts:
I'm new to game development, but I'm trying to figure out a good algorithm for positioning rectangles (of any width and height) in a given surface area, and connecting them with any variation of lines.  Two rectangles will never have more than one line connecting them.

Where would I begin working on a problem like this?  This is only a 2 dimensional surface.  I read about graph theory, and it seems like this is a close representation of that.  The rectangles would be considered a node, and the lines connecting them would be considered an edge in graph theory.


texts:
I have a staggered hexagonal map created with "tiled" map editor and I want to calculate the height of this map in pixels, the example map below should be MAP_WIDTH_IN_PX = 1056 and MAP_HEIGHT_IN_PX = 303;

MAP_WIDTH = map.getProperties().get("width",Integer.class); //16 tiles
MAP_HEIGHT = map.getProperties().get("height",Integer.class); //5 tiles
TILE_WIDTH = map.getProperties().get("tilewidth",Integer.class); //64px
TILE_HEIGHT = map.getProperties().get("tileheight",Integer.class); //84px
TILE_SIDE_LENGTH = 27; //this value is set in the map editor

MAP_HEIGHT_IN_PX = ?;
MAP_WIDTH_IN_PX = MAP_WIDTH * TILE_WIDTH + TILE_WIDTH * 0.5f;


texts:
There is a very good game loop in the link which is tailored for windows forms. I need it in c++/cli so I converted the code as below. Here is my main loop.

using namespace System;
using namespace System::Windows::Forms;

HWND g_theAppHandle = nullptr;

bool IsApplicationIdle()
{
  MSG msg;
  return PeekMessage(&msg, g_theAppHandle, 0, 0, 0) == 0;
}

void OnIdle(System::Object ^sender, System::EventArgs ^e)
{
  while (IsApplicationIdle())
  {
    if (PunkEd::ABTCLI::g_initSuccess)
    {
      PunkEd::ABTCLI::Frame(0.0f);
    }
  }
}

[STAThread]
int CALLBACK WinMain(
  _In_ HINSTANCE hInstance,
  _In_ HINSTANCE hPrevInstance,
  _In_ LPSTR     lpCmdLine,
  _In_ int       nCmdShow
  )
{
  _CrtMemState memstate;
  _CrtMemCheckpoint(&memstate);

  PunkEd::PunkEdMain^ theApp = gcnew PunkEd::PunkEdMain;
  g_theAppHandle = (HWND)theApp->Handle.ToPointer();

  Application::Idle += gcnew System::EventHandler(&OnIdle);
  Application::Run(theApp);

  _CrtMemDumpAllObjectsSince(&memstate);
  return 0;
}

This loop triggers PunkEd::ABTCLI::Frame(0.0f); every time the application is idle. And Frame(float deltaTime); function triggers everyting related to game. Like render and physics. However my rendering window is a panel. And I override its mouse move callback as below.

private: System::Void panel1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
  Debug::WriteLine(e->Location);

  glm::vec3 cp = glm::vec3(e->Location.X, e->Location.Y, 0);
  glm::mat4 view = g_camera->GetViewMatrix();
  glm::mat4 project = g_camera->m_projection;
  glm::unProject(cp, view, project, glm::vec4(0.0f, 0.0f, (float)panel1->Width, (float)panel1->Height));

  cp.x -= panel1->Width / 2.0f;
  cp.y -= panel1->Height / 2.0f;

  g_cursor->m_node->m_translation = cp.xzy;
}

This function updates my curser's position in the game. However my render function is get called after I stop moving the mouse. How can I overcome this stuation such that my curser position gets update and renders immediatly after I moved mouse.


texts:
Why are the "professional" versions of console SDKs closed to the public? For example the Xbox Development Kit is available only to certain registered developers. The PS3 has some similar arrangement. Even the pricing is undisclosed.

What is the reason for this secrecy? Also, what additional features do these "professional" SDKs have, in comparison with the free SDKs (like XNA)?


texts: Why Change from one coordinate system to another?

texts: When dealing with affine transformations, why do we need to change from one frame to another? What are some reasons. What are the pros and cons of doing this and the limitations if this was not possible.(Change of Coordinate Transformations)


texts: 2D line of sight - hiding all tiles behind walls

texts:
I'm interested in knowing the techniques on how 2D games hide tiles that are behind walls.

This is a really old MMO that is probably the easiest example to show what I'm asking.

Here you can see all the tiles apart from inside the two buildings

But enter the building and let the door close, and you can see only what's inside.

Stand beside or IN the doorway, and you can see inside and out.

What techniques should I look into to achieve an effect like this?

EDIT: A video of a similar game that shows the effect also, skip through parts and you'll get the idea: https://www.youtube.com/watch?v=ujwQ0-gNQ64


texts: How to control the list of items on the screen?

texts:
I am an experienced app developer (c#) however I am just looking at starting 2d game development.

I have read some articles and understand the concept of the gaming loop controlling the application flow. However there seems few articles explaining general concepts for an existing developer. From these I assuming that each on screen item becomes it's own object and handles it's own location, drawing, collision detection etc. (though correct me if I am wrong)

My question is how to control the list of items on the screen? Are these stored in a simple collection and then removed as they fall out of play and is this collection held by the game engine or individual components? An example would be bullets from a gun?


texts:
I have always asked myself this, especially about x4 or x8 anti-aliasing. It seems that over the years, the algorithm has remained the same but needs more power than before due to improved game graphics.

Most disturbingly, some games look the same at x4 and x8, but perform worse at x8!

What makes anti-aliasing algorithms so computationally demanding?


texts:
I was trying to develop a simple drag and drop items for Web. What I was trying to do is to make the UI elements from web view to mobile view when the aspect ratio is changes.

I need this web view change to mobile view as below when the screen changes.

Changing Canvas settings does not seems to be work. Could someone please help with this issue?


texts: Storing player data for multiple players in libGDX

texts:
I'm working on a game (in libGDX) that would allow multiple player accounts. I need to store some simple user data (several key-value pairs).
I think JSON is the best for my needs, but I'm wondering how this data should be organised. I'm thinking about two possibilities:

single file for each player seems better design-wise, but I'm not sure if real-time file creation won't lead to issues
one big file with player id as key and organised array of values - safer, but would require loading data for all players on initial read and each update (although there shouldn't be that many accounts on a single game instance). Also harder to maintain due to necessity of keeping values in proper order, etc.

Perhaps there are better ways to do it, that I didn't think about.


texts: How long should a user's input be delayed?

texts:
For browsing the web, the UX site has a great answer.

My question is about games, not forms.

How long from the time a button is pressed, should the player's character react?

On the one hand, instantaneous could be nice.  But how would that affect the visuals?  I would expect some sort of preparation for the character's actions.  For example, jumping would require some bending of the knees first.  Swinging a sword would involve raising the sword in hand first.  Neglecting these preliminary animations could feel better, but may not look nice.  So should that preparation animation not exist?  Should it be 100 ms?  Can it be up to 500 ms?

On the other hand, many games add intentional delays to require timing by the player.  Falcooooo punch!  This is not what I am asking for this question, but I figured I should mention it.

So assuming we want instantaneous results for the player, how much time can be designated to the preliminary animations?  Does 100 ms (as referred to for the forms answer) also apply to games?  Or is there some other strategy used to find a good sweet spot?

And to address the inevitable "You must playtest!" answers - absolutely!  But what is a good starting point?  As an indie developer, I don't have the ability to iterate much on animations.


texts: How to pass rendered frames from OpenGL to DirectX 11?

texts: I have a dll that does some rendering using OpenGL.  I need to render it to a texture and use that texture in direct x 11.  My current attempt has been to render the OpenGL to a texture on one process, and then use Cuda to encode the texture to a h264 video stream, and then decode that stream on another process using cuda / directx 11.  However, I'm wondering if there is an easier way to get a portion of a scene rendered OpenGL to DirectX11.


texts:
I made a game, and I am currently making a game engine. I want them both to be completely free and open source. What license should I choose? I was reading a bit on GPL, but that seems to be more suited for system code and libraries, AFAIK, as it doesn't permit the use of code for proprietorial software - which, in turn, implies that the code can be used in the first place. I can see that, obviously, game engines can be considered libraries, and therefor be used, but what about game code?

Is there an alternative to GPL?


texts: I want to make fade for my player shadow. I don't know if it's possible or not. In my skinned mesh render there is "Cast shadows" with four options "Off, On, Two sides, and Shadows Only". How to do it by a script ?


texts: Build and Run results in an empty window

texts:
Out of nowhere my builds are broken. The .exe just always gives me this little blank window but it runs fine in the editor.

Here are some things I have tried:

Deleted the previous build files
Deleted the Library folder
Upgraded to 2020.2.4f1
Uninstalled/Reinstalled Unity
Deleted AppData Files
Deleted branch and pulled it back down (the branch works fine for other people)

Here are my resolution and presentation settings:


texts: Unity3D: Download multiple files and implement a callback

texts:
IEnumerator GetFileRequest(List<String> urlList, Action<List<UnityWebRequest>> callback)
{
    List<UnityWebRequest> reqList = new List<UnityWebRequest>();
    for (int i = 0; i < urlList.Count; i++)
    {
        using (UnityWebRequest req = UnityWebRequest.Get(urlList[i]))
        {
            req.downloadHandler = new DownloadHandlerFile(GetFilePath(urlList[i]));
            reqList.Add(req);
        }
    }
        yield return reqList;

    callback(reqList);
}

I'm using this code, all files get downloaded, but they seem to be corrupted ( I guess it's not completely downloaded). How do I complete the download without files getting corrupted?


texts: How to get pixel coordinates between 0,1 from SV_POSITION

texts:
I am new to HLSL and Directx. I was trying to write a simple gradient Shader by modifying one of Microsoft samples.

1.I can not understand why SV_POSITION is float4? If it is pixel coordinates shouldn't it have only x and y ? What are the 4 parts? I think SV_POSITION is not between 0,1 and the maximum val is bufferWidth,bufferHeight ... then how can I get the position between 0,1?

The first code does not work because distance between float2 and float4 is impossible. While the second one works I get a warning. How can I avoid the warning message because I believe something is wrong!

Fist code (Of course it should not work):

float4 VS( float4 Pos : POSITION ) : SV_POSITION
{

    return Pos;
}

float4 PS(   float4 Pos : SV_POSITION) : SV_Target
{
    float distfromcenter=distance(float2(0.5f, 0.5f), Pos);
    float4 rColor = lerp(float4(0,0,0,1),float4(1,1,1,1), saturate(distfromcenter));
    return rColor;
}

The second one :

float4 VS( float4 Pos : POSITION ) : SV_POSITION
{

    return Pos;
}

float4 PS(   float2 Pos : TEXTCOORD  ) : SV_Target
{
    float distfromcenter=distance(float2(0.5f, 0.5f), Pos);
    float4 rColor = lerp(float4(0,0,0,1),float4(1,1,1,1), saturate(distfromcenter));
    return rColor;
}

Why do I get this warning ? How can I compile this Shader using SV_POSITION to avoid the warning message ?

D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (TEXTCOORD,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]


texts: Easiest way to make a button in Gamemaker Studio 2

texts: I want to make a menu for my title screen where the user can click on the option they want. The only way I can think of doing this is by making an object that checks if there is a click and then checks if the mouse is on top of it. This feels like a really round-about way to do this. Is there an easier way? I don't yet know how to use the GML so, please use DnD.


texts:
I want to start developing a browser game. Not for success, just for the sake of doing it and learning something from it.

Now, a point where I have serious problems figuring out how to deal with it is; how does one player receive message of another player does something that is somehow time-critical.

Easy example for a trading card game; Player 1 plays The devious flames of hell and Player 2 has to react to this card by playing Watery waves directly afterwards, before the card of Player 1 takes effect (so to say a counter-card).

Of course, I could just request the server every second and see if the other player did something, but I was hoping for a less request-frequent solution, like the server pushes the event of Player 1 playing a card to Player 2.


texts:
I'm learning Lua and thought I should try my hand at making a Breakout clone.  It is pretty much playable, but there seems to be odd intersection logic at some points, specifically the ball-brick collisions.

In case you can't tell, the ball is behind 2 bricks (left-most light blue and dark brown).  Also, most of the bricks that are missing seem to have been detected correctly.

I cannot seem to figure out why this is happening.  Here is the code:

for i=1,rows do
  for j=1,cols do
    if bricks[i][j].x~=nil then

      --ball is between left and right edges
      if ball.x+dirx>bricks[i][j].x-radius and ball.x+dirx<bricks[i][j].x+length+radius then

        --ball is between top and bottom edges
        if ball.y+diry>bricks[i][j].y-radius and ball.y+diry<bricks[i][j].y+8+radius then

          --Ball hit top/bottom?
          if ball.y<bricks[i][j].y or ball.y>bricks[i][j].y+8 then
            diry=-diry  -- Reverse Y velocity
          end

          --Ball hit side?
          if ball.x<bricks[i][j].x or ball.x>bricks[i][j].x+length then
            dirx=-dirx  --Reverse X velocity
          end

I've kind of been doing this Lua thing on-the-fly so if I am doing any bad practices I'd appreciate knowing how it should be done.


texts: Java Tile Collision Detection not accurate enough

texts: How can I make my isometric tile collision detection more accurate, I'm using the Rectangle class from java to detect collisions but because it's a rectangle it overlaps other rectangles which means clicking on a tile has a chance of selecting the tile next to it and I would like to know how to fix that.


texts:
I'm building a skeletal animation system. My goal is to make it as efficient as I can.

Is there a place where I can download some 3d models (preferably from real games) So I could see if my system animates them efficiently?

The current model I'm testing on has 12500 faces overall and 57 bones. My FPS drops from 60 when there are 10~ animated instances of it running. I don't know if it's okay or bad.

Any other help and tips for benchmarking my system will be highly appreciated.


texts: How to create array with unique sprites? in cocos2d iphone

texts:
I write the code like this. This displays only one sprite (red colour bubble) with number of times and moving down, but actually I want to display different sprites (different colour bubble) every time and moving down. I also add no of .png images in resource folder of my project. Here I used only 3.png, but I need to display all *.png images (different colour bubbles) in my project but I don't know how to get this.
Please help me
Thank you.
Here is the code:

-(void)addTarget {
CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)];

CGSize winSize = [[CCDirector sharedDirector] winSize];
int minY = target.contentSize.height/2;
int maxY = winSize.height - target.contentSize.height/2;
int rangeY = maxY - minY;
int actualY = (arc4random() % rangeY) + minY;

// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
target.position = ccp(winSize.width + (target.contentSize.width/2), actualY);

[self addChild:target];

// Determine speed of the target
int minDuration = 4.0;
int maxDuration = 12.0;
int rangeDuration = maxDuration - minDuration;
int actualDuration = (arc4random() % rangeDuration) + minDuration;

// Create the actions
id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2,actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
[target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];

// Add to targets array
target.tag = 2;
[_targets addObject:target];
}

-(void)gameLogic:(ccTime)dt {

[self addTarget];

}

-(id) init
{

if( (self=[super initWithColor:ccc4(255,255,255,255)] )) {

// Enable touch events
self.isTouchEnabled = YES;

// Initialize arrays
_targets = [[NSMutableArray alloc] init];
_projectiles = [[NSMutableArray alloc] init];
// Get the dimensions of the window for calculation purposes

CGSize winSize = [[CCDirector sharedDirector] winSize];

[self schedule:@selector(gameLogic:)
interval:1.0];
[self schedule:@selector(update:)];

}
return self;
}

- (void)update:(ccTime)dt {

NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
for (CCSprite *projectile in _projectiles) {
CGRect projectileRect = CGRectMake(projectile.position.x - (projectile.contentSize.width/2),
projectile.position.y - (projectile.contentSize.height/2),
projectile.contentSize.width,
projectile.contentSize.height);

NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
for (CCSprite *target in _targets) {
CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2),
target.position.y - (target.contentSize.height/2),
target.contentSize.width,
target.contentSize.height);

if (CGRectIntersectsRect(projectileRect, targetRect)) {
[targetsToDelete addObject:target];
}
}

for (CCSprite *target in targetsToDelete) {
[_targets removeObject:target];
[self removeChild:target cleanup:YES];
_projectilesDestroyed++;
if (_projectilesDestroyed > 30) {
//GameOverScene *gameOverScene = [GameOverScene node];
//  [gameOverScene.layer.label setString:@"You Win!"];
//  [[CCDirector sharedDirector] replaceScene:gameOverScene];
}
}

if (targetsToDelete.count > 0) {
[projectilesToDelete addObject:projectile];
}
[targetsToDelete release];
}

for (CCSprite *projectile in projectilesToDelete) {
[_projectiles removeObject:projectile];
[self removeChild:projectile cleanup:YES];
}
[projectilesToDelete release];

}


texts:
I am struggling to understand the basics behind pixel art in Unity.

I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16.

Take stardew valley for example, in the image below you can clearly see that the player is not square. The creator of the game said he made everything in 16x16, but then how is there so much detail in the characters? Surely you do not patch several 16x16 squares together to make a character (as you would with a tilemap)?

What is the "common" way of dealing with things that are not square, like the characters in the image. Do you just make  16x32 sprite and set PPU to 16? Wont that make it look a bit weird next to 16x16 sprites?
Do you generally pick one size (i.e 16, 32, 64) And then stick to that for everything in the game?

The visual Issue I've seen is this, where a 32x32 sprite looks very out of place (too sharp) next to a 16x16 sprite.

So I am wondering, how do you mix sizes wihout getting this effect where one image looks much sharper than the other. If I for example wanted a character to be 16x32, or any non-square value, when my tiles are 16x16


texts:
I'm trying to implement simple 2D circle collision system. There are circles with different radiuses and velocities (the larger the circle the slower it is). Contrary to all the questions on the Stack, the circles do not bounce at all.

There is no problem with collision response for two circles that overlap. There are two approaches that I thought of:

Pushing the circles apart with displacements dependent on the ratio of circles' radiuses.
Pushing the smaller circle away so it doesn't collide with the bigger circle anymore.

However, neither of these approaches works for multiple circle collisions. Let's consider an easy example:

Three circles are moving towards the same point but with different velocities:

In the next frame they overlap like this:

Then with either of the two approaches the smallest circle gets pushed away from the
biggest one:

And then the right-most circle would push the smallest circle to the right making an infinite collision loop.

Of course, the more circles, the more complicated the collision resolving would be.
Additionally, I'm going to add static walls thus making collision system even more complex.

What algorithm can I use to make multiple collisions work?
I guess that the desired effect would look like this:


texts: How to calculate rect-moving-in-a-curved-path collision detection

texts:
I'm trying to find the best way to use collision detection for a rect moving in a curved path:
here is example of what i have

I found few methods and I have hard time to find what is the best way.
I have the pure calculation method that is here:
http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
and I also have the pixel perfect method that is here:
http://blog.muditjaju.infiniteeurekas.in/?p=1

I'm using cocos2d-x but it can be in any engine or language.  What is the best method for this?


texts: How can I place the player into a 360° video in UE4?

texts:
I have a 360° video (6 separate videos stitched together into a panorama) with a first person view walking through an environment. I would like to put this in a game engine such that the actor can walk forward and backward and it will feel like they are in the environment.

I have tried this in UE4 but am somewhat new to all this. I'm not opposed to using UDK or Unity if that is easier. I have created a MediaTexture from the video asset. Now I'm trying to create a Material sphere that uses the MediaTexture and reflects it back so the actor is essentially in a spinning sphere. I keep getting stuck with these errors:

I understand that I must next construct a blueprint that reads the actor's movement to play back the video, and also rotate the texture coordinates according to the view of actor.

How can I do this?


texts:
What is a good/the best way to fill a cube map with depth values that are going to give me the least amount of trouble with floating point imprecision?

To get up and running I'm just writing the raw depth to the buffer, as you can imagine it's pretty terrible - I need to to improve it, but I'm not sure how.

A few tutorials on directional lights divide the depth by W and store the Z/W value in the cube map - How would I perform the depth comparison in my shadow mapping step?

The nvidia article here http://http.developer.nvidia.com/GPUGems/gpugems_ch12.html appears to do something completely different and use the dot of the light vector, presumably to counter the depth precision worsening over distance? He also scales the geometry so that it fits into the range -.5 +.5 - The article looks a bit dated, though - is this technique still reasonable?

Shader code http://pastebin.com/kNBzX4xU

Screenshot http://imgur.com/54wFI


texts: How can I make the loop only once when it's inside OnGUI?

texts:
The script is EditorWindow type.

private void OnGUI()
{
var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0)
        {
            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();
        }
}

When I select with the mouse a object in the Editor Hierarchy it will keep making the loop nonstop since selections.Count is large then 0.

I tried to add after the loop:

selections = new List<GameObject>();

But it didn't help.

I want that it will make the loop and the whole code inside the if (selections.Count > 0) only once each time when selecting one or more objects in the editor.

If I select one object make the whole code once if I then selected another more object make the whole code over again for the two selected objects and so on but make it once. Now it will keep making the loop over and over again even if I didn't select more other objects.

Since in the editor the first object is still selected it will keep making the code the loop over and over again.

This is what I tried:

var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0 && isSelected == false)
        {
            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();

            isSelected = true;
        }

The flag boolean isSelected is global variable and set to false as init.

UPDATE what I tried:

var selections = Selection.objects.OfType<GameObject>().ToList();
        int currentSelectionCount = selections.Count;
        if (currentSelectionCount != lastSelectionCount)
        {
            lastSelectionCount = currentSelectionCount;
            for (var i = 0; i < currentSelectionCount; ++i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());

            tempTransformSelection = transformSelection;
            transformSelection = new List<Transform>();

            Selection.objects = new UnityEngine.Object[0];
        }

But when I select object in the editor in hierarchy it's immediately unselecting the object since the line:

Selection.objects = new UnityEngine.Object[0];


texts: I would like to localize Unity launcher using own texts. At the very least I would like to change "play!", "quit", "Graphics" and "Input" to own arbitrary labels. How can I achieve that?