sentences:
Convert Global Space 3D Location to Local object space? I'm trying to find a formula that could convert my 3D global coordinates into local object space.
Here are the inputs I have
A Location

B Location
B Rotation
B Scale

I need a Location output, corresponding to my A Location in B Space, according to B Location, Rotation, and Scale. I'm working in a 3D Space
So far I didn't found any formulas online, anyone can point me in the right direction?
Bests
If possible, i'd need a formula that doesn't use any matrix calculation, it's not supported by the nodal system of my engine (I'm using blender geometry node, but my problem is more generic as you can see)

sentences:
Any good smartphone simulators available? I'm trying to find a good smartphone simulator to test HTML5 games on. Doesn't matter if it is only 1 phone or a library of phones, iOS or android. As long as it's as close as it can get to the touchscreen experience.

Any suggestions?

sentences:
Box2D how to implement a camera? By now i have this Camera class.

package GameObjects;

import main.Main;

import org.jbox2d.common.Vec2;
public class Camera {

public int x;
public int y;
public int sx;
public int sy;

public static final float PIXEL_TO_METER = 50f;

private float yFlip = -1.0f;

public Camera()
{
    x = 0;
    y = 0;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public Camera(int x, int y)
{
    this.x = x;
    this.y = y;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void update()
{
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void moveCam(int mx, int my)
{

    if(mx >= 0 && mx <= 80)
    {
        this.x -= 2;
    } else if(mx <= Main.APPWIDTH && mx >= Main.APPWIDTH - 80)
    {
        this.x += 2;
    }

    if(my >= 0 && my <= 80)
    {
        this.y += 2;
    }
    else if(my <= Main.APPHEIGHT && my >= Main.APPHEIGHT - 80)
    {
        this.y -= 2;
    }
    this.update();
}

public float meterToPixel(float meter)
{
    return meter * PIXEL_TO_METER;
}

public float pixelToMeter(float pixel)
{
    return pixel / PIXEL_TO_METER;
}

public Vec2 screenToWorld(Vec2 screenV) {
    return new Vec2(screenV.x + this.x, yFlip
            * screenV.y + this.y);
}

public Vec2 worldToScreen(Vec2 worldV) {
    return new Vec2(worldV.x - this.x, yFlip
            * worldV.y - this.y);
}

}

I need to know how to modify the screenToWorld and worldToScreen functions to include the PIXEL_TO_METER scaling.

sentences:
How can I make a spline that does not overshoot? I have a list of line segments that run through a track model and I am looking to achieve two things:

smooth the overall shape of the path
being able to evaluate a position by querying from 0.0 to 1.0

I have implemented Catmull-Rom spline using the TreeSpline class from Unity (it's not explicitly in the docs but you can see it here), it does work except for one thing: some places have overshoot:

Legend

purple: original line segments
white: result of the TreeSpline evaluation

After searching for a bit, it appears that Monotone cubic interpolation would be a solution to my problem. However, the formulas only show on how to do with 2D points, not with 3D points which I'm using.

Question:

How can I adapt the formulas in the Wikipedia article to 3D points instead ?

(I am also open to alternative approaches)

Edit:

Thanks to @Jay it's better now:

sentences:
Does playing sound effects have to be filtering enabled? In roblox I made a sword that plays the unsheath sound when equipped. This works by using a local script tell a server script to play it when equipped. I made a whole new remote event in replicated storage just for playing this sound effect and nothing else.

Is it really true that simply playing sound effects required filtering enabled?

Is all that extra work of creating the equipted event in replicated storage actually necessary or can I just play it in a non local script in the sword?

sentences:
How to increase points per second when speed increases I am making an endless rider game that is crossed between tron legacy and cube field. I am trying to add a point system were the faster you go the more points you get because you are more likely to die so high risk high reward. I am really stuck on this however. This is my current script which is already connected to a point ui system that works. I am also probably going to post a question later about how to make speed correlate with emission/light intensity.

 public static int movespeed = 1;
    public Vector3 userDirection = Vector3.right;

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Input.GetAxis("Horizontal") * Time.deltaTime * 50, 0f, Input.GetAxis("Vertical") * Time.deltaTime * 70, 0f);
        transform.Translate(userDirection * movespeed * Time.deltaTime * 40);
        scorecript.scoreValue += 10;

        if (Time.deltaTime > 10)
        {
            scorecript.scoreValue += 10;

        }
        if (Time.deltaTime > 11)
        {
            scorecript.scoreValue += 11;

        }

    }

This is how I translated MDgrgory's code:

[Tooltip("How fast the character should move with no input, in world units per second")]
public float autoMoveSpeed = 40.0f;
[Tooltip("The direction the character should move with no input")]
public Vector3 autoMoveDirection = Vector3.right;
// Enforce that this is always a unit direction vector, so it doesn't bias our speed.
void OnValidate() { autoMoveDirection = autoMoveDirection.normalized; }

[Tooltip("How much the player can affect the speed in the direction of auto movement")]
public float parallelMoveSpeed = 50f;
[Tooltip("How fast the player can affect the speed perpendicular to the auto movement")]
public float perpendicularMoveSpeed = 70f;

[Tooltip("How many points to earn per second with no input")]
public float scorePerSecondAtDefaultSpeed = 10f;
[Tooltip("How many extra points to earn per second for every extra unit of speed")]
public float extraScorePerVelocityUnit = 1.0f;

// Track how much "loose change" points we've accumulated.
float _scoreAccumulator = 0f;

void Update()
{
// Capture the player's input vector.
Vector3 input = new Vector3(
                    Input.GetAxis("Horizontal"),
                    0,
                    Input.GetAxis("Vertical")
                );

// Clamp the input to make sure we don't move faster on diagonals.
input = Vector3.ClampMagnitude(input, 1.0f);

// Extract the portion of the player's input parallel to the auto movement.
float parallelComponent = Vector3.Dot(autoMoveDirection, input);

// Leaving the component perpendicular to the auto movement.
Vector3 perpendicularComponent = (input - parallelComponent * autoMoveDirection);

// Compute how much to increase or decrease our auto movement based on our input.
float extraVelocity = parallelComponent * parallelMoveSpeed;

// Compute our net velocity, combining auto, parallel, and perpendicular movement.
Vector3 velocity = autoMoveDirection * (autoMoveSpeed + extraVelocity)
                 + perpendicularComponent * perpendicularMoveSpeed;

// Translate us according to that velocity and the elapsed time.
transform.Translate(velocity * Time.deltaTime, Space.Self);

// Scoring:
// Compute our increased (or reduced) scoring rate based on our forward velocity.
float extraScore = extraVelocity * extraScorePerVelocityUnit;

// Increase our score accumulator based on our current earning rate and time passed.
_scoreAccumulator += (scorePerSecondAtDefaultSpeed + extraScore) * Time.deltaTime;

// Whenever we earn a whole point, send it to the score display as an integer.
int scoreUnits = Mathf.FloorToInt(_scoreAccumulator);
scoreScript.scoreValue += scoreUnits;
// And decrement our accumulator to store just the "spare change".
_scoreAccumulator -= scoreUnits;
}

sentences:
Inconsistent accessibility: parameter type is less accessible than method I have a level class in which I make a new turret. I give the turret the level class as parameter. So far so good.
Then in the Update function of the Turret I call a function Shoot(), which has that level parameter it got at the moment I created it.

But from that moment it gives the following error:

  Inconsistent accessibility: parameter type 'Space_Game.Level' is
  less accessible than method
  'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

All I know it has something to do with not thr right protection level or something like that.

The level class:

    public Level(Game game, Viewport viewport)
    {
        _game = game;
        _viewport = viewport;
        _turret = new Turret(_game, "blue", this);
        _turret.SetPosition((_viewport.Width / 2).ToString(), (_viewport.Height / 2).ToString());
    }

The Turret Class:

        public Turret(Game game, String team, Level level)
        :base(game)
    {
        _team = team;
        _level = level;

        switch (_team)
        {
            case "blue":
                _texture = LoadResources._blue_turret.Texture;
                _rows = LoadResources._blue_turret.Rows;
                _columns = LoadResources._blue_turret.Columns;
                _maxFrameCounter = 10;
                break;
            default:
                break;
        }

        _frameCounter = 0;
        _currentFrame = 0;
        _currentFrameMultiplier = 1;
    }

    public override void Update()
    {
        base.Update();

        SetRotation();
        Shoot(_level, "turret");
    }

The Shoot Function (Which is in GameObject class. The Turret Class inherited the GameObject Class. (Am I saying that right?)):

protected void Shoot(Level level, String type)
    {
        MouseState mouse = Mouse.GetState();
        if (mouse.LeftButton == ButtonState.Pressed)
        {
            switch (_team)
            {
                case "blue":
                    switch (type)
                    {
                        case "turret":
                            TurretBullet _turretBullet = new TurretBullet(_game, _team);
                            level.AddProjectile(_turretBullet);
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
    }

sentences:
MoveTowards giving two different results for same input - Unity I have prefab and its hierarchy is as follows:

bird

-Outline

--mask

--filler

Now I am using this in Update to move the filler:

filler.gameObject.transform.position = Vector3.MoveTowards(
            filler.gameObject.transform.position,
            new Vector3(feedBar.gameObject.transform.position.x, -1.1f, filler.gameObject.transform.position.z),
            (1f / PlayerPrefs.GetFloat("timetofeedbird", 5)) * Time.deltaTime);

All the instantiated birds have movement in correct direction. But the last one has a movement in reverse direction.

Here is the GIF to explain the issue:

Any idea what the issue here?

sentences:
How to compare two skeletons by using kinect sensor? I need to know about how to compare record skeleton with live skeleton in C#. If there are any reference please let me know.

 example image for what I done up to now

sentences: How to create very simple doom like corridors in XNA? So I have seen many 3D tutorials creating heightmaps and big landscapes but I am hoping there is something simple that i can throw together. If I was to do something doom/wolfenstien-like, do i just draw a cube and texture it? I guess my question is, How should i go about creating a very simple box-like room?

sentences:
How can I keep vertex order the same on every Instantiate()? While trying to resolve another question, I have discovered that if I Instantiate() from a prefab, the order of the mesh vertices (and therefore triangles) is inconsistent between instances. This is apparent, for example, if I RaycastHit.triangleIndex the same location on the mesh on different runs of the game. The same location returns the same triangle index during one run of the game, but a different triangle index in the next run.

If instead I add the model to the scene in the editor, and then run the game, the same location returns the same triangle index in every run of the game. If I duplicate the model through the scene editor, the duplicate also returns the same triangle index. This is the behaviour I am aiming for.

However, I would obviously prefer to Instantiate at runtime. (This would allow me flexibility on when and how many models to instantiate, and in the long run I want to add other models too. The alternative is to add the model to the scene and create a large number of "offscreen" duplicates, which seems prone to inefficiencies on multiple fronts.)

Is it possible to use Instantiate and maintain a consistent vertex/triangle order between instances and between runs of the game?

sentences:
If player leaves a rectangle take him back to his previous position Okay, I'm making a game. The map contains all the blocks/buildings/structures etc... The map is bordered by a rectangle.

So what I want is if the player attempts to exit the rectangle he goes back to where he was. This way he cannot leave the map.

My attempt's output (right side), this one is perfect:

But the left side is not perfect:

My code:

public class Player extends GameObject{

BufferedImageLoader loader;
Texture tex = Game.getInstance();
BufferedImage image;
Animation playerWalkLeft;
private HealthBarManager healthBar;
private String username;
private int width;
private ManaBarManager manaBar;

public Player(float x, float y, ObjectID ID) {
    super(x, y, ID, null);
    loader = new BufferedImageLoader();
    playerWalkLeft = new Animation(5,tex.player[10],tex.player[11],tex.player[12],tex.player[13],tex.player[14],tex.player[15],tex.player[17],tex.player[18]);

}

public void tick(LinkedList<GameObject> object) {

    setX(getX()+velX);
    setY(getY()+velY);

    playerWalkLeft.runAnimation();

}

public void render(Graphics g) {

    g.setColor(Color.BLACK);

    FontMetrics fm = g.getFontMetrics(g.getFont());

    if(username != null) width = fm.stringWidth(username);
    if(username != null){
        g.drawString(username,(int) x-width/2+15,(int) y);
    }

    if(velX != 0){
        playerWalkLeft.drawAnimation(g, (int)x, (int)y);
    }else{
        g.drawImage(tex.player[16], (int)x, (int)y,  null);

    }

    g.setColor(Color.PINK);
    g.drawRect((int)x,(int)y,33,48);
    g.drawRect(0,0,(int)Game.getWalkableBounds().getWidth(), (int)Game.getWalkableBounds().getHeight());

}

@SuppressWarnings("unused")
private Image getCurrentImage() {
    return image;
}

public float getX() {
    return x;
}

public float getY() {
    return y;
}

public void setX(float x) {

    if(isPlayerInsideBoundry(x,y)){
        this.x = x;
    }

}

public void setY(float y) {
    this.y = y;
}

public float getVelX() {
    return velX;
}

public void setHealthBar(HealthBarManager healthBar){
    this.healthBar = healthBar;
}

public HealthBarManager getHealthBar(){
    return healthBar;
}

public float getVelY() {
    return velY;
}

public void setVelX(float velX) {
    this.velX = velX;
}

public void setVelY(float velY) {
    this.velY = velY;
}

public ObjectID getID() {
    return ID;
}

public void setUsername(String playerName) {
    this.username = playerName;

}

public String getUsername(){
    return this.username;

}

public void setManaBar(ManaBarManager manaBar) {
    this.manaBar = manaBar;

}

public ManaBarManager getManaBar(){
    return manaBar;
}

public int getLevel(){
    return 1;
}

public boolean isPlayerInsideBoundry(float x, float y){
    Rectangle boundry = Game.getWalkableBounds();

    if(boundry.contains(x,y)){
        return true;
    }

    return false;
}

public Rectangle getBounds(String boundType){
    if(boundType.equalsIgnoreCase("left")){
        return new Rectangle((int)x,(int)y,33/2,44/2);
    }
    return null;
}

}

sentences:
lz4 archive with encryption I want to make a game data archive that contains all the game assets, now I could use zlib or lz4 to just make a simple zip archive type thing, but I need a bit more security, does anyone have any recommendations on adding AES encryption to the whole thing? I was also thinking maybe I need like a MPQ archive type system where I can mount the thing in the game engine and it acts as an interface to accessing the individual files inside, allowing streaming?

Any ideas appreciated, thanks.

sentences:
"Line of sight" path across navigation mesh I want to calculate the line of sight in a navigation mesh.

Consider the image below, the yellow line is the result of only A* and the red line is the result of a line of sight" algorithm that uses the yellow line as input. Now the unit can move directly without “zig-zagging”.

What is an algorithm to calculate that "line of sight"?

sentences:
How do I find more details about a Vuforia error when going into play mode? I want to make an AR app in Unity using Vuforia Engine. But when I try to enter play mode nothing appeared. Here's the error alert:

Since this error does not give me any clue about what went wrong, I'd like to know if there is a way to get more details about it so I can eventually figure out how to fix it.

sentences:
What is the relationship between glVertexAttribPointer index and GLSL location? I've been getting some strange results when trying to implement a normals buffer for the purpose of rendering lighting.  It seems to be related to the indexes for glEnableVertexAttribArray, glVertexAttribPointer and the location value in the vertex shader.
Take a look at the following code for example:

  gl.glEnableVertexAttribArray(1);
  gl.glEnableVertexAttribArray(0);

  //bind vertex data - why does the index have to be 1?
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[VERTICES_IDX]); //the vertex data
  gl.glVertexAttribPointer(1,3,GL4.GL_FLOAT, false,  0,0);

  // Select the VBO, GPU memory data, to use for colors
  // - why doe the index have to be 0??
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[COLOR_IDX]);
  gl.glVertexAttribPointer(0, 3, GL4.GL_FLOAT, false, 0, 0);

  //bind IBO
  gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, vboHandles[2]);

Where do the values for the indexes used in the above functions come from?  If I were to switch them and make the color buffer 1 and the vertex buffer 0, nothing renders.  It seems logical to me that the vertices should be applied first and then the colors?  My confusion is compounded when I try to pass the data to a shader.  I thought the location value in the shader program referred to the index in glVertexAttribPointer but that doesn't seem to be the case.  In fact it looks like location is being completely ignored (targeting GLSL 430).
Have a look at this:

From the shader:

layout (location=0) in vec3 vertexPosition;
layout (location=1) in vec3 vertexNormal;

The Java code:

//with glEnableVertexAttribArray 0 and 1 enabled all of the cubes render but they
//are individually lighted - ie the shading doesn't propagate over the whole scene,
//only over each cube.
//if i rem 1, the scene looks lighted properly.  So only 1 vertex array enabled
//and it still works?
  gl.glEnableVertexAttribArray(0);
  gl.glEnableVertexAttribArray(1);
  //gl.glEnableVertexAttribArray(2);

  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[VERTICES_IDX]);
  //with the index set to 5 (doesn't relate to any other index) the scene still
  //renders...
  gl.glVertexAttribPointer(5,3,GL4.GL_FLOAT, false,  0,0);

  //normals
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[3]);
  gl.glVertexAttribPointer(1, 3, GL4.GL_FLOAT, false, 0, 0);

      // Select the VBO, GPU memory data, to use for colors
  //almost strangest of all.  If I remove colors the program crashes.  I don't
  //even use this buffer..
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[COLOR_IDX]);
  gl.glVertexAttribPointer(0, 3, GL4.GL_FLOAT, false, 0, 0);

  //bind IBO
  gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, vboHandles[2]);

There is obviously something fundamental here that I am not understanding.  I would think that by setting the glVertexAttribPointer index for the vertices to 5 it would
unlink from the shader in variable as its location is 0.  I need to know what is going on here especially now that I am implementing lighting.
So, what is the relationship between the glVertexAttribPointer index and the shader location value?  Also, why does the index have to be certain value (eg 0 for color, 1 for vertex)?

sentences:
When the motion button is pressed, the shape of the character changes and always goes to the left direction good day. When the motion button is pressed, the shape of the character changes and always goes to the left direction.

Why is this happening and what is the solution?

Pressing two buttons moves to the left and the shape changes.

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

public class PlayerKontrol : MonoBehaviour {

public float karakterHizi = 8f, maxSurat = 4f;
private Rigidbody2D myRigidbody;
private Animator myAnimator;

private bool solaGit, sagaGit;

void Awake () {
    myRigidbody = GetComponent<Rigidbody2D> ();
    myAnimator = GetComponent<Animator> ();

}

void FixedUpdate () {
    if (solaGit) {

        SolaGit ();
    }

    if (sagaGit) {

        SagaGit ();
    }
}

public void AyarlaSolaGit (bool solaGit)
{
    this.solaGit = solaGit;
    this.sagaGit = !solaGit;
}

public void HareketiDurdur () {
    solaGit = sagaGit = false;
    myAnimator.SetBool ("run", false);
}

void SolaGit (){

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = -0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

void SagaGit () {

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = 0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

}

sentences:
How do I make so when user moves the camera it doesn't go beyond the scene borders in Unity3D? How do i make so when i move my camera, it doesn't go beyond the border of the canvas while playing. This is the script i use to make the camera move:

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved)
    {
        Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;
        transform.Translate (+touchDeltaPosition.x * speed, +touchDeltaPosition.y * speed, 0);
    }

sentences:
How does the Direct3D 9 rasterizer determine triangle coverage? I'm working on a software rasterizer to use in my project. I have implemented one that works well, however, often my rasterizer under or overestimates triangle coverage. I need perfect emulation of the hardware rasterizer. I'm using the exact same rasterization rules from MSDN (including the top-left rule).

How does the Direct3D rasterizer determine which pixels are covered by a triangle? What's the algorithm being employed? Does it rasterizer use the pixel center coordinate or the pixel's top-left coordinate when determining triangle coverage?

When I use the pixel's top-left coordinate I get better results. I've also been determining the planes perpendicular to the triangle's edges, then admitting pixels if their coordinate is "behind" each plane.

sentences:
How to disable camera moves (mouse drag) in an Unreal Engine editor plugin? I tried to override FEdMode:

virtual bool DisallowMouseDeltaTracking() const override
{
    UE_LOG(LogTemp, Warning, TEXT("do not allow mouse delta tracking!"));
    return true; // I also tried to return false
}

but the problem is that the cursor stops moving (and gets invisible).

Is it possible to change the camera moves (to make it like in 3Ds max or sketchup)?

sentences:
Increasing spawn difficulty I'm trying to increase the difficulty of the game over time. I'm using InvokeRepeating to spawn enemies and in the update function I calculate the next spawn time using the following code:

public Vector2 secondsBetweenSpawnsMinMax;
float nextSpawnTime;

void Update()
 {
    if (Time.deltaTime >= nextSpawnTime)
    {
        float secondsBetweenSpawns = Mathf.Lerp(secondsBetweenSpawnsMinMax.y, secondsBetweenSpawnsMinMax.x, Mathf.Clamp01(Time.time / 60));
        nextSpawnTime = Time.deltaTime + secondsBetweenSpawns;
    }
 }

public void StartNewGame()
{
    InvokeRepeating("Spawn", 0.1f, nextSpawnTime);
}

public void Spawn()
 {
    Vector3 enemySpawnPos = spawnPoint.position;
    Instantiate(enemy, enemySpawnPos, Quaternion.identity);
 }

I'm fixing the secondsBetweenSpawnsMinMax.y to 3 and secondsBetweenSpawnsMinMax.x to 1. The issue I'm facing is that the nextSpawnTime doesn't change. It starts at 3 and stays at that value when it should go down to 1. I'm not sure what's wrong with the code here.

sentences:
A question about Decal projection From my understanding, there are several different ways to implement decals, from screen space, to copying geometry, but I can never find an explination of it's math.

So what exactly is the math about Decal geometrical projection? I understand that it's dependent on some set of UVs to be projected, which is generated by clipped triangle coordinates, and meant to only be used on statics.

How does the Screen Space projection work exactly?

And I understand that the two previous methods do not work on dynamic geometry, (say you want a bullet wound on a character), how is that solved?

sentences:
How can I improve this architecture? In a roguelike I'm developing in Ruby, I started with a traditional object hierarchy where all game logic relevant to creatures were contained in the Creature class. Movement logic, for example:

Creature.instance_methods(false)    # => [ :move ]

In my design, the map and creatures are decoupled: the map has no idea what's on a tile and the creature has no idea which kind of tile it is on. What brings them together are coordinates.

Movement logic requires information about where on the map the creature is, so the creature would need access to the map. The map belonged to the game, so I just added a game attribute to every creature as a quick solution. I didn't really want to pass a map instance every time the creature needed to move around because the map the creature is on isn't likely to change.

In the end, I removed the game logic from the Creature class, and separated them into modules:

Game::Logic::Movement.singleton_methods(false)    # => [ :move ]

The way I understand it, these logic modules integrate multiple game parts which depend on each other in a way not easily expressed hierarchically. The methods are just algorithms that operate on the given information. For example, the implementation of the move method:

def self.move(creature, map, dx, dy)
  coordinates = Map::Coordinates[dx + creature.x, dy + creature.y]
  tile = map[coordinates]
  creature.coordinates = coordinates if tile and tile.passable? # Teleport!
end

These methods are called directly from the game loop:

def handle(input)
  case input
    when :up then Logic::Movement.move character, map, 0, 1
    # ...
  end
end

This is how the game is currently organized. Movement is the only game logic I've added as of now, so I think it would be wise if I revised the architecture while it is still small. So, what do you think of it? What are the problems, and what can I do to improve it?

I'm also interested in how it compares to component-based game architecture. I've read a lot about it during my research, and it seems to be the most maintainable and reusable way to write game code. I think it would fit naturally in the Ruby world, due to its dynamic nature and message-based method invocation. The thing is, I really never understood how different components interact with each other, and I'm looking for something I can make sense of.

sentences:
System.Drawing.dll not found I am creating an asset, in Unity, and I need to use System.Drawing. I have been trying to figure out how to add the DLL in a way that works, but I have had zero luck. I have tried adding the DLL to the assets folder, but it just shows up in Visual Studio as if it couldn't be found. I have also followed the instructions of a similar question, on the Unity Answers page, without any luck.

How do I use System.Drawing in Unity?

sentences:
Mapping Coplanar Vertices in 3D space on to a 2D Plane Say I have a plane specified by a normal vector and point on the plane.

I want to specify a 2-D co-ordinate system that lies 'across' the plane, and then use that to find the 2-dimensional distance between any given points on that plane.

I want to do this so that I can specify scaled texture UV co-ordinates on an arbitrary plane. I will use the average centre of all points on the plane (the barycentre?) as UV: 0,0, and then I need a way to determine the 2-dimensional UV value for each point, subsequently.

Here's an example of what I'm trying to do:

The points in bright green are supplied as the inputs, those are the values I'm trying to work out. The dark green is the calculated mean-average centre (the image isn't exactly to scale), and should act as UV: 0,0.

A friend suggested that I take (firstPoint - centrePoint).ToUnit() as my 'x-axis' and then xAxis.Cross(planeNormal) as my 'y-axis'. That seems like a good place to start, but I'm unsure how to use these values to get X/Y co-ordinates for each point.

I don't care what the 'plane-local' X/Y axes are as long as they're the same for each vertex on the plane. I can rotate them in-editor later to make the right alignment manually anyway (I don't think there's any good way to programmatically select a 'default').

sentences:
Unity - Determine direction vector3 from a point in space and an angle in eulers I have a ball positioned as Vector3(x, x, x).

I was able to get the direction of the ball to the mouse clicked position with:

Code (csharp):

Vector3 direction = Direction (clickPos2 - startPos);

Where the method is:

Code (csharp):

public Vector3 Direction(Vector3 position) {
        return new Vector3(position.x / Length(position.x, position.y), position.y / Length(position.x, position.y), position.z);
    }

Now I have an angle in eulers and I want that the ball goes to the direction of the angle.

But how I calculate it?

The game is played in 2d so actually only x and y is needed, z stays the same.

Mirza

sentences: How to resize my 2d game to fit the screen? I am currently making a 2D game using Java (Java 2D). I want to make my game resizable. If you play any game on an emulator (e.g. legend of Zelda in fceux emulator) in full screen mode, you'll see that the 8-bit or 16-bit game re-sizes to fit the screen size. How can I implement the same thing in my game programatically?

sentences:
Why does glGetUniformLocation report some of my uniform locations as -1? I have been writing GLSL shaders for over a year but this is the first time I have run into this problem. I am on the iOS platform - if that matters.

In a vertex shader I have this:

uniform mediump mat4 projectionViewModelMatrix;

In a fragment shader I have been using for months I have the following uniforms:

uniform int channels;
uniform sampler2D hero;

Nothing to write home about. I added three additional uniforms to the fragment shader:

uniform int heroChannels;
uniform int heroWidth;
uniform int heroHeight;

Using

glGetUniformLocation

I tried to grab the location of all my uniforms. This is when my own personal hell began. This is the result:

uniform heroChannels location -1
uniform channels location 4
uniform hero location 5
uniform heroHeight location -1
uniform projectionViewModelMatrix location 0
uniform heroWidth location -1

Huh? Why are the recently added uniforms not given a valid location by the GL Gods?

sentences:
Why do people use quaternions? I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question.

So far the only benefit I've come across personally is the ability to SLERP between two angles - to achieve the same effect with a vector you need quite an ugly work around (intrinsically linking 0 and 2PI together).

sentences:
Why can't I duck reverb in the mix bus? i'm surprised there is so little documentation on this issue. But i'm trying to duck the audio on all the mix buses in Unity so that you can clearly hear the VO of the game.

Now it works great except that I have some reverb zones in the game and any sound that plays in these reverb zones, the actual reverb itself is NOT DUCKED.

So the VO is accompanied with a huge wall of wishy washy muddy noise.

Anyone deal with this before? How can we deal with this?

sentences:
Changing sprite animation depending on direction I'm working on an android game where my sprite is controlled by a joystick. I just added an animation to my sprite with 4 rows and 3 columns:

Now I want to change the animation of my sprite depending on its direction. How do I calculate the direction of my sprite?

This is my controls:

public void update(MotionEvent event)
{
    // drag and drop
    if (event.getAction() == MotionEvent.ACTION_DOWN)
    {
        _dragging = true;
    }
    else if (event.getAction() == MotionEvent.ACTION_UP)
    {
        _dragging = false;
    }

    if (_dragging)
    {
        // get the pos
        _touchingPoint.x = (int) event.getX();
        _touchingPoint.y = (int) event.getY();
        // get the angle
        double angle = Math.atan2(_touchingPoint.y - inity,
                _touchingPoint.x - initx) / (Math.PI / 180);

        // move the beetle in proportion to how far
        // the joystick is dragged from its center
        _pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (_touchingPoint.y / 70);
        _pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (_touchingPoint.y / 70);
    }
}

And this is the drawing method in my sprite-class:

private void update()
{
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

public void draw(Canvas canvas, int x, int y)
{
    update();
    int srcX = currentFrame * width;
    int srcY = 1 * height;
    Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);
    Rect dst = new Rect(x, y, x + width, y + height);
    canvas.drawBitmap(bitmap, src, dst, null);
}

sentences:
Adding network support I am trying to implement a simple game "Bulls and cows" in c#.
It is a final project of my university course about design patterns.
The target of the game is simple - try to guess the opponent number.

http://github.com/snoward/BullsAndCows

I try to follow the MVC and dependency injection patterns.
My problem is that I don't know what part of my program should be responsible for network connection. Is this a part of controller work?

I think that the best way is to create a new instance of network controller as server for my game. And then user choose UI to use (console or window). So, network controller must observe user's UI to update game model state.

sentences:
Is a Stamina Bar (ala Dark Souls) a good idea for a casual player target group? We all know the "Stamina Bar".
For those who dont: Its a "Bar" (usually right below your life-bar) which prevents spamming the attacks as much as you want.
Attacking will also reduce your stamina and you need a certain amount of stamina to use Attacks. Usually blocking , rolling and other things also require and reduce your stamina. Its a great way to balance the a real time action battle system. You can upgrade your stamina which is cool too because gives you a feeling of progress and add a little bit of fun there.

Anyway:

The Question here is:

Is this "okay" for "Casuals"?

I have a game which is open-world-ish and you can walk around and fight enemies and fight bosses too.
But the game seems "too easy" now. You can basically just spam your attack button and every enemy is easy.
Even the bosses.

A way the fix this is the stamina bar.

But wouldnt that overwhelm the casual players ?

sentences:
How to weld nearby mesh collider vertices together to erase seams in Unity? I'm using Unity 2020.3.2f1 and I have a very commonly seen problem. I have a Spherecollider which I am using for a physics game, and geometry that uses BoxColliders or MeshColliders. Everything is nice until I get to the seams of one of these objects, and then my ball loves to do inane things like come to a complete stop across a seam or bounce high into the air when striking one. These seams are very tiny as you can see in the image below.

So, I've tried basically every workaround in the physics engine and rigidbody options for my ball (continuous, changing timestep, etc), and none of them completely erase the issue. I suspect that unless I marry all the colliders together, decimating points within some tolerance of each other into one, I will always have this problem at least in some cases, which isn't acceptable for my project.
So I'm wondering how I would work with this data. How do I access the MeshCollider data of each object in the scene? If I join them into a "master mesh" how does it expect to be constructed (quads from vertices or something)? Is there a performance aspect to worry about, having one giant collider versus many tiny ones? I imagine it screws with pruning colliders in the collision detection portion.

sentences:
What are good questions for design interns? I've recently been interviewing design interns and been pitching what I consider fairly easy practical design questions to measure their skill level. I've been shocked by poor quality of answers. Now this may be the quality of the applicants.

What questions do you ask an entry level games designer to probe for their skill level?

sentences: How to scale objects and tiles without doubling view port in gamemaker How do I scale up tiles and sprites without acully making the view port larger than the acual view? I know that I can just scale up the images and the tileset but there must better alternative right? The reason why I dont want to make the port bigger is because then I get this kind of "pixel perfect" behaviour so 1 pixel on the image is one pixel on the screen (So it looks kind of choppy). I'm thinking I can use the draw event if there's no other alternative but how would I do that with the tileset?

sentences:
How do I autogenerate gradient lighting? I am trying to think of a way to generate a gradient like this picture:

Something like this GetGradientTexture(360f,100(width),100(height)), or if i want a directional light (like a flashlight) 180f,10,200.

But I can't really think of a good way to do this. Does anyone have anything that can push me in the right direction?

sentences:
How to fix this existing shadow shader/material with alpha textures? I hope I could get some help here in finally resolving this problem of mine re: shadow casting with alpha textures.

Here's a screenshot on what I am hoping for as a result:

A friend of mine just sent this shader program to help out but I still can't get it to work properly. The alpha textures such as leaves still leave a rectangular shadow. I'm using a custom built Ogre based engine but overall the material and compositor system is still the same.

Attachment:
Alpha_Shader.zip

Any help would be greatly appreciated.

Thanks.

sentences: How to select multiple frames from a sprite sheet in unity I have a sprite sheet and cannot figure out how to select multiple frames in unity 5.5 I am watching a tutorial and it doesn't say how to do it. Is there a button I have to press while clicking or is it having to change some settings?

sentences:
Polygon editor to draw collision data over image I need an editor to plot a polygon over the texture for of a ship  in my game.

It would look like this..
Where the red is the collision outline and the image is the texture.

I want to store the polygon like texture coordinates eg top left is (0, 0) and bottom right is (1, 1).

Are there any tools (free) that does something similar to this, I'll be working with xna and C#.

sentences:
How can I derive force vectors from velocity vectors? I'm making a 2d shooter ala Geometry Wars. I've got my own simple physics at work driving the background grid and all my entities. To move anything in the world I apply a Vector2d force to it. The 'engine' calculates the resulting acceleration and therefore the velocity.

I am trying to port some code I found which implements the classic 'Boids' flocking algorithm, but the code I have works by calculating the Boids' velocities directly, so If i use it as is, it bypasses my physics engine. How I can translate the velocity vectors into force vectors that I can apply to the Boids and which will result in the proper velocities via my physics engine.

sentences:
Multiplayer card game using PHP/Ajax and mysql I am designing a map game, using PHP and MYSQL. I don't know how to make the players who sign-in to the website to see other players who are also connected to the site and be able to chat with one another.

I want to design the game in such a way that 2 players can play with each other and be able to send messages during the game while others groups are playing at the same time.

I have designed the map game successfully, but the problem is making the player 1 who log-in to site to see the player 2 who will also log-in and both can get connected to play each other.
http://i.stack.imgur.com/YyCPG.png

I will appreciate your responses.

sentences:
Unity3d mesh is getting distorted while animation I attached boxing glove to rig using this method
https://stackoverflow.com/questions/34719718/transferring-rig-weights-from-one-mesh-to-another-in-blender-2-76
 It works fine in the blender, But while animating in unity mesh is getting distorted.
Image{https://imgur.com/a/5McCX}
Anyone knows how to fix this?

sentences:
Is there any reason not to save skinning animation data in texture? I have thought about saving animation data in texture. I think I can save shader parameter setting and interpolation cost in CPU, and also enable animated instancing.

But I couldn't find no text mentioning about this, so I think there's some obvious reason people don't do this. Which I'm missing.

Can I know what I missed? Or is this just widely known technique?

sentences:
Change collision action I have a collision detection and its working fine, the problem is, that whenever my "bird" is hitting a "cloud", the cloud dissapers and i get some points. The same happens for the "sol" which it should, but not with the clouds.

How can this be changed ? ive tryed a lot, but can seem to figger it out.

Collision Code

- (void)update:(ccTime)dt {
    bird.position = ccpAdd(bird.position, skyVelocity);

    NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
    for (CCSprite *bird in _projectiles) {
        bird.anchorPoint = ccp(0, 0);
        CGRect absoluteBox = CGRectMake(bird.position.x, bird.position.y, [bird boundingBox].size.width, [bird boundingBox].size.height);

        NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
        for (CCSprite *cloudSprite in _targets) {
            cloudSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(cloudSprite.position.x, cloudSprite.position.y, [cloudSprite boundingBox].size.width, [cloudSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [cloudSprite boundingBox])) {
                [targetsToDelete addObject:cloudSprite];

            }
        }

        for (CCSprite *solSprite in _targets) {
            solSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(solSprite.position.x, solSprite.position.y, [solSprite boundingBox].size.width, [solSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [solSprite boundingBox])) {
                [targetsToDelete addObject:solSprite];
                score += 50/2;
                [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
            }
        }

        // NÅR SKYEN BLIVER RAMT AF FUGLEN
        for (CCSprite *cloudSprite in targetsToDelete) {
            //[_targets removeObject:cloudSprite];
            //[self removeChild:cloudSprite cleanup:YES];
        }

        // NÅR SOLEN BLIVER RAMT AF FUGLEN
        for (CCSprite *solSprite in targetsToDelete) {
            [_targets removeObject:solSprite];
            [self removeChild:solSprite cleanup:YES];

        }

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

    // NÅR FUGLEN BLIVER RAMT AF ALT ANDET
    for (CCSprite *bird in projectilesToDelete) {
        //[_projectiles removeObject:bird];
        //[self removeChild:bird cleanup:YES];
    }
    [projectilesToDelete release];

}

sentences:
GLSL - Rewriting shaders from #330 to #130 I recently created a game (LD21) that uses a geometry shader to convert points into textured triangles/culling. Since I was under the impression that the support for #330 was widespread I only wrote #330 shaders, but it seems that a lot of not so old hardware only support #130 (according to GLView)
Now, since I'm only familiar with the #330 core functionality I am having trouble rewriting my shaders to #130. The fragment shader was quite trivial to rewrite, but I've only managed to get my vertex and geometry shader down to #150.
So, is it possible to rewrite the shaders, or would it require a lot of changes in my rendering engine?
Geometry shader
#version 150
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
uniform mat4 oMatrix;
in VertexData
{
    vec4 position;
    vec4 texcoord;
    vec4 size;
} vert;

out vec2 gTexCoord;

void main()
{
    if(vert.position.x>-4f && vert.position.x<4f && vert.position.y>-2f && vert.position.y<2f)
    {
        gTexCoord=vec2(vert.texcoord.z,vert.texcoord.y);
        gl_Position = vert.position + vec4(vert.size.x,vert.size.y,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.x,vert.texcoord.y);
        gl_Position = vert.position + vec4(0.0,vert.size.y,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.z,vert.texcoord.w);
        gl_Position = vert.position + vec4(vert.size.x,0.0,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.x,vert.texcoord.w);
        gl_Position = vert.position;
        EmitVertex();

        EndPrimitive();
    }
}

Vertex shader
#version 150
#extension GL_ARB_explicit_attrib_location : enable

layout (location = 0) in vec2 position;
layout (location = 1) in vec4 textureCoord;
layout (location = 2) in vec2 size;
uniform mat4 oMatrix;
uniform vec2 offset;
out VertexData
{
    vec4 position;
    vec4 texcoord;
    vec4 size;
} outData;

void main()
{
    outData.position = oMatrix * vec4(position.x+offset.x,position.y+offset.y,0,1);
    outData.texcoord = textureCoord;
    outData.size = oMatrix * vec4(size.x,size.y,0,0);
}

sentences:
Finding the closest face normal from a given point in space efficiently I have a large model (roughly 400k faces) and a large number of points on this model (roughly 2000) and I need to calculate a normal per point based on the closest face on the model. Is there a faster way that isn't O(n*m) where n is the number of points and m is the number of faces (e.g., raycasting or iterating through every face)?

I'm using THREE.js and the target hardware is a Toshiba tablet with Intel integrated graphics so I don't have a lot of power to work with. Currently if I compute this on load it takes about 10+ minutes.

I've been given the requirement that there shouldn't be any model specific information precomputed for each point so that we can use the points on a different model without recomputing everything and then have multiple datasets of point => normal mappings. This is currently what we are doing and it works but doesn't scale well to our needs.

sentences:
How can I update a Stage-based HUD from another Stage's Actor in libGDX? I feel like this is a simple problem, but I'm having issues finding the correct search terms.

I have a Screen that includes two Stages.

The first, stage, contains a number of objects deriving from Actor and added via the standard stage.addActor(Actor). This is for the actual game objects.
The second, hudStage, consists of a single Table actor. This table includes a button as well as two Labels. This is for the static user interface/HUD.

I'm handling touch events on my custom actors in the game stage like the following:

public class GameObject extends Actor {
    private final static String TAG = GameObject.class.getName();
    // ...

    public GameObject() {
        // ...

        addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log(TAG, "touchDown on GameObject actor: <" + x + "," + y + ">");
                return super.touchDown(event, x, y, pointer, button);
            }
        });
    }

This works perfectly and logs what I need. However, I would now like to update the HUD with information about the object the user touched.

My screen has defined the Label I want to update (added via hudStage), but I'm not sure how to go from an actor in stage to the screen, or to the hudStage label.

public class GameScreen implements Screen {
    Stage stage;
    Stage hudStage;
    // This is the label I want to update.
    Label infoLabel;
    // ...
}

I know I can call setText(String) on the label, but I'm not sure the best way to bubble the click up. Plenty of examples have simplified versions where objects are defined in the main class (in my case, GameScreen) and are able to refer to them that way, but I've already broken these apart.

I started to look at creating a custom event that my actor could trigger, and that the stage would handle, but documentation is sparse and I'm not sure this is required.

I've also thought about scrapping the idea of having a label in the hudStage and instead having my actor draw text where the HUD would have. However, from what I continue to see, I think Scene2D is the right direction to go for the UI.

Thanks!

EDIT: What I'm looking for:

An actor in GameScreen.stage is target of a touchDown event.
Logic in actor fires and updates object.
touchDown event in actor finishes by updating infoLabel in GameScreen.hudStage or updates String value in GameScreen (if easier, I'll go this route).

sentences:
RTS game unit structure I want a way to make a lot of different units without having to program stuff like moveTo and Attack actions more than once

The way I see it, there are 2 ways I can do this.

A single generic Unit class with flags that specifies what it can/can't do (then create instances in a static array and grab them when needed)
Abstract unit class with abstract methods for Unit-specific actions like (Attack, Harvest, Patrol), which then all need to be implemented in the subclasses, even if the unit can't actually harvest anything.

the first way of doing this seems the simplest, but i would end up having a lot of code being unused for the majority of the units.

the second way could also work. But if i decide to have two different units that can harvest resources, i'm gonna have the exact same code in two different classes, which doesn't seem like the right way to do it.

Is this even the right approach to this problem?
In a game like AoE, every unit has, what i presume is, some kind of List of Actions/Orders, I would really like to know how to achieve something similar to that, where i can just code each Action/Order once, and then give it to all the units that need said Action.

If i'm unclear (highly plausible) or you need more information on what exactly i'm looking for, just ask me in a comment.

sentences:
ClickListener getTapCount() returns 0 I want to detect the double tap on a Container. If it is detected, then i have to remove the Actor associated with it.

This is my first attempt:

addListener(new ClickListener() {
    if(getTapCount() == 2) {
        System.out.println("double click detected");
    }
    return true;
});

It does not work. The method getTapCount() returns always 0.

sentences:
Intersect of vector and triangle side I'm trying to create a triangular touch surface for iOS where the user can drag around a point inside this triangle. Using information from this page, it is easy to figure out if the dragged point is inside or outside the triangle. However, I want to clip the point to the triangle edges if the user drags outside the triangle.

This is easy for side AB and side AC, because I just have to set vectors u or v to zero respectively if the user's finger drags outside of these edges. However, I'm not sure how to find point p, on side BC. I need to find this point of intersection if the user drags their finger outside of edge BC.

sentences:
What's the most efficient way to find barycentric coordinates? In my profiler, finding barycentric coordinates is apparently somewhat of a bottleneck.  I am looking to make it more efficient.

It follows the method in shirley, where you compute the area of the triangles formed by embedding the point P inside the triangle.

Code:

Vector Triangle::getBarycentricCoordinatesAt( const Vector & P ) const
{
  Vector bary ;

  // The area of a triangle is
  real areaABC = DOT( normal, CROSS( (b - a), (c - a) )  ) ;
  real areaPBC = DOT( normal, CROSS( (b - P), (c - P) )  ) ;
  real areaPCA = DOT( normal, CROSS( (c - P), (a - P) )  ) ;

  bary.x = areaPBC / areaABC ; // alpha
  bary.y = areaPCA / areaABC ; // beta
  bary.z = 1.0f - bary.x - bary.y ; // gamma

  return bary ;
}

This method works, but I'm looking for a more efficient one!

sentences:
How to measure skill in a pinball game? I am trying to come up with a system to measure or estimate the skill of a player at a single player game (so no head-to-head rating system help here). Specifically, it is a pinball game, but I do believe it is similar to most point-based single player games.

I have thought of 3 approaches:

total points scored with a threshold for each skill level
average points scored over all time
average points scored over last X games

All of them use points, which I think is probably the right metric: anything a player does in pinball grant points, with the most difficult objectives worth more points. Points also take into account all of the rare combination of objectives (like score multiplier + multiball) that would be hard to track manually.

However, I am not sure which approach to use and I bet other games have implemented similar skill-measuring system that I can use as a guide, so I'd appreciate any and all help on this.

sentences: Löve2D: Making a random map/city generator So I'm making a game using love2d where the player will find himself in an zombie infested city but I don't want the city/map to be just the same all the time, so I want to create a random map/city generator, but I don't know where to start, I maybe can make my own but the result would probably be not what I wanted, as I don't want tiles getting placed all over the place messily(it won't look like a city then), I want random set of tiles getting placed in the world/map like buildings get placed randomly throughout the world/map, I hope someone can help me with this as this is really hard for me...

sentences:
How does CharacterMovementComponent::PerformMovement work? I'm developing an adventure platformer. As such, the manipulation etc. of the CharacterMovementComponent is going to be crucial to the game.

I have seen the more top level explanations of the MovementComponent however none of them provide any insight into how PerformMovement is coded.

I'm trying to work through it and understand it myself, however as i'm not completely familiar with the component, it's a little hard for me to understand.

So I was wondering if anyone on here knew anything about this MovementComponent, could tell me how the function really works, or could point me in the right direction for the development of our movement systems.

sentences:
Should collision detection be done server-side or cooperatively between client/server? I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist server side (not stored in client data files).

For security purposes, should I do all collision detection server-side? Or should I have the client do the detection and have the server follow up on it somehow? I feel like it will be too much for the server to do by itself (I am designing the engine for hundreds of players on one server).

Does anyone know how mainstream MMOs do it? I know that almost all MMOs right now are susceptible to physics hacks and usually deal with them by detecting hacks and banning people. I would rather the hacks did not work at all, at least for the physics component.

sentences:
3D open source physics engine suitable for mobile platforms (Android and iOS) I have made some research and found that bullet, ode, newton and some others are open source physics engines that should be portable enough (but I have never tried to comile/use anyone of them on phones). I am writing my games for mobile platforms in C++, so the engine should be C or C++. I need a fast engine, since mobile platforms have limited resources. I need a free engine. A good design would be nice to have too.

What engine is best suited for my task?
What I really would like to hear from you is your direct experience.

Documentation and support (for example, forum or an IRC channel) is a really important aspect to take into consideration.

sentences:
Make platformer character stay in the air at the top of a jump I have a player who can jump. I want the character to stay in its position and not fall to the floor.
This is the code I am using so far:
private void FixedUpdate()
{
        if(moveup)
        {
            rigid.AddForce(new Vector3(0, 1f, 0) * speed, ForceMode2D.Impulse);
            moveup = false;
        }
}

How can I stop the character from falling?

sentences:
How to set player rotation to direction the player is moving? I'm having an issue with my click to move mechanic. I want the player to move to a specific position in the game when the mouse is clicked (and it does just that) but the issue I'm having is that the player doesn't face the direction in which it is travelling.

Lets say I click a position diagonally right to where the player is. Immediately after clicking that point, the character will face that direction and run to it, instead of facing the direction it has to take to get there... if that makes sense.

Here's my code snippet:

public void moveToTargetPosition() {
    Seeker seeker = GetComponent<Seeker>();
    seeker.StartPath (transform.position, targetPlayerPosition, OnPathComplete);

    transform.rotation = Quaternion.Lerp (transform.rotation,  Quaternion.LookRotation(targetPlayerPosition - transform.position), Time.fixedDeltaTime * lookSpeed);
}

Obviously I'm missing some modifier in here.

Any ideas?

Thanks!

sentences:
GPU (render time) increase if screen size increase i create a simple 2d scene in unity 2017.3.1f1
I changed the size (height and width) in the Game View and proflie to see how it affects the rendering.. (below photo)

I saw that the rendering time increases by increasing size, and now if this happens when playing the game on a different resolution android phone, each The higher the resolution of the phone, the more likely it is to get gpu bound !???
And i do not understand Cpu graph in the two situations in above photo(lower GPU ---> higher CPU !!!)
I tested my game on the "huawei mate 10 lite"(android device) with a resolution of 1080 x 2160 and it looks like there is a lot of rendering time.(a simple scene with only 5 sprite renderer)
(unity dosen't show GPU profiling when game run on android device and we can't check these...)
I did all the optimizations I heard, like:
DynamicBatching, Sprite Atlas , Quality Setting , sprite Texture Comprestion Override for Android..
What can be done to ensure that rendering time does not exceed a specified limit on different phones ??

sentences:
Mixamo Fuse Unity eyelashes not correct I created a character in Adobe Fuse, sent it to Mixamo for rigging with blendshapes and downloaded the fbx for unity file.
Below is how the character eyelashes appear in Fuse..

However, when I imported the fbx file and pulled it in my scene, the eyelashes appear as a piece of block. How do I fix this?

EDIT: It seems like the eyelashes are messed up due to Mixamo, there is no issue with Unity import. It happens when the Fuse character is sent to Mixamo for rigging and downloaded from there. When I opened the downloaded fbx file in Windows 3dViewer, it appeared with messes up eyelashes as shown below.

EDIT: Added the texture/material option pane, material settings and import settings for albedo texture in Unity below:

sentences:
How to make the game run at 60 FPS in Irrlicht? I want my game run at 60 fps, but I don't know where to start, I have the simple loop:

while(device->run()){

How do I lock the frame rate to 60 FPS?

sentences:
Counting shader animation "iterations" I'm writing a shader that animates "pinching" an image and releasing it. It's similar to this shader on shadertoy.

One issue I have is that my shader should only "animate" once - meaning the image should appear to "pinch", then "unpinch", but then stop. Like this example, it'll keep going since the animation ia time-driven.

Since the shader is called for each pixel I don't see any easy way to track how many "animation iterations" there have been for the entire image.

I can handle animation via a Unity Update method, where I can easily control when to stop, but I'd rather do this entirely in-shader if at all possible.

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord.xy / iResolution.xy;

    vec2 center = vec2( .5 );
    vec2 dir = normalize( center - uv );
    float d = length( center - uv );
    float factor = .5 * sin( iTime );
    float f = exp( factor * ( d - .5 ) ) - 1.;
    if( d > .5 ) f = 0.;

    fragColor = texture( iChannel0, uv + f * dir );
}

sentences:
Set the LineTraceByChannel to use my custom created channel? C++ I want to use LineTraceSingleByChannel function for my SightRay component which will be used for my adventure game. I want to mark certain objects in game as 'Viewable' in Trace Channel. Then the ray will only be true if it hits a 'Viewable' object.

I have created the Viewable trace channel in the Collision settings of Project Settings. But I have two problems now.

In the actual c++ code I am writing, how do I reference this new 'Viewable' channel in the ECollisionChannel parameter of the method?
How do I assign this channel to each object in the scene?

I have been trying to figure this out for hours, I've read many Unreal documentation pages and forum threads but can't get a straight answer, particularly without using Blueprint nodes.

Here is my code:

bool USightRay::GetLineTraceHit(FHitResult &OutHit)
{

FVector LineStart = UGameplayStatics::GetPlayerCameraManager(this, 0)->GetCameraLocation();
FVector LineEnd = LineStart + UGameplayStatics::GetPlayerCameraManager(this, 0)->GetCameraRotation().Vector() * LineTraceLength;
//ECollisionChannel viewable =  WHAT CAN I PUT HERE?????
if (GetWorld()->LineTraceSingleByChannel(OutHit, LineStart, LineEnd, viewable))
{
    UE_LOG(LogTemp, Warning, TEXT("HIT ME WITH YOUR RHYTHM STICK!"));
    return true;
}

return false;
}

I actually thought this would be simple before I started to code it. I've used it before but I just used ECollisionChannel::ECC_Visibility  in place of 'viewable'. This time I want to learn to filter the collisions and traces properly.

Thank you for any help.

sentences:
Create Full Tile Map Zone in an Art Software, then generate corresponding tile name list? I'm completely new to tile map creation. I'm a programmer and I'd like to make life easier for myself. It's a bit long to explain the problem I think I have, but bear with me.

The Scenario:
From what I understand, in my code I need an array which holds my tile information for a zone/area in my game. Lets say for simplicity this zone was a 10x10 grid, so 100 indexes in the array. Now, lets say each index holds a number that corresponds to a specific tile. ex) Number 1 means grass tile. Number 4 means rock tile. etc.

So far so good. From this array (and additional coding), my tile map will be generated on my game screen.

The problem:
As it stands I have to individually type each tile identifier for each index in the array. Now let's say that I have already fully designed the visual tile grid map for my zone in a particular art software. Simply put, I am staring at my fully completed zone in my art software screen and it is my visual aid for creating my array. My strategy now is to look at each grid cell, see what tile I put in there, and type its identifying number into my array. Rinse and repeat hundreds of times, looking at each individual tile until I manually complete the array. This is an extremely tedious and long process.

What I want:
So my full tile map is already in my art software. What I want is for the software to more or less generate the array for me! I press a button, and It will see what tile is in each grid square, and accordingly generate a list in a text document with each tile's identifying number that I give it. That's literally all I need. I can then copy and paste the list into my array in my code. It shaves off tons of time.

The Question:
Notice that I have used the generic term "art software". Is there any art software that can do what I described? Is there any art software (e.g. adobe illustrator, photoshop, gimp, etc.) which upon having a fully completed tile map, will be able to generate a text file list of each tile's identifying name?

sentences:
Car driving through walls with transform.Translate() I need help with a script for a very simple car that uses transform.Translate:

public class car1 : MonoBehaviour {

    public PauseMenu pause;
    [Space]
    public Car_Script car_s;
    public float speed;
    public GameObject car;

    void FixedUpdate()
    {

        if (car_s.InCar == true)
        {
            if(pause.isPaused == false)
            {
                if (Input.GetKey(KeyCode.W))
                {
                    car.transform.Translate(Vector3.forward * Time.deltaTime * speed);

                    if (Input.GetKey(KeyCode.A))
                    {
                        if (speed <= 0)
                        {
                        }
                        else
                        {
                            if (speed > 0F && speed <= 50F)
                            {
                                car.transform.Rotate(Vector3.down, 2F);
                            }
                            else if (speed > 50F && speed < 90F)
                            {
                                car.transform.Rotate(Vector3.down, 1.3F);
                            }
                            else if (speed > 90F)
                            {
                                car.transform.Rotate(Vector3.down, 0.9F);
                            }

                        }
                    }
                    if (Input.GetKey(KeyCode.D))
                    {
                        if (speed <= 0)
                        {
                        }
                        else
                        {
                            if (speed > 0F && speed <= 50F)
                            {
                                car.transform.Rotate(Vector3.up, 2F);
                            }
                            else if (speed > 50F && speed < 90F)
                            {
                                car.transform.Rotate(Vector3.up, 1.3F);
                            }
                            else if (speed > 90F)
                            {
                                car.transform.Rotate(Vector3.up, 0.9F);
                            }

                        }
                    }
                }
            }
        }
    }
}

Whenever I drive the car it immediately goes through walls.

I have colliders on everything. The car has mesh colliders set to convex.

I've searched around quite a bit for answers and it seems that a common one is using rigid bodies. But whenever I even put a rigid body on the car, it flies out into the sky.

sentences:
Unable to move GameObject? This simulates a GameObject swinging between two positions.

I am unable to manually move a GameObject on the Y axis using the Unity editor (in scene view) when the following script is attached and running, it's like a solid animation:

Vector3 min, max;

void Update()
{
    min = wall1.position + new Vector3(4,0,0);
    max = wall2.position - new Vector3(4,0,0);

    transform.position = Vector3.Lerp (min, max, (Mathf.Sin(2 * Time.time) + 1.0f) / 2.0f);
}

sentences:
LibGDX TexturePacker line problem I'm trying to use a TextureAtlas for all my textures for better performance. Every time my game starts all my tiles are packed into one texture atlas. I have put following code into my DesktopLauncher class that does that:

TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 512;
settings.maxHeight = 512;
settings.filterMin = Texture.TextureFilter.Nearest;
settings.filterMag = Texture.TextureFilter.Nearest;
TexturePacker.process(settings,"blocks","texturePacks","blockPack");
TexturePacker.process(settings,"items","texturePacks","itemPack");

The atlas is loaded with the asset manager and I'm getting the texture region with

atlas.findRegion(..);

It all works, but I have came across an issue. The texture is not filling the whole space anymore. It should fill a 32 by 32 pixel area, but it doesn't. Here is a picture of whats happening:

There are fine blue lines between the tiles and I don't know what I'm doing wrong. My background is blue, if that's helpful information.

I have tried so far:

Loading the texture region from the .png file directly -> no blue lines, so it is an issue with the texture packer
Changing the texture filters, but no one I have tried helped

Thanks in advance for any comments and answers!

sentences: Simulating Enums with Javascript When developing in Javascript, it seems useful especially for event systems to use enum-likes, but not string comparison for performance considerations (also because it doesn't protect against typos). How do you use Enums in JS? Should I switch to Typescript?

sentences:
Send empty vertex buffer data but keep Vertex Shader Input Structure? lets say i have the following structure defined in a header (for reusage):

struct VertexShaderInput
{
    float3 Position: POSITION;
    float3 Normal: NORMAL;
    float2 UV: TEXCOORD;
    float4 Color: COLOR;
};

however, some meshes dont have normals or colors and some passes (such as Depth PrePass) doesn't need Normal or Color.

Is there a way to keep the struct definition above in my shaders and simply sending "zero" bytes for Normals and Colors?

sentences:
LibGDX how to change animations I have a Player Class and i have 3 different Animations for it. I can render them perfectly but i don't know how to change from one animation to another. For exmaple i have 3 animations, one for Running, one for Jumping and one for Rolling down. Now i want to to change from running animatioon to Jumping when user presses a button. Inpout is not the problem. I am using the same code at LibGDX wiki to create to sue animation just like in this link: https://github.com/libgdx/libgdx/wiki/2D-Animation

It would be very helpful if you could give an example too but its not necessary though.

sentences:
UDP server and large number of users? My initial research showed the most people prefer to use UDP protocol and build a control code on top of it for multiplayer games. It seems like a good design at first, but I am wondering if it is really the best in the long run.

For example, what happens if your game goes from 64 players to 500, 1000, 20 000

Is the UDP port going to overflow and start dropping incoming packets?
Is the overhead that you wrote for UDP-reliability going to be less optimal when you start using more bandwith? (I.e. the server will spend significant cycles managing features that may already be present at the hardware and network level that are built into TCP)

I am considering re-writing a server that initially used UDP+reliablity protocol and splitting it into two cluster servers to handle different regions as well as introducing a load balancer in the middle. The UDP design is starting to look a little more complicated and having a large number of NPCs and state synchronization that may have to take place is making me reconsider UDP.

sentences:
Loading resources in a portable manner I've been looking at ways to load data into a game.  I even asked a question on stack overflow about reading binary data in a portable manner .  The gist of the answer seemed to be that you can use the int types header file to specify an particular integer byte amount, but there's nothing really useful for floats, etc.

I then thought that you could use fixed point, rather than floating point, but I wanted to see how other games did it.  Here is one example, a md2 loader: http://tfc.duke.free.fr/old/models/md2.htm .  However, it seemed to assume that the size of various types would just work, and that they would be the same on the platform that made the md2, and the one that read it.  This seemed to be fairly common in the code that I've seen so far.

So is it really common to just ignore possible different size issues, or have I just been looking at bad (or old) samples?  If it's not, could you also demonstrate a better way to do it, or at least link to one?

Thank you.

sentences:
What are ways I can transition from enterprise application development into gaming development? I'm currently a software architect using the Microsoft stack of enterprise app development tools (.NET, C#, SQL Server, etc.). I've been thinking about transitioning over to game dev.

What paradigms exist in gaming that
don't in enterprise development that
I'd need to learn? I'm deeply versed
in DB design, design patterns, theory
etc. Will this help me?
Overall, will
it be like I'm starting over from
scratch in changing careers?

sentences:
Access vertex data stored in VBO in the shader If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data in GLSL? I already know how to put the data in the buffer, interleaved with the rest of the data.

For example I want each vertex for a model to contain:

Vec3 position;
Vec3 normal;
Vec4 color;
Vec2 texCoords;
int boneCount;
int[3] boneIndex;
float[3] boneWeight;

Then drawing like:

bind(vertexBufferID);
glVertexPointer(3, GL11.GL_FLOAT, stridePlus, 0 * 4);
glNormalPointer(GL11.GL_FLOAT, stridePlus, 3 * 4);
glColorPointer(4, GL11.GL_FLOAT, stridePlus, (3 + 3) * 4);
glTexCoordPointer(2, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4) * 4);
glVertexPointer(7, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4 + 2) * 4);
glDrawArrays(GL11.GL_TRIANGLES, 0, VPNCTEnd);

Then in my vertex shader I want:

 //Get indices of bones
 //Get weights of bones
 //Get bone transforms
 //for each bone transform, apply it to gl_Position at the specified weight

What is the GLSL required for the last part of the process? It seems like I need to set a attribute pointer to the data somehow, but I'm not sure where to do that when the data is stored in the VBO.

sentences:
Will having many timers affect my game performance? I'm making a game for android, and earlier today I was trying to add some cool stuff to my game. The problem is this thing needs like 5 timers. I build my timers like this:

timer += deltaTime;
if(timer >= 2.0f){
    doStuff;
    timer -= 2.0f;
} // this timers gets stuff done every 2 secs

Will having to many timers like this, getting checked every frame, screw up my games performance? The effect I wanted to add was a crosshair every 2 sec, then remove it after 2 sec and do a timed animation. So an array of crosshairs dependent on a bunch of timers to be exact. This caused my game to shut down when used, so thats why Im wondering if using that many timers causes my game to flip out.

sentences:
Having trouble making game time pause and unpause I've been trying to make it where when the player does a certain task, the game's time will pause. When the player does another action, the game's time would unpause and continue. I had my code like so:

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

public class timeScript : MonoBehaviour
{
    //uGUI Items
    public Text date;
    public Text playerCash;

//Times
public static int week;
public static int month;
public static int year = 1980;
//amount of cash
public static int myCash = 10000;
public AlertBox alert;
public Text timeText;

bool timeActive = true;
int time;

int day;

void Start()
{
    InvokeRepeating("Timer", 0, 1);
}

public static void Timer()
{
    timeText.GetComponent<Text>().text = "W" + week.ToString() + "" + year.ToString();

    playerCash.GetComponent<Text>().text = "$" + myCash.ToString();

    #region YEAR
    //Check if month equals 13 (allows for 12th month to be counted)
    if (month == 13)
    {
        year++;
        month = 0;
    }
    #endregion
    #region MONTH
    //Check if week equals 5 (allows for 5th week to be counted)
    if (month == 5)
    {
        month++;
        week = 0;
    }
    #endregion
    #region WEEK
    //Check if day equals 8 (allows for 7th day to be counted)
    if (day == 8)
    {
        week++;
        day = 0;
    }
    #endregion
    #region DAY
    //Check if Time equals 5 (allows for 4 seconds)
    if (time == 2)
    {
        day++;
        time = 0;
    }
    else
    {
        time++;
    }
    #endregion

I tried using CancelInvoke(timeScript.Timer()); in another c# file but all it did was give me an error that stated I couldn't convert from string to void.

sentences:
When is Micromanagment in games considered fun/boring? Some players (typically the developer types, but not exclusively) love to control intricate aspects of a game (typically a simulation game) such as how long traffic lights take, how much to tax certain citizens (in sim city style games) when to change gear (in a racing game) exactly what an AI should do etc...

But how far should a developer go to implement micromanagement, when does it stop becoming fun? It would be rather tedious to connect each building to the water, and electrical grid for example in sim city. Whereas issuing city ordinances is considered engaging to the player.

sentences:
How can I make a character stand on slopes? First of all, note that I want to understand the principle, so I would prefer explanations in plain english (but of course I have nothing against some code to complement these explanations).

I am wondering what is the way to make a character step correctly on a slope, let's start with two screenshots of the game Limbo to show you what I mean :

So, as you can see on these pictures, it looks like the spine of the character is actually perpendicular to the horizon and not to the surface of the ground and this observation leads me to my question:
How can you reproduce such a behavior with Sprite Kit ? Because if I attach a physic body to a node, I have the possibility to let it rotate, so I would get something like this :

If I disable the rotation I would get something more like this :

As you can see these ways to do both present important issues and doesn't looks natural at all. So how should I do to make it look natural ? I thought to create several sprites and several physics bodies and then attaching them all together with joints I don't think that it will look natural because if you look at this :

Although I can physically link these nodes, how will I do to make them look real graphically ? Because in the reality, for example, the thigh and calf are linked by a knee...

Any ideas ?

sentences:
Click on an isometric plane and obtain normal coordinates I have photos distributed as cells. When I click, I get the corresponding row and column.
console.log("Col:" + X + "Row:" + Y);

When applying an isometric view conversion like this:

ctx.translate(0, 300);
ctx.scale(1, 0.5);
ctx.rotate(-45 * Math.PI /180);

I do not know what mathematical formula applies to get the coordinates correctly.

Based on feedback so far, I've been able to get this far. The x coordinate seems to work fine, but the y coordinate not.

Isometrico();

function Isometrico(){
     ctx.translate(0, 300);
     ctx.scale(1, 0.5);
     var radianes= -45 * Math.PI /180;
     ctx.rotate(radianes);
}

/*
document.addEventListener("mousedown", function(e) {
             CorIsometrico( e.offsetX, e.offsetY);
});
*/

/*
function CorIsometrico(xI,yI){
     //RESPUESTA yI=yI-300;
     yI = yI * 2;
     xI = xI * Math.cos(45) - yI * Math.sin(45);
     I  = yI * Math.sin(45) + yI * Math.cos(45);
     console.log("Coor Isometricas:" + xI + "/"+ + yI);
}
*/

Edit:

Each cell is 50x50. Having 10 columns and 50 rows, the information of each cell would look like this:

1: 50/50
2: 100/50
3: 150/50
...
49: 450/250
50: 500/250

Maximum Y value = 250.

xI=xI*Math.cos(45 / 180 * Math.PI)-yI*Math.sin(45 / 180 * Math.PI);
yI=yI*Math.sin(45 / 180 * Math.PI)+yI*Math.cos(45 / 180 * Math.PI);
yI=yI*2;
yI=yI-300;

Click in X:1 / Y:1 = -138.5929291125633/ 531.5575746753798
Click in X:1 / Y:5= 198.69700551341987/ 90.3229432149742

Y exceeds the maximum value.

Edit2:

var xI2=xIMath.cos(45 / 180 * Math.PI)-yIMath.sin(45 / 180 * Math.PI);
 var yI2=xIMath.sin(45 / 180 * Math.PI)+yIMath.cos(45 / 180 * Math.PI);
 yI2=yI*2;
yI2=yI-300;
xI2=xI2+150;

/// console.log("Coor Isometricas:" + xI2 + "/"+ + yI2 );

x coor : 100 to 400 px if x+150; y coor: 0 to -155.

Been thinking that the problem is not necessary on isometry.
What I'm looking for can be simplified to get the coordinates of a 2d plane by having it rotated X degrees

sentences:
UI event issues with reaction game I'm making my first real video game. You have to click either on the left or right side on time or else you lose (note: the code I'm about to post doesn't have the timing, don't worry about that, I haven't added it yet). My question is why when the player clicks a UI button that's on the left or right side based on where they're instructed to click, nothing... happens. This is the main script, and all of it is relevant because the whole game isn't done yet, and this small amount is just what I've created so far.
I have done my research. I have been looking up everything I can think of for the past day now.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Advertisements; // coming soon

public class Game: MonoBehaviour {

  public Button playBtn;

  public Button clickSideLBtn;
  public Button clickSideRBtn;

  public Text clickSideLTxt;
  public Text clickSideRTxt;

  public Image playIcon;
  public Image pauseIcon;

  private float correctSide = 0;

  private GameManager gameManager;

  private bool hasAnswered = true;

  private AudioSource audioData;

  private void setSideActive(float side, bool state) {
    if (state) {
      correctSide = side;
    } else {
      if (side == 0) {
        correctSide = 1;
      } else {
        correctSide = 0;
      }
    }

    if (side == 0) {
      clickSideLTxt.gameObject.SetActive(state);
      clickSideLBtn.gameObject.SetActive(state);
    } else {
      clickSideRTxt.gameObject.SetActive(state);
      clickSideRBtn.gameObject.SetActive(state);
    }
  }

  void Start() {
    audioData = GetComponent<AudioSource>();

    gameManager = GetComponent<GameManager>();

    pauseIcon.gameObject.SetActive(false);

    gameManager.gameIsStarted = false;

    setSideActive(0, false);
    setSideActive(1, false);

    StartCoroutine(HandleUpdate());
  }

  private IEnumerator HandleUpdate() {
    for (;;) {
      DoUpdate();

      yield return new WaitForSeconds(2.0f);
    }
  }

  void DoUpdate() {
    if (gameManager.gameIsStarted && hasAnswered) {
      hasAnswered = false;

      if (Random.value > 0.5f) {
        setSideActive(0, true);
        setSideActive(1, false);
        audioData.Play(0);
      } else {
        setSideActive(1, true);
        setSideActive(0, false);
        audioData.Play(0);
      }
    }
  }
  void OnEnable() {
    //Register Button Events
    playBtn.onClick.AddListener(() => playBtnCallback());
    clickSideRBtn.onClick.AddListener(() => clickSideR());
    clickSideLBtn.onClick.AddListener(() => clickSideL());

  }

  private void playBtnCallback() {
    if (gameManager.gameIsStarted) {
      gameManager.EndGame();
    } else if (!(gameManager.gameIsStarted)) {
      gameManager.gameIsStarted = true;
      playIcon.gameObject.SetActive(false);
      pauseIcon.gameObject.SetActive(true);
    }
  }

  private void clickSideR() {
    if (correctSide == 1) {
      hasAnswered = true;
      setSideActive(1, false);
      // yay, you did it right, don't do anything, other scripts keep the game alive until you tell it not to
    } else {
      gameManager.EndGame();
    }
  }

  private void clickSideL() {
    if (correctSide == 0) {
      hasAnswered = true;
      setSideActive(0, false);
      // yay, you did it right, don't do anything, other scripts keep the game alive until you tell it not to
    } else {
      gameManager.EndGame();
    }
  }
}

sentences:
Cocos2d not getting the texture which is added to CCTextureCache using thread I convert the image into texture in a thread using the following line of code to reduce the image to texture converting time.

[[CCTextureCache sharedTextureCache] addImage:@"imageName"];

But when i retrieve this image from cache i am getting a blank image. If i am calling the above line of code in main thread i am getting the image.

sentences:
Voxel traversal for parabolic projectile arc under constant gravity For linear polynomials, there's a bunch of algorithms for efficiently determining which voxels to test for collision (eg. A Fast Voxel Traversal Algorithm for Ray Tracing ). I'm having troubles though, searching for algorithms that work for any other case, such as a parabolic projectile arc under constant gravity.

Are there any algorithms for that case, or am I stuck just trying to sample at a high enough frequency that only rarely will a projectile travel though a wall without getting detected.

sentences:
How do I scroll to follow my sprite in the physical world? I am using andengine to make a game where a sprite (player) is going up across the stage,  and I want the camera to stay centred on the sprite the entire time.

This is my world so far:

final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);

final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);

/* Create two sprits and add it to the scene. */

this.mScene.setBackground(autoParallaxBackground);

this.mScene.attachChild(ground);
this.mScene.attachChild(roof);
this.mScene.attachChild(left);
this.mScene.attachChild(right);

this.mScene.registerUpdateHandler(this.mPhysicsWorld);

The problem is that when the sprite reaches the top wall, it crashes.
How can I fix this?

sentences:
Why my charchter fluctuate instead go down stairs? My player is a capsule with:

First person controller
Charchter controller

When my player go up stairs, it works well.
When my player go down stairs, it fluctuate in air.

What am i wrong ?

Thanks

sentences:
How to move in between grid in crossword game I am trying to create crossword game in my current app. As my current project is in iOS native so I wanted to implement this game only in UIKit so that it can be easily integrated.

Requirement

i need these types of movement in the crossword(as shown in below gif), like whenever I entered any char, it automatically moved to the next grid and when I entered the backspace button it clear that grid and automatically moves the previous grid.

Issue

Right now user have to select each and every grid to give input, which reduces the user interaction. So I wanted to implement this movement so that user can use crossword in a better way.

What I have done?

I successfully created the UI part by using the json structure which is similar to iPuz. But facing issue to implement this movement in crossword.

To check screen ui image, json structure & git repository, pls cleck here, if you need any further information pls ask in comment I will update the question.

sentences:
Backend for data-driven multiplayer game I am working on a match-based (5v5) multiplayer steam game that is similar to TF2, LoL, Dota 2, etc.

I am planning a data-driven approach where character/abilities/items/etc are defined in data (JSON). This will allow for easy patching to constantly balance the game.

So I have something like the following. (obviously simplified)

{
    "Troll": {
        "name" : "Troll",
        "health" : "100",
        "abilities" : [
            {
                "name" : "ClubSwing",
                "damage" : "50"
            },
            {
                "name" : "FootSmash"
                "damage" : "100"
            }
        ]
    },
    "Orc": {
        "name" : "Orc",
        "health" : "50",
        "abilities" : [
            {
                "name" : "SwordSwing",
                "damage" : "10"
            },
            {
                "name" : "ArrowShoot",
                "damage" : "25"
            }
        ]
    }
}

I am wondering what the best practice way is for storing this data. I obviously can't store it client-side or the player will be able to cheat. Is it normally stored in the database? I haven't setup any backend for my game yet.
Should I setup a nodejs server with a nosql database like mongodb to be the master of this data? And then build a REST API on top of that for reading this data?

I also need to write some things to a database. Such as the users rank, items, game stats, etc.

Would it be better to have two separate databases? One for reading gameplay data like I have above and another reading/writing user information (stats, rank, items, etc.)

Or would it be wiser to use a single database? Would you recommend nosql or sql based?

Note: The game engine I'm using is unreal engine 4. Currently I am using a listen server (peer-to-peer), but think it may be necessary to eventually use the dedicated server instead.

sentences:
Drawing & transforming matrices upwards I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale.

I get my expected results If I draw my objects from my root node in this fashion:

public void Draw(Matrix world, Matrix view, Matrix proj)
{
    foreach (var item in Children)
        item.Draw(world * item.Transform, view, proj);
}

However, I want to draw my objects by starting with a child node, drawing upwards, and achieving drawing from a child-object relative space. How would I do this?

I've tried a number of ways or drawing the parent nodes with inverted transform, but I'm not getting the correct results, I'm guessing I need to take care of the multiplication order, but I don't know what that is if I'm going up instead of down.

sentences: Is C++ being replaced by C# in industry games? In industry games I mean like Quake, CoD etc.

sentences: What are the pros and cons of HLSL vs GLSL vs cg? What are the pros / cons of the three?

sentences: Is there any way to earn money with an open source game? I know FreeToPlay games are financed by advertisements and/or selling additional content, but what about an Open Source single player game to which several people have contributed? And how can a fair sharing be determined?

sentences:
Unity3D Resize texture without corruption I am currently working on a solution to make my game look very pixelated, like Doom or Quake. But there is a big problem.

I'm using Unity Personal.

I render my camera to a 1920x1080 texture, then I try to use Texture2D.Resize on it, then render it back to the screen using ScaleMode.StretchToFill.

But the problem is that the texture seems to corrupt when I use Texture2D.Resize on it.

And here is my current code:
using UnityEngine;
using System.Collections;

public class PixelRenderer : MonoBehaviour {

    Texture2D texture;

    // Use this for initialization
    void Start () {
        texture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
    }

    // Update is called once per frame
    void OnPostRender() {
        texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
        texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        texture.Apply();
        texture.Resize(256, 256);
    }

    void OnGUI() {
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture, ScaleMode.StretchToFill);
    }
}

Is there something that I'm missing here? Or am I doing something wrong?

sentences:
Mouse joint isn't restricting the ball from going to the other part of the screen I'm developing a application in cocos2d using the Box2D framework, but unfortunately I am having issues. I'm not able to restrict the orange ball in the half screen area, taking the image below as reference, I don't want to allow the ball to go to the opposite part of the screen.

I'm using the b2MouseJoint to move the ball around the screen. b2PrismaticJointDef seems to restrict on any particular axis, but I need to restrict on a particular rectangular area of the screen.

sentences:
Using a remote highScore storage/retrieval system. I have no idea on how to implement The system is something like this:

  highScoreDB || Validator || PlayerSession
  ---Database---||--Script---||----Game------

PlayerSession is an active game session, on finalizing a match, the game checks if highScoreDB is full, if full; compare the session's score with the lowest DB score and replace if its greater; if not full then just add the session score normally. Upon score submission, the game also sends some other data for the Validator.

The Validator checks if the score is legit by processing the extra data(match duration, key entities interacted with, etc); if the score is valid, then score is applied successfully; otherwise, it's rejected and the sent data is logged elsewhere(not relevant ATM).

The highScoreDB simply stores the data for retrieval by players.

Now I do not know how to make and where to stick the scripts as well as how to appropriately store the data. I'd appreciate any assistance on this matter.

sentences:
Per fragment lighting with OpenGL 4.x tessellated model I'm experienced with OpenGL 3+. I'm dabbling with tessellation shaders and have now got to a point where I have a nicely tessellated teapot/plane demo (quick look here)

As can be seen from the screenshots, the lighting is broken (though admittedly doesn't look too bad in the image)

I've tried to add a normal map to the equation but it still doesn't come out right, I can calculate the normals, tangents and binormals per triangle in the geometry shader but still looks wrong.

I think the question would be; How do I add per fragment lighting to a tessellated model?

The teapot is 32 16-point patches, the plane is one single 16 point patch.

The shaders are here, but they are a complete mess, so I don't blame anyone who cant make sense of them. But peruse at your leisure if you like.

Also, if this question is more suited to be somewhere else i.e. Stack Overflow or the Programming stack please let me know.

sentences:
Position child on the edge of the parent circle while scaling unity3d I have come across to some different situation. I have one circle sprite and i am rotating circle continuously while rotating i want to make circle smaller and larger.

I have one object on the edge of the circle i have made that object as child of the circle.

Now my problem is how to make this child object to stay at the edge while i scale circle sprite . I s this possible ?

Thanks.

sentences:
SDL2 in a VS2015/C++ panel I'm trying to use SDL2 in a panel (VS2015/C++) and cannot find solid examples of how to connect the two. Anyone know how this is done?

I've tried some code found in various places, but no luck yet.  The code below was my latest attempt. I'm using latest version of SDL2.

SDL_Window* sdlWnd = SDL_CreateWindowFrom((void*)mapPanel->Handle);
SDL_SetWindowTitle(sdlWnd, "SDL Window - Set by SDL");
SDL_Surface* s = SDL_GetWindowSurface(sdlWnd);
SDL_FillRect(s, &s->clip_rect, 0xffff00ff);
SDL_UpdateWindowSurface(sdlWnd);
SDL_ShowWindow(sdlWnd);

sentences:
Determine height on Bresenham line algorithm path I have path from Bresenham line algorithm, example for A->B vector:

Path is [(0,5), (0,4), (1,4), (1,3), (1,2), (1,1), (2,1), (2,0)]. Considering A height is 10 meters, B height is 5 meters and a tree at position 1,1 is 5,5 meters:

How to know if point B is visible from point A ? My real question is: How to know the A->B vector height when it is "above" specific position, so here 1,1 ?

sentences:
Bouncing ball slowing down over time I use the unreal engine 4 to bounce a ball off of walls in a 2D space, but over time the ball gets slower and slower.

Movement happens in the tick function of the ball

FVector location = GetActorLocation();

location.X += this->Velocity.X * DeltaSeconds;
location.Y += this->Velocity.Y * DeltaSeconds;

SetActorLocation(location, true);

When a wall gets hit I get a Hit Event with the normal of the collision.
This is how I calculate the new velocity of the ball:

FVector2D V = this->Velocity;
FVector2D N = FVector2D(HitNormal.X, HitNormal.Y);

FVector2D newVelocity = -2 * (V.X * N.X + V.Y * N.Y) * N + V;

this->Velocity = newVelocity;

Over time, the more the ball bounced around, the velocity gets smaller and smaller.
How do I prevent speed loss when bouncing off walls like that? It's supposed to be a perfect bounce without friction or anything.

sentences:
Unity built-in Network Lobby How to move GUI? I'm using built-in network manager HUD and I'm fine with it for now.
But I can't move lobby GUI, only Network Manager HUD. Is there a way to move it down to make space for Title Art?

sentences:
Facial expressions capabilities in various engines For a research project, I am developing a small game focused on non-verbal communication clues, like facial expressions (smiling, frowning, looking bored, etc), eyegazing, proxemics, etc. My main issue is facial expressions, as I can't find detailed info on various engines capabilities on that point.

I usually believe that the engine/language used doesn't matter, as you can more or less do anything with any engine/language, but in this case I need something as efficient as possible (I am time limited).

I have reduced my options to 4:

UDK
Unity
Skyrim Creation Kit
Source Engine

So, what are the capabilities of these 4 regarding facial expressions? And let's be honest, in which of them are they the easiest to implement/manipulate?

If there is another engine more appropriate, I'll be glad to hear about it too.

Thanks!

sentences: How do you determine which object/surface the user's pointing at with lwjgl? Title pretty much says it all. I'm working on a simple 'lets get used to lwjgl' project involving manipulation of a rubik's cube, and I can't figure out how to tell which side/square the user's pointing at.

sentences:
Changing Pixels Per Unit First off, excuse my ignorance. I am just getting started in game dev. and ran into a little issue. So I had these weird rippling-lines going across my screen, and saw in a couple forums that this means I don't have what is called a "pixel perfect" game. To fix this, I am supposed to change the pixels-per-unit of each sprite down to 1. Currently I had it on 32 because that is my sprite size and I am a complete noob.
Now, I change it down to one but it completely destroyed my game. Everything that is generated on my map/grid is sucked into the center in this giant orb of sprites (I procedurally generate my map off a grid of 1/0s). I am guessing there is just a setting or some such thing that I am missing. Any ideas?
Also would be happy with an alternative to remove the rippling lines.

sentences:
Shadow map shimmering, indexing outside the shadow map I have tried to reduce the shadow shimmering/flickering using the technique described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324%28v=vs.85%29.aspx

It works as I want and shimmering is reduced but sometimes I have artifacts. It looks like my code tries to index space outside the shadow map. The article above writes about it but I didn't find a solution.

When I played with the code I also got black strips on the corners.

Code:

// reduce shadow shimmering/flickering
Vector2 vecWorldUnitsPerTexel = Vector2(D.x() / (float)D.shadowMapSize(), D.y() / (float)D.shadowMapSize());

// get only x and y dimensions
Vector2 min2D = min.vector2(),
                max2D = max.vector2();

min2D /= vecWorldUnitsPerTexel;
min2D = Round(min2D);
min2D *= vecWorldUnitsPerTexel;

max2D /= vecWorldUnitsPerTexel;
max2D = Round(max2D);
max2D *= vecWorldUnitsPerTexel;

min.set(min2D, min.z);
max.set(max2D, max.z);

// crop matrix based on this article https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
Vector scale;
Vector offset;
scale.x  = 2.0f / (max.x - min.x);
scale.y  = 2.0f / (max.y - min.y);
scale.z =  1.0f / (max.z - min.z);

offset.x = -0.5f * (max.x + min.x) * scale.x;
offset.y = -0.5f * (max.y + min.y) * scale.y;
offset.z = -min.z * scale.z;

Matrix4 m;
m.x = Vector4(scale.x, 0, 0, 0);
m.y = Vector4(0, scale.y, 0, 0);
m.z = Vector4(0, 0, scale.z, 0);
m.w = Vector4(offset.x, offset.y, offset.z, 1.0f);

I think that I should store in the depth map a slightly larger area but I'm not sure how to do this. I tried to change the scale of the crop matrix but it doesn't help.

EDIT:
It seems I've found a solution. When I'm rounding (or flooring) min and max values I subtract one from the min value and add one to the max value. This makes the shadow map contain a slightly larger area and I don't see any artifacts.

sentences:
Why do game engines convert models to triangles instead of using quads? I've worked using Maya for animation and more film orientated projects however I am also focusing on my studies on video game development. Anyways, I was talking with one of my professor and we couldn't figure out why all game engines (that I know of) convert to triangles.

Anyone happen to know why game engines convert to triangles compared to leaving the models as four sided polygons? Also what are the pros and cons (if any) of doing this?

sentences:
How to reduce the total time spent checking against my world bounds? I'm making a game engine and currently I use a function for checking a new position after movement to prevent game objects from escaping the world:

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

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

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

sentences:
New clients don't see objects spawned before they connect I'm making a game with UNet where the server must create some objects when he connects to the game, and all clients play with these objects that the server has created.

A server connects to the game
In his start method he calls a function CmdbuildEverything to spawn some objects to the game.
A local player connects to the game. The local player should be able to see the objects that the server player has created.

The code:

public class GameScript : NetworkBehaviour {
    void Start() {
        if(base.isServer)
            CmdbuildEverything();
    }
    [Command]
    void CmdbuildEverything() {
        GameObject ob1 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(0, 0, 1), Quaternion.identity);
        GameObject ob2 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(0, 1, 0), Quaternion.identity);
        GameObject ob3 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(1, 0, 0), Quaternion.identity);
        NetworkServer.Spawn(ob1);
        NetworkServer.Spawn(ob2);
        NetworkServer.Spawn(ob3);
    }
}

The problem is that the objects are created only on the server player and don't appear on the clients payers.

How can I solve that?

sentences: Can I make the project files/source code of my comerical Unity game avalible as a DLC or with the game? Is it legal and/or a good idea to let the players download the source code/project files of a comerical Unity game with the game or as a DLC?

sentences:
Unity calculate the size of a text box before text gets drawn so it can lerp to the next size Im trying to make a dialog box image that lerps to the next size.

In order to do that I need to calculate the size of the image before the text gets drawn.

My idea is to use the legacy GUI stuff like guiStyle.CalcSize to get the width and guiStyle.CalcHeight to get the height. then im setting the image's layout elements min values = to the GUI sizes.

the width is set to the longest string in the array of "lines"

the problem is that while the image does scale it doesn't do so correctly. perhaps my approach is wrong and there's an easier way?

private void Update()
{
    lineText = dialogueRunner.dialogText;
    drawnText = dialogueUI.lineText.text;

    //Debug.Log(prefferedValues);

    numberOfCharactersInLine = dialogueRunner.dialogText.Length;

    lineTextWithNewLine = NewLineAfterNChar(lineText, 18);

    string[] lines = lineTextWithNewLine.Split(new[] { "\n" }, StringSplitOptions.None);
    for (int i = 0; i < lines.Length; i++)
    {
        longest = lines.OrderByDescending(s => s.Length).First();

        prefferedValues = textMesh.GetPreferredValues(longest);

        Debug.Log(longest.Length);
    }

    //scale isnt correct
    layoutElement.minWidth = size.x;
    layoutElement.minHeight = size.y;

}

void OnGUI()
{
    guiContent = new GUIContent(longest);

    guiStyle = GUI.skin.box;
    guiStyle.alignment = TextAnchor.UpperLeft;
    guiStyle.wordWrap = true;

    //------
    boxSize = new Rect(Screen.width / 2, Screen.height / 1, txtBGRect.sizeDelta.x, txtBGRect.sizeDelta.y);
    boxSize.center = new Vector2(Screen.width / 2, Screen.height / 2);

    // // Compute how large the button needs to be.
    size.x = guiStyle.CalcSize(guiContent).x;
    width = size.x / 1;
    size.y = guiStyle.CalcHeight(guiContent, width);
    height = size.y;

    GUI.Box(boxSize, longest); //this draws the box

}

//Pass it a string and it will insert a line break after every n characters at end of words.

public static string NewLineAfterNChar(string inputText, int lineLength)
{
    string[] stringSplit = inputText.Split(' ');//Split string into array seperatly "word1" "word2" "word3" etc...
    int charCounter = 0;
    string finalString = "";

    for (int i = 0; i < stringSplit.Length; i++)// iterates per word count
    {
        finalString += stringSplit[i] + " ";// "word1 "  "word2 " "word3 "
        charCounter += stringSplit[i].Length;

        if (charCounter > lineLength)//after n characters
        {
            finalString += "\n";
            charCounter = 0;
        }

    }
    return finalString;
}

sentences:
Networking Pong Clone I have the fundamentals of TCP sockets, UDP communication etc, but can't find much on how to apply these to a real time game environment.

I have a Pong clone, with 4 players, and need to synchronise the paddle positions between the three clients and the server (the server is the fourth player). Currently I use UDP to send real time updates (paddle movements), and TCP for setting up the game lobby etc.

Is it a BAD THING to be spamming out huge amounts of UDP traffic? Should I look into something like DCCP for its congestion features? Or is this not really a problem with a small scale project like this?

When should synchronise messages be sent between client/server? Currently the server is spamming out UDP packets with the current game state as fast as it can manage, and clients are spamming out their paddle position back to the server as fast as they can.
Is this the best way to do it? Is there some sort of delay I should add so messages are sent once every X milliseconds, or should I only be sending out messages as events happen? (eg paddle velocity changed due to user input)

Would it be better to make clients communicate their paddle positions with each other peer to peer?

I am asking these questions within the context of Pong but am also interested in how these problems would be overcome in other games, or generalised solutions.

sentences:
Creating a movable camera using glm::lookAt() I came across this tutorial on how to create a movable camera in OpenGL using glm::lookAt(glm::vec3 position, glm::vec3 target, glm::vec3 up). In the tutorial, in order to keep the camera always facing in one direction while moving, the view matrix is created as such: view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);, where cameraPos, cameraFront, and cameraUp are all glm::vec3 type.

What I would like to ask is why does the second argument have to be cameraPos + cameraFront? If the camera position moved to the right without changing cameraFront, wouldn't cameraPos + cameraFront have an effect of rotating to the right as opposed to staying in the same direction (which I think is what should be needed)?

sentences:
organizing animation in Flash CS6 for sprite sheets Can I make a sprite sheet of a character which contains animated movies inside the main movie-symbol?
I tried to export it, but those movies inside the main one are not animated.
Thanks

sentences:
Maze or puzzle algorithm for something similar to noodles Not sure if anyone has played Noodles at all https://itunes.apple.com/gb/app/noodles!/id967624193?mt=8 but it is a simple puzzle game, that involves rotating tiles until they link up. The tiles are either 4-sided or 6-sided and each tile can have 1 of a set number of 'pipes' including end pipes. There's only one solution which you reach by joining all the pipes together to a special 'starter' pipe which can take the form of any of the other pipes. There's also no loops.

What type of algorithm would someone use for this? I thought it could perhaps be a maze algorithm, but I'm struggling to understand how you would go about this.I think it's because in essence there aren't any walls, just different styles of connectors. But is this in essence a perfect maze? Does anyone have an idea of a starting point for an algorithm to accomplish something similar?

I'm not specifically looking for code, but a help in the right direction to identify a relevant algorithm or how someone might go about this. Though I have tagged this 'ios' as that's what I would ultimately be targetting

sentences:
How to create the "drunk camera" effect in GTA 4? If you have played GTA 4, then you have probably been drunk at some stage. This is one of the best intoxicated simulators I have ever seen. It is actually hard or sometimes almost impossible to drive a vehicle while drunk in this game.

I know that a lot of the things that make up this drunk experience are changes to the controls or having random changes in direction, but how would the camera be done?

The camera seems to wave in and out and side to side. It also has changing blur, and other effects going on. Would this be some kind of shader? What are the effects that are used on top of each other to create the experience?

sentences:
Pathing for 2D, sprite-based game I'm making a 2D, oblique-styled sprite based RPG. My game does not live in a 2D matrix (like Tetris), rather it's sprites animating over a tilemap. I am trying to set pathing rules for NPCs. I've considered a few methods to do this but am not sure on the path I should take (no pun intended).

The NPC's trajectory is set by calculating the angle between origin coordinates and next coordinates and moves at that angle. I'm sure this will lead to blocky movements as they move along an array of coordinates along their path.

So, to set pathing rules, I was considering the following approaches and would like some direction given my style of game:

Manually define coordinates: For each NPC, define a set of coordinates for a given destination (a destination location set in my game). This issue with this is it will get tedious to set all the coordinates along the path.
Pathing algorithm: I'd rather simply set the destination coordinates once, and perhaps use a pathing algorithm, such as Dijkstra's Algorithm, that the NPC can use to navigate the map. I am not sure if this will have any ability/effect on smoothing out the movement.

It was also suggested using the Rapidly Exploring Random Tree algorithm, but again... not sure if this is overkill for my game... and what the performance hit would be.

Here is a snapshot of my map. The red arrow is a sample path. The blue lines are collision rules defined around map objects.

I would love some guidance on this. I am not sure if something like a pathing algorithm is a) overkill my game, b) doesn't fit with my game style

sentences:
how to design transparent screen in libgdx this question is for LibGdx geeks. I want to make transparent screen in my game. For example, when level completes I want a new transparent screen pop up and show player's high score, buttons to navigate on next level etc like in angry birds kind of screen.

This type of screen can also use, when user click on pause button, to show pause screen.
Please guide me to design this kind of screen.

Or if I am going wrong to make transparent screens for this kind of situation. Please guide me for better one.

sentences:
Sprites are rendered as black rectangles in android 4.0.x only I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx.
Basically sprites are black rectangles, while other images that i declare as Texture are correct.
I've tested my game with android 4.2 4.3 and 5.0 and I have no problems...

Is there some difference between 4.0 and 4.2 in graphics rendering? Maybe it's Gl10 and not Gl20?

sentences:
How To Create A Dynamic 2D Rope In Unity? I'm trying to create a 2D rope in Unity that is fixed at one end and other is moving up and down to pick up objects just like a crane.

I've tried adding a cube and making more instances of it, adding a parent-child relation and hinge joint between them when I press the Down arrow.

It worked, but when I tried to move them sideways a big noise is generated.
I then tried with a spring joint, but that didn't work.

sentences:
Maintaining relative location of objects across different screen resolutions I'm developing a very simple interactive HTML5 game, in which I need to show a room having multiple objects like a cupboard, table, fan etc.

How can I display all of the objects together, so that they remain at same place, on all screen resolutions?

sentences:
Texture does not fit the screen Hi guys I am really new in OpenGL-ES and I am developing a simple android application with NDK, and I just want to ask why the image is not fit after I set the width and height of it.

this is my width and height

const int FIXED_WIDTH = 320;
const int FIXED_HEIGHT = 568;

and this is how I set my Matrix

glViewport(0, 0, width, height);

// Create a new perspective projection matrix. The height will stay the same
// while the width will vary as per aspect ratio.
float left = FIXED_WIDTH;
float right = 0.0f;
float bottom = FIXED_HEIGHT;
float top = 0.0f;
float near = 1.0f;
float far = 50.0f;

mProjectionMatrix = Matrix::newFrustum(left, right, bottom, top, near, far);

// Position the eye in front of the origin.
float eyeX = 0.0f;
float eyeY = 0.0f;
float eyeZ = 1.0f;

// We are looking at the origin
float centerX = 0.0f;
float centerY = 0.0f;
float centerZ = 0.0f;

// Set our up vector.
float upX = 0.0f;
float upY = 1.0f;
float upZ = 0.0f;

// Set the view matrix.
mViewMatrix = Matrix::newLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);

// model * view * projection
mMVPMatrix->multiply(*mProjectionMatrix, *mViewMatrix);

After setting the Matrix I thought that my point 0.0 will start at the top right corner of the device (This is my understanding of matrix). as you shown in the image.

and this is how I setup my texture

TextureGenerator* textureGenerator = new TextureGenerator();
textureGenerator->setSize(320.0f, 568.0f); // width and height
textureGenerator->setTranslate(0.0f, 0.0f); // X and Y
textureGenerator->setTextureId(GLUtils::loadTexture("bg.jpg"));
mTextureCollection.push_back(textureGenerator);

then after I add some texture this is the result.

This is the actual picture, size 320x568.

as you can see to the result of my doing, I don't know if my point 0.0 is starting at the center. Please someone help and explain to me why the texture is not fit, and if my matrix is correctly set or not. Thank you.

sentences:
Mining cubes out of marching cubes I originally built the start of my game world with a fully minecraft style structure: chunks, only visible faces rendered, noise, etc. Too blocky. I implement marching cubes. Looks great, horrible to work with:

The problem is when you try to add or remove blocks to the marching cubes as... exactly as they are supposed to... everything gets smoothed. It becomes difficult to raycast on a neighbor and if you do all the blocks around him get changed. Obviously.

I see a lot of marching cubes/metaball looking games that implement area based organic molding. You don't place "blocks" you shape an area or deshape it like Landmark mining etc.

On the otherhand Blockscape and Landmark seem to be a blend of the two? The land starts out marching but you can cut clear square chunks out of it and place square cubes onto it.

How can you make straight corners with marching cubes? Or is it a combination of two entirely different systems?

(UPDATE):
There is probably more than one answer to this, does anyone have any experience trying to do this though? I can think of a couple of possible approaches:

Separate player built objects into a separate mesh/object per chunk keeping terrain as terrain. Run smoothing (marching cubes or others) algorithms and normal calculations only on terrain. Would probably need some sort of a half-transparent cube highlighter showing what the cursor is currently selecting. I can see a number of benefits to this system, though feel as if there are some downsides I'm just not thinking of immediately that would crop up if I started coding it...?
Define a "smooth" bool per cube, only assigned at initial calculation of the mesh on any surfaces (floor/ceiling/etc). Any built/added/removed blocks are not re-labelled as "smooth" when generating the mesh use different math for smooth cubes than for blocky cubes. This is what I'm currently working with and it works, but it's still only about a third as smooth as a full marching cube approach would be. Basically I'm average each vertices y value with its surrounding four cubes height(noise) values while never letting it go beneath 0 or above 1 (to stay within the cube). I also had to re-write the raycast click detection to use the surface normals.
Re-code the marching cubes algorithms to work only on the cells I want them to/do what I want them to. This seems like the most difficult but possibly most visually rewarding approach.

or ??

sentences:
Camera field of view: 3D projections & trigonometry Okay, here goes.

I have a camera at (Xc, Yc, Zc.) The Xc and Yc coordinates are latitude/longitude, and the Zc coordinate is an altitude in metres. I have a point at (Xp, Yp, Zp) and a field of view on the camera (Th1, Th2) - where Th1 is horizontal FOV and Th2 is vertical FOV.

Given this information, I'd like to:

test if the point is visible (i.e. in the camera's FOV)
project the point as the camera would see it

I've figured out already that the camera's horizontal view at any given distance is tan(Th1) * distance, but I don't know how to test if the point is visible.

Accuracy is not critical. I would prefer a simple solution over a complicated solution, if it works well enough. The computations will be performed by a small microcontroller, which isn't very fast at things like trig functions.

P.S. this is not homework, I'm doing this for some game development. It will be integrated with the real world, hence the latitude/longitude/altitude. It involves flying real RC planes through virtual hoops (or chasing virtual targets), so I have to project the positions of these hoops on a display.

sentences:
Anchored Unity text ...not anchoring! I've added some text to a unity UI and set both the achor and pivot to the top right corner as shown here:

When I start this in debug in unity the text looks fine:

What's weird is that when I build the app and run it as an executable as a host (this is a multiplayer networked game) the text also looks fine. But when I start a client instance the text doesn't appear.

I debugged and paused the game in unity in client mode and noticed that the text object is miles away from where I'm expecting it to be (and as a result doesn't show on the camera).

You can just about see the black line on the below image which is my level and the text anchored miles up and right of the level.

It seems like I've done something stupid here but I can't work out what :s

EDIT: Leo's answer was correct conceptually, but here's how I implemented the suggestion.

Created an empty game object GameStateManager in the hierarchy
Add a GameState script to the manager with a network identity
Added my 'RemainingTime' property to the game state script and put the [SyncVar] attribute on it
Put logic in the game state Update method to update the remaining time
Added a ClientTimer script to the text object (mono behaviour), which retrieved the GameState from within the clients copy of the game state manager.
In the update method of the client time, get a reference to the Text object and set the .text property to the value of the remaining time.

I'm not sure if this is correct, but it does seem to work, and now the ClientTimer script isn't networked, which resolved the issues with placement of the text.

sentences:
Load custom resources in Unity The situation is I work in my free time on one study project. I have resources of one game packed in it's own format. My intent was to use those  with Unity without converting them into Unity's inner format.

But with brief analysis of Unity Api Reference I did not find anything that would help my in my efforts. Like I have custom binary files I would need to parse with Unity and upon that data create geometry, lights and so on using Unity's classes.

So I wonder if it's even possible? I would really appreciate if anyone would show make a hint on this subject

sentences:
How can I save a global high score for all players in AS3? I am developing a game in which I want to make a scoring system where the global high score is stored and shared by all players.

I am using Flash and ActionScript 3. Until now I've used SharedObject.getLocal("savename") for saving score individualy but I cant figure out the way to store a common high score for all players.

sentences:
Align Players Rotation I'm currently working on rope Swinging.
The Rope consists of Physics Constraints/Joints and between them the rope is rendered.
I would like align my Character's Pitch to the Rope.
I'm horribly bad at vector Math, and I have trouble finding the solution.
Here's a picture that shows what I want to achieve:

I tried using the Difference between two joints but somehow it doesn't work.
I'm using Unreal Engine if that helps.

sentences:
Interpolating bent textrues I am currently making a pressure heat map that will be overlaid on a bent shape (let's say cylinder). I am using a 2d texture that is mapped to the object. The pressure points are also mapped to the texture matrix. As there are only few pressure points giving values, I am interpolating the pressure for the rest of the texture, however, there is an issue...

As you can see because the texture data is in 2d array the interpolation does not account for the place where it connects.
Is there an algorithm that would help account the borders of the matrix being connected?

sentences:
Export Blender materials to Unity3D I have a low poly model that I made in Blender 2.8. Because it's low poly, it only has a material that's a mix between a diffuse and a glossy shader - it has no textures. The only thing I want to do is import the model into Unity3D with the diffuse and glossy shaders, just like it is in Blender.
Does anyone know how can I do this?

sentences:
Position GUI Text in 2D game I am working on a 2D game, and my camera is a orthographic with a size of 320.

I want to display some text, but not with OnGUI(). Rather, with a GUI Text game object.

I couldn't help but notice that positioning my GUI Text object is a real pain: apparently, the onscreen coordinates where the text appears range from 0 to 1. That is, 0.5 is the center of the screen.

If I wanted to put my label at exactly (100,50) regardless of the screen size, I would have to calculate something like

(100f / Screen.width, 50f / Screen.height)

Is there a way to tell the GUI Text to appear at the actual transform position as it appears on the scene editor? Currently, if you move the GUI Text game object's transform slightly to the right, the rendered text will be displaced a LOT to the right instead...

sentences:
TypeError: this.scale.setScreenSize is not a function Game work with the old version 2.0.6. But they get this error after switching to 2.4.2

TypeError: this.scale.setScreenSize is not a function

any Idea how to solve this ?

sentences:
Calculating collision of polygons Say I have a multitude of 2D polygons floating about on a plane. These polygons can have any side count and aren't necessarily regular.

Assuming I know absolutely everything about the polygons (area, collision point, location, velocity, rotation, angular velocity... etc) how to I calculate what happens to two polygons after collision?

I.e. what will their resultant velocities and angular velocities be after collision?

If not an exact solution, what resources could help me learn how to accomplish this?

sentences:
Picking objects with mouse ray I simply want to pick a few spheres in my scene using the mouse-ray. I have implemented(copied most of it but with little understanding) a ray-sphere collision code. Also I have implemented the code for converting the mouse window coords to OpenGL coords. And constructed the mouse function. I have a ray class. In other words I have made everything, but sth isn't working...

So, there is the ray-sphere collision code:

bool Sphere::CheckRayCollision(Ray mouseRay)
{
     double discriminant, b;

     b = -DotProduct(mouseRay.GetOrigin(), mouseRay.GetDirection());
     discriminant = b * b - DotProduct(mouseRay.GetOrigin(), mouseRay.GetOrigin()) + this->radius * this->radius;

     if(discriminant < 0)
     {
         std::cout<<"disc"<<std::endl;
         return false;
     }
     discriminant = sqrt(discriminant);

     double x1 = b - discriminant;
     double x2 = b + discriminant;

     if(x2 < 0)
     {
          std::cout<<"x2"<<std::endl;
          return false;
     }
     if(x1 < 0)
     {
           x1 = 0;
           return true;
     }

     return true;
}

It is within the sphere class. The convertion between window and OGL coords:

Vector3d MouseClass::ConvertMouseToOGLCoordinate(int mouseX, int mouseY, int mouseZ)
{
    GLint viewport[4];
    GLdouble modelMatrix[16];
    GLdouble projectionMatrix[16];

    glGetIntegerv(GL_VIEWPORT, viewport);
    glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
    glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix);

    //float winZ;
    float winY = float(viewport[3] - mouseY);
    //glReadPixels(mouseX, (int)winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);

    double x, y, z;
    gluUnProject((double)mouseX, winY, mouseZ,
        modelMatrix, projectionMatrix, viewport,
        &x, &y, &z);

    return Vector3d(x, y, z);
}

And the function which checks whether the left mouse btn is clicked and if it is checks for the collision:

void HandleMouse()
{
    if(userMouse.IsLeftButtonDown())
    {
        int cursorX = int(userMouse.GetCurrentPosition().GetX());
        int cursorY = int(userMouse.GetCurrentPosition().GetY());

        Vector3d nearPoint = MouseClass::ConvertMouseToOGLCoordinate(cursorX, cursorY, 0.0f);
        Vector3d farPoint = MouseClass::ConvertMouseToOGLCoordinate(cursorX, cursorY, 1.0f);

        Vector3d direction = farPoint - nearPoint;
        direction.Normalize();

        positionInWorld = farPoint;

        mouseRay = Ray(nearPoint, direction);
        drawCube = true;
        for(int i = 0; i < 3; i++)
        {
            bool isCollided = sphere[i].CheckRayCollision(mouseRay);
            if(isCollided)
            {
                sphere[i].SetColor(0.0f, 1.0f, 0.0f);
            }
            else
            {
                sphere[i].SetColor(1.0f, 0.0f, 0.0f);
            }
        }
     }
}

The 'drawCube' bool var is just for me to show if the convertion func works well and the 'positionInWorld' var is for the cubes coords. The drawing is well, so I think the convertion function works, but I might've done sth wrong.

If anyone can help me sort out why isn't this code working I would be very gratefull! I have been struggling with this for a week and searched everywhere on the Internet and haven't found a solution yet...

Thanks in advance!

EDIT:

The picking isn't working here. Pressing the left mouse button doesn't select anything. No matter where I click...

sentences:
Replicating no. of sprites without letting the app to slow down and crash Is it possible that if I'm making a a simple drag-n-drop game, does making a new sprite via constructor with texture as a parameter makes the game slower and depletes more memory until it crashes or does making a new texture via constructor cause the memory to go slow? I'm on a revision for the new drag-n-drop puzzle game where the only goal is to stack the most no. of objects as you can before it falls off the platform. Is it a good idea to create another sprite with texture as a parameter every time a player drag-n-drop another object?

Here's the start of the dry run looked like and I set it to debug mode so that the platform is completely block the pit to test the replication test.

Afterwards, when it reaches from hundreds to thousands, this will be like this and the game gets slower.

When the game crashes, here's the result via Logcat:

12-11 16:38:53.953: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:38:53.953: E/SoundPool(25701): Error creating AudioTrack
12-11 16:38:53.993: D/dalvikvm(25701): GC_EXPLICIT freed 947K, 14% free 14414K/16672K, paused 2ms+4ms, total 96ms
12-11 16:39:16.363: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:39:16.363: E/SoundPool(25701): Error creating AudioTrack
12-11 16:39:16.433: D/dalvikvm(25701): GC_FOR_ALLOC freed 2120K, 15% free 14418K/16848K, paused 47ms, total 47ms

By the way, I'm using BodyEditor library for Box2D program and rendering, a physics engine.

sentences:
How to proceed on the waypoint path? I'm using Dijkstra algorithm to find shortest path and I'm drawing this path on the screen. As the character object moves on, path updates itself(shortens as the object approaches the target and gets longer as the object moves away from it.) I tried to visualize my problem.

This is the beginning state. 'A' node is the target, path is the blue and the object is the green one.

I draw this path, from object to the closest node. In this case my problem occurs. Because 'D' node is more closer to the object than 'C' node, something like this happens:

So, how can i decide that the object passed the 'D' node? Path should be look like this:

One thing comes to my mind is that I use some distance variables between the two closest nodes in the route path. (In this example these are 'C' and 'D' nodes.) As the object approaches 'C' and moves away from the 'D' node at the same time, this means character passed the 'D'.

However, I think there are some standardized and easy ways to solve this. What approach should I take?

sentences: Using the AssetManager in LibGDX I am trying to use the AssetManager class in LibGDX and I understand how it works but I am trying to implement a loading screen. I have followed the AssetManagerTest.java file here, but I am having a hard time trying to figure out how to get it to work correctly. Can someone point me in the right direction? My goal is to load the assets (textures, sounds, fonts, ... etc) and update a bar with the percentage complete on the screen. I don't understand the ResolutionFileResolver and the Resolution[] in the link I provided. What are they for? My goal is to support a static class that can give me access to all of the assets I need in my game from any screen. Is there a preferred method to do this? Thanks.

sentences:
XNA - SoundEffect with SpeedOfSound SoundEffect has SpeedOfSound property. I'm trying to use it, but it doesn't work:

SoundEffect.SpeedOfSound = 600.0f;
SoundEffectInstance soundEffectInstance = stepsSound.CreateInstance();
soundEffectInstance.Volume *= 0.5f;
soundEffectInstance.Play();

How to use it? How to set speed of sound?

sentences:
Streaming 3d model --> unity android I want to include a feature in my game that allows me to host raw 3d models (.fbx/ .obj/ etc., not AssetBundles) on a server.
The game should download these files, save them to the device and load them into a scene.
I want to support multiple file formats, so writing my own parser is not an option!

First idea:Use the WWW class to load the model data, save it as a String in the player prefs, and load it if requested.(the last part is the problem)

Second idea:Use the WWW class to load the model data, extract the jar file containing StreamingAssets folder to the sdcard. Writing the model data into a new file in this directory. Creating a new ZIP..ah...JAR archive from the folder and replacing the old .jar file.Of course I would need an Android Plugin and a archive java library for that. Then the Models will be loaded from the Ressources.(this is a pretty weird idea and cannot be the right way)

Do you know, if that works?Has anybody ever done something like that?

UPDATE 1:

I tried to use the obj loader from samed-tarık-Çetİn's comment, but I got this error:

ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[System.String,UnityEngine.Material].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:136)
GeometryBuffer.PopulateMeshes (UnityEngine.GameObject[] gs,     System.Collections.Generic.Dictionary`2 mats) (at Assets/OBJ/src/GeometryBuffer.cs:145)
OBJ.Build () (at Assets/OBJ/src/OBJ.cs:236)
OBJ+<Load>c__Iterator0.MoveNext () (at Assets/OBJ/src/OBJ.cs:63)

Replacing line 145 in GeometryBuffer.css with gs[i].GetComponent<Renderer>().material = new Material(Shader.Find("Standard")); did resolve the runtime error and a Material, OBJ (Mesh Filter) and Mesh Renderer Component have been added, but it still show a model.

UPDATE 2:
I am behind a proxy so loading the model from the web didn't work.
Loading .obj files from file:///<path to obj> works perfectly fine though.

sentences: Finding a way to display objects efficiently I am making a 2D simple Breakout game, and I would like to know of an efficient way to display all the blocks on the screen. I was thinking of dividing the whole screen into little squares that can be occupied by a block or a wall (or most objects). Is this the best way of doing it? Sorry if my question is kinda noob-ish, I just started learning to develop games.

sentences:
Why does the box rotate, spin instead of gliding? I've just learned that if I want to move an object so it acts depending of physics, I need to use rigidbody.velocity instead of transform.Translate. When I was using transform.Translate the box glided without problem. The only problem was that when it collided with a wall it began to jump and spin like crazy. But that problem is fixed now!

But when I added a rigidbody and used rigidbody.velocity, another problem stemmed: It doesn't glide. I tried using rigidbody.velocity and also, instead, I tried to create a Vector 3 movement, and at the end of the code I would write rb.AddForce (movement);. However, it still rotates, instead of gliding.

What's is generating this weird problem?

This is my updated code:

using UnityEngine;
using System.Collections;

public class MoveCharacter : MonoBehaviour {

    public float deltaMovement = 1f;
    public Rigidbody rb;
    // Use this for initialization
    void Start ()
    {
        rb = GetComponent<Rigidbody> ();
    }

    // Update is called once per frame
    void Update ()
    {
        Debug.Log (Time.deltaTime);
        Moving();
    }

    void Moving()
    {
        Vector3 movement = new Vector3(0, 0, 0);
        //Moves the character to where it needs.
        if (Input.GetKey (KeyCode.A)) {
            movement = new Vector3(deltaMovement, 0, 0);
        } else if (Input.GetKey (KeyCode.D)){
            movement = new Vector3 (-deltaMovement, 0, 0);
        }
        float yRotation = Camera.main.transform.eulerAngles.y;
        float movementX = Mathf.Sin ((yRotation * Mathf.PI) / 180) * deltaMovement;
        float movementZ = Mathf.Cos ((yRotation * Mathf.PI) / 180) * deltaMovement;

        if (Input.GetKey (KeyCode.W)) {
            movement = new Vector3 (movementX, 0, movementZ);
        } else if (Input.GetKey (KeyCode.S)){
            movement = new Vector3 (-movementX, 0, -movementZ);
        }
        rb.AddForce (movement);
    }
}

By the way, changing between Update() and FixedUpdate() didn't help...

sentences:
Large-Scale 2D worlds with a "world texture" to draw to causing memory issues Background:

I've currently implemented a world class where the dimensions are provided in meters and those dimensions are translated to pixel values for an allegro (4.x) memory bitmap to be created so objects can be draw to it. This seemed like a good idea...until I learned the hard way that world dimensions translated to pixel dimensions such that the bitmap created would be upwards of 100,000,000 pixels causes um..."issues" and allegro (4.x) barfs.

Question:

How would I implement large-scale worlds such that they can be any arbitrary size and still have a bitmap/surface/texture to draw to that's small enough to fit into memory along with everything else? Please limit answers to allegro 4.x solutions.

sentences:
Swept AABB vs Line Segment in 2D I've been trying to get a swept collision detection up and running now for almost a week and I can't for the life of me get it working.

There is a answer on this linked here below:
Swept AABB vs Line Segment 2D
I've translated this into Go which will be running the game server and needs this logic:
func SweepRectLine(rectX, rectY, rectW, rectH, rectHSpeed, rectVSpeed, lineX1, lineY1, lineX2, lineY2 float64) (bool, float64) {
    outVel := [2]float64{}
    // hitNormal := [2]float64{}
    lineNX, lineNY := lineX2-lineX1, lineY2-lineY1
    // lineMinX, lineMaxX, lineMinY, lineMaxY := math.Min(lineX1, lineX2), math.Max(lineX1, lineX2), math.Min(lineY1, lineY2), math.Max(lineY1, lineY2)
    var lineMinX, lineMaxX, lineMinY, lineMaxY float64
    if lineNX > 0 {
        lineMinX, lineMaxX = lineX1, lineX2
    } else {
        lineMinX, lineMaxX = lineX2, lineX1
    }
    if lineNY > 0 {
        lineMinY, lineMaxY = lineY1, lineY2
    } else {
        lineMinY, lineMaxY = lineY2, lineY1
    }
    r := (rectW/2)*math.Abs(lineNX) + (rectH/2)*math.Abs(lineNY) //radius to Line
    boxProj := (lineX1-rectX)*lineNX + (lineY1-rectY)*lineNY
    velProj := rectHSpeed*lineNX + rectVSpeed*lineNY

    if velProj < 0 {
        r *= -1
    }

    hitTime := math.Max((boxProj-r)/velProj, 0)
    outTime := math.Min((boxProj+r)/velProj, 1)
    // log.Println("start", hitTime, outTime)

    rectXMax, rectXMin := rectX+rectW/2, rectX-rectW/2
    if rectHSpeed < 0 { // left
        if rectXMax < lineMinX {
            return false, 0
        }
        hitTime = math.Max((lineMaxX-rectXMin)/rectHSpeed, hitTime)
        outTime = math.Min((lineMinX-rectXMax)/rectHSpeed, outTime)
    } else if rectHSpeed > 0 { // right
        if rectXMin > lineMaxX {
            return false, 0
        }
        hitTime = math.Max((lineMinX-rectXMax)/rectHSpeed, hitTime)
        outTime = math.Min((lineMaxX-rectXMin)/rectHSpeed, outTime)
        // log.Println("right", hitTime, outTime)
    } else {
        if lineMinX > rectXMax || lineMaxX < rectXMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    rectYMax, rectYMin := rectY+rectH/2, rectY-rectH/2
    if rectVSpeed < 0 { // up
        if rectYMax < lineMinY {
            return false, 0
        }
        hitTime = math.Max((lineMaxY-rectYMin)/rectVSpeed, hitTime)
        outTime = math.Min((lineMinY-rectYMax)/rectVSpeed, outTime)
    } else if rectVSpeed > 0 { // down
        if rectYMin > lineMaxY {
            return false, 0
        }
        hitTime = math.Max((lineMinY-rectYMax)/rectVSpeed, hitTime)
        outTime = math.Min((lineMaxY-rectYMin)/rectVSpeed, outTime)
    } else {
        if lineMinY > rectYMax || lineMaxY < rectYMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    outVel[0] = rectHSpeed * hitTime
    outVel[1] = rectVSpeed * hitTime
    return true, hitTime
}

I also put up a Gist with a executable UI here: https://gist.github.com/KidLinus/3f847c46b0e6dc1addac7252d9cb54ab
I can't for the life of me figure out what all class variables stand for. I think that some of them are native to Unity but that's just a guess. I've come so far as to figure out that the extent is half of the width/height in said direction. What the "line.n" stands for is anyones guess, I assume its the direction and have no idea if it's normalized or not.
There are also a couple of dead variables just laying there.

sentences:
Incorrect angle calculation? I'm trying to create a simple topdown game, in which you control the player by WASD keys and use mouse to aim and shoot. So far, I have a player moving and firing, but I think there is something wrong with the shooting.

Accuracy gets lower as the mouse cursor move away from the player.

Please try the following SWF to see more clearly what I'm trying to say.

http://dl.dropbox.com/u/24777511/gdstack.swf

Here is a chunk of relevant code:

private function fireBullet(x:Number, y:Number, dFireAngle:Number):void {
            var b:Bullet = recycleBullet();
            var rFireAngle:Number;
            b.reset(x, y);
            b.angle = dFireAngle;
            rFireAngle = (dFireAngle * (Math.PI / 180));

            b.velocity.x = Math.cos(rFireAngle) * 385;
            b.velocity.y = Math.sin(rFireAngle) * 385;
        }

...

if (FlxG.mouse.pressed()) {

                    var p:FlxPoint = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY);
                    var angle:Number = FlxU.getAngle(new FlxPoint(player.x, player.y), p) - 90;
                    fireBullet(player.x, player.y, angle);
...

sentences:
How do network applications get around firewalls? Forgive me if this comes off as naive; I've only a cursory understanding of network communications.

My work has a public and very restrictive network - (they appear to block everything that isn't approved) - and yet I've seen people accessing many games (World of Warcraft for example).  I don't imagine that the network admins made any explicit exceptions for these applications - but when I tried to develop a networked prototype with services like 'Photon Server' or 'Adobe's RTMFP' they all fail from the office due to the network restrictions (can't establish connection).

Is there some kind of work around that applications like WoW employ that distinguish them from an anonymous networked app I've built myself?  (Some kind of fallback channel maybe?)

I appreciate that there might not be enough information here for an answer, but any insights would be welcome.

Thank you!

sentences:
Can Harlowe for Twine 2 handle variable references inside a Datamap? I'm starting to learn Twine and I'm putting together a little framework for making a game.

I'm trying to make a DataMap named 'Door' that has a key/value pair of "openCondition",$doorUnlocked. What currently happens is that "openCondition" is set to what $doorUnlocked is when 'Door' is created (false).  This is fine, but when $doorUnlocked becomes 'true', "openCondition" stays the same, because it's already been set.

Is is possible to set a DataMap value to a reference of a variable?
Are reference variables even built into Harlowe?
If not, are they available in any other Twine format?

sentences:
Create a "genie" effect in fragment shader GLSL I have tried a while now to create a genie effect on a scrolling plane to emulate the background/floor from the Mad Hatter fight in Adventures of Batman and Robin (SEGA).
Judging the way the 16 bit era loved using scan-lines to create most of these (in this case amazing) effects I wanted to try and achieve this effect in GLSL. What I have tried to do so far was to adapt this tutorial code here and convert it to work in the fragment shader instead of the vertex shader, mostly because I haven't dabbled much with model loading (creating grids by hand isn't fun) but have created this monstrosity.

So far I am at step two where the float t gets introduced, instead of getting a leaning trapezoid like shape I only get this:
The square is just squished more on the x-axis instead of actually doing anything useful for me, this is my current fragment code for manipulating the image:

#version 330 core
precision lowp float;

out vec4 color;
in vec2 UV;

uniform sampler2D in_Tex_0;
uniform vec4 in_Val_0;

vec2 dist(vec2 coord)
{
    // xy range of transformation
    vec2 start = vec2( 0.0, 0.0 );
    vec2 end = vec2( 1.0, 1.0 );
    vec2 pos;
    // in_Val_0.x instead of size param in tutorial
    pos.y = mix( start.y, end.y, in_Val_0.x );
    float t = pos.y / end.y;
    pos.x = mix( start.y, end.x, t * in_Val_0.x );
    // should return a leaning trapezoid
    return coord * pos;
}

void main()
{
    // Pass through color data to bound framebuffer using distorted texture
    color = vec4( texture2D( in_Tex_0, dist( UV ) ) );
}

I'm suspecting there's something wrong with the ´t´ that gets added in the mix, but I am at a loss of what. Any idea of what might be wrong and/or how I could fix this?

sentences:
Howdo I create differently sized texture atlases for different screen sizes? I am beginning game development and using texture atlases.
I've created textures based on the resolution 1920x1080, so I created a 1024x1024 size Texture Atlas for storing multiple graphics.

If the game is played on a 800x480 size device, the atlas will be very big to load in memory. An atlas of 512x512 would be enough and on devices with 480x320 resolution the game might not even work due to the different texture size.

How can I resize the atlas to save memory? Can I use different texture atlases for different screen sizes?

I just want to know how other game devs do it?

sentences:
Java OpenGL Perspective matrix not working I'm trying to render a simple triangle with OpenGL in Java using LWJGL3.
Everything is working great, but the projection matrix (perspective) is not working. In C++ I just used to apply the glm::perspective() method which works just great. But in Java, I implemented it myself since there are no libraries like GLM handling it.
So here the code for the perspective in Java :

public mat4 perspective(float fov, float aspectRatio, float zNear, float zFar){
    mat4 perspective = new mat4();

    float halfTanFov = (float) Math.tan(Math.toRadians(fov/2));
    float range = zNear - zFar;

    perspective.m00 = 1f / halfTanFov * aspectRatio;
    perspective.m11 = 1f / halfTanFov ;
    perspective.m22 = - (zFar - zNear) / range;
    perspective.m23 = -1;
    perspective.m32 = (2f * zFar * zNear) / range;

    return perspective;
}

Of course I tested this multiplication and a compared a result with my TI output, and it worked great.
Other information, the default constructor for the mat4 class is putting all the values to 0.
here is the code :

public void setZero(){
    m00 = 0; m01 = 0; m02 = 0; m03 = 0;
    m10 = 0; m11 = 0; m12 = 0; m13 = 0;
    m20 = 0; m21 = 0; m22 = 0; m23 = 0;
    m30 = 0; m31 = 0; m32 = 0; m33 = 0;
}

the viewMatrix() in the other hand is working great. It's a simple implementation of the lookAt() method.
So when it's lookAtMatrix * modelMatrix * position where the position is a vec4 the result is good.
But when I try to add the projection matrix for the MVP : perspective * lookatMatrix * model * position the result is nothing.
Here where I do it in the code :

public mat4 getViewProjection() {
    mViewProjection = MatrixTransform.getInstance().lookAt(mPosition, mPosition.add(mDirection), mUp);
    return mViewProjection;
}
public mat4 getMVP(mat4 model){
    return mPerspective.mult(getViewProjection()).mult(model);
}

And here is my simple GLSL shader (for the vertex shader ) :

#version 430

layout(location=0) in vec3 position;
uniform mat4 MVP;

void main(void){
    gl_Position = MVP * vec4(position, 1);
}

I tried other implementation of the perspective without success, so I guess my mistake is somewhere else, but sadly enough, I can't figure out where. If someone could help, it'd be great ! thank you.
If you other informations, please ask me and I'll post it.

EDIT :
Here is how I put a mat4 into a uniform :

    public void uniform(String variableName, mat4 matrix){
            int loc = glGetUniformLocation(mId, variableName);
            FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
            matrix.putIntoBuffer(buffer);
            buffer.flip();
            glUniformMatrix4(loc, false, buffer);
    }

and the method putIntoBuffer() :

public void putIntoBuffer(FloatBuffer buffer){
    buffer.put(m00);
    buffer.put(m01);
    buffer.put(m02);
    buffer.put(m03);

    buffer.put(m10);
    buffer.put(m11);
    buffer.put(m12);
    buffer.put(m13);

    buffer.put(m20);
    buffer.put(m21);
    buffer.put(m22);
    buffer.put(m23);

    buffer.put(m30);
    buffer.put(m31);
    buffer.put(m32);
    buffer.put(m33);
 }

sentences: Set default values by script? Insted of Inspector, I want to set default values by script because there is MeshRenderer, a RigiBody etc. I don't know how to write this in script. These are not numerical values.

sentences:
How to Make Saving System More Secure I've been working on an saving system for my 2D RPG game, and I recently encountered an issue: my saving system uses PlayerPrefs, which I heard is supposed to be used for things such as settings. I've also heard that it isn't very secure and that people can exploit it. I was wondering whether there was a way to make my saving system more secure. Here's my inventory script that also holds the save function:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ItemInformation : MonoBehaviour
{
    // These are the assets for the item to change
    public Text nameText;
    public Text descriptionText;
    public Text regenText;
    public Text amountText;

    // This is the identifier for each item
    public string identifier;

    // These are the variables that change with the different items
    public string itemName;
    public string itemDescription;
    public float itemRegeneration;
    public int itemAmount;

    // Starts on awake
    void Awake()
    {
        // Function to change the object's information and such
        nameText.text = itemName;
        descriptionText.text = itemDescription;
        regenText.text = "HEALS " + itemRegeneration + "HP";

        // Loads game data
        LoadDataIfNeeded();
    }

    // Function to save game data
    public void SaveData()
    {
        string jsonString = JsonUtility.ToJson(this);
        PlayerPrefs.SetString(identifier, jsonString);
        PlayerPrefs.Save();
    }

    // Loads data if needed
    public void LoadDataIfNeeded()
    {
        if (PlayerPrefs.HasKey(identifier))
        {
            string jsonInstance = PlayerPrefs.GetString(identifier);
            JsonUtility.FromJsonOverwrite(jsonInstance, this);
        }
        else
        {
            SaveData();
        }
    }

    // Updates on every frame
    void Update()
    {
        // Shows amount of item left
        amountText.text = "HAVE:" + itemAmount;
    }
}

sentences:
x-inverted obj importer in BulletSharp - what's wrong? See [dead link removed] at the repository.

Screenshot:

[broken image removed]

Left: bullet imported version, right: correct 3ds max version.

It's somehow inverted. If you think that left part is just 180 degrees rotated you are wrong. Just rotate it yourself in Paint and you'll see - they will be different.

What's wrong with the bullet importer?

Usage:

        var wo = new WavefrontObj();

        int tcount = wo.LoadObj(path);

        Vector3 localScaling = new Vector3(1, 1, 1) * 1f;

        var vertices = wo.Vertices.Select(v => Vector3.Modulate(new Vector3(v.X, v.Y, v.Z), localScaling)).ToArray();
        var indices = wo.Indices;

        if (tcount > 0)
        {
            var trimesh = new TriangleMesh();
            int i;
            for (i = 0; i < tcount; i++)
            {
                int index0 = indices[i * 3];
                int index1 = indices[i * 3 + 1];
                int index2 = indices[i * 3 + 2];

                Vector3 vertex0 = vertices[index0];
                Vector3 vertex1 = vertices[index1];
                Vector3 vertex2 = vertices[index2];

                trimesh.AddTriangle(vertex0, vertex1, vertex2);
            }
            CollisionShape concaveShape = new BvhTriangleMeshShape(trimesh, false);
            CreateRigidbody(transform.Position, transform.Rotation, concaveShape);
        }

I tried to import with Assimp and got the same result. So the importer is correct but something inside the bullet mirrors it.

sentences:
Voxel heightmap terrain editor I've recently been experimenting with a simple Voxel-based 3d engine (think Minecraft) which uses heightmaps to define terrain in the following format:

http://en.wikipedia.org/wiki/Heightmap

Does anyone know of the best software for producing these kind of maps? Preferably with the ability to define a texturemap also. Are terrogen and picogen the only real alternatives?

sentences:
Why does the object rotate to a random direction when I start dragging? I'm trying to do drag to rotate sort of thing, so far the code is fine. However when starting to drag (left clicking first), the object rotate to a random direction first which looks odd.

here is my code :

public Camera cam;
public float smoothAngle, dragPower = .3f;
public bool isRadial = true;
float angle, angleOld, angleDelta, angleRef;
Vector2 mousePosOld, mousePosDelta = Vector2.zero;

void Update()
{
  Vector2 mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
  if (Input.GetMouseButton(0))
  {
    mousePosDelta = mousePos - mousePosOld;
    float rotX = (mousePosDelta.magnitude / Time.deltaTime)
                  * dragPower
                  * -Mathf.Sign(mousePos.y)
                  * Mathf.Sign(Vector2.Dot(Vector2.right, mousePosDelta));

    transform.Rotate(Vector3.forward, rotX);

    mousePosOld = mousePos;
    angleDelta = Mathf.DeltaAngle(angleOld, transform.localEulerAngles.z);
    angleOld = transform.localEulerAngles.z;
  }
  else
  {
    transform.RotateAround(transform.position, transform.forward, angleDelta);
    angleDelta = Mathf.SmoothDampAngle(angleDelta, 0, ref angleRef, smoothAngle);
  }
}

this is the effect :

sentences:
Calculating Bounding Rect I'm trying to clone space invader of atari and I have problem with bounding rect calculations.. the rect is not correctly bounded.. maybe I have problem with the transformations

void Barrier::Render()
{

    if (mBarrierImage)
    {
        CIwFMat2D Transform;
        // Build transform
        Transform.SetIdentity();
        Transform.SetRot(0);
        Transform.ScaleRot(1);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);

        Iw2DSetColour(0xffffffff);

    CIwFVec2 pos = Transform.t;
    BoundingRect.x = Position.x;
    BoundingRect.y = Position.y;
    BoundingRect.w = (float)mBarrierImage->GetWidth();
    BoundingRect.h = (float)mBarrierImage->GetHeight();
    Iw2DSetColour(0xff0000ff); // Set red
    Iw2DDrawRect(CIwFVec2(pos.x, pos.y), CIwFVec2(mBarrierImage->GetWidth(), mBarrierImage->GetHeight())); // Draw red outline

sentences:
SerializeField vs GetComponent Efficiency As far as I know, there are two built in ways to get an instance of a component in Unity.

1 - Serialize the field and drag in the component manually in the editor

[SerializeField] private MyScript script;

2 - Using MonoBehaviour's GetComponent method

script = GetComponent<MyScript>();

I would think that it is more efficient to drag the component in the editor lest making the engine illiterate through every component in the GameObject to find the component.

Is it more or less efficient to drag the component in the editor compared to using GetComponent? Or does Unity find components in a different way or dragging components in the editor is handled in a different way such that it would be more efficient to use GetComponent? Would using one over the other have any impact on performance in the real world?

A similar question would also be raised regarding GameObject.FindGameObjectWithTag() vs dragging in the editor.

As far as optimization go, should you use one method over another?

sentences: What resources are available for using Qt as a toolkit for games Qt is an excellent application toolkit and overall the best for C++. While some large projects use Qt (KDE for example), I haven't seen many games using it. So I decided to make my own. But what does Qt provide that may be useful when writing a game (in my case a 2D game)?

sentences: libgdx - handling battery warning I want to pause my game when the battery warning on Android pops up. How do I do this? I have a method that pauses the game but how do I call it when the battery warning pops up?

sentences:
Can I speed up "potential fields" pathfinding when it's working on a large grid? I'm looking to implement a pathfinding algorithm that will allow me to throw hundreds of spiders at the players in my grid-based game. I can implement this with A*, but I'm worried that that algorithm has too high of a "per spider" performance cost.

The "potential fields" approach looks really good to me, but my map is quite large and rebuilding the entire potential field sounds expensive (even on a background thread).

Unfortunately, there's no logical divisions on my map where I could separate the grid into smaller grids. And the map is quite dynamic (walls/bridges can be destroyed, which could have huge impacts on pathing).

Are there any options other than reducing the size of the map?

sentences:
Determine route between rooms Is there a general purpose algorithm to determine a route between rooms of a building?

Imagine a fixed-layout, single-level house with 50+ rooms. Assume I have a data structure that defines the exits of each room and the room to which each exit leads. I'd like to know how to get from room 4 in the NW corner to room 37 in the E side, say. I want the shortest list of rooms that need to be traversed. (I don't need to see this graphically in real-time.)

Is it worth finding such an algorithm or should I just 'map out' the level and use the pathfinding abilities of my game dev platform of choice..

edit: removed the A* reference

sentences:
Error when using GetComponent (Object reference not set to an instance of an object) I'm using a textmesh to check variables in real time. Thing is if I use AddComponent within Update(), it obviously starts spamming and slows the game. If I try with GetComponent the error is the following:

NullReferenceException: Object reference not set to an instance of an object
DebugCombo.Update() (at Assets/DebugCombo.js:9)

which points to the text.text assignment.
This is the script from DebugCombo.js, from which I call the Combo class (from Combo.js)
#pragma strict

public class DebugCombo extends MonoBehaviour{

    function Update () {
        var text = gameObject.GetComponent(TextMesh);
        var combo = gameObject.GetComponent(Combo);

        text.text = "Current: "+ Time.time +" | Limit: " + combo.comboTime;
    }

}

How do I get rid of this error?

sentences:
What is the correct formula for penalty forces? I am trying to add penalty forces between two hard body objects, so when they collide they move in a realistic way. What I have so far is this:
var totalMass = aMass + bMass;
var temp = (aMass / totalMass * aVelocity) + (bMass / totalMass * bVelocity);
newVelocityB = (bMass / totalMass * bVelocity) + (aMass / totalMass * aVelocity);
newVelocityA = temp;

Originally I thought this was correct and it seems to work for the most part. However, this doesn't seem to be flawless. For example, if the collided object is a vertical wall (represented with a mass of infinity), the wall's velocity of (0,0) will be the final result. So, for an object moving diagonally with a velocity of (10,10) and hitting the wall, will result in a velocity of (0,0). In my case I would expect that the y component of the velocity remains 10, and it keeps sliding up the wall.
Can anyone tell me if I'm on the right path, and how I can modify my formula to make sure that the y-velocity does not become 0?
I have considered that the collision normal of the wall could be important (in this example [-1, 0]), or the perpendicular of the normal, however I still have not figured out how to apply it in this formula. Multiplying by the perpendicular of the normal was my first idea, but this isn't the correct answer.

sentences:
UE4 tips how to handle Minigolf Multiplayer Heyo!

I'm doing a Minigolf multi-player game right now. What I couldn't figure out by now is how to set up the game logic of the actual game. So where to keep track of all players being in bounds, the scores or when everyone is in the hole to load the next hole. And how do that anyway? Do I keep different versions of the same map with different spawns and travel there after that  or can I move somehow spawns and everything else staying in the same level?

I'm sorry if this is confusing or there is not enough information to follow me there. Please aks when something is unclear!

sentences:
How do I make a 2D character aim their gun toward the mouse? Heli Attack is a perfect example of the shooting mechanic I'd like. The character aims perpetually toward the mouse. What's going on here?

From what I've read so far, you could separate the arm and rotate that. I've also noticed some people use a different sprite for each weapon.

How can I achieve this?

sentences: Is it safe to use Sleep() in game loop (on Windows)? Is it safe to use Sleep() function on Windows in game loop (C++)? I want to have fixed frame rate.

sentences:
Help Applying SDL_Surface on an array of SDL_Surface? I'm trying to make a 4x4 blocks (50x50 px) with SDL Surface. Added another block (50x50 px, I wrote the variable as 'flag') that can only move within the 4x4 blocks, so I can select one of the blocks with this one.
The problem is when I move it (say I move it to flag_x + 50), the previous surface (flag_x) is still there, even though I already use blit surface. It's like taking a multiple snapshots of walking person. How can I move 'flag' normally within the 4x4 blocks? Or do I use the wrong method?

Below is the code

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include <string>
#include <sstream>

using namespace std;

//Screen attributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

//The frame rate
const int FRAMES_PER_SECOND = 20;

//The surfaces
SDL_Surface *screen = NULL;
SDL_Surface *matchbox[4][4];
SDL_Surface *flag;

....
....
....

bool load_files()
{
    flag = load_image("matchbox2.png");
    if( flag == NULL )
   {
       return false;
   }

   for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
         matchbox[i][j] = load_image("matchbox.png");
         if( matchbox[i][j] == NULL )
            return false;
      }
   }
   return true;
}

void clean_up()
{
//Free the surfaces
SDL_FreeSurface( flag );

for(int i=0;i<4;i++){
   for(int j=0;j<4;j++){
      SDL_FreeSurface(matchbox[i][j]);
      matchbox[i][j] = NULL;
   }
}
//Quit SDL
SDL_Quit();
}

int main( int argc, char* args[] )
{
   for(int i=0;i<4;i++){
      for(int j=0;i<4;i++) {
         matchbox[i][j] = NULL;
      }
}

   Timer fps;

   bool quit = false;

   //Initialize
   if( init() == false )
   {
      return 1;
   }

   //Load the files
   if( load_files() == false )
   {
      return 1;
   }

   int matchbox_x = 50;
   int matchbox_y = 50;
   int flag_x = 50;
   int flag_y = 50;

   //Fill the screen white
   SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0xFF, 0xFF, 0xFF ) );

   //Apply matchbox to the screen
   for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
         apply_surface( matchbox_x , matchbox_y , matchbox[i][j], screen );
         matchbox_x += 50;
      }
      matchbox_x = 50;
      matchbox_y += 50;
   }

   //key event
   while( quit == false )
   {
      fps.start();

      //While there's events to handle
      while( SDL_PollEvent( &event ) )
      {
         //If a key was pressed
         if( event.type == SDL_KEYDOWN )
         {
            switch( event.key.keysym.sym )
            {
                case SDLK_UP: flag_y -= 50; break;
                case SDLK_DOWN: flag_y += 50; break;
                case SDLK_LEFT: flag_x -= 50; break;
                case SDLK_RIGHT: flag_x += 50; break;
            }
         }
         else if( event.type == SDL_QUIT )
         {
            quit = true;
         }
     }

     //collision detection
     if(flag_x < 50)
        flag_x += 50;
     if(flag_x > 200)
        flag_x -= 50;

     if(flag_y < 50)
        flag_y += 50;
     if(flag_y > 200)
        flag_y -= 50;

     apply_surface(flag_x, flag_y, flag, screen);

     //Update the screen
     if( SDL_Flip( screen ) == -1 )
     {
        return 1;
     }
     //Cap the frame rate
     if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
     {
        SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
     }

  }

  //Free the surfaces and quit SDL
  clean_up();

return 0;
}

function examples taken from http://lazyfoo.net/SDL_tutorials/index.php

sentences:
Change the scale-policy of OpenGL ES in Android? I currently develop a game for Android in OpenGL ES 1.0, use libgdx library. I target the 720x480 screen size.

For example, I design only one arts pack for 720x480. And what will happen in Android phones with screen-size smaller or bigger than it, 480x320 for instance? Could you please tell me how to change the scale-policy of OpenGL ES in Android? Or in libgdx specially?

Is there anything like "Resample Image" like photoshop?(Nearest Neighbor, Bilinear, Bicubic etc..) for libgdx?

Edit: I found some tutorials about texture filter in OpenGL, test it with Linear and Nearest. Linear is good for scaling but slow down the game, and Nearest is on the contrary. What should I do to get a balance between those?

sentences:
Shifting the camera and setting a new scene when using Box2D My jsFiddle:

// START -- MOVE CAMERA
var p = new b2Vec2();
p = (ball.body.GetWorldCenter().x) * physics.scale;
pos.push(p);
var length = pos.length;

var s = (pos[length - 1] - pos[length - 2]); //in pixels

if ((halfwidth < (dw - p)) && (p > halfwidth)) {
    ctx.translate(-s, 0);
}

I followed this tutorial, but the ball rendering is acting weird and slow.

I can't figure out how this example did it. He used 3 variables (stage,x, y) that are undefined in the code he wrote. Also check out how the camera moves with the player in this ImpactJS demo. I'd like to have that.

How can I do this?

sentences:
How to deal with objects placed in the root nodes of a quad tree? I've implemented a quad tree where points and axis aligned rectangles can be put.
It works fine, except for one issue that I'll try to describe.
When you put a rectangle in the tree and this rectangle collides with quadtree's node borders, than your rectangle is put in parent node of that node.
It's ok! That's how it should work!

Let's consider I have a small rectangle (red) laying in quadtree's center (x: 0, y:0). And I would like to retrieve other rectangles near my rectangle (blue rectangles). But here's the problem, when I do that the algorithm will return all rectangles(blue + green), because my rectangle collides with quad tree nodes border and is put in quadtree's root node. I don't need green rectangles and I can't allow myself to have such an overhead.

How can I avoid such problem? What would be the easiest way to implement solution to this problem?

The current Retrieve method recursively walks to each subnode of the node where red rectangle is positioned.

I've heard about overlapping node borders solution, but I guess it won't help in case if red rect would be 3x time bigger?!

sentences:
Unity C# Array Scripting! I was just trying and make a simple 2D game. I have a simple circle sprite (red, green and blue). These circles fly upwards with my scripting as shown below:-

public class Direction : MonoBehaviour {
    public GameObject[] ballons;
    public float increase;
    public float timeInterval;
    public float timeForGetGo;
    public float increaseInterval;

    public float startTime;
    public float timeForNextSpawn;
    public Transform instantiatePos;
    void Start () {;
        StartCoroutine (direction ());

    }

    void Update () {
        increase += increaseInterval;
        direction ();
        Instantiater ();
    }

    IEnumerator direction (){
        while (true){
            foreach (GameObject gameObjects in ballons) {
                gameObjects.transform.position = new Vector3 (gameObjects.transform.position.x, gameObjects.transform.position.y + increase, 0f);
                yield return new WaitForSeconds (timeInterval);

                }
                }

So, instead of making them fly with one script by one script, which I normally do, I tried to make array of these gameObjects and make them go upwards. **It worked great!** But, I have a problem. I want these upward going circle to instantiate but when I instantiate them, they won't go upwards as they aren't in the list of arrays I put earlier as in:-

public GameObject[] ballons;

in first line in that script.

So, as in conclusion, my problem is the instantiated objects won't have same property coz the script is attached to another gameobject and not in the original gamobject itself. Any ideas?

sentences:
Double buffer - Managing Collision I'm thinking about how I should manage collisions in my game. I'm thinking about having a "Collision" class that checks for collision, and in case takes actions to resolve them.

My problem is this:

A and B moving to the other, when they collide they must bounce.

If I resolve the collisions sequentially, like calling:

A.collideWith(B)
B.collidesWith(A)

B will be stuck, because A has already updated his velocity and position, and when will be called B.collideWith(A) there won't be any collision anymore.

So, is it a good idea to use a double buffer pattern?

I'll write the values obtained by the collision resolver in some variables, they will be swapped to the real ones when all the collision has been resolved. In that way all should work fine.

But it is a good software design?

EDIT

I see, yes of course i check only for half.
So there should be a class that checks for collisions, and should be like:

checkedpairs.clear();
for( Object a : objects )
{
    for( Object b : objects )
    {
        if( ! a.collideWith( b ) || checkedpairs.contains( a, b ) ) return;

        Object a1 = copyf( a );
        Object b1 = copyOf( b );

        a.collideWith( b1 );
        b.collideWith( a1 );

        checkedpairs.add( a, b );
    }
}

Instead of putting the logic for the swap in the objects themselves...

But that way, I'm creating two objects for each collision, isn't too much overhead?

The problem is that I don't need only the position, but al lot of physics stuff like velocity, acceleration, mass... Should I pass them? Isn't it too hard-coded?

sentences:
How to use Bullet physics with Entity Component Systems? I have an Entity Component system and I want to have a Physics Component that would add the given object to the physics simulation.

My problem arises because the Bullet API requires me to add each object before doing the simulation.

How should I proceed to create a System(System in entity component terms) that wraps the Bullet Physics API to do simulation while the Physics components are getting added and removed?

Edit:

This is how my Entity component system looks like.

class Entity
{
    std::unordered_map< size_t, void* > components;
public:
    // setters getters for components based on key
}
class EntitySystem
{
    std::unordered_map< size_t, Entity* > entities; // maps entity GUID to entity*
public:
    // calls function on all entities
    void Process( void* userdata, void (function*)(void*, Entity*) );

    // Entity creation, setting, getting, component index management, etc...
}

sentences:
Fastest way to draw quads in OpenGL ES? I am using OpenGL ES 2.0
I have a bunch a quads to be drawn, would love to be able to have to pass only 4 vertices per quad as if I were using GL_QUADS, but basically I just want to know the best way of drawing a bunch of separate quads.
So far what I've found I could do:

GL_TRIANGLES(6 vertices per quad)
Degenerate GL_TRIANGLE_STRIP(6 vertices per quad)

Possibilities I've found:

GL_TRIANGLE_STRIPS with a special index value that resets quad strip(this would mean 5 indexes per quad, but I don't think this is possible is OpenGL ES 2.0)

sentences:
Collision Detection and Bounding Box Creation I am trying to create bounding boxes. My goal is not to create them with giving x,y and z coordinates. But rather, I will be loading a model or else rendering a shape - say an aeroplane. The algorithm then should be able to create efficient bounding boxes around it. I am coding in opengl.

Can you help me out with the same?

sentences:
OpenGL color overlay I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

-Edit-

One solution I came up with (not just now) is multiplying alpha in every glColor3f function with a variable that is smaller than 1 so everthing gets relatively smaller, but I worry about this being uneffective and badly mantainable

sentences:
Altering Animation Playback Given Terrain Information Say my character has a jog animation.  Assuming Y is vertical, his feet leave the ground at Y=0 and hit the ground again at Y=0.  This works fine in a world like that of Minecraft, where every surface the player could traverse is flat.

Now say the character is jogging through hilly terrain.  Without any transformations, the animation would break through the ground at certain points.  (As the character's foot is lifted and moved forwards, it would go straight through the hill.)

How do I remove this artifact?  Do I ask the artists to create separate animations depending on the grade of the terrain?  Is there a standard system to resolve animation-world collisions that I'm unfamiliar with?  Or is there another more logical approach I haven't thought of yet?

sentences:
How can I render a JBox2D ParticleGroup? I want to render a ParticleGroup from JBox2d using OpenGL.  I've managed to define a particle group area, but I'm unsure how to draw the individual particles.

Here's how I create the ParticleGroup:

m_world.setParticleRadius(0.15f);
m_world.setParticleDamping(0.2f);

PolygonShape shape = new PolygonShape();
shape.setAsBox(8, 10, new Vec2(-12, 10.1f), 0);
ParticleGroupDef pd = new ParticleGroupDef();
pd.shape = shape;
m_world.createParticleGroup(pd);

This is how I draw a normal Square (which I don't know how to apply to groups of particles):

public void draw(GLAutoDrawable gLDrawable, Vec3 position, float angle){

    gLDrawable.getGL().getGL2().glEnable(GL.GL_BLEND);
    gLDrawable.getGL().getGL2().glEnable(GL.GL_TEXTURE_2D);

    gLDrawable.getGL().getGL2().glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);

    gLDrawable.getGL().getGL2().glBindTexture(GL2.GL_TEXTURE_2D, TextureFactory.getTextureIndex(TextureCollection.valueOf(getTextureSelection())));
    gLDrawable.getGL().getGL2().glPushMatrix();

    gLDrawable.getGL().getGL2().glTranslatef(position.x * getP2M(), position.y * getP2M(), position.z);
    gLDrawable.getGL().getGL2().glRotated(Math.toDegrees(angle), 0, 0, 1);
    gLDrawable.getGL().getGL2().glBegin(GL2.GL_QUADS);
    gLDrawable.getGL().getGL2().glTexCoord2f(0.0f, 0.0f);
    gLDrawable.getGL().getGL2().glVertex3f(-getWidth() / 2 * getP2M(), -getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(0.0f, 1.0f);
    gLDrawable.getGL().getGL2().glVertex3f(-getWidth() / 2 * getP2M(), getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(1.0f, 1.0f);
    gLDrawable.getGL().getGL2().glVertex3f(getWidth() / 2 * getP2M(), getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glTexCoord2f(1.0f, 0.0f);
    gLDrawable.getGL().getGL2().glVertex3f(getWidth() / 2 * getP2M(), -getHeight() / 2 * getP2M(), 0.0f);
    gLDrawable.getGL().getGL2().glEnd();
    gLDrawable.getGL().getGL2().glFlush();
    gLDrawable.getGL().getGL2().glPopMatrix();

    gLDrawable.getGL().getGL2().glDisable(GL.GL_TEXTURE_2D);
    gLDrawable.getGL().getGL2().glDisable(GL.GL_BLEND);
}

How should I do this?  (Example code would be great.)

sentences:
Assigning bone transform in every draw a good idea? In my Draw method, I am doing the following:

thisMesh.CopyAbsoluteBoneTransformsTo(transforms);

Is this a good idea?  Or should I do this once at the constructor level?

sentences:
What operations should be multithreaded? I wonder what game operations should be multithreaded, and which should always run on the main thread.

The most expensive operations I could come up with are:

loading a level
loading resources (for each level or at game initialization)
updating game world (weather, liquids, chain reactions, lots of small entities, etc.)
downloading from game server (level files, custom resources, player saves, object states, etc.)
occasional heavy methods (large screenshots, per-pixel calculations, full world update)

Which of those operations should be threaded, and which should not? Which of them can be threaded most effectively by using as many threads as the host supports?

Or is it better to split some of these operations into blocks and execute each frame, bit by bit, without threading, and without causing frame drops?

sentences: Geometric Transformations on the CPU vs GPU I've noticed that many 3d programs normally do vector/matrix calculations as well as geometric transformations on the CPU. Has anyone found an advantage in moving these calculations into vertex shaders on the GPU?

sentences:
Finding new position after collision with multiple colliders What is the most accurate way to find the correct position to where a moving character should be re-positioned as a collision-resolution, after it has collided with multiple colliders?

The figure below illustrates the situation. The rectangles in black are the walls, the rectangle/circle in blue is the moving character and the arrow in read shows the direction of movement, i.e. in this case from right to left. My set up is in 2D and I am using C# in Unity.

sentences:
Placing Zones in Cities Skylines I'm trying to build a mod that places zones on a keypress. How would I accomplish this?
So far I've detected the keypress. But when I modify m_blocks in ZoneManager by calling block.setZone(x,y,zone) The block appears to have changed, but only for the moment. When I run the keycommand again, the data appears to have  been reset. I never see the zone change in game, only when I print it to the console.
string outtext = "";
            uint blockCount = Singleton<ZoneManager>.instance.m_blocks.m_size;
            outtext += "start{\n";
            for (int index = 0; index < blockCount; index++) {
                var block = Singleton<ZoneManager>.instance.m_blocks.m_buffer[index];
                if (block.m_valid != 0) {
                    block.SetZone(1, 1, ItemClass.Zone.Industrial);
                    block.RefreshZoning(0);
                    outtext += " valid:" + block.m_valid + " position:" + block.m_position.ToString() + " zone:" + block.GetZone(1, 1) + " \n ";
                }
            }
            outtext += "}";
            Debug.Log("OUTTEXT " + outtext);

I've tried calling block.refreshZoning() as well, but I'm not sure how to calculate the blockid :(.

sentences: Does the base game I choose for a steam mod matter? Me and a couple of my friends are planning on trying to make a source mod, but we can't figure out how to tell what game to use as a base. We hope to make a totally different game with it, and aren't sure how much of the base game will actually hang around. Like if we chose TF2 for the base would we be stuck with cartoony graphics and teams?

sentences:
How should I rotate vertices around the origin on the CPU? I have tried using glm::rotate and such. glm::translate works fine, but rotate doesn't work (if I rotate before/after a translation).

Here is my current setup:

glm::vec4 Off = glm::vec4(0, 0, 0, 1);
glm::vec4 result = Util::createTransform(offset) * Off;

for (int i = 0; i < Tvertex.size(); i++) {
    Tvertex[i] += glm::vec3(result.x, result.y, result.z);
    Tcolors[i] = currentColor;
}

And here is my Util::createTransform:

glm::mat4 Util::createTransform(glm::vec3 pos) {
    glm::mat4 trans = glm::mat4(1.0);
    trans = glm::translate(trans, pos);
    return trans;
}

glm::mat4 Util::createTransform(glm::vec3 pos, glm::vec3 rot) {
    glm::mat4 trans = glm::mat4(1.0);
    trans = glm::rotate(trans, glm::radians(rot.x), glm::vec3(1, 0, 0));
    trans = glm::rotate(trans, glm::radians(rot.y), glm::vec3(0, 1, 0));
    trans = glm::rotate(trans, glm::radians(rot.z), glm::vec3(0, 0, 1));
    trans = glm::translate(trans, pos);
    return trans;
}

sentences:
DirectX11 Shader issue I am currently having issues with HLSL shaders. I am trying to implement point lights but I am getting unusual data when debugging the shader in Visual Studio.

I have read on several sites that say that the data stored in CBuffers should be aligned to 4 bytes, thus I added padding where it was needed (is this correct?).

When I set the data in c++, some of it comes through alright but other data is not. For example the color comes through alright but the range is being displayed as NaN in the VS graphics debugger.

Is there something wrong with the code below? (All structs are the same as those in c++ structs)

Please ask if there is anything else you would like to see code wise. Thanks!

PointLight Code:

float4 calcPointLight(PointLight pointLight, float3 normal, float3 worldPos0, float4 specularMap, float4 diffuseTex)
{
    float3 lightDirection = worldPos0 - pointLight.pos;
    float distanceToPoint = length(lightDirection);

    //  if (distanceToPoint > pointLight.range)
   //   return float4(0, 0, 0, 0);

    lightDirection = normalize(lightDirection);

    float4 color = calcLight(pointLight.base, lightDirection, normal, worldPos0, specularMap);

    float attenuation = pointLight.atten[0] +
    pointLight.atten[1] * distanceToPoint +
    pointLight.atten[2] * distanceToPoint * distanceToPoint +
    0.0001;

    return color / attenuation;
}

float4 calcLight(BaseLight base, float3 direction, float3 normal, float3 worldPos0, float4 specularMap)
{
    float diffuseFactor = (dot(normal, -direction));

    float4 diffuseColor = float4(0, 0, 0, 0);
    float4 specularColor = float4(0, 0, 0, 0);

    if (diffuseFactor > 0.0f)
    {
        diffuseColor = base.color * base.intensity * diffuseFactor;
        diffuseColor = saturate(diffuseColor);

        float3 directionToEye = normalize(cameraPos - worldPos0);
        float3 reflectDirection = normalize(reflect(direction, normal));

        float specularFactor = dot(directionToEye, reflectDirection);
        specularFactor = pow(abs(specularFactor), specularPower);

        if (specularFactor > 0)
        {
            specularColor = base.color * 1.0f * specularFactor;
        }
        if (specularMap.a > 0.0f)
            specularColor = specularColor * specularMap;
    }

    return saturate(ambient + diffuseColor + specularColor);
}

Structs

struct BaseLight
{
    float4 color;
    float intensity;

    float3 padding3; //TEST
};

struct DirectionalLight
{
    BaseLight base;
    float3 direction;
};

struct PointLight
{
    BaseLight base;
    float3 atten;
    float padding;
    float3 pos;
    float range;
};

CBuffers

    cbuffer MatrixBuffer : register(b0)
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

cbuffer LightingBuffer : register(b1)
{
    float4 ambient;

    float specularPower;
    float3 padding3;

    PointLight pointLight;
    //DirectionalLight light;

 };

 cbuffer CameraBuffer : register(b2)
{
    float4 cameraPos;
};

sentences:
Directx11 create Texture2D using subresourceData I'm trying to create immutable texture in d3d11 so I want to use subresourceData, every tutorial on textures creates them with 2nd argument being null and after that updates subresource but I want to create it using the 2nd argument.
This code works:

hResult = m_device->CreateTexture2D(&textureDesc, NULL, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

int rowPitch = textureWidth * 4;
m_deviceContext->UpdateSubresource(m_cubeTexture, 0, NULL, &(decodedTexture[0]), rowPitch, rowPitch * textureHeight);

And this does not:

int rowPitch = textureWidth * 4;
D3D11_SUBRESOURCE_DATA tSData;
tSData.pSysMem = &(decodedTexture[0]);
tSData.SysMemPitch = rowPitch;
tSData.SysMemSlicePitch = rowPitch * textureHeight;

hResult = m_device->CreateTexture2D(&textureDesc, &tSData, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

DirectX11 debug layer outputs this:

D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[3].SysMemPitch cannot be 0 [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]
D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[5].pSysMem cannot be NULL. [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]

Which I don't understand since it's not even an array and texture array size is set to 1

sentences:
How does one get sprites to hide/unhide using OnMouseDown() in Unity? I'm right now using Unity for a school project and I need to be able to hide and
unhide sprites for "expansions".

I've looked all over the internet for this and I can't seem to find an answer.

Here is the script so far:

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

[DisallowMultipleComponent]
public class addBlock : MonoBehaviour{

  void OnMouseDown()
  {
     Debug.log(gameObject.name);
  }
}

sentences:
2D UI - Image with 1px border randomly gets different thickness I created a test image that is 60 x 60 px, which has a 1px border.  I then drop that into Unity as a UI sprite image set to the same size, however the 1px border on a few sides can appear to be thicker, and this ruins the look I am going for especially when there are multiple of them.

I've tested in the editor and creating builds (testing resolutions), and the same issue in all cases.

It's easier to explain this with images.

The left screen shot is the actual size of the image in the game view.  The zoomed in image is another case where the borders change thickness, but zoomed in to make it more clearer.

I've tried various settings, always the same issue.

How can I get the image to appear exactly as it should with no changes to the borders?

sentences: Player movement vs world movement in infinite runner game? Well I'm developing a Temple Run or Subway Surfer style infinite runner game. Which is more good? -Moving the player and make the Main Camera follow, or keep the player in one position and move the generated worlds? And the generated paths or worlds will have many animations in it. So which choice ouuld be good and why?

sentences:
How do I get bullets to move in the direction of the mouse's position? Possible Duplicate:
  Shoot a bullet towards cursor - top down 2d

I'm creating a 2D top down shooter, and I want to get the bullets to go in the direction of the mouse. Not sure of the logic that goes into it.

sentences:
Triangle Strips of Tetraheron I am confused about the triangle strip representation of closed mesh .The vertex buffer for triangle strip representation of the a figure is shown below:

A(0,1) B(0,0) C(1,1) D(1,0)E(2,1)

vertex buffer=[A,B,C,D,E] where, T1=(A,B,C) T2=(B,C,D) T3=(C,D,E)

Now, if I have a tetrahedron with four vertex A(0,0,0),B(1,0,0),C(0,1,0) and D(0,0,1) then what would be its vertex buffer representation?

Thank you very much.

sentences:
HTML5 Game (Canvas) - UI Techniques? I'm in the process of building a JavaScript / HTML5 game (using Canvas) for mobile (Android / iPhone/ WebOS) with PhoneGap. I'm currently trying to design out how the UI and playing board should be built and how they should interact but I'm not sure what the best solution is. Here's what I can think of -

Build the UI right into the canvas using things like drawImage and fillText
Build parts of the UI outside of the canvas using regular DOM objects and then float a div over the canvas when UI elements need to overlap the playing board canvas.
Are there any other possible techniques I can use for building the game UI that I haven't thought of? Also, which of these would be considered the "standard" way (I know HTML5 games are not very popular so there probably isn't a "standard" way yet)? And finally, which way would YOU recommend / use?

Many thanks in advance!

sentences:
Picking random monster cards from a deck What is the best way to go about making user defined classes (monsters, items, loot, armor, weapons, spell types, etc) and then calling them later during an encounter? Looking at the entire card list for a trading card game is intimidating, and I would love some advice on tackling this before I go about it the wrong way.

class Card(object):
def __init__(self, name, value, type, power):
    self.name = name
    self.value = value
    self.type = type
    self.power = power
    self.expan = 'Base'

class Monster(Card):
def __init__(self, name, value, type, power):
    self.active = False
    Card.__init__(self, name, value, type, power)
    #monsterlist.append((self.name, self.value, self.type, self.power))

Is it ideal to just make a random number and create the monster like this (there's over a thousand cards, so this doesn't seem optimal to me):

def pickMonster():
    chance = random.randint(1,2)
    if chance == 1:
        goblin = Monster('goblin', 8, 'animal', 'run')
    if chance = 2:
        troll == Monster('troll', 8, 'troll', 'smash')

Can I define monsters in a list/dictionary somehow and pull them at random from there?  I was trying to use this method to make the code easier to read, but I'm having a hard time figuring out exactly how to do it that way (as I'm not even sure it's possible to put more than 2 values into a list, and dictionaries are the bane of my existence -- I'm fairly new to python).

sentences:
NullReferenceException: Object Reference Not Set to an Instance of an Object (How is that so and I should I solve it?) I am stuck several days because of this problem, which I am almost on the verge of giving up. (Using Unity Engine 2019.3a by the way). The TextButtonName.text can't read what TextButton is throwing to it. Meanwhile, when I did a Debug.Log test, the console shows what is the text in the TextButton. What the console showed about Debug.Log() thing should be the value of a variable assigned (hence, the

Is there any way that whatever is the text at the button, will be the value that can be used for Switch Statements? If there is a way (I am sure there is), how? Thanks.

//When pressed, ButtonPress() will be triggered and will go to Experiment Information Scene
public void ButtonPressTutorial(){
    //TextButton = gameObject.GetComponentInChildren<Text>().text;
    TextButton = EventSystem.current.currentSelectedGameObject.GetComponentInChildren<Text>().text;
    TextButtonName.text = TextButton;
    /* TextButton, although has value shown in Debug.Log, the problem is that
    it throws a NULL value when being thrown to TextButtonName.text Why is that? Is there that I need to do?*/
    Debug.Log(TextButton);
    SceneManager.LoadScene(5);}

Switch statements:

        switch (TextButtonName.text) {
        case "  Tutorial":
            ExpNum.text = "Tutorial";
            ExpTitle.text = "Coke With Mentos Experiment";
            ExpDetails.text = "//Details will be shown here";
            break;
        case "Experiment 1 Button":
            ExpNum.text = "Experiment 1";
            ExpTitle.text = "Lemon Volcano Experiment";
            ExpDetails.text = "//Details will be shown here";
            break;
        default:
            ExpNum.text = "No Experiments";
            break; }

sentences: How to test ad mediation in cocos creator? I made a game in cocos creator and added Admob as my primary ad network and Ad Colony as secondary. But I am not sure how can I test if it's working? Can I just disable adMob ads (test ads) and see if the game still showing ads with AdColony (test ads)?

sentences:
MVC with looping view For our school project we'd like to develop a game using the MVC pattern. We're all moderate new java programmers and absolutely new in game development.

With our current view (containing only menu) using swing we have no issues. But we'd like to make the menu navigation within the game loop. And there's the issue: The game loop prevents the controller to continue. The solution sounds easy, but the implementation lacks some of my/our knowledge, additional thread. I think using a separate thread for view makes handling all stuff threadsafe difficult.

Our game loop is based on nifty, which is using slick2d and this is based on lwjgl (and so on). Reverting to swing does not solve our issue, because once we're in the real game loop, the situation would be the same (so far I understand).

I hope it is understandable without posting huge amount of code. Two questions comes to mind:
How should threading be done, when my current try is having a (looping) view instance in its own thread?
(Reading a bit here on gamedev seems to call our architecture in question) Is MVC the right choice if we're using slick as framework?

sentences:
How does one avoid the "staircase effect" in pixel art motion? I am rendering sprites at exact pixel coordinates to avoid the blurring effect caused by antialiasing (the sprites are pixel-art and would look awful if filtered). However, since the movement of the objects involves variable velocity, gravity, and physical interactions, the trajectory is computed with subpixel precision.

At large enough screenspace velocities (vΔt larger than 2 or 3 pixels) this works very well. However, when velocity is small, a noticeable staircase effect can appear, especially along diagonal lines. This is no longer a problem at very slow screenspace velocities (v << 1 pixel per second) so I am only looking for a solution for intermediate velocity values.

On the left is the plotted trajectory for a large velocity, obtained by simple rounding of the object coordinates. In the middle you can see what happens when velocity becomes smaller, and the staircase effect I am talking about. On the right, the locus of the trajectory I would like to get.

I am interested in algorithm ideas to filter the trajectory in order to minimise the aliasing, while retaining the original behaviour at large and small velocities. I have access to Δt, instant position and velocity, as well as an arbitrary number of previous values, but since it is a realtime simulation, I do not know about future values (though if necessary, an estimation could be extrapolated under certain assumptions). Note that because of the physics simulation, sudden direction changes can also happen.

sentences:
Can't correct perspective of Main Camera in Unity 3D without losing field of view I have been trying to create a space based rails shooter game following a particular online course and I find a tilt(roll) on my spaceship as I move it towards the left and right ends of the screen.

https://imgur.com/Kkg8hp2
(A normal screenshot of my spaceship at default position)

This is due to perspective of the camera as I have been told and apparently dragging the camera farther behind the spaceship and decreasing its field of view helps.

https://imgur.com/0oXJff7
(The tilted spaceship when it's at an end of the game window)

But, doing that neutralizes the illusion of speed caused by a greater field of view. I have found a middle point between the two to balance both aspects of the game but I would like to know if there is any way to get higher field of view without making the ship look like it's tilted.

Things I have considered doing:

Added a positionRollFactor which gives the ship some additional roll in the opposite direction of the tilt. (This still doesn't fix the perspective issue in which one half of the ship is more enlarged than the other).
Tweaking the field of view by trading off a little of each feature.

sentences:
Is there a way to convert built unity games back into a project I accidentally deleted my game.
I had been working on it for about 2 months and I accidentally deleted it while cleaning up my files. I am so smh. I have a ton of builds of the game though and since the game and all its scripts was converted to a file. Would I be able to un-pack said build back into a unity project? I am not that cut about the game because I didn't like it but I did spend a lot of time on it. Oh yeah and also its a school assignment...
Please help.

sentences:
What is the standard way to synchronize sound effects with sprite animations? Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each spell has only 1 continuous animation associated with it (as opposed to multiple modular pieces that are used to form a full animation) ala the old 16 Bit Final Fantasy games.

The only way I can think of in order to make sure that the sounds and animations sync up is to:

Get the number of frames of an animation.
Get the time between each frame of the animation. (if it's 30 fps then it's 1/30th of a second per frame.)
Then create a sound file that is exactly the same length as the animation.

So this means that if an animation is 5 seconds long, running at 30 fps, with a total of 150 frames, the sound file will also be 5 seconds long. If the animation should have an "impact" sound on the 30th frame, that means the sound file will include the sound of impact at the 1.0 second mark.

At the end, we start the animation and the sound effect at exactly the same time and hope that the frames and the sound sync up.

This sounds like it could pose problems when frames are skipped or something happens during the animation and the sound gets played slightly too soon or too late, and will cause the sound and the animation to go out of synch. Is this the best approach or are there usually a better way that I'm just not seeing?

The answer doesn't necessarily need to be for Cocos2D specifically if it's conceptual, but if there's a specific solution for cocos2d, I'd love to hear it.

EDIT: I just also realize that with this method, if we happen to go in and adjust the number of frames or timing of the animation later, we MUST also go back and change the sound file. This sounds like a terrible cause for human error (forgetting to update sound files after animation change.) I hope there are better methods out there.

sentences:
Unity Animation makes object spawn at x0 y0 z0 I was making an animation for a coin in my game in Unity, and when I was testing the full game, I saw that the coin is spawning at x0 y0 z0 and is doing the animation there.
Then I realized that it was the animation, that increases and decreases y position and y rotation, starting at 0.
So, I need to make the animation, that increases and decreases position y and rotation y, without affecting the actual position, because it will be different the position of the coins each time.
In a while I will upload a screenshot for describing better the problem.
Any clue?

sentences:
Splitting up duties for a card game server I'm working on a game where players connect to a game server and to a lobby to play a card game against others.

I have a pretty good idea how to code it and such, I'm just not sure regarding a few details.

The game will have multiple lobbies, so although all lobbies run from the same exe and server, the player is bound to a specific lobby.

When the player connects to a lobby, I need to:

-Tell all the players in the lobby about it

-Send that player their list of online friends

-Send that player the list of all players online (in that lobby)

-Send that player the list of all current games and who's playing in each game (This info is all displayed in a ListBox).

Once that player is connected, I need to ensure that while they were receiving that information, if anyone else joined, or any games ended / started etc, that they dont miss any of those messages.

In a single-threaded world, I'd find this pretty simple, but I fear this would mean horrible lag or something every time someone joins. (I could be wrong though).

I'm wondering in general what would be an ideal way to tackle this problem such that it minimizes slow downs for other players. What I mean is, the whole server should not halt for 3 seconds while a user joins.

I guess with a message system it is not too bad since the server can get work done while it waits for the reply. But how robust is such a message system? Login / Authentication be on its own thread, and then it sends a message to the lobby thread which would handle any lobby related transactions. Should each game be in its own thread or should I loop through each active game and process them iteratively?

In addition, each game has a private chat between the 4 players. Each lobby has a chat that only players in the lobby and not in a game can see.

I was also wondering if I should incrementally update the lobby for players in a game or send them a full update when they finish a game.

If anyone could lead me in the right direction for any or all of these questions I would really appreciate it.

I'm coding this in C++ with a network library called ENet, but I'm not looking for any code, but maybe psudocode.

Thanks

sentences:
How to initialize once for all a static field of a custom editor in unity I have a custom editor wich has a static field.

Suppose you have a static field of type MyObject:

public class myEditor : Editor {

...

private static MyObject myObj;

...
}

I'd like to initialize the field myObj directly on the same line of the declaration, but in this way I get a TypeInitializationException.

I could initialize  the field myObj in the method OnEnable, but in this way I have to use an if statement like the following:

if ( myObj == null )
    myObj = new MyObject();

Is there a way to initialize myObj once for all without using if statement?

sentences:
Using result of ProjectWorldToScreen for DeprojectScreenToWorld does not produce initial input data I am using this logic to project a point in world space into screen space.
const FVector Location = FVector(1, 2, 3);

FIntRect Rect;
Rect.Max.X = ViewportSize.X;
Rect.Max.Y = ViewportSize.Y;
FVector2D CurrentScreenSpaceCoords;

const FMatrix ViewProjectionMatrix = SceneView->ViewMatrices.GetViewProjectionMatrix();
SceneView->ProjectWorldToScreen(Location, Rect, ViewProjectionMatrix, CurrentScreenSpaceCoords);

I am using this code to get the initial value back
FMatrix const InvViewProjMatrix = ViewProjectionMatrix.Inverse();
FVector WorldPosition;
FVector WorldDirection;
FSceneView::DeprojectScreenToWorld(CurrentScreenSpaceCoords, Rect, InvViewProjMatrix, WorldPosition, WorldDirection);

However the result of DeprojectScreenToWorld does not produce the initial input (Location).
Instead of giving me the expected vector of [1, 2, whatever], it gives me X = [69.8139954,3840.00073, 250.49826]
Edit:
I am interested in X,Y. I don't need Z.
Somebody knows:

Why this happens?
How to get the initial value back from it

Thanks in advance

sentences:
How do I hide an Input field? I have in my hierarchy tab a Canvas. Inside the canvas I have an Input Field that holds a placeholder and a text.

I read the documentations and didn't find how to hide the Input field.

I want that if a if statement is true, then it will show the input field. Else you won't see it.

How can I implement it?

EDIT

I thought about an idea to test: If I press the O key on the keyboard it disappears, and if I press again it appears; and so on.

This is what I tried:

bool shown = true;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    GameObject inputField = GameObject.Find("InputField");
    if (Input.GetKeyDown (KeyCode.O)) {
        shown = !shown;
        inputField.SetActive (shown);
    }
}

I play the scene and when I press the O key I get

NullReferenceException: Object reference not set to an instance of an object

If I double-click on the console message it highlights me the if (Input.GetKeyDown (KeyCode.O)) { line.

Something not good does the SetActive(bool) method, I suppose.

sentences:
Direction vector to quaternion I have a unit vector (direction) which represent a rotation around Y axis,

and would like to turn this into a quaternion to represent the same rotation.

I use GLM library, but interested any library agnostic solution.

Should I pack the direction vector to a matrix then convert to quaternion? Is there a better way?

UPDATE:
As I said the matrix solution works already, but there must be a shorter way, as i don't need all dimension only one (around Y):

glm::quat q = glm::conjugate(glm::toQuat(
    glm::lookAt(glm::vec3(from.getX(), from.getY(), from.getZ()),
                glm::vec3(from.getX(), from.getY(), from.getZ()) + direction,
                glm::vec3(0, 1, 0)
    )
));

sentences: What are the differences between XNA 3.1 and 4.0? I have been away from XNA for a couple months and want to get back into it.  I had a game I was currently working on, but it was done in XNA 3.1. What are the differences between the two, and is it worth updating?

sentences:
Changing the position of a Gravity Controller - Farseer I'm trying to create mini black holes for my XNA game using farseer physics.

Problem is I can not get the gravity source to stick to the Body I've attached it to, as it scrolls across the screen, the gravity source simply stays in the same position. This is the code I've used.

Body blackHoleBody;
blackHoleBody = BodyFactory.CreateBody(world);
CircleShape ballShape =
new CircleShape(ConvertUnits.ToSimUnits(imageItemList[i].texture.Width / 2f), 1f);
Fixture ballFixture = blackHoleBody.CreateFixture(ballShape);

blackHoleBody.BodyType = BodyType.Static;
blackHoleBody.Position = ConvertUnits.ToSimUnits(imageItemList[i].Position);
blackHoleBody.Restitution = 0.0f;

blackHoleBody.CollisionCategories = Category.All;
blackHoleBody.CollidesWith = Category.All;

//Create the gravity controller
GravityController gravity = new GravityController(10f);
gravity.DisabledOnGroup = 3;
gravity.EnabledOnGroup = 2;
gravity.DisabledOnCategories = Category.Cat2;
gravity.EnabledOnCategories = Category.Cat3;
gravity.GravityType = GravityType.Linear;

world.AddController(gravity);

gravity.AddBody(blackHoleBody);

ballBodyList.Add(blackHoleBody);

My guess is that I need to get in the GravityController inside world, and update it's position there, but when I look I can only find the world global gravity.

If anyone could point me in the right direction it would be much appreciated.

sentences:
Moving sprites using the accelerometer (Android) In my previous game, I was moving my sprite like so:

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

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

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

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

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

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

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

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

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

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

Edit

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

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

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

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

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

sentences:
How does XNA/MonoGame project 3d to 2d? I am trying to figure out how XNA is actually projecting a 3d world space coordinate to screen space.

I decompiled the MonoGame framework and copied the CreateLookAt und CreatePerspectiveFieldOfView methods of Matrix and multiplied thereafter  3 vectors like XNA does:

First multiply each position with world, then multiply resultig new vector4 with view and then the new resulting vector4 finally by projection.

      public static Vector2<T> Project(Vector3<T> source, Matrix4x4<T> world, Matrix4x4<T> view, Matrix4x4<T> projection, int width, int height)
    {
        Vector4<T> worldPosition = world * new Vector4<T>(source.X.ParseToNumeric<T>(), source.Y.ParseToNumeric<T>(), source.Z.ParseToNumeric<T>(), 1);
        Vector4<T> viewPosition = view * worldPosition;
        Vector4<T> position = projection * viewPosition;

        var X = position.X.ParseToNumeric<T>();
        var Y = position.Y.ParseToNumeric<T>();
        var Z = position.Z.ParseToNumeric<T>();

        return new Vector2<T>((X / Z) + width / 2, (Y / Z) + height / 2);

    }

Because (0,0,0) would be the center of the screen I added to the corresponding X and Y coordinates width and height divided by 2. Just because it made sense I divided finally the xy components by z.

The result is sobering:

I used following matrices:

      basicEffect.World = Matrix.Identity;
        basicEffect.View = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000.0f);

And these points:

            vertices[0] = new VertexPositionColor(new Vector3(0, 0, 2), Color.Red);
        vertices[1] = new VertexPositionColor(new Vector3(1, 0, 2), Color.Red);
        vertices[2] = new VertexPositionColor(new Vector3(0, 1, 2), Color.Red);

Do you know why this happens?

sentences:
How to solve the overlap of two circles that collide I have two circles, one of the circles is static the other is moving around. I have a method that checks whether the two circles collide. How to make the two circles don't overlap when colliding?

public void UpdateGame()
{
    //keyboard input and moving the circle here

    if(CollisionDetection(dynamicCircle,staticCircle)
    {
        ResolveOverlap(dynamicCircle,staticCircle);
    }
}

public class CircleBody
{
    public Vector2 position {get;set;} // top left corner
    public float CenterX;
    public float CenterY;
    public int Width { get; set; }
    public int Height { get; set; }
}

public bool CollisionDetection(CircleBody body1, CircleBody body2)
{
    float radius = body1.Radius + body2.Radius;
    float distanceBetweenTwoCircles = ((body1.CenterX - body2.CenterX) *
        (body1.CenterX - body2.CenterX)) +
        ((body1.CenterY - body2.CenterY) *
        (body1.CenterY - body2.CenterY));

    if(radius > Math.Sqrt(distanceBetweenTwoCircles))
    {
        return true;
    }
    return false;
}

public void ResolveOverlap(CircleBody body1, CircleBody body2)
{
    //answer to my question
}

If it wasnt clear by now here is my code for solving that with two rectangles I want the same thing to happen to the circles.

public void ResolveOverlap(RectangleBody body1, RectangleBody body2)
{
    double widthY = (0.5 * (body1.Width + body2.Width)) * (body1.CenterY - body2.CenterY);
    double heightX = (0.5 * (body1.Height + body2.Height)) * (body1.CenterX - body2.CenterX);

    if (widthY > heightX)
    {
        if (widthY > -heightX)
        {
            //collision - top
            body1.Position.Y = body2.Position.Y + body2.Height;
        }
        else
        {
            //collision - right
            body1.Position.X = body2.Position.X - body1.Width;
        }
    }
    else
    {
        if (widthY > -heightX)
        {
            //collision - left
            body1.Position.X = body2.Position.X + body2.Width;
        }
        else
        {
            // collision - bottom
            body1.Position.Y = body2.Position.Y - body2.Height;
        }
    }
}

sentences:
What are the parameters for a smooth wall jump I want to make a platformer like Celeste and trying to implement wall jump.
When the player is on the air and near a wall, and presses jump, the player gains x velocity opposite the wall direction, and some y velocity. So the player jumps against the wall, but it shouldn't climb the wall thru wall jumping.
Game runs 60 frames per second. resolution is 320x180. Tile size is 16.
Here's some constants for calculating velocity and gravity:
export const vMax = 4; // maximum velocity in pixels
export const tMax = 20; // time to reach maximum velocity in frames

export const hMax = 16 * 3; // maximum jump height
export const xSubH = 16 * 3; // x distance that is reached in one jump

export const xFriction = 5 / tMax;  // friction to apply to x velocity
export const hAccel = vMax * xFriction; // accelaration for x

export const v0Jump = (2 * hMax) * vMax / xSubH; // initial jump velocity
export const gJump = - (2 * hMax * vMax * vMax) /
      (xSubH * xSubH); // gravity applied to y velocity on jump

Here's how I do wall jump:
 // player object
 let p = {
   x: 0, // position
   y: 0,
   dx: 0, // velocity
   dy: 0,
   ax: 0, // acceleration
   ay: 0
 };

 // let inputX = -1 for left input 1 for right input

 // x movement
 let _hAccel = inputX * hAccel;
 p.dx += _hAccel;
 p.dx += - p.dx * xFriction;

 // let isGrounded = ...
 // let wallDir = ... // -1 for left wall 1 for right wall

 // fall
 if (!isGrounded) {
   p.ay = -gJump;
 }

 // jump
 p.ay = -gJump;
 p.dy = -v0Jump;

 // wall jump
 p.dy = -v0Jump;
 p.dx = - wallDir * hAccel;

 p.dy += p.ay;

 // position
 p.x += p.dy;
 p.y += p.dx;

What are the parameters of the wall jump I need to control and tweak so it looks smooth and doesn't allow player to climb up the wall. But player can climb two walls side by side jumping one off another vs.
As you can see I have parameters like vMax and tMax that I can tweak to control the jump and movement. I tried setting arbitrary fractions of current values to give more x velocity or y velocity for wall jumping, but I can't quite get a wall jump that feels good to climb against two walls.
If you look at the Celeste Pico 8 source code:
  if (E.abs(spd.X) > maxrun)
        spd.X = G.appr(spd.X, E.sign(spd.X) * maxrun, deccel);
    else
        spd.X = G.appr(spd.X, input * maxrun, accel);

When the x velocity is greater than maxrun, it is decelarated towards maxrun, otherwise it is decelarated towards input. So this basically disables input when given a big x velocity, thus disallowing to approach the wall thru input.

sentences:
When to Use Spatial Hashing vs Bounding Volume Hierarchy? I've been slowly working on implementing a spatial hashing function into Bullet Physics to see how well it will work in my game engine as a general use. Though as I'm starting to design it, I do notice a few select problems about it's design.

So in the middle of research, I see that Spatial Hash functions start to suffer when objects take up too many cells.

Example: 1D's optimal case is at max 2. 2D's optimal case is 4. And 3D's optimal case is at most 8.

I can use a hierarchal method and hash larger objects to other tables to solve this.

But my biggest concern is exactly what are the best use cases for each of them?

BVH seems like it can generate a larger number of checks, and needs to bounce around on pointers

And Spatial hashing seems like it chews through memory, but is pretty good at what it does.

sentences:
Investigation stage before starting a game I was thinking about how to organize the stage about getting informed about whatever game is needed to develop, what would others do.

For example, if I wanted to develop a game about car racing, I should figure out all the factors during the race, from the car factor to the pilots, etc., environmental factors like weather, circuit conditions, etc.

How does one manage this stage?

Thanks.

sentences:
Game loop architecture using WPF(MVVM) and C# Could i get some suggestions on how to implement a game loop whilst using WPF(MVVM) and C#, I am a professional developer and understand the technology well.

The game loop usually contains a Init(), Render() and Update().

I know how to implement the Init() and Update(), but i would like ideas of how the render() fits in, using data binding the Render will happen on update(). Should forget the Render method or suppress the bindings and force them with a render?

Hope that makes sense :)

sentences:
GLSL Shader not compiling (Android & LibGDX) and no log available I'm trying to get a "ripple"-shader working for OpenGL ES 2.0+ (using LibGDX).

However, I can't get it to compile, and for some reason ShaderProgram.getLog() returns an empty string even though the Shader didn't compile.

I am 100% confident that the vertex shader is correct.. here's the fragment shader (not written by me, but I modified it a bit long time ago.. when I had a desktop project - and it worked back then):

                #version 120
                precision mediump float;
                varying vec2 v_texCoords;
                uniform float time;
                uniform float alpha;
                uniform float waveLengthMultiplier;
                uniform sampler2D u_texture;
                void main()
                {
                    vec2 center = vec2(0.5, 0.5);
                    vec2 tc = v_texCoords.xy;
                    vec2 p = -1.0 + 2.0 * (tc - offset);
                    float len = length(p) * waveLengthMultiplier;
                    vec2 uv = tc + (p / len) * cos(len * 12.0 - time * 4.0) * 0.03;
                    vec3 col = texture2D(u_texture, uv).xyz;
                    gl_FragColor = vec4(col, alpha);
                }

I'm still not very well-versed with shaders, as I've used them only a little.. Like I said, getLog() returns an empty string, so I'm hoping someone spots an error in the code.

sentences:
Extending control remapping script to work with mouse buttons I have created a default key map for my game, however I have also included an option in the settings where the player can change the key bindings.

My issue is if the player clicks on the button for shooting, which is defaults to mouse0, or aim on mouse1, then click on another key, they can never go back to mouse0 or mouse1.

I am unsure of how to include all the mouse buttons/scroll wheel into the viable buttons the player can choose from.

Here is the part of my code that deals with the changing of the keys:

private void OnGUI()
{
    if(curKey != null)
    {
        Event e = Event.current;
        if (e.isKey)
        {
            keyBinds[curKey.name] = e.keyCode;
            curKey.transform.GetChild(0).GetComponent<Text>().text = e.keyCode.ToString();
            curKey.GetComponent<Image>().color = normal;
            curKey = null;
        }
    }
}

sentences:
how to sync clients and local avoidance in mobile RTS game? I have been making mobile RTS game in Unity look like Clash Royale similarly.

Unfortunately, I faced to two big problems.

First is two phones(clients) to be synchronized each other in game state.
And second is "path finding" or "local avoidance"(collision check).

To solve the path finding issue, I have searched about "Flow Field".

Should I do consider on 3 layer map(cost field, integration field, flow field) to apply "Flow field"?
If I do apply "flow field" to my game, can I have a liberty from the problem of Sync two clients?

Thank you in advance.

sentences:
Get internal and external IP addresses in Unity 2018.2.0? Unity 2018.2.0 makes the Network class obsolete.  I have used "Network.player.ipAddress" in my code to get the local LAN IP address.

    internalIP = Network.player.ipAddress;
    externalIP = new WebClient().DownloadString("http://icanhazip.com");

What code should replace this?  What would be best practice for getting internal and external IP addresses for manual LAN and internet direct connections between server and client?

Internal/external IP addresses are needed so players can load the game, then tell their friends what their IP is to direct connect.

sentences:
How can I use Drag handlers (IBeginDragHandler, IEndDragHandler, IDragHandler) with a 2D sprite renderer instead of a UI Image? In my game, I assigned all of the blocks to be 2D sprites so that they could be easily converted into prefabs:

However, when designing the drag and drop scripts, I noticed that all of the drag and drop handlers such as IBeginDragHandler, IEndDragHandler, IDragHandler, etc. weren't working at all. I later noticed that these were intended to be used by UI Images.
Now I am left wondering what I can do to make these 2D Sprites be usable by these functions for UI Images. Do I have any other options other than to start from scratch by making new UI Images?
Here's the small amount of code needed to create a reproducible example:
Public class DragDrop : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{
    [SerializeField]
    private Canvas canvas;
    private CanvasGroup canvasGroup;

    private RectTransform rectTransform;

    private void Awake()
    {
        rectTransform = GetComponent<RectTransform>();
        canvasGroup = GetComponent<CanvasGroup>();
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        canvasGroup.alpha = 0.6f;
        canvasGroup.blocksRaycasts = false;
    }

    public void OnDrag(PointerEventData eventData)
    {
        rectTransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        canvasGroup.alpha = 1f;
        canvasGroup.blocksRaycasts = true;
    }
}

sentences:
Category/genre name for games like: Ogame, Kings of Chaos, and Bitefight.? I'm searching for a category name for games like: Ogame, Kings of Chaos, and Bitefight.

When I learned about those, they were just called browser games, but today where we have the technology to create every genre of games in the browser, I miss a box to put these: 'only text, pictures and no fancy animation-games' into.

Do they actually have a name, leading to my Google-Fu being miserable?

sentences: 2D js physics engine for HTML4 Is there any engine for Javascript like box2dweb that does not use Canvas? I need to build a game that works in HTML4 browsers.

sentences:
How should I implement a Game Over menu in Android? By Game Over menu, I mean a menu displayed when you die, with an option to play again.

I have two approaches in mind:

Use OpenGL

Have some button textures ready. When the character dies, draw them. Listen for events on those textures.
Use a view

(This is what I'm doing now.) When the user opens the game, I have a basic activity, along with a basic view with a FrameLayout: The root is a GlSurfaceView and there's a menu on top of it (embedded in a LinearLayout). When the user hits "Play", this menu is translated away (using a translate animation) from the screen, leaving only the GlSurfaceView visible, with which the user can interact. I was thinking of implementing something similar when the game ends, but I'm not sure where to start.

I don't particularly like the first approach, since implementing button events in OpenGL seems hard.

How should I approach this?

sentences: AABB of a sphere's screen space projection What is a nice, neat way to get the AABB of a sphere's projection onto the screen? This is to determine simplified geometry for lights in deferred shading.

sentences:
Using Unity as a front-end GUI for a non-unity application? I'm working on a game right now that is 2D, and grid based, and for a variety of reasons have decided making it in Unity wouldn't be worth the hassle I'd have fighting the engine.

That said, I want to possibly add in VR support at some point, and Unity seems the easiest way to make that happen.
Right now, the game is structured so that part of the code takes in a grid from the game-core, and that grid tells it what sprite(s) to stick in each spot on said grid.

My thought was that it might be possible to replace the "take grid array, render sprite-grid" portion of my game with a Unity front-end. For example, perhaps this would be like a board game sitting on a table, and rather than a 2D grid, the "sprites" would be simple models on the grid-board, with the user looking down at it in VR.

Is this a thing that is possible? Essentially, all I would need is for my Unity program to take inputs, and send trigger signals to the game-core, then receive an updated grid-array and respond accordingly. I've not been able to find any information on this kind of thing, interfacing Unity with an external program in this way. The game is turn based, so 2-3 updates per second would be the absolute max I'd need, performance-wise, and the game core could run on a potato.

In specific: can Unity send triggers to and receive a data array from an external binary (written in c#), and how would I do this?

I really hope this is possible.

sentences:
Is the output from D3DCompile specific to one GPU, or not? In Direct3D 11 there is a two-stage shader compilation process; you first pass the HLSL source code into D3DCompile, which outputs a "blob" of bytecode.  You then take this blob and call CreatePixelShader or another of the CreateWhateverShader methods to finally get an object that can be bound to the D3D pipeline and used.

My question is: is the bytecode produced by the first stage machine-independent or is it specific to the GPU on which it was compiled?  I could not find a straight answer to this in the MSDN docs.  I heard somewhere that HLSL compiles to machine-independent bytecode which is then translated into GPU-specific machine code by the driver, but I have not been able to confirm this.

sentences:
Enconding/Decoding bit value in Texture Alpha Channel I am Rendering to a SurfaceFormat.Color. (R8G8B8A8)
The alpha of this format has 8 bits and I want to be able to use those 8 bits as a bit field.

For example, in one pass of my render, I want to save a bit value like 1 or 4  passing => 00000001 = 1 or 00000010 = 4 ....

The problem is that the output data of my pixel shader need to be in the range of [0 - 1].

How can I encode, for example, the value 00100001 = 33 in my surface.

I am doing this:

PixelShaderOutput PShader( PS_INPUT pin ) : COLOR0
{
    PixelShaderOutput output;
    ///bla bla bla
    output.color.a = 33 / 255;
    return output;
}

Is this the right way?

Will I be able to read it in the other side? I mean, in another shader, when I need to read this value, can I use float value = ReadTexture(...) * 255; where value will have 33? (or 00100001)

The GPU will make the right "convertion", cause 33 / 255 = 0,1294117647058824. Will it be encoded as 00100001 in the texture?

In this new shader I want to this value as a bitfield like:

bool xTextureRepeat = fmod(value , 64) >= 32;

sentences:
Creating pixel art / animation with flash I have a friend that was the one creating graphics for my games. He left the town for some months (work, sigh) and I have tried to get in contact with him but it is impossible right now. Last talk I had with him he explained me that the graphics (2D) he did for my games were all made with flash and also the animations.

I can see why my pal does everything in flash: we develope for several movile platforms with different resolutions and having everything in vector format is nice.

My question is: How is he doing pixel art with flash? I recall he told me he was doing everything with vectors and later exporting to bitmpap, but, is it possible to do this with flash? Can't see how to do the pixel art feeling with vectors. If anyone could help here I would be really greateful.

Thanks in advance.

sentences:
WaitforSeconds() not working as it should I searched for using WaitforSeconds and used as it was mentioned(using a return type of IEnumeration and using coroutines instead of update). but it did not work. Initially it showed Waitfor Seconds and IEnumerator were not "present in the current context". I had to r-install unity to get it fixed but this problem still remains. The following is my code. Am I using WaitforSeconds in correct way? Is it the 'if' code block that ruin my complete work(I mean have I used it in wrong place)?

using UnityEngine;
using System.Collections;

public class EnemyCreeator : MonoBehaviour {
public float xmin,xmax,zmin,zmax;
public GameObject enemy;
public float spawnWait,StartWait,waveWait;
public int turretCount;
public int enemyCount;
int i=0;
void Update() {
    StartCoroutine (TurretWaves());
}
IEnumerator TurretWaves() {

    while (true) {
        Vector3 pos=new Vector3(Random.Range (xmin,xmax),0.5f,Random.Range(zmin,zmax));
        yield return new WaitForSeconds(StartWait);
        while(i<turretCount) {
            //Debug.Log ("The vaue of game time in spawnwaiting is: "+Time.time);
            Instantiate (enemy, pos, Quaternion.identity);
            enemyCount++;
            i++;
            //Debug.Log ("value of i in loop is: "+i);
            //Debug.Log ("The vaue of game time is: "+Time.time);
            yield return new WaitForSeconds (spawnWait);
        }
        //Debug.Log("cHECKing Before WAVE WAIT(value of time )is: "+Time.time);
        yield return new WaitForSeconds(waveWait);
        if(i>=turretCount) {
            i=0;
        }
        //Debug.Log("cHECKing AFTER WAVE WAIT and value of time is: "+Time.time);
        //Debug.Log ("value of i outside the while loop is: "+i);
    }
}
}

The code needs to wait until the spawnWait before spawning each turret and wait till the wavewait before spawning the next wave. even though the Startwait works fine, I still am unable to find the problem with others...

(I had this question asked in StackOverflow but since i did not get any answer ,and i didnt know about this specific game-development website, so sorry for the repetition)

Thanks in advance.

sentences:
Per Instance Textures, and Vertex And Pixel Shaders? How do you implement per instance textures, vertex shaders, and pixel shaders?

Given:
1. Two different model templates in Vertex Buffer, Square & Triangle
2. Instance Buffer with [n] instances of type Square or Triangle.

How do I add a Texture, VertexShader or PixelShader ID to the buffer data so that HLSL or the InputAssembly can determine which Shader to use at draw time?

A. How do I "Set" multiple Pixel and Vertex Shaders into the DeviceContext, and how do I tell DirectX to "switch" the Vertex Shader that is loaded at render time?

B. How many Shaders of each type, (Vertex, Pixel, Hull, etc), can I associate with model templates in the default Vertex  Buffer?

C. Can I use some sort of Shader Selector in HLSL?

Related C++ Code

When I create an input layout, can I do this without specifying an actual Vertex Shader, or somehow specify more than one?

NS::ThrowIfFailed(
result = NS::DeviceManager::Device->CreateInputLayout(
NS::ModelRenderer::InitialElementDescription,
2,
vertexShaderFile->Data,
vertexShaderFile->Length,
& NS::ModelRenderer::StaticInputLayout
)
);

When I set the VertexShader and PixelShader, how do I associate them with a particular model in my VertexBuffer?  Is it possible to set more than one of each?

DeviceManager::DeviceContext->IASetInputLayout(ModelRenderer::StaticInputLayout.Get());

DeviceManager::DeviceContext->VSSetShader(ModelRenderer::StaticVertexShader.Get(), nullptr, 0);
DeviceManager::DeviceContext->PSSetShader(ModelRenderer::StaticPixelShader.Get(), nullptr, 0);

sentences:
Tile textures on 3D models. HLSL shader code maybe? I'm making a game in C# with XNA. I'm now applying textures to models. However if I change the scale of the model, the texture stretches with it. How can I make the texture tile over the model instead of stretching? I'm using UV mapping to load the texture onto the model. This only has to work for a cube so I'm not worried about UV mapping issues. I have just been using the basic effect class in XNA because I haven't needed anything more yet.

Is there a way to set the texture to draw in a tiled manor?

Can this be done in C#? Maybe by changing the GraphicsDevice.SamplerStates?

Can this maybe be done with a HLSL shader? I know very little about HLSL.

This is the first 3D game I'm making so everything is very new to me. Please keep that in mind when answering. Thanks in advance.

EDIT:

So I did some testing with the GraphicsDevice.SamplerStates
Here is my UV map:

Here is my texture:

Here are the results:

                GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;

                GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

                GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicWrap;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Point;
                samState.AddressU = TextureAddressMode.Wrap;
                samState.AddressV = TextureAddressMode.Wrap;
                samState.AddressW = TextureAddressMode.Wrap;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Point;
                samState.AddressU = TextureAddressMode.Mirror;
                samState.AddressV = TextureAddressMode.Mirror;
                samState.AddressW = TextureAddressMode.Mirror;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Linear;
                samState.AddressU = TextureAddressMode.Wrap;
                samState.AddressV = TextureAddressMode.Wrap;
                samState.AddressW = TextureAddressMode.Wrap;
                GraphicsDevice.SamplerStates[0] = samState;

                var samState = new SamplerState();
                samState.Filter = TextureFilter.Linear;
                samState.AddressU = TextureAddressMode.Mirror;
                samState.AddressV = TextureAddressMode.Mirror;
                samState.AddressW = TextureAddressMode.Mirror;
                GraphicsDevice.SamplerStates[0] = samState;

None of them seem to have tiled the image. So does that mean I need to use the HLSL shader as well?

EDIT:
This is what I'm trying to achieve:

OR

sentences:
Don't understand how paddle location is tracked; using XNA tutorial Wanting to learn how to make games, decided to use Monogame. Have pretty light programming knowledge, so I apologize beforehand for my ignorance to this surely obvious oversight.

Following a beginner's tutorial on XNA game development. It's a simple ball and paddle game that has a game class, paddle class, and ball class.

Now my problem lies in the code for the ball class.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    namespace BreakingOut
{
class Ball
{
    Vector2 motion;
    Vector2 position;
    float ballSpeed = 4;

    Texture2D texture;
    Rectangle screenBounds;

    public Ball(Texture2D texture, Rectangle screenBounds)
    {
        this.texture = texture;
        this.screenBounds = screenBounds;
    }

    public void Update()
    {
        position += motion * ballSpeed;
        CheckWallCollision();
    }

    private void CheckWallCollision()
    {
        if (position.X < 0)
        {
            position.X = 0;
            motion.X *= -1;
        }
        if (position.X + texture.Width > screenBounds.Width)
        {
            position.X = screenBounds.Width - texture.Width;
            motion.X *= -1;
        }
        if (position.Y < 0)
        {
            position.Y = 0;
            motion.Y *= -1;
        }
    }

    public void SetInStartPosition(Rectangle paddleLocation)
    {
        motion = new Vector2(1, -1);
        position.Y = paddleLocation.Y - texture.Height;
        position.X = paddleLocation.X + (paddleLocation.Width - texture.Width) / 2;
    }

    public bool OffBottom()
    {
        if (position.Y > screenBounds.Height)
            return true;
        return false;
    }

    public void PaddleCollision(Rectangle paddleLocation)
    {
        Rectangle ballLocation = new Rectangle(
            (int)position.X,
            (int)position.Y,
            texture.Width,
            texture.Height);

        if (paddleLocation.Intersects(ballLocation))
        {
            position.Y = paddleLocation.Y - texture.Height;
            motion.Y *= -1;
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(texture, position, Color.White);
    }
}
}

When I run the game, it functions properly. Player moves the paddle, and when the ball collides with the paddle, it bounces off.  I don't understand how the Ball class knows the paddle location though.  It's not like paddleLocation is a public variable in the paddle class.

sentences:
How to use OOP to handle different requirements I've been trying to make games for a while now, but even when making a very simple one, I've always run into a problem - Because different subclasses have different functionality, therefore needing different requirements, I can't properly use OOP concepts in my code.

For example, I have a Projectile class in my code, which serves as a superclass for a Bullet class and Missile class. All of my projectiles are stored in a List, and I would like to be able to loop through the List and update all projectiles. However, I would like the Missiles class to follow the player, which means I need to supply the player's position to update it.

I could also store a pointer to the player in the Missile class, but this quickly becomes messy, and since the game is very simple, I wouldn't want to use ECS's. What solutions are available for this?

sentences:
Keep rasterized pixel amount constant I have a scene that is rendered from the point of view of the light using an orthographic projection matrix.

For an arbitrarily shaped and oriented object that doesn't change its shape or size in any way, the amount of pixels that get rasterized change with its position. I guess it's better to explain this with an images:

The depth of the quads (their y coordinates) are constant. Their x and z coordinates are slightly different. However, since it's an orthographic projection matrix, their "world space" floating point sizes are the same as seen from the camera. Just in one case, one additional lines of pixels is rasterized (I drew the two white lines with mspaint to illustrate their size difference).

This is highly undesirable for my application. Is there a way to keep the amount of rasterized pixels consistent? How would I go about implementing it using OpenGL?

sentences:
How can I start a new row when instantiating UI elements in a grid? using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

    // Start is called before the first frame update
    void Start()
    {
        int counter = 0;

        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        //slots = GameObject.Find("Slots").transform;
        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        for (int i = 0; i < imagesToLoad.Length; i++)
        {
            var go = Instantiate(saveSlotPrefab);
            go.transform.SetParent(slots);

            Texture2D thisTexture = new Texture2D(100, 100); //NOW INSIDE THE FOR LOOP
            string fileName = imagesToLoad[i];
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
            GameObject ChildGameObject = go.transform.GetChild(1).gameObject;
            ChildGameObject.GetComponent<RawImage>().texture = thisTexture;
            var raw = go.GetComponent<RectTransform>();

            if (counter == 3)
            {
                raw.anchoredPosition = new Vector3(1 , 0.3f, 0);
                counter = 0;
            }
            else
            {
                raw.anchoredPosition = new Vector3(1 + counter * gap, 6, 0);
            }

            counter++;
        }
    }

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

    }
}

Now it's creating a line of 3 objects but then when it's filled with 3 objects in a line I want it to move one step down and start a new line of 3 and so on.
The problem is I can't make it automatic move one step down with the right gap on the Y and start a new line.
I'm doing the new line with this :
raw.anchoredPosition = new Vector3(1 , 0.3f, 0);

but the result is that the fourth object is too much down :

And it should be like this :

sentences: How do I stop rotation after colliding with a specific object? How do I stop rotation after colliding with a specific object? I want player to stop rotating when they collide with walls. I am using Unity, with C#.

sentences:
Quadtree terrain splitting - I don't get it Most of the papers i've read base their terrain in some form or another on a quadtree. See this at page 38:

http://www.slideshare.net/repii/terrain-rendering-in-frostbite-using-procedural-shader-splatting-presentation?from=ss_embed

Doesn't the first point contradict the bottom two? How can you have a fixed 33x33 vertex grid per leaf yet talk about adaptive division in a quad tree? The terminology is confusing and i'd appreciate any clarity on this!

Here are my assumptions:
Re-placing the patches everytime the quadtree changes would be a hit wouldn't it?

Quadtree starting at terrain bounds.

Iterate down to observer location.

Constrained version (no more than 1 level difference between neighbours)

Frustum cull.

Place terrain patch in each resulting leaf, where the scale differs but the resolution is always 33x33.

sentences:
How do you construct a node map for pathfinding in a non-tiled 2D environment? A* and Dijkstra's pathfinding algorithms work by navigating a node map. In a tile-based 2D environment, these nodes could easily be inferred to be the literal x,y positions of the map.

For example, the agent is at (0,0), an obstacle is at (0,1), and the agent wants to go to (0,2).

However, in a 2D environment where locations are represented using floating point variables float x, float y, agents and obstacles can exist between the traditional style nodes (0,0) and (0,1).

How do you create a node map from such an environment?

sentences:
How to deal with "level design creep?" Level Design Creep is what I've started to call what happens when you build a series of levels and notice that every level is a little bit better looking or designed than the last, or when working together with several people with different skill levels. Left alone, as the player goes through the game the level quality would go up and down according to the order the levels were built. It seems like we're spending more time on this than we should be.

Besides cutting out the really good and really bad levels, is there a way I can plan for or manage the production so that the detail doesn't "creep up," and we have to revisit the same work over and over?

sentences:
Random movement avoiding walls I have a top-down game you can scroll through placeable tiles I have some NPCs that do nothing at the moment I want them to freely move around without going through wall tiles etc.

For the freely moving I have code and it works fine but they walk through walls:

if(new Random().nextInt(4) == 0){
   x+=1;
}
if(new Random().nextInt(4) == 1){
   x-=1;
}
if(new Random().nextInt(4) == 2){
   y+=1;
}
if(new Random().nextInt(4) == 3){
   y-=1;
}

How can I make it so they don't walk through walls?

All the solid tiles are stored in an arraylist

public static ArrayList<block> s = new ArrayList<block>();

and then have the for loops for them and each block has its own rectangle around it.

sentences:
How do i draw sprite on fixture position? b2BodyDef bd;
    bd.position.Set(1700 / sfdd::SCALE, 150 / sfdd::SCALE);
    bd.type = b2_dynamicBody;
    b2PolygonShape squareShape;
    squareShape.SetAsBox(70 / sfdd::SCALE, 13 / sfdd::SCALE);
    m_body1 = m_world->CreateBody(&bd);
    m_body1->CreateFixture(&squareShape, 100);
    squareShape.SetAsBox(38 / sfdd::SCALE, 16 / sfdd::SCALE,b2Vec2(-54/sfdd::SCALE,-30/sfdd::SCALE),90*DEGTORAD);
    m_body1->CreateFixture(&squareShape, 20);

    squareShape.SetAsBox(30 / sfdd::SCALE, 10 / sfdd::SCALE, b2Vec2(60 / sfdd::SCALE, -20 / sfdd::SCALE), 90 * DEGTORAD);
    m_body1->CreateFixture(&squareShape, 100);

sentences:
How can I stop certain keys from being prioritized in a 2D platformer? I am currently working on a 2D platformer in Monogame. I have implemented WASD and arrow keys control, but because of the ordering of the if statements, the D key is always executed last if down, making the character flip the wrong direction.

if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A))
{
    if (Velocity.X > -MaxVelocity)
        Velocity.X -= Acceleration.X * time;
    spriteEffect = SpriteEffects.None;
}
else //Deceleration
{
    if (Velocity.X < 0)
        Velocity.X += Acceleration.X * time;
}

if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D))
{
    if (Velocity.X < MaxVelocity)
        Velocity.X += Acceleration.X * time;
    spriteEffect = SpriteEffects.FlipHorizontally;
}
else //Deceleration
{
    if (Velocity.X > 0)
        Velocity.X -= Acceleration.X * time;
}

Is there a way to prioritize the key that is pressed last, as well as only performing one every update cycle?

sentences:
Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).

This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.
How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts?

sentences:
What resources can I use to determine if the name of my game violates any copyrights or trademarks? I'm a indie/hobbyist game developer.  How do I check that I'm not infringing any copyrights or trademarks when I release my game?

I'm not making megabucks so it's not financially feasible to get professional legal help for each game.

I asked recently if I can reuse the name of an old arcade game (Crazy Balloon), but this got me thinking about future games where I might not even be aware of something similar that existed before.

So, are there any tools or resources that you can recommend to check myself (due diligence I think it's called).

sentences:
How do I get the width of a string as it would be displayed on screen? What is the best and easiest way to get the width of a String using Slick2D?

I'm working on the achievement interface menu in my game that displays some images. On each image I need to draw a string such as "Reach Level 5.". Only problem is that I don't know how to get the string width to properly center the string on the image.

sentences:
HLSL : Offset and length were out of bounds //Vertex Shader Constants
float4x4 World; float4x4 View; float4x4 Projection; float4x4 WorldViewIT;

//Color Texture
texture Texture;

//Normal Texture
texture NormalMap;

//Specular Texture
texture SpecularMap;

//Albedo Sampler
sampler AlbedoSampler = sampler_state
{
    texture = <Texture>;
    MINFILTER = LINEAR;
    MAGFILTER = LINEAR;
    MIPFILTER = LINEAR;
    ADDRESSU = WRAP;
    ADDRESSV = WRAP;
};

//NormalMap Sampler
sampler NormalSampler = sampler_state
{
texture = <NormalMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};

//SpecularMap Sampler
sampler SpecularSampler = sampler_state {
texture = <SpecularMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};

//Vertex Input Structure
struct VSI {
float4 Position : POSITION0;
float3 Normal : NORMAL0;
float2 UV : TEXCOORD0;
float3 Tangent : TANGENT0;
float3 BiTangent : BINORMAL0;
};

//Vertex Output Structure
struct VSO {
float4 Position : POSITION0;
float2 UV : TEXCOORD0;
float3 Depth : TEXCOORD1;
float3x3 TBN : TEXCOORD2;
};

//Vertex Shader
VSO VS(VSI input) {
//Initialize Output
VSO output;

//Transform Position
float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
//Pass Depth
output.Depth.x = output.Position.z;
output.Depth.y = output.Position.w;
output.Depth.z = viewPosition.z;

//Build TBN Matrix
output.TBN[0] = normalize(mul(input.Tangent, (float3x3)WorldViewIT));
output.TBN[1] = normalize(mul(input.BiTangent, (float3x3)WorldViewIT));
output.TBN[2] = normalize(mul(input.Normal, (float3x3)WorldViewIT));

//Pass UV
output.UV = input.UV;

//Return Output
return output;
}

//Pixel Output Structure
struct PSO {
float4 Albedo : COLOR0;
float4 Normals : COLOR1;
float4 Depth : COLOR2;
};

//Normal Encoding Function
half3 encode(half3 n) {
n = normalize(n);

n.xyz = 0.5f * (n.xyz + 1.0f);

return n;
}

//Normal Decoding Function
half3 decode(half4 enc) { return (2.0f * enc.xyz - 1.0f); }

 //Pixel Shader
PSO PS(VSO input) {  //Initialize Output
PSO output;

//Pass Albedo from Texture
output.Albedo = tex2D(AlbedoSampler, input.UV);
//Pass Extra - Can be whatever you want, in this case will be a Specular Value
output.Albedo.w = tex2D(SpecularSampler, input.UV).x;

//Read Normal From Texture
half3 normal = tex2D(NormalSampler, input.UV).xyz * 2.0f - 1.0f;

//Transform Normal to WorldViewSpace from TangentSpace
normal = normalize(mul(normal, input.TBN));

//Pass Encoded Normal
output.Normals.xyz = encode(normal);
//Pass this instead to disable normal mapping
//output.Normals.xyz = encode(normalize(input.TBN[2]));

 //Pass Extra - Can be whatever you want, in this case will be a Specular Value
output.Normals.w = tex2D(SpecularSampler, input.UV).y;

//Pass Depth(Screen Space, for lighting)
output.Depth = input.Depth.x / input.Depth.y;

//Pass Depth(View Space, for SSAO)
output.Depth.g = input.Depth.z;

//Return Output
return output;
}

//Technique
technique Default {
pass p0 {
    VertexShader = compile vs_3_0 VS();
    PixelShader = compile ps_3_0 PS();
}
}

This is my current shader… it is producing a "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection" argumente axeception… I don't understand what's wrong with it….

Any help is appreciated.

sentences:
Designing Collision Detection for 2D Rectangular Adventure/RPG TLDR: I'm looking for an efficient way to detect collisions between irregular/small objects that are not a full tile size (like small cans) and a free-moving character in a 2D game.

I'm planning to design a 2D RPG-style game in XNA. It will be similar to the style of Chrono Trigger (pictured below) -- I will explain what that means. The main issue I have is how to properly design the collision detection.

First, a description of two of the main points of my game design:

Sprites are rectangular. So a character is two parts: lower-half (which collides with solid tiles) and upper half (which is "above" the lower half).
Free movement. Even though I use tiles, you don't move from tile to tile; you can move in any direction in a small increment (such as 8px).

Another important aspect of my design is that I don't (can't?) do any pre-processing on images to detect collision spaces. It must be either generic (eg. a 4px range outside of each tile), or cheaply calculatable. (This is to make it easier to develop by cutting down on the time needed to make sprites.)

My initial design for this (which I prototyped) was to use the (bottom half of the) character to collide with anything on the "ground" level. This works well with things that are full-tile covering (like walls), but not small objects (like cans). Pixel-level collision detection solved this, but can lead to irregularities, problems with granularity (eg. checking 4 pixels to either side), and of course, performance.

What I really want in this case is for the character to be able to move close to small or irregular objects. Is pixel-level collision detection the right answer? What about encapsulating it in a small polygon approximation (say a rectangle, even) and colliding with that area?  I'm concerned that, even with spatial partitioning, the performance will be poor and the user perception of collision will be poor-quality.

How do other 2D games deal with this?

sentences:
What does distance divided by acceleration mean? I'm reading a book named "Programming Game AI by Example". Here's a method to help an autonomous character to slow down when it's getting closer and closer to its target:

Vector2D SteeringBehavior::Arrive(Vector2D TargetPos, Deceleration deceleration)
{
    Vector2D ToTarget = TargetPos - m_pVehicle->Pos();

    //calculate the distance to the target
    double dist = ToTarget.Length();

    if (dist > 0)
    {
        //because Deceleration is enumerated as an int, this value is required
        //to provide fine tweaking of the deceleration..
        const double DecelerationTweaker = 0.3;

        //calculate the speed required to reach the target given the desired
        //deceleration
        double speed =  dist / ((double)deceleration * DecelerationTweaker);

        //make sure the velocity does not exceed the max
        speed = min(speed, m_pVehicle->MaxSpeed());

        //from here proceed just like Seek except we don't need to normalize
        //the ToTarget vector because we have already gone to the trouble
        //of calculating its length: dist.
        Vector2D DesiredVelocity =  ToTarget * speed / dist;

        return (DesiredVelocity - m_pVehicle->Velocity());
    }

    return Vector2D(0,0);
}

For this line:

//calculate the speed required to reach the target given the desired
//deceleration
double speed =  dist / ((double)deceleration * DecelerationTweaker);

The Deceleration is an enum like this.

//Arrive makes use of these to determine how quickly a vehicle
//should decelerate to its target
  enum Deceleration{slow = 3, normal = 2, fast = 1};

I just don't understand how can it get a speed by dividing a distance by an acceleration (deceleration)? Did I misunderstand anything?

sentences:
Streamline Facebook and Google Play Game Services integration in Android Game This has been confusing me a lot .

I am creating a simple 2D platformer which I wish to make social. So I thought of letting users do the following:

Share their in game objective completion/ their high score etc with their friends.
Challenge their friends to have a better score / better multiplier etc from their's
View leaderboards of high score , most distance traveled etc both social and global.

So My First preference was Facebook , simply because people have better social connections there.

But then Google Play game services integration has another advantage, It makes you game available in their game services app and may be boost your game ranking in play store if you have game services integrated. But then I'' need to have leaderboards(same ones) for google plus as well. That 'll be too confusing for people.

I do not want people to sign in twice in my app. That'll simple cut down and disperse the number of people getting social with the game.

I personally want to use facebook alone but then google game services may be boosts my app in store.

Can someone tell me a solution to use them both frictionlessly and get the most out of them in my game

sentences:
Balancing Attack to Defense in a text based RPG I understand that there is no correct or incorrect way of doing this, and its all down to a matter of trial and error in terms of perfecting the system.

What I am after is some advice or even get thoughts on how others have tackled a situation like this.

Right now I have a very basic attack formula

$attackPower = $baseAttack * 4;
$percent = $attackPower / 100;
$percent1 = $percent * 10; // Gets 10% of the users attack power

Using the above code I then use rand to work out a users attack power, so it varies rather than a single number

$power = rand($attackPower - $percent1, $attackPower + $percent1)

So that's the users attack power calculated.

However if I used the same formula to calculate the opponents defense, and then calculated the Attack minus Defense equals the damage

$totalDamage = $power - $defense;

This may sometimes result in a negative value (especially if the opponent has a considerably higher defense stat to the users attack)

Above I have used

$attackPower = $baseAttack * 4;

For calculating the defense would this be efficient?

$defensePower = $baseDefense * 2; // Could have this set to rand? 1 - 3??

Is there anything that could be changed to balance the stats out a bit more?
Could there be a much simpler formula?

sentences:
Rotate quaternion around plane normal How can one rotate a quaternion so that the rotation is around a plane normal?
A graphic/diagram I made below gives more detail about what exactly I am implying.  Note that the tip of the quaternions in the diagram are that of the quaternions local, upwards direction, symbolizing roll (the quaternion's w component).

English describing the diagram:
The rotation is around plane normal (vector) N with amount θ.  The global axes are X, Y, and Z (Y is up).  The plane normal and quaternion are both in global space.  Notice how the beginning and end of the operation does not use any reference to the global axes, only the plane.
The angle between the start quaternion (q) and end quaternion (q') and the plane is equal (a = a').  If you were to draw lines from the tips of the quaternions to the plane, the angles of intersection would be equal.  In other words, the roll of the quaternions are preserved in relation to that of the plane.

EDIT 6/21/2020:  Thanks to Theraot, this is possible simply by doing this in your favorite engine with quaternions:
quaternion qPrime = quaternion.AxisAngle(normal, θ) * q;

As Theraot states in his answer, order of multiplication does matter, and some engines may do the opposite operation compared to other engines.  For Unity's Mathematics package, the above pseudo-code holds true.  The formula for AxisAngle can be found by a simple google search.  The following Gif shows it working while proving that all angle requirements I stated above are satisfied.

sentences:
How do I write a game server with single-threaded networking? I want to write a game server with one thread for clients message handling and use something like epoll to accept network messages. All I/O and database access will be processed in a thread pool and they are asynchronous and non-blocking.

Given such a scheme, how should I handle other events/messages (physics, game logic, etc)? Can I implement methods to handle these messages as a blocking interface in the main thread?

What simple, popular servers exist (using Cocos*d/Unity as client) that I could look at for an example of this?

sentences:
How can I implement a "20 Questions" algorithm? Ever since childhood, I've wondered how the 20Q electronic game worked. You think of an object, thing, or animal (e.g. potato or donkey). The device then asks you a series of questions such as:

Is it larger than a loaf of bread?
Is it found outdoors?
Is it used for recreation?

For each question, you can answer yes, no, maybe, or unknown. I always imagined it work with immense, nested conditionals (if-statements). However, I think that's an unlikely explanation because of its complexity for the programmer.

How would I implement such a system?

sentences: Angle between two points I have a character who walks to random points in my room in Unity. The problem is he always faces one direction, I want to write in C# a piece of code that will get the direction the character is currently facing and the position of the target, then works out the angle between them to turn the character that amount. I have tried the LookAt function but that makes the character walk in an arc shape towards the target which looks very unnatural as it constantly looks at the target.

sentences:
How to get scripted programs governing game entities run in parallel with a game loop? I recently discovered Crobot which is (briefly) a game where each player codes a virtual robot in a pseudo-C language. Each robot is then put in an arena where it fights against other robots.

A robots' source code has this shape :

/* Beginning file robot.r */
main()
{
    while (1)
    {
        /* Do whatever you want */
        ...
        move();
        ...
        fire();
    }
}
/* End file robot.r */

You can see that :

The code is totally independent from any library/include
Some predefined functions are available (move, fire, etc…)
The program has its own game loop, and consequently is not called every frame

My question is: How to achieve a similar result using scripted languages in collaboration with a C/C++ main program ?

I found a possible approach using Python, multi-threading and shared memory, although I am not sure yet that it is possible this way. TCP/IP seems a bit too complicated for this kind of application.

sentences:
body_entered signal won't emit when rigidbody collided to rigidbody I have multiple rigidbody object floating away in the space. When they hit each other, they push away each. I want to destroy object if they hit something, but connect body_entered signal won't invoked when they impact each other:

func _ready():
    connect("body_entered", self, "destroy")

func destroy(body):
    print("HIT!")
    queue_free()

How do I check Rigidbody hit something?

sentences:
How do I make a racing car turn more smoothly when traversing waypoints? In a racing game, I have set up waypoints for the player to follow.

I have added many waypoints to give an illusion of curved movement.

However, the player car turns instantaneously when passing each point, which is especially jarring because the camera is following their rotation.

How can I make the player's movement a more natural curve?

I'm using C# in Unity.

sentences:
What's the equivalent of wglShareLists for Mac OS? I'm trying to share lists between two contexts on Mac OS but despite my research I couldn't come up with an answer so far. I've found that NSOpenGLContext was able to initialize a context with a shared context but not to set it afterward.

What's the equivalent of wglShareLists on Mac OS?

sentences:
Maya 2015 Collada mesh transforms not applied I am trying to load a dae (Collada) model into my 3d engine. The problem is they export the vertices and transforms seperately. So in Maya 2015 it looks like this

In the game engine I have it simply read in vertices, normals, etc. It looks like this...

You can tell it loaded the model without any transformations. I would like it so it applies the transformations to the vertices before it exports them to the file. Does anyone know how to do this in Maya. It defaulted like that in maya on my old computer but not on my new one I just built. So now I can't make 3d geometry and load it in the engine.

NOTE: I am also using Assimp to load my models is there possibly a flag that would do this.

sentences:
Best API coverage for 2D game? If one were to code a game for most versions of Windows, which API should be used?

I know DirectDraw works from NT4 and up (although DirectDraw is emulated on NT4 with GDI). However, I am told DirectDraw is deprecated in newer versions of Windows?

I could revert to just GDI, but then it is hard to completely eliminate flicker, since there is no double buffering with flipping between buffers.

Should I go for Direct3D or DirectDraw? Or is there some way of completely eliminating flicker in GDI or some other Windows API I am not aware of?

If Direct3D is the answer, which version of it is supported on most platforms?

sentences:
Playing Sounds and removing instances once they have played -- Android I am playing sounds in my application I have the following code

sounds = new HashMap<String, MediaPlayer>();

Then when guys are created on screen they are given a sound.

sounds.put("sounds"+Integer.toString(ncount), MediaPlayer.create(this, R.raw.hit));

I want to remove the MediaPlayer from the hashmap like I do the enemies when they die

sounds.get("sounds"+Integer.toString(ncount)).setOnCompletionListener( new MediaPlayer.OnCompletionListener() {

    public void onCompletion(MediaPlayer mp) {

        sounds.remove("sounds"+Integer.toString(ncount));
    }

});

This errors out... how would I reference the sounds hashmap to remove the associated MediaPlayer when sound is complete?

Thanks!

sentences:
GLSL shader error on different computers I recently discovered a strange error with my fragment shader:

#version 330 core

in vec4 v_color;
in vec2 v_texCoords[10];

out vec4 frag_color;

uniform int actual_textures;
uniform sampler2D u_texture[10];

void main() {
    vec4 final_color = texture2D(u_texture[0], v_texCoords[0]);
    for(int i = 1; i < actual_textures; i++){
        vec4 tex = texture2D(u_texture[i], v_texCoords[i]);
        final_color = tex * tex.a + final_color * (1 - tex.a);
    }

    frag_color = v_color * final_color;
}

On my PC with a GTX 960 and OpenGL 4.5.1 there is no error at all. But on my laptop with an Intel HD 3000 and OpenGL 3.3, I get a compile error that the texture2D function is deprecated and that the sampler2D array size is too big because I only pass 3 textures at the moment and I want the array to be able to handle up to 10 textures. On any other computer I testedm the error didn't occur, but they all had nvidia or amd gpus. Why do I keep getting this error on my laptop?

sentences:
Unity 5.5 Android scaling The questions I've seen are outdated, explained, not to my liking, or just don't work.

Problem: I want to be able to create a game that can scale on all mobile devices with ease and with no pixelation.

Extra Info:

I'm very new to unity and tackling the the software with all my might I'm sorry for being a noob.
I already paired unity with my phone and set the build to android (Nexus 5).
Aspect ratio is 10:16, The game is going to be portrait.
I have no scripts or anything, Its legit a blank game with a camera that has a blue background.

I have some pictures, if you need anything else for my assistance don't hesitate I'm here to learn and take, GULP, Constructive Criticism.

PC

Android

sentences:
Tangent on generated sphere I have difficulties understanding the tangent/bitangent concept for normal mapping, or rather the calculations of them.

I draw a sphere which is generated with the code in the OpenGL redbook http://www.glprogramming.com/red/chapter05.html. I use cube mapping to texture the sphere.

Now, pretty much everything in the web links to http://www.terathon.com/code/tangent.html. But in that algorithm, they use the texture coords u and v, which I don't have like this because my texture mapping is 3D...

Any pointers to how I can compute the tangents and bitangents with this setup?

Also, aren't the tangents just vectors orthogonal to the normal of a point on the sphere? To me it seems there could be an easier way..

Edit:
As far as I understand I need those values to be able to "apply" the normal from the normal map to the point on the sphere. (I'm not sure what the correct mathematical terminologies are here). In other words, to deviate the normals of any point on the sphere based on the normal map. I calculated the normals as point_on_surface - center_of_sphere (which, in modelspace, when the center is (0,0,0), is just point_on_surface)

sentences: Detect up and down slopes to switch between character animation There's a player and a slope in my scene. I want the player to automatically switch to 'climbing down' animation when he's at the top of the slope and moving down and similarly switch to 'climbing up' when he's at the bottom and moving up. I'm using the default 'character controller'. I've managed to get the slope angle with 'Vector3.Angle(transform.forward, hit.normal)' and the 'climbing up' is working fine since the angle is > 95 and that's the condition I stated. But when 'climbing down' the angle is not uniform and ranges from 30 - 140 and the condition I've stated is < 70 which is not satisfied all the time and hence the animation switches from 'climbing down' to 'climbing up' and vice versa. How do I get the right slope angle to differentiate between up slope and down slope?

sentences:
How to achieve highly detailed textures on buildings/architecture? I have a bit of experience when it comes to 3D modeling, but something I never really wrapped my head around is environment modeling. You know, you walk down a road and you see lots of buildings, they all look good, with great texture details, and yet they don't go over the texture budget and the framerate is nice.

Now I'm working on a little prototype, and I wanted to test how to make assets for it.

This is supposed to be one floor of a fantasy tower. I did the modeling in Blender (with a rough UV), then I exported it into Quixel, I made a simple texture, 4K resolution because why not at this stage. The problem is, when I look at it ingame or in blender, it's quite awful. This is a single texture and a single material for the whole mesh.

I was expecting this result, because the wall is some 20 meters long, so the texel density is really low. But this is already a 4K texture, when I should be using a 512 or 1k texture really. I mean, when you look at modern games, stuff like this looks sharp enough, with lower res textures than what I'm using now.

So, basically, what is the right approach to something like this?

I was thinking about something like this:

Have the "core" with a low res tiling texture, and then details as separate meshes that I would build in the engine (UE4 in this case). But I'm kinda worried about performance. I mean one floor would be at least 15 meshes, so 15 draws calls, so for ten floors it would be 150 drawcalls or something, I could barely make a village this way.

I know some games do fully modular buldings, like Fallout 4, they have a bunch of "kits" made of 2x2m blocks that snap together and each block has its texture and it looks good. But I don't really need that level of granularity, and I want more individual looking buildings, that don't look really copy-pasted.

And even if I did go that way, if one building is like 100 pieces alone, that's some 100 draw calls, how does that even work ingame?

An example from RDR2, how would go about making something like this? It can't possibly be one single mesh with just one texture.

How can I achieve this kind of result?

sentences:
Instantiated object not tracking collision I have an issue, and I'm not sure why it's happening. I have a prefab that I've built in a colour-changing game. It has the following:

Four 2D objects that if they collide with the player (2D collider attached to all), they cause the player to die.
One 2D object that if the player strikes, it generates a duplicate of itself with the Instantiate function.

All 2D objects are created; The four objects that cause the player to die are being created as normal and continue to cause the player to die. However, the object that instantiates the prefab and increments the score can no longer be collided with. The player appears to pass behind it. I'm pasting my code below. I would really appreciate if anyone can offer advice on this:

void Update () {
    if (Input.GetButtonDown("Jump") || Input.GetMouseButtonDown(0))
    {
        thing.velocity = Vector2.up * bounciness;
    }
    scoreText.text = score.ToString();
}
private void OnTriggerEnter2D(Collider2D collision)
{

    if (collision.tag == "plusScore")
    {
        score++;
        Destroy(collision.gameObject);
        Instantiate(barrier, new Vector2(transform.position.x, transform.position.y + 7f), transform.rotation);
        return;
    }

    if(collision.tag != currentColour)
    {
        Debug.Log("You DIED!");
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        score = 0;
    }
}

sentences:
Rotation of a 3D ball on a plane This used to be on the physics stack exchange but I was told to put it here:

I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation is messed up. It seems way too fast, and the axis seems to be all wrong. Here's the code that runs every tick (20 times per second). (normal is the normal to the plane, acceleration is gravity vector projected onto the plane, in m/tick2, and velocity is the velocity in m/tick.)

vec3 rotationAxis = normalize(cross(normal, acceleration));
quat newRotation = rotate(oldRotation, length(velocity) / sphereRadius, rotationAxis); // rotate by v/r radians about the rotationAxis

I'm not sure why this doesn't work, since according to angular mechanics, v=rω and ∆θ=v∆t/r (and ∆t=1 since velocity is in meters/tick). Am I doing something wrong? Why is the rotation so much faster than it should be? And is my axis of rotation correct?

Rephrased in a more physics way, is this correct in 3D:

$$\hat{x} = \frac{\hat{N} \times \vec{a}}{|\hat{N} \times \vec{a}|}$$

$$\Delta \theta \textrm{ about } \hat{x} = \frac{v}{r} \Delta t$$

And if it is correct, then what’s wrong with my code?

sentences:
How can I dynamically load the correct sprite from a sprite sheet? I am making a simple card game in unity. The game is based on a standard 52-card pack, with identical backs for unique faces. In my particular game different cards are worth different values and have various special abilities. The game will have 52 cards on the table (on the draw position or in the face-down deck or in someone's hand) at all times, so this number won't change.

I thought that making a Card prefab and instantiating 52 of these manually would be a bad idea. Even doing it in code, I thought, would be a bit OTT, and that I should just instantiate visual cards when they are face-up to the player.

I have a sprite sheet of the 52 cards and the back, which is imported as a Sprite in multiple mode, sliced in to a grid containing all the cards needed to play the game.

The problem I now face is that, through my GameController script I want to generate a shuffled pack of cards, deal some to each player and then show those cards to a player. However, I am not sure of the best way, or even if it's possible, to do this dynamically with the sprite sheets as they are. For instance if I have the following:

private CardRank rank;
private CardSuite suite;
private GameObject visualCard; // the card in the scene

private void Start()
{
    this.rank = CardRank.Ace;
    this.suite = CardSuite.Spades;
}

This class would be instantiated by the game manager. I would have 52 of these in code.

Whenever I have to visually show a card in the scene, I would use a card prefab, which is essentially a game object with a SpriteRenderer on it. I would need to dynamically load the correct sprite for this object from the sprite sheet. Something like this:

SpriteRenderer spriteRenderer = this.visualCard.renderer as SpriteRenderer;
spriteRenderer.sprite = ...

The sliced sprites from the sprite sheet actually have names in the format AS (Ace of Spades), 7H (Seven of Hearts), etc - though this was a manual thing I did myself of course.

I have also tried various alternative solutions, including creating animations, having separate sprites not in a spritesheet and having an array of available sprites in an array with a specific index for each card, but none seem as elegant as trying to load the correct sprite at runtime, as I'm trying to.

So, how do I load a specific sprite from a spritesheet at runtime? I'm open to suggestions, even those that make me think differently about how to approach the problem.

sentences:
Help in understanding atmospheric scattering shading I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site:
Click to visit site
I don't understand this:

As with the lookup table proposed in Nishita et al. 1993, we can get the optical depth for the ray to the sun from any sample point in the atmosphere. All we need is the height of the sample point (x) and the angle from vertical to the sun (y), and we look up (x, y) in the table. This eliminates the need to calculate one of the out-scattering integrals. In addition, the optical depth for the ray to the camera can be figured out in the same way, right? Well, almost. It works the same way when the camera is in space, but not when the camera is in the atmosphere. That's because the sample rays used in the lookup table go from some point at height x all the way to the top of the atmosphere. They don't stop at some point in the middle of the atmosphere, as they would need to when the camera is inside the atmosphere.
Fortunately, the solution to this is very simple. First we do a lookup from sample point P to the camera to get the optical depth of the ray passing through the camera to the top of the atmosphere. Then we do a second lookup for the same ray, but starting at the camera instead of starting at P. This will give us the optical depth for the part of the ray that we don't want, and we can subtract it from the result of the first lookup. Examine the rays starting from the ground vertex (B 1) in Figure 16-3 for a graphical representation of this.

First Question - isn't optical depth dependent on how you see that is, on the viewing angle? If yes, the table just gives me the optical depth of the rays going from land to the top of the atmosphere in a straight line. How to find the optical depth in the case where the ray pierces the atmosphere and goes through it to the camera?
Second Question - What is the vertical angle it is talking about...like, is it the same as the angle with the z-axis as we use in polar coordinates? (I am having a very hard time understanding this angle)
Third Question - The article talks about scattering of the rays going to the sun..shouldn't it be the other way around? like coming from the sun to a point?
Any explanation on the article or on my questions will help a lot.
Thanks in advance!

sentences:
Questions on the legal protection of games and their parts (assets, sounds, title) we started new pirate game, and I just want to ask some questions about rights. So I am new in game dev, I guess there are a lot of answers, but I guess professionals can advise something for first steps.

So we started some things like:

concept arts
sounds
we are working on the name of the game (just use temp one for now)
we develop some models of ships and characters

I have question what's my step to protect everything I listed above. Do I need to protect everything separately? Do I need to register a game somewhere? Can I use my already made domain and subdomain for the game? Or do I need to register unique one domaine.

sentences:
How can I transform a world space point to a camera's screen coordinate? I'm trying to transform a point in fragment shader from world space to screen coordinate of a second camera. Not the main one.

I think I know how to achieve that to the main camera, but I'm struggling to find an easy way to transform a point in world space to screen coordinate of camera2.

sentences:
Accessing managers from game entities/components I'm designing an entity-component engine in C# right now, and all components need to have access to the global event manager, which sends off inter-entity events (every entity also has a local event manager).

I'd like to be able to simply call functions like this:

GlobalEventManager.Publish("Foo", new EventData());
GlobalEventManager.Subscribe("Bar", OnBarEvent);

without having to do this:

class HealthComponent
{
    private EventManager globalEventManager;

    public HealthComponent(EventManager gEM)
    {
        globalEventManager = gEM;
    }
}

// later on...
EventManager globalEventManager = new EventManager();
Entity playerEntity = new Entity();
playerEntity.AddComponent(new HealthComponent(globalEventManager));

How can I accomplish this?

sentences:
How to achieve dotted trail behind moving object with use of Trail Renderer? How can I achieve effect shown on picture below with use of Trail Renderer in 2D game? Is it even possible? I need dotted (dashed) trail behind my object and i can't figure it out.

don't know why stack can't load my images LINK HERE

Why trail renderer? Because I feel this is the right way to do this. Earlier, (Unity ver 5.3) I achieved this using: Mesh Particle Emitter + Particle Animator (Fade) + Particle Renderer, but sometimes it behaves strangely in multiplayer. Particles not always came out from object, sometimes they were offset. Anyway, Unity in ver. 5.5 released new component (TrailRenderer), which I would like to use (if it is possible to accomplish effect I need).

I am looking for efficient ways, so answers like "you can instantiate"dot" every X sec. at position of your moving object" ... Please no.

What I have tried.

I added to my gameobject a child (gameobject) with Trail Renderer. Then I put material into Materials array field.

Material shader currently is set to Mobile/Particles/Additive (I am targeting Mobile devices). Material Texture is:

don't know why stack can't load my images LINK HERE

I've tried different settings to accomplish my needs but with no success.

Trail Renderer -> Texture Mode -> Tile (my gameobject is followed by one dot and line)

Texture Import- > Wrap mode -> Repeat (my gameobject pulls dots without gaps behind instead leaving dots in place it was)

Also i tried different shaders, different Trail Renderer parameters with no success. Most of time, my gameobject is followed by stretched dot, line or dots without gaps which are pulled instead of left in place where object was.

sentences: Procedural dungeon generation. No corridors, color key doors I am curious how dungeons like the one in Runescape dungeoneering skill are generated. They basicaly have a 10x10 grid. So theres 100 rooms total. There's starting room and exit room. And each one are conected by open doors or doors that require key of some color. Anyone have idea how to generate something like this? I mean how to place doors and keys to make dungeon doable?

sentences:
Game Background graphics blurred edges? Why when using this code for the background for my game do I receive blocks with blurred edges?

public final class State_Play extends State_Template {
    private BufferedImage background;
    private int[] pixelelements;
    private int width,height;

    State_Play(){
        init();
    }

    public void init(){
        width=8; //Configuration.appwidth,
        height=6; //Configuration.appheight
        background=new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        pixelelements=((DataBufferInt) background.getRaster().getDataBuffer()).getData();
        maketuringarray();
    }

    public void maketuringarray(){
       int singlecolor=new Random().nextInt();
       pixelelements[new Random().nextInt(width*height)]=singlecolor | 0xFF000000;
    }

    @Override
    public void update() {
       maketuringarray();
    }

    @Override
    public void render(Graphics g) {
        g.drawImage(background, 0, 0, Configuration.appwidth, Configuration.appheight, null);
    }

Like this

sentences:
How to iterate through the frames of an AnimationClip in editor mode I'm working on a 2D game, using spritesheets as the basis for four AnimationClips. (Every frame from the spritesheet is a keyframe in the animation.) I'm trying to step through the frames of these AnimationClips and programmatically create Collider2Ds which fit the dimensions of each frame.

The problem is, I'm having an impossible time actually iterating through the frames. My character has an Animator component, with 4 different states. I've tried various inputs to my editor script, but the closest I've gotten has an AnimationClip as input:

private AnimationClip clip; // set in inspector
private GameObject targetForColliders; // set in inspector

void createColliders() {
    Animation animation = new Animation();
    AnimationUtility.SetAnimationClips(animation, new AnimationClip[] { clip });

    foreach (AnimationState state in animation) {
        // do useful things here
    }
}

Unfortunately, somehow the animation local variable is null, crazy as that sounds. I've confirmed that by both logging it and attempting to use it, which causes a NullReferenceException every time.

I can't access the Sprite containing the spritesheet directly, because I've made manual adjustments within Unity to the keyframes (removing some, duplicating others) and I don't want to have to manually sync my colliders with the modified assets.

Has anyone attempted to do something similar to this before? tl;dr: What's the easiest way to iterate through the frames of a 2D animation in an editor script?

sentences:
How do you decide upon the price for a game? I hope this is the right board for the question.

I have this idea for a game, programming Skills with C++ and a licensed Engine. I already made a prototype of the game as proof of concept and a few friends liked it so far.

I don't want to spoil it all, but it is a 2D Robotron Style Precision Shooter in an arena which is set in space.

All you do is beating waves of enemies and when you leveled up, you select a perk to enhance your ship. Examples are making weapons stronger, faster, making the ship more agile, different Weapons as Smartbombs, Mines etc.

Having different maps with this kind of game is quite difficult, since space does not have obstacles. All you can do is make different backgrounds and maybe asteroids etc. Another type of content could be to allow the user to gather some virtual money to unlock goodies that are available at wave 1.

So far for my idea. Now, would this alone already justify asking 5$ for a game? When I compare it for example to puppygames game "Titan Attacks", I say yes, since they do not have more features. On their website the game is 7$, on Steam 4$. Their Ultratron is also 7$, which is also a classic robotron style game. But it does not yield any special features imho ( it is fun nontheless :D ), but has a very adorable artstyle.

Nation Red, which is also an inspiring source for me (Robtron Style 3D Zombie Shooter, awesome game btw), costs 10$ on Steam but also has coop, local and online.

So, how do you estimate the price of your game that you just made so people don't feel ripped off and you still make profit after getting back the investment of licenses?

sentences:
Basic Character Controller Not Working Properly in Unity I've been trying to setup a simple mouse camera which I had all the code working fine, except when I move with wasd and move my mouse to turn the camera simultaneously the input freezes up and gets stuck repeatedly inputting whatever the last input was. I've tested the simplest way to replicate the issue and it doesn't even need a camera for the issue to come up. If anyone would like to test and try to replicate the issue these are the steps its super fast and simple.

create new project(basic PC 3D project)

create a plane, and a cube

Add a basic character controller script to the cube (this time I used the official Unity code to be sure it's not an issue with code)

and that's it, that's actually all that was needed to create the issue for me. And to explain to anyone who may want to test it the issue is as follows: when you use wasd keys normally, everything works fine and the controls are responsive. However if you hold down one of the wasd keys while also moving your mouse (just wiggling the mouse should suffice) suddenly things will lock up and the cube will keep moving for a bit even after you let go of the respective wasd keys. In general if you hold a direction while simultaneously wiggling the mouse for a longer period of time, it will extend the amount of time the cube keeps moving after you let go of the direction. And this was done on Unity version 2020.1.16f1
If anyone has any idea what the issue may be its really appreciated.

sentences:
How to properly interact with game objects in Unity3D? I am trying to make a game where player will be placed in the scene and the goal is to explore it. He can interact with game objects that player can find in the environment, like picking object, examining, dropping and putting back. Basically it is something like first person exploration...

So the problem is how to properly implement code regarding interaction. One way I see and saw it on the internet is Raycasting. So the idea would be to in Update() method place Raycast fire code and see what it hits. Also all game objects with which player can interact are placed on separate Layer and also limit length of Raycast (which is obvious thing to do as player cannot interact with objects that are like 10 meters from him)...

So as I understand, game objects should have at least some kind of collider (I know box and sphere colliders are simple, but sometimes I will need to use more complex one)...

That being said, I wonder is this right approach:

Separate layer for interactable objects
Raycast that checks objects in that layer
Raycast length limited to like 1 meter

This approach should not be that much CPU consuming or is there any other way?

I am also thinking to putting some invisible box area (trigger) where raycasting would make sense, but I am not sure will this be overhead or not....

So, at the end what would be the right approach to this?

sentences:
Animation Blending Basics Say I have a framework with characters that can run and walk and of course, stand still.

Am I right in thinking that animation blending is the process of smoothly transitioning between these by generating dynamic animations at runtime?

If so, what is the basic theory of how this works, and how would I implement it?

sentences:
Anybody remember this webpage? I remember visiting a webpage some time ago (1 year ago maybe)

It contained many java applets, describing how certain mathematical functions like sin, cos, arcsin, exp would make an object move, with an example of  animated ball next to it, with its curve and the function name.

It was quite exhaustive, and was quite handy to simulate physical behaviors, like bouncing ball, smoothing cameras...

I can't find it on google, Anybody remembering this page ?

sentences:
Problem finding correct value for Yaw I use an Arduino and a 9dof sensor ( gyroscope, accelerometer and magnetometer ) and i'm trying to use the pitch, roll and yaw that the sensor gives me to rotate an object in unity.

I managed to correctly compute pitch and roll ( the z and x axis in unity ) from the accelerometer but it seems that I can't get the Yaw right. By that I mean that when I rotate my sensor pitch or roll it rotates my Yaw too in a weird way.

Code in the arduino to get the heading

void getHeading(void)
{
  heading=180*atan2(Mxyz[0],Mxyz[1])/PI;
  if(heading <0) heading +=360;
}

void getTiltHeading(void)
{
  //float pitch = asin(-Axyz[0]);
  //float roll = asin(Axyz[1]/cos(pitch));
  float pitch = atan( Axyz[0] / sqrt( Axyz[1] * Axyz[1] + Axyz[2] * Axyz[2] ) );
  float roll = atan( Axyz[1] / sqrt(Axyz[0] * Axyz[0] + Axyz[2] * Axyz[2]));

  float xh = Mxyz[0] * cos(pitch) + Mxyz[2] * sin(pitch);
  float yh = Mxyz[0] * sin(roll) * sin(pitch) + Mxyz[1] * cos(roll) - Mxyz[2] * sin(roll) * cos(pitch);
  float zh = -Mxyz[0] * cos(roll) * sin(pitch) + Mxyz[1] * sin(roll) + Mxyz[2] * cos(roll) * cos(pitch);
  tiltheading = 180 * atan2(yh, xh)/PI;
  if(yh<0)    tiltheading +=360;
}

Pitch and roll

    float _Pitch  = (float)(180 / Math.PI * Math.Atan( m_ResultX / Math.Sqrt( m_ResultY * m_ResultY + m_ResultZ * m_ResultZ ) ) );
    float _Roll = (float)(180 / Math.PI * Math.Atan(m_ResultY / Math.Sqrt(m_ResultX * m_ResultX + m_ResultZ * m_ResultZ)));
    float _Yaw = (float)(m_TiltHeadingResult);

Don't hesitate to ask for details.

sentences:
Will any program written with XLib work on any desktop environment (Gnome, KDE, etc.)? I'm making an application that uses Win32 API on Windows but I want to support linux distros too.

Some people say linux doesn't have a native GUI API like Win32 API of Windows.

But I found XLib and it seems like it is somethink similiar to Win32 API. If I use XLib on my project, can I compile and run it on any linux distro that uses any desktop environment without using external libraries?

I don't want to use something like GTK+ or SDL because I'm learning Win32 (just for fun) and using a platform independent library along with Win32 API sounds really absurd.

sentences:
Water effect using DuDv Map weird look I'm trying to apply a DuDv Map effect (distortions) on my water.

My texture is 512x512 in size.

I'm using the following code:

(Vertex Shader)

out vec2 texCoord0;

void main()...
{

texCoord0 = vec2(position.x / 2.0 + 0.5, position.y / 2.0 + 0.5) * 6.0;
}

(Fragment Shader)

in vec2 texCoord0;

void main()
{
    ...

        vec3 ndc = (clipSpace.xyz / clipSpace.w)/ 2.0 + 0.5;

    vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
    vec2 refractTexCoords = vec2(ndc.x, ndc.y);

    vec2 distorsion1 = (texture(dudvMap, vec2(texCoord0.x, texCoord0.y)).rg * 2.0 - 1.0) * waveStrength; // waveStrength = 0.02;

    refractTexCoords += distorsion1;

    reflectTexCoords += distorsion1;

    vec4 reflectColor = texture(reflectionTexture, reflectTexCoords);
    vec4 refractionColor = texture(refractionTexture, refractTexCoords);

      outColor = mix(reflectColor, refractionColor, 0.5);
}

As you can see when I add my distortion to my reflection and refraction texture coordinates, it seems that something is wrong and can't figure what, because I get this effect:

Do any of you have any idea how can I fix this? Thanks for your time!

sentences:
Game state management (Game, Menu, Titlescreen, etc) Basically, in every single game I've made so far, I always have a variable like "current_state", which can be "game", "titlescreen", "gameoverscreen", etc.

And then on my Update function I have a huge:

if current_state == "game"
  game stuf
  ...
else if current_state == "titlescreen"
  ...

However, I don't feel like this is a professional/clean way of handling states. Any ideas on how to do this in a better way? Or is this the standard way?

sentences: Which game portals support Silverlight games? I have been looking for strong game portals that support Silverlight.  Which ones are currently available?

sentences:
Pathfinding and collision avoidance on mobile Currently I'm developing a Diablo like game for mobile platform(iphone5+).

A simple A* search will find the path, but collision avoidance still needs to be taken into consideration.

There will be about 50 monsters active at the same time, so performance is very important.

I found some methods that might work.

NavMesh + RVO

The recast/detour library works well on the pathfinding part, but its crowd simulation quickly reach the limit(more than 5ms for 30 agents).

Another library RVO2 seems fine(less than 2ms for 50 agents), but the library has some license issues.
Flow Fields + Physics Engine

Many RTS games use this method, but it seems that a physics engine is required to resolve  collisions. If many agents don't share a common goal, this method might cost more than traditional A* pathfinding.
Steering Behaviors + Physics Engine

Steering Behaviors includes many concepts, I think simple avoidance behavior might work(just turn left/right if there is something in front) , but the method still requires a physics engine to work together.

I'm still not sure which one to use, maybe there exists other pathfinding and collision avoidance methods.

P.S. Halo:Spartan Strike uses Havok AI(based on RVO?), but I didn't see many enemies in that game,
so I wonder whether the first method(NavMesh + RVO) will works well on mobile platform.

sentences:
How does one integrate Game Center leaderboards in Monogame? Do anyone know how to integrate a Game Center leaderboards for an iOS game using MonoGame framework?

I have searched high and low yet I haven't gotten any luck of finding articles or tutorials that talks about the topic of Game Centre leaderboard integration. A direct link to where I can learn how to do the implementation will be very much appreciated. Thank you!

sentences:
Capturing a programs performance I'm trying to capture the performance of the GPU, CPU, FPS and memory usage on a program I'm currently working with and want to avoid having to write my own performance capture stuff. Does anyone know of a good program/programs that can do 1 or more of the above?

Ideally something that is simple to use. I've googled a few, but getting them to work has been a right pain. The couple that I've tried out have given me my entire systems performance, as opposed to just my running program.

Any help would be appreciated. I'm currently using DirectX 9 and C++ for my program.

sentences:
Picture rendered from above and below using an Orthographic camera do not match I'm using an orthographic camera to render slices of a model (in order to voxelize it). I render each slice both from above and below in order to determine what is inside each slice.

The model I render is a simple 'T' shape constructed from two cubes. The cubes have the same dimensions and have the same Y (height) coordinate. Here's a render of it in Blender:

I render this model once directly from above and once directly from below. My expectation was that I would get exactly the same image (except for mirroring over the y-axis). However when I render using a very low resolution render target (25x25) the position (in pixels) of the 'T' is different when rendered from above as opposed to rendered from below. See figure 2 and 3. The pink blocks are not part of the original rendering but I've added them so you can easily count/see the differences.

Rendered from above

Rendered from below

This is probably due to what I've read about pixel and texel coordinates which might be biased to the top-left as seen from the camera. Since I'm using the same 'up' vector for both of my camera's my bias only shows on the x-axis. I've tried to change the position of the camera and it's look-at by, what I thought, should be half a pixel. I've tried both shifting a single camera and shifting both cameras and while I see some effect I am not able to get a pixel-by-pixel perfect copy from both camera's.

Here I initialize the camera and compute, what I believe to be, half pixel. boundsDimX and boundsDimZ is a slightly enlarged bounding box around the model which I also use as the width and height of the view volume of the orthographic camera.

Matrix projection = Matrix.CreateOrthographic(boundsDimX, boundsDimZ, 0.5f, sliceHeight + 0.5f);
Vector3 halfPixel = new Vector3(boundsDimX / (float)renderTarget.Width, 0,
    boundsDimY / (float)renderTarget.Height) * 0.5f;

This is the code where I set the camera position and camera look ats

  // Position camera
                if (downwards)
                {
                    float cameraHeight = bounds.Max.Y + 0.501f - (sliceHeight * i);
                    Vector3 cameraPosition = new Vector3
                    (
                        boundsCentre.X, // possibly adjust by half a pixel?
                        cameraHeight,
                        boundsCentre.Z
                    );
                    camera.Position = cameraPosition;
                    camera.LookAt = new Vector3(cameraPosition.X, cameraHeight - 1.0f, cameraPosition.Z);

                }
                else
                {
                    float cameraHeight = bounds.Max.Y - 0.501f - (sliceHeight * i);
                    Vector3 cameraPosition = new Vector3
                    (
                        boundsCentre.X,
                        cameraHeight,
                        boundsCentre.Z
                    );
                    camera.Position = cameraPosition;
                    camera.LookAt = new Vector3(cameraPosition.X, cameraHeight + 1.0f, cameraPosition.Z);
                }

Main Question
Now you've seen all the problems and code you can guess it. My main question is. How do I align both camera's so that they each render exactly the same image (mirrored along the Y axis)?

sentences: How can I set up a loading screen in Panda3D? How would I go about using Double Buffering (to create a loading screen) in Panda3D using C++? I've searched Google and found some forums that talk about the concept of swapping buffers, but I haven't seen any that show any type of source code (specifically Panda3D/C++). I'd like to try and stay away from using pure OpenGL code and work it through Panda3D, but if I have no other choice, then I'll have to go with OpenGL coding.

sentences: OpenGL - using gluSphere I have an OpenGL code that currently draws several spheres at different locations. I generate the vertex buffer data (and normal data) myself. However, to simplify the code and increase efficiency, I am now trying to use gluSphere instead. The problem is that if I want to draw several spheres at different locations, I think I will need several different model matrices, and thus several different MVP matrices (because I am using OpenGL 4.3 and there is no glTranslate). But if I want to rotate the whole scene, I will need to rotate all of these model matrices, instead of just one as before. Is there a workaround for this? Is there a simple way to draw several different things with gluQuadrics objects at different locations?

sentences:
What is a good approach for making a relationship between the HUD and Environment? What is an elegant / common way to build a relationship between the game scene / environment / world and the HUD that usually sits on top of it? I have thought about this for a while, and though there are ways to accomplish this that are easy to implement, they always seem to expose too much unrelated information between the two, or end up being too coupled. An example of this that I have used in the past would be to simply pass reference from the HUD to the Environment and vice-versa (which is obviously not a good apporach for many reasons, especially when aiming for low coupling).

What I want to end up with is a clean, uncoupled way to do things like:

From the HUD; reference and manipulate objects within the environment, change the state of the Environment itself.
From the environment; update the HUD to reflect the current state of the environment.

Maybe passing reference between the two is the way to go about this, but I feel like there's some pattern that I am missing for this type of task. Any insights into past experience and implementations concerning this type of problem would be very helpful.

sentences:
Control frustum near and far clip plane sizes in a Projection Matrix I'm trying to achieve a dolly zoom effect.
My first try was the obvious one, the original "zoom in & dolly out" technique, which works nicely.
Except that there are cases which this is not possible due spatial conditions (E.g.: camera close to a wall)

If you pull back the camera too much you may occlude the view with some other objects (the red area).

To solve this I figured that I can't move the camera.
Instead, I have to change the frustum, making a larger near plane and a smaller far plane.

This way, it's possible to control de effect without moving the camera.

I know how to build the perspective and orthogonal projection matrices, and I was able to interpolate between them (interpolating each element separately).
This got me really near to solve the puzzle.

The only problem now is to set a distance from the camera to keep my frustum height, effectively locking the focus in an object/position.
But I can't figure this one out.

So, any ideas?

Aditional info

This is the matrices that I'm using:

4x4 matrix for orthogonal projection

   0         1         2          3
  -----------------------------------------------
0 | 2/(r-l) |         |          | -(r+l)/(r-l) |
  -----------------------------------------------
1 |         | 2/(t-b) |          | -(t+b)/(t-b) |
  -----------------------------------------------
2 |         |         | -2/(f-n) | -(f+n)/(f-n) |
  -----------------------------------------------
3 |         |         |          | 1            |
  -----------------------------------------------

4x4 matrix for perspective projection

   0           1         2              3
  -----------------------------------------------------
0 | 2n/(r-l) |          | (r+l)/(r-l)  |              |
  -----------------------------------------------------
1 |          | 2n/(t-b) | (t+b)/(t-b)  |              |
  -----------------------------------------------------
2 |          |          | -(f+n)/(f-n) | -2*f*n/(f-n) |
  -----------------------------------------------------
3 |          |          | -1           |              |
  -----------------------------------------------------

To interpolate them, I use something like this (pseudo-code):

interpolate (from, to, percentage)
{
    matrix = []
    i = 0
    while (i < 16)
    {
        matrix[i] = from[i] + (to[i] - from[i]) * percentage
        i++
    }
    return matrix;
}

projection = interpolate(perspective, orthogonal, 0.75)

sentences:
Space & Sound? Defying Physics? Why are there sound effects in space shooter games like asteroid and such?

There is no medium in space for sound to travel by. Yet we get hear gun shots & explosion.

I am not talking about the background music/sound.

sentences:
Getting choppy, jumpy animation Hey I'm trying to get a smooth animation for my player movement. Earlier I changed my frames to render at fixed time(1/60 sec). Well that makes my player now run at a constant speed but the animation now appear to be choppy and it seems like the player jumps from one point to another instead of smoothly transitioning between them.
Below is my code and an gif animation of player movement. How do I make the animation appear smooth?

float deltaTime = 0;
float oldTime = 0;

//The direction in which the player will move
int playerX = 0;
int playerY = 0;

//callback method for keyboard events
void keyboard_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
    if (key == GLFW_KEY_W && action == GLFW_REPEAT) {
        playerX = 0; playerY = 1;
    }
    if (key == GLFW_KEY_S && action == GLFW_REPEAT) {
        playerX = 0; playerY = -1;
    }
    if (key == GLFW_KEY_D && action == GLFW_REPEAT) {
        playerX = 1; playerY = 0;
    }
    if (key == GLFW_KEY_A && action == GLFW_REPEAT)
    {
        playerX = -1; playerY = 0;
    }
}

//update player's position
void update() {
    player->move(playerX, playerY, TIME_PER_FRAME);
}

//set up glfw keyboard callback function and other stuff
void init() {
    glClearColor(0, 0, 0, 0);
    player->bindVertexAttributes(shader.getAttributeLocation("position"));
    glfwSetKeyCallback(window->getGLFWWindow(), keyboard_callback);
}

//wait logic
float expected_frame_end = glfwGetTime() + TIME_PER_FRAME;
void wait() {
    while (glfwGetTime() < expected_frame_end) {

    }
    expected_frame_end += TIME_PER_FRAME;
    playerX = playerY = 0;
}

//rendering function
void render() {
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    player->setUniformMatrixLocation(shader.getUniformLocation("projectionMatrix"), shader.getUniformLocation("transformationMatrix"));
    shader.useProgram();
    update();
    player->render();
    wait();
    shader.stopProgram();
}

//main function
int main(int argc, char** argv) {
    init();
//main loop
    while (!glfwWindowShouldClose(window->getGLFWWindow())) {
        render();
        window->swapBuffers();
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

sentences:
In Ren'py, can I make a text tag that opens a displayable? I'm developing a visual novel in Ren'py that would benefit from an interactive glossary. Ideally, I'd like words in the text box that are included in the glossary to be highlighted, and if the user clicks on one, the glossary would open at the corresponding entry.
I see that a URL text tag is available, so I'm wondering if it would be possible to do something similar to HTML, where an <a> tag can call a Javascript function rather than an actual URL.
Failing that, I know it is possible to make custom tags, but I have not been able to find a way to use these to create an action rather than a new style.
Any advice would be most appreciated, even if it's just to say impossible, so that I can let it go and consider other options.

sentences:
HTML5 2D Game Renderer i have a question on designing a HTML5 2D game renderer.

I've read that it's better to not let entities draw themselves but instead put all the drawing functions in the renderer. After coding for a bit, I realise that this does have its advantages. For instance, I can have a list of helper functions in my renderer system, like drawRotatedImage(), getSprite(), setFontSize(), plus the context variable etc.

However, wouldn't this lead to a very bloated renderer class, with functions like drawTree(), drawMonster(), drawPlayer(), drawBall() or whatever entity?

Also, how would i easily map the entity objects to their corresponding draw functions? Would i have to do an if (entity.type == 'monster') this.drawMonster(); else if (entity.type == 'tree') this.drawTree(); kind of thing?

sentences:
How to detect if players alter game files and stop them from entering the game server as the question says.

how can i check if a player modifies a file such as maps or spells in my rpg games that will be located as "/cache/spells", "/cache/maps" or "/cache/entities" and you get the point.

all the files are going to be written in .xml if that matters and the game will be an online game made in java. not a browser game btw

sentences:
Libgdx: How to leave the dialog visible? setBtn.addListener(new ClickListener() {
    @Override

    public void clicked(InputEvent event, float x, float y) {
        final Dialog dialog = new Dialog("Settings", skin, "dialog") {
            public void result(Object obj) {
                Preferences prefs = Gdx.app.getPreferences("My Preferences");

                if (obj.equals(2))
                    muteMusic = true;
                if (obj.equals(3))
                    muteMusic = false;

                prefs.putBoolean("music", muteMusic);
                prefs.flush();

            }

        };
        dialog.text("Do you want to play music");
        dialog.button("Yes", 2); //sends "true" as the result
        dialog.button("No", 3); //sends "false" as the result
        dialog.button("Ok", false);

        dialog.show(stage);
    }

});

I want the ok button to be on an another row but if I do dialog.row() like with tables, it won't work, I can't add an empty row
I want the dialog to stay visible on the screen until the ok button is touched, only then I want to call dialog.hide()

I can't do

if (obj.equals(false))
dialog.hide(); // IDE will suggest that i create a local variable called dialog

sentences:
How to add prefabs to the terrain and still retain scripts, colliders, etc.? I have been working on an old DOS-styled game, and I began work on the trees for my terrain. Here is a group of them:

They, right now, are simply objects in the scene. This works, but is very cumbersome when mass placing them. I want to have them part of the terrain. I tried simply adding them as a detail mesh, but they didn't retain scripts nor colliders. Is there a way to accomplish this?

sentences:
Advice regarding Unity hosted content I'm currently trying to build a mobile application that, for the purposes of trying to keep small in size, I would like to have store much of its content Online and be downloaded to the users mobile when the application requires it.

Ideally I'd like to do so not just as a means to reduce the applications original size, but also to allow new assets to be introduced over time (such as new objects and textures) without the user having to reinstall the application or download a new update.

I am at the moment researching into the use of Unitys Addressible Assets for these purposes, and am currently trying to test and implement this idea on a small scale using assets stored using Google Cloud storage.

If possible however I would like to to ask whether anyone here has any experience with storing and accessing assets on an external server, and if so, might they have any advice as to whether or not this could be a feasible solution for these purposes?

Any help would be really appreciated, as this is an area that is completely new to me.

Thanks in advance.

sentences:
What are the different ways to balance an online multiplayer game where user spend different amounts of time online? Let's consider a game where every player is building his own medieval town. To make this question simple, let's assume that, on this persistent world, some people will play an hour every day (heavy players), and others will spend an hour per week (light players).

To keep the game fair, a gamer with a lot of free time shouldn't be able to grow much faster than a less present gamer just because he connects more often to the game.

So the first idea is to have a sort of time-based budget: You are saving "action points" as the time is passing. When you connect, you are able to spend this "action points". This way, players are fairly treated...

I see 2 problems:

On one hand, heavy gamers should have the opportunity to play. As often that they want to...
On the other hand, light gamers will be able to connect and make a lot of "actions" in a really short range of "real time" (for instance without been "seen" as the heavy players are..)

So my question is:

What are the solutions that allows light and heavy players to play flairly and balanced regardless of free time to play?

sentences:
UnityEngine.PlayerPrefs corrupts string? I need to use PlayerPrefs to store arrays of bytes for my game. For some reason, the string I save with PlayerPrefs doesn't come out with the same length.

I.e.

byte[] TestArray = new byte[256];
for (byte i = 0; i < 256; i++)
{
    TestArray[i] = i;
}

char[] charBuffer = new char[TestArray.Length];
for (int i = 0; i < TestArray.Length; i++)
{
    charBuffer[i] = (char)TestArray[i];
}

PlayerPrefs.SetString ("Storage", new string(charBuffer));

PlayerPrefs.Save ();

Debug.Log (new String(charBuffer).Length);
Debug.Log (PlayerPrefs.GetString ("Storage").Length);

Log:

256
5

Is this possibly an issue with encoding? How do I fix it?

sentences:
dual contouring concept and term translations I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've read about every paper i could find on the internet about how to implement such a thing and, since i have a very basic experience in game/3d/complex programming, I've had quite a hard time. but I think I've found the solution i was looking for and would like to check with some more experienced programmer if my solution seems right and if I really successfully wrapped my mind around some of those pesky terms that were haunting my nights for the last few months;

Edit: I will try and add some more precise detail as to what i already do here in bold

so, first of all, I've created an object called voxel when I say object, i refer the the user side's way of handling the data received from the server. I already compress the data as to have it fit a byte or a short and use bitwise operations. Voxels are loaded once from the server then stored to memory unless the server returns a change to that voxel (not sending entire chunks for a small change), a voxel knows it's type and it's "integrity" (in this case, how much that stone voxel has been mined for example. I think it refers the the volume i often read about?). Those voxels "will" be created from a pre generated world map for a persistent world. Yes, the world will have overhangs and most of all, tunnels players can mine.

then i got a chunk, composed of at most 32x32x32 voxels. A chunk knows it's world position and has a 3D array of voxels passed from the server when first loaded to memory, then the client/server only updates the voxels that have changed since the last update. A chunk also knows it's neighbors (if such neighbors have been loaded into memory, or creates a default chunk of 32x32x32 air voxels)

To find the surface, inside a chunk, i check every voxel from the bottom,left,near (I think it is the right order to fit with the way OpenGL read it's coordinates?) to the top,right,far. each time, i take the current voxels and all it's 7 neighbors in a cube shape and check whether their is a type change from solid to air in any of them, indicating a surface running through that cube. If there's a type change, i compare every edges to see if there's a type change and if so, place the entersection of that edge using and average of both corners integrity. doing so for all 12 edges allows me to average all the planes to a single point inside that cube and create a vertex and store it in an array.

The point where I'm confused is this: what should i do next? I think I should check along one edge that displays a type change to find the 3 other cubes that has the same edge and find their vertices. Since i know what direction the ground is (comparing the type change along the edge axis) I can deduce the front and back of the quad. taking 3 of those 4 vertices should allow me to get a normal from their dot product and from there, go around that normal CCW and send those vertices to the GPU for the rendering phase. I guess the real question here is: How do I get the right order of vertices to form triangles that OpenGL can draw correctly from that large collection of vertices generated while finding the surface?

In theory, in my mind, it makes sense! but I find it so much simpler than all those papers I've found, that i fear I've missed the boat completely! I get lost when it comes to Isosurface (I guess here, the formula they're talking about would be the average of integrity along any type change?) and hermite data (here, should i read voxel collection instead?) and most maths are slightly beyond my understanding yet (working on it tho and I progressed quite a bit) please, can you help me out here and guide me a bit?

sentences:
Conditional Variables in Scriptable Objects While using ScriptableObjects, how can I make some variables conditional?

Example Code:

[System.Serializable]
public class Test : ScriptableObject
{
      public bool testbool;
      public string teststring;
      public int testint;
}

Goal: When testbool == true then teststring is available to edit, when testbool == false then testint is available to edit while the other one is "grayed out".

sentences:
Most efficient way to handle coordinate maps in Java I have a rectangular tile-based layout. It's your typical Cartesian system.

I would like to have a single class that handles two lookup styles

Get me the set of players at position X,Y
Get me the position of player with key K

My current implementation is this:

class CoordinateMap<V> {
    Map<Long,Set<V>> coords2value;
    Map<V,Long> value2coords;

    // convert (int x, int y) to long key - this is tested, works for all values -1bil to +1bil
    // My map will NOT require more than 1 bil tiles from the origin :)
    private Long keyFor(int x, int y) {
        int kx = x + 1000000000;
        int ky = y + 1000000000;
        return (long)kx | (long)ky << 32;
    }

    // extract the x and y from the keys
    private int[] coordsFor(long k) {
        int x = (int)(k & 0xFFFFFFFF) - 1000000000;
        int y = (int)((k >>> 32) & 0xFFFFFFFF) - 1000000000;
        return new int[] { x,y };
    }
}

From there, I proceed to have other methods that manipulate or access the two maps accordingly.

My question is... is there a better way to do this? Sure, I've tested my class and it works fine. And sure, something inside tells me if I want to reference the data by two different keys, I need two different maps. But I can also bet I'm not the first to run into this scenario.

Thanks!

sentences:
Attaching scripts which trigger on specified events to objects I'm new to Unity and C#. For concreteness, I'll phrase the question in terms of building a TCG like Magic: the Gathering or Hearhtstone, although the method seems of more general utility.
Suppose we wish to create cards that have special properties, such as: "when played, does [a thing]", or "Immunity to fire". Having created a card class, here is the pseudo-code that I would like to write, when initializing the 'library' of cards:
Card testCard = new Card( /*generic arguments here like HP, etc*/);

testCard.abilities = [fireImmunity, drawCardOnPlay, ...];

Where I would have defined the abilities fireImmunity, drawCardOnPlay, and all others in some convenient location. Of course, I could manually define these abilities on each card, but that seems like a short route to insanity: many cards will share the abilities.
First question: it seems I need to create a 'container' on each card to hold the abilities of that card; how does one do this, and what's it called? How/ where to write the abilities list that will go into these containers? First thought was the container should be a list, but I don't know what type of objects we should populate it with.
Second question: in order to handle effects that occur at specified times ("when drawn", "at end of turn", etc) I think I need to be able to create custom events, similar to the built in ones such as onCollisionEnter. These custom events would then be referenced in the scripts such as drawCardOnPlay. How to do this and what's it called?
Third question: is this unnecessary? Is there a more obvious way to do these things?
I'm certain this has answers somewhere (here, probably), but without knowing what these things are called I haven't made any progress. I've read some similar questions here but none that have addressed the implementation.

sentences:
How to know the size of object in Unity in world units? Suppose I have some external package with objects. Suppose I place some of these object to the scene. Now how to know actual size of object in world units?

I found no any rulers or something in Unity.

The I thought I can place primitive cube and compare it, but then I realized that I don't know the size of cube too.

Is is possible to "measure" arbitrary object in Unity somehow?

sentences:
Calculating angle a segment forms with a ray I am given a point C and a ray r starting there. I know the coordinates (xc, yc) of the point C and the angle theta the ray r forms with the horizontal, theta in (-pi, pi]. I am also given another point P of which I know the coordinates (xp, yp): how do I calculate the angle alpha that the segment CP forms with the ray r, alpha in (-pi, pi]?

Some examples follow:

I can use the the atan2 function.

sentences:
displaying leaderboard Basically what i wish to ask:
*A game is developed for android platform, is on google store and its leader board (scores etc.) are on Google server.

Can we display the top scores from there on a webpage/website which is on a different server? Yes or No!

sentences:
Focus scene2d UI actors programmatically in libGDX I am trying to implement keyboard movement in game main menu which is libGDX Stage with UI-Actors. I'm also trying to code this feature myself since I can't neither find anything relevant to it in the docs nor find libraries for the feature.

I have a bunch of Buttons in the VerticalGroup. Using keyboard UP and DOWN keys, I want to somehow focus, highlight or hover buttons like the way that mouse hovering do. Hovewer, firing FocusEvent on children of the VerticalGroup do not change Button appearance.

So how do I focus these buttons or any other UI element (because there are other menus with more complex UI architecture) ?

Here is the code for the menu (Kotlin, using ktx-scene2d builders and ktx-actors event methods):

class MainMenuUi: Stage() {
    val root = verticalGroup {
        center()
        setFillParent(true)
        expand(true)
        space(spacing)
        fill(0.5f)
        wrap(false)

        textButton("Start")
        textButton("Settings")
        textButton("Exit")

        onKeyUp { key ->
            when(key) {
                Input.Keys.UP -> { /* ??? */ }
                Input.Keys.DOWN -> { /* ??? */ }
            }
        }
    }.also {
        addActor(it)
        keyboardFocus = it
    }
}

sentences:
What's an appropriate difficulty scale for weapon efficacy vs difficulty to obtain? I'm writing up a design document for a voxel based adventure game, similar to minecraft, but fixing a lot of fundamentally broken game mechanics, or at least updating those mechanics to be more suited to an adventure game.

I'm considering creating a weapon scale from 1-10, where weapons at 1 are least powerful, and weapons at 10 are most powerful. I was considering making the materials to make the weapon most common for the level 1 weapons, and 10x less common for the most powerful weapon, but if you look at minecraft, diamonds only occur in 0.1% of blocks and they still feel too common, unless you're prone to dying of course.

In keeping with the adventure focus, would it be better to have the higher tiers of weapons only come from monster drops, or from a combination of a rare monster drop and a mineable item, or are there other common game mechanics I could use to have a super powerful weapon that's also hard to get, but worth your time to get?

To state the question another way, for the time investment, should a weapon that's 10x as powerful take 10x as long to obtain, or 20x or higher? Are there any studies that show any correlation between "fun" in how long players will grind for an item and an appropriate time investment scale for obtaining equipment?

sentences: Apparently, Unity decided to import a bunch of things I already had I am getting lots of errors ever since Unity decided to reimport plugins and Unity assemblies that were already present in my project. I am not sure what I can now do, what folders to delete to fix this issue, etc. Is there any simple solution to fixing all of these problems? I cannot even click play in the Unity Editor now.

sentences:
How can I forward GLFW's keyboard input to another object? I'm having trouble trying to execute keyboard events in a another class with GLFW3. The problem I'm having is that GLFW3 uses a static function for input as shown:

static UI u;
...
...
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    u.controls(window, key, action);
}

u is also static and controls holds the the input for WSAD keys (the only way I could get get key events). From here, pressing a key works displaying which key is pressed in the console window. The trouble I'm having is trying to used the key pressed to manipulate a variable in another class.

I have another class called MainMenu that has the function update(). Is there a way I can use my UI class within this function?

sentences:
How make Unity wait before consuming next item in a list? I have a class like so:

public class SomeObject : MonoBehaviour
{
    protected List<EdibleStuff> SomeItemsToConsume;

    private void StartConsuming()
    {
        this.SomeItemsToConsume
            .ForEach(item =>
            {
                StartCoroutine(Consume(item));
            });
    }

    private IEnumerator Consume(EdibleStuff edibleStuff)
    {
        yield return new WaitForSecondsRealtime(2);

        // Check whether edibleStuff is still fresh after 2 seconds
        // Figure out how to consume it -- e.g. by cooking, eating raw, whatever
    }
}

Before SomeObject consumes the next item in the SomeItemsToConsume list, I would like it to wait another short period of time, say, another 2 seconds.

I have tried these approches:

I added another yield return new WaitForSecondsRealtime(2); statement at the end of the Consume(EdibleStuff edibleStuff) method, but that did not work.
I added another co-routine, which simply contains the statement yield return new WaitForSecondsRealtime(2); in its definition, at the end of the ForEach loop, but that did not work either.

How can I achieve the effect I want?

sentences:
differences in UDK map on different installs My goal is to create a simple groundplane in UDK (11/2012 version, fresh install) that the user will be able to run around on. My requirements are therefore very basic and I tried to whip something up quickly in the editor. I created a circular (cylinder) plane and applied a material. I added a Blocking Volume, a Lightmass Importance Volume, and a Sky Light. I built everything and get no errors. The map played fine on my system.

I transferred the file to another system with the same version of UDK (also a recent install). When I try to play the map, I plunge to my death. Though I have verified that my player start position is above the ground, I seem to start below the ground looking up at it. What could cause a map that works great on one system have such a positioning issue on another system?

I believe this is a valid question. I'm obviously going to need to systematically test things and I already have tried moving the player start etc. However, I will need to have some idea of what can differ between installs. I'm extremely new to the UDK.

Thanks.

sentences:
How to rotate an object to face another in Unity? I'm having an issue where I can't seem to rotate my bullet appropriately whenever I spawn one. I currently have a capsule prefab I am testing with. I spawn it with the following code.

        GameObject b = (GameObject)Instantiate(Resources.Load<GameObject>("Prefabs/Bullet"));

I am using the following code to try and orient the bullet so that it lays along the imaginary ray between it's spawn location and the centre of the target.

    void Start() {
    go = InputController.instance.hit.transform.gameObject;
    transform.position = new Vector3(transform.parent.position.x, transform.parent.position.y - 5, transform.parent.position.z);
}

void Update () {
    transform.LookAt(go.transform.position);
    Vector3 rotation = transform.eulerAngles; //THIS IS THE LINE I NEED TO ALTER
    transform.rotation = Quaternion.Euler(rotation);
    transform.position = Vector3.MoveTowards(transform.position, go.transform.position, SPEED * Time.deltaTime);
    Debug.DrawRay(transform.position, transform.forward * 10000000, Color.red); //DEBUGGING
    Debug.DrawRay(transform.position, transform.up * 1000000, Color.green); //DEBUGGING
}

Essentially the issue I am having is how I can calculate the rotation of the object based on the two I have available.

As you can see the line that I can't seem to calculate is the second line of the Update method, what it needs to do is orient the Vector3.up direction of the object to run along the Vector3 created by linking its position with the target location.

Interestingly the bullet is already laying horizontally but the LookAt method changes its rotation so I just need to fix it but I'm not sure on the math to do that.

sentences:
How do I make a sine wave without using an infinitely-increasing time value as input? I have a basic understanding of sine wave generation. The problem I am facing is that as the input parameter for time gets larger, my sine wave falls apart and starts to look really ugly.

I'd like to calculate a sine wave without depending on an ever increasing time value. How can I do this?

sentences:
Texture not carrying over to game correctly? I have created my map for my game using 3DS Max. I have then applied textures to the map within 3DS Max, where the textures all show correctly. I export the map as a .fbx file to use within an XNA project.

However as you can see from the below screenshot, the textures are not displayed correctly in XNA.

Does anyone know why this is happening?

I am using the Autodesk FBX content importer and the Model - XNA Framework Content Processor.

As you can see my model which was created in the same way has the textures displayed correctly, it is only doing it to my map.

sentences:
Why do I have to set my Unity app to full-screen manually on my phone When I open my unity app it doesn't go full-screen until I change it in the settings, isn't there a way to do that... it actually isn't a scaling problem or an aspect ratio.... Because you can see how in the phone settings it is turned off
Thanks in advance

sentences:
JavaScript - 2D Top-down Collision Detection issue I'm developing a 2D Top-down Game using HTML5 Canvas and a custom Game Engine. I'm implementing the Quad-intersection detection (Function below, if it helps) on different areas of the Sprites (As they're larger than Tiles in some cases), and have thought of an issue with this. I want to check these areas before moving, using the amount of pixels I will move if allowed to (Nothing blocking the character). Below if the code I use to move the Player:

move: function(delta) {
    var distance = Math.floor(this.getSpeed() * Math.floor(delta / 10));

    this.setMoving(false);

    if(Engine.input().isPressed(Engine.keys.LEFT_ARROW)) {
        this._config.x -= distance;

        this.setMoving(true);
        this.setDir(0);
    }
    if(Engine.input().isPressed(Engine.keys.RIGHT_ARROW)) {
        this._config.x += distance;

        this.setMoving(true);
        this.setDir(1);
    }
    if(Engine.input().isPressed(Engine.keys.UP_ARROW)) {
        this._config.y -= distance;

        this.setMoving(true);
        this.setDir(2);
    }
    if(Engine.input().isPressed(Engine.keys.DOWN_ARROW)) {
        this._config.y += distance;

        this.setMoving(true);
        this.setDir(3);
    }

    this.boundaries();
}

As the distance is not 1 pixel, it will be checking a few pixels ahead of the Player for solid tiles, and if there is one X many pixels in front of them, they can't move the distance and stop.

Problem

So - let's say the distance is 3. If they're 2 pixels from a Solid Tile, they will not move those 2 pixels because of the collision detection, meaning there will be a 2 pixel gap between the Player and the tile, which will only increase the larger the Player, or Entities, speed.

Is there any way to get around this, other than having to check pixel-by-pixel for each anchor point I want to check collision on?

Collision Detection

collided: function(box1, box2) { // Basic Quad-intersection Collision
    return (
        ( (box1.x >= box2.x && box1.x <= (box2.x + box2.width) ) ||
        ( (box1.x + box1.width) >= box2.x && (box1.x + box1.width) <= (box2.x + box2.width) ) ) &&
        ( (box1.y >= box2.y && box1.y <= (box2.y + box2.height) ) ||
        ( (box1.y + h1) >= box2.y && (box1.y + h1) <= (box2.y + box2.height) ) )
    ) ? true : false;
},

sentences:
Objects do not stop when colliding each other while using mouse drag I work on a 2D game and I have multiple objects that the player can control.

The objects each have a RigidBody2D and a Collider, and a method OnMouseDrag() with which I can drag the objects.

I want the dragging to stop when the objects hit each other.

I tried by using this:

rigidbody2d.velocity = Vector3.zero;
rigidbody.isKinematic = true;

But the objects do not stop.

I want exactly like this video.
I tried this but it isn't work too.

https://www.youtube.com/watch?v=ZfjVR-0ZFHU&t=270s

using UnityEngine;
 using System.Collections;
public class NewBehaviourScript1 : MonoBehaviour
{

bool allowDrag = true;
void OnCollisionEnter(Collision collision)
{
    allowDrag = false;
}

void OnMouseDrag()
{
    if(allowDrag)
    {
    float distance = 7;
    Vector3 mousePosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y , distance);
    Vector3 objPosition = Camera.main.ScreenToWorldPoint (mousePosition);
    transform.position = objPosition;
        if ((transform.position.x <0))
            {
            Vector3 _tmp = transform.position;
            _tmp.x = 0;
            transform.position = _tmp;
            }
            if ((transform.position.x > 4.5f))
            {
            Vector3 _tp = transform.position;
            _tp.x = 4.5f;
            transform.position = _tp;
            }

    }
}
void OnMouseUp()
{
    if ((transform.position.x > 0) && (transform.position.x < 0.375f))
        {
        Vector3 _tr = transform.position;
        _tr.x = 0;
        transform.position = _tr;
        }
    if ((transform.position.x > 0.375f) && (transform.position.x < 1.25f))
        {
        Vector3 _fs = transform.position;
        _fs.x = 0.75f;
        transform.position = _fs;
        }
    if ((transform.position.x > 1.125f) && (transform.position.x < 1.875f))
        {
        Vector3 _tr2 = transform.position;
        _tr2.x = 1.5f;
        transform.position = _tr2;
        }
    if ((transform.position.x > 1.875f) && (transform.position.x < 2.625f))
        {
        Vector3 _tr4 = transform.position;
        _tr4.x = 2.25f;
        transform.position = _tr4;
        }
    if ((transform.position.x > 2.625f) && (transform.position.x < 3.375f))
        {
        Vector3 _tr6 = transform.position;
        _tr6.x = 3;
        transform.position = _tr6;
        }
        if ((transform.position.x > 3.375f) && (transform.position.x < 4.125f))
        {
        Vector3 _tr7 = transform.position;
        _tr7.x = 3.75f;
        transform.position = _tr7;
        }
    if ((transform.position.x > 4.125f) && (transform.position.x < 4.875f))
        {
        Vector3 _tr8 = transform.position;
        _tr8.x = 4.5f;
        transform.position = _tr8;
        }
}
void Start ()
{
}
void Update()
{
}

}

Please help!

sentences: How to rotate an object to a specific transform? I am working on a car racing game and there are some times when the car rotates and ends up on its roof. On those situations I want the car to respawn on the same location. What can I do to rotate it so the car ends up on its wheels?

sentences:
Need an ideal opensource 3D engine for building Golf simulation game I'm looking for a open-source 3D graphics and physics engine specialized in golf simulation.

The preferred engine would be have short learning curve, supports Windows platform and Java or C++ and Lua/Python support for scripting, also prefer something like outdoor golf plane scene with weather system support, I'm new to this area and would love to hear all of your advice.

I'm just come from stackoverflow site, @mikera there recommends jMonkeyEngine, it sounds a fit, but I'm not sure if there's other ideal candidate engine?

sentences:
Using Sampler States in Effect file I have been reading a lot of different shaders and some have the preference of:

sampler depthSampler : register(s1);

Whilst others take the longer route:

texture depthMap;
sampler depthSampler = sampler_state
{
    // etc.
};

Is there any real difference between the two?  Does one perform faster than the other?

sentences:
How can I set up a flexible framework for handling achievements? Specifically, what is the best way to implement an achievement system flexible enough to handle going beyond simple statistics-driven achievements such as "kill x enemies."

I'm looking for something more robust than a statistics based system and something more organized and maintainable than "hardcode them all as conditions." Some examples that are impossible or unwieldy in a statistics based system: "Slice a watermelon after a strawberry", "Go down a pipe while invincible", etc.

sentences:
How to draw grass sprites without using gameobjects? I am making a rimworld-like procedurally generated 2D game using Unity's tilemap system.
Just like tiles, I also have to procedurally generate grass and trees. Each grass instance should have logic inside that keeps track of it's growth progress and update the grass size appropriately.
The downside is, I have to have maps as big as 400x400. That could be THOUSANDS of grass instances and each of them having their own GameObject seems ridiculous and like the game would lag.
How can instantiate those grass sprites without creating new gameobjects for each one while still being able to control the growth and similar things?
(Come to think of it, the DOTS / ECS system in Unity would be perfect for this, however it is nowhere near ready and many things I want to do are just not supported.)

sentences:
UObjectFinder versus UClassFinder; when is one better than the other? I want to change the default pawn of my game and I decided to do it with c++.

I came up with this solution, which works fine:

static ConstructorHelpers::FClassFinder<APawn> MyPawn(TEXT(" address..."));
        DefaultPawnClass=Pawn.Class;

However, I searched on the internet and found this approach used more often:

static ConstructorHelpers::FObjectFinder<UClass> MyPawn(TEXT(" address..."));
        DefaultPawnClass=(UClass*)Pawn.Object;

What advantages does UObjectFinder have over UClassFinder?

Are there certain circumstances where one is preferable to the other?

sentences:
How to determine which thrusters to turn on to rotate the ship? The configuration of the ship changes dynamically, so I have to determine which thruster to turn on when I want to rotate the ship clockwise or counter clockwise. The thrusters are always axis aligned with the ship (never at an angle) and are either on or off. Here's one of the possible setups:

What I've tried so far is to visualize the firing vector and the direction vector to the center of mass of the ship:

Unfortunately, I didn't get very far with that.

sentences:
Brighter pixels around area (OpenGL ES 2) I'm trying to achieve an effect like in the image bellow. Basically I will have a 2D texture and I want a small area around a point (let's call it "light source") to be slightly better lit (i.e. be brighter). The light source will never move from its original position nor will it seem to "pulse" like the light of a fire for example. All the other areas further away will have some default brightness.

From my understanding, this can be done using a light map, but I was wondering whether it was possible to come up with a formula in the fragment shader of the texture below that changed the brightness of my pixels so that it is very bright around a particular point and quickly faded to a default value for the pixels further away. I tried working with something like this:

precision mediump float;
uniform sampler2D u_Texture;

uniform vec3 u_LightPosition;
varying vec3 v_Position;
varying vec2 v_TexCoordinate;

void main() {
    float dist = length(v_Position - u_LightPosition);
    gl_FragColor = (1.0 / (c + b * dist + a * dist * dist) + 0.15) * texture2D(u_Texture, v_TexCoordinate);
}

where c, b and a are hardcoded and adjusted by myself. However I wasn't able to find any combination of c, b and a that achieved an effect like the one from the image, because the brightness doesn't fade away quickly enough and it's very gradual. I think that's expected behaviour from a quadratic expression anyway, so my approach is clearly wrong and it's not a matter of adjusting c, b and a. What should I try then?

sentences:
Weapon Class Organization Im making a game and i want to organise my weapons, and im having a few doubts on not only the best architecture but also on how to use it properly:

The First approach is to make a single Weapon class with a Type variable, and create every weapon, melee or ranged, in there. That way, even handeling collision would be "easy" (i have a collisionManager class where i handle all the collision (with pointers to collideable game elements), but thats also a problem, since weapons might have different ways to collide, lets say if im using a projectile weapon, like a pistol, i only need to check collision with its bullets, while a knife's is all about its range, so the Type variable would be very useful for that). The downside, i believe, is that:

1 - In the future, the class might get very big and maybe complex (i intend to add lasers, flamethrowers and rocket launchers so...)

2 - Every mob that posesses a "Weapon" object initialized would have data to use every weapon, when some enemies might just use one of them (lets say i have an enemy that just melee hits, which i might say its the knife), and althought i might be overreacting about the memory it wastes, it bothers me.

The second approach is the classic, yet quite attractive, hierarchical one, where i would create a class Weapon similar to this:

public abstract class zWeapon {

//weapon attack info
protected boolean attacking = false;
protected int damage;
protected long startTime;
protected long delay;
protected long elapsed;

public void attack(double X, double Y, double angleShoot)
{
    if(attacking) return;

    startTime = System.nanoTime();
    attacking = true;

    useWeapon();
}

protected abstract void useWeapon();

public void update()
{
    if(attacking)
    {
        elapsed = (System.nanoTime()-startTime) / 1000000;
        if(elapsed >= delay)
            attacking = false;
    }
}

protected abstract void draw();}

(forget about the "z" behind Weapon)

and then create extensions like MeleeWeapon, ProjectileWeapon, Laser etc

What confuses me, is how to properly use this. My only idea to use this. if a mob has a Weapon, and a certain mob only uses Knife, it makes sense that i say weapon = new Knife(); and the mob uses the knife as it should. But lets say, for example, the player. The Player can use every weapon, eventually. And i would probabily create an array of weapons with every weapon object initialized, and id change the weapon variable everytime i had to change weapon. The problems that come up to my mind are the following:

1 - If i use it like this, if i change weapon variable from, lets say, pistol to knife, the vector of bullets in pistol would stop being updated since im now updating a different weapon.

2 - The collision would be a harder work, i dont want to use instanceof to check which type of collision i should do with the weapon against my game elements...

So as you see i have alot of confusion going on in this Weapon Class architecture, would you ease my mind with a few solutions/hints/tips?

sentences:
Varying framerate (FPS) In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep!

However, when the framerate is varying between 30-60fps during the game, the game looks jumpy. For example, balls suddenly look accelerated when the frame rate increases from 35 to 45 suddenly.

Is there a way to make the game look smooth while framerate is varying?

Here is my game loop:

protected void update(float deltaTime) {
    //do some pre stuff

    deltaTimeAccumulator +=deltaTime; //deltaTimeAccumulator is a class-member holding the accumulated frame time
    while(deltaTimeAccumulator>FIXED_TIME_STEP) {
        world.step(FIXED_TIME_STEP, 6, 2);  //perform physics simulation
        deltaTimeAccumulator-=FIXED_TIME_STEP;
    }
    // world.step(deltaTime, 6, 2);

    destroyBodiesScheduledForRemoval();
    render(deltaTimeAccumulator /FIXED_TIME_STEP); //interpolate according to the remaining time
}

Here is the part related to the interpolation (related inner works of render() method) :
        this.prevPosition = this.position; //get previously simulated position

    this.position = body.getPosition(); //get currently simulated position

    //interpolate
    Vector2 renderedPosition = new Vector2();
    if (prevPosition != null) {//&& !isFloatApproximatelyEquals(this.prevPosition.x, this.position.x) && !isFloatApproximatelyEquals(this.prevPosition.y, this.position.y)) {
        renderedPosition.x = this.position.x * interpolationAlpha + this.prevPosition.x * (1 - interpolationAlpha);
        renderedPosition.y = this.position.y * interpolationAlpha + this.prevPosition.y * (1 - interpolationAlpha);
    } else {
        renderedPosition = position;
    }

    //Draw the object at renderedPosition

sentences:
Zooming and panning a camera simultaneously causes a swooping effect In a 2d game, I have a basic camera class.  The guts of the class creates a transformation matrix that is later passed to the Begin() method of a SpriteBatch.  The transformation is done like this:

        Transform = Matrix.Identity *
                    Matrix.CreateTranslation(-Position.X, -Position.Y, 0) *
                    Matrix.CreateScale(new Vector3(Scale, Scale, Scale)) *
                    Matrix.CreateTranslation(ScreenCenter.X, ScreenCenter.Y, 0);

I'm trying to create an effect that zooms in on a specific point on the screen.  The issue is that the zoom/translation causes a strange "swooping" effect when applied.  For example, when the zoom is set to 1.0 and the current position is (0, 0), and I change these to 2.0 and (100, 200) over a 1 second interval, the camera appears to take a curved path to (100, 200).

Here is my code to update the position / scale on each frame (I removed logic to determine when the transition is finished):

        _positionTimeElapsed += gameTime.ElapsedGameTime.TotalMilliseconds;
        _scaleTimeElapsed += gameTime.ElapsedGameTime.TotalMilliseconds;

        Position = Vector2.Lerp(
            _positionStart,
            PositionDestination.Value,
            (float)(_positionTimeElapsed / TransitionTimeMilliseconds));

        Scale = (ScaleDestination.Value - _scaleStart)
             * (float)(_scaleTimeElapsed / TransitionTimeMilliseconds)
             + _scaleStart;

I'm relatively confident that I'm missing something basic about Matrix math.  Does anyone know how to transition both position and scale simultaneously and have the camera appear to take a linear path to the destination?

UPDATE

Added two videos on YouTube that show the issue and the fix in action.  These videos zoom to 10x over 5 seconds to make the bug obvious.

Broken: http://www.youtube.com/watch?v=d8fJ4Zf-sqU

Fixed: http://www.youtube.com/watch?v=GpcUc25eZ8o

sentences:
What's the difference between XNA Game Services and glorified global variables? 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?

sentences:
How to place the origin of an isometric map at the top, not the left I have an isometric diamond-shaped map. Currently my map origin is to the far left, instead of the top.

The green circle at the top-center of the map is where I want the origin point to be, however the red circle on the far left is where it currently is now.

Basically when I walk "up" in my game, my x coordinates increase, where I would want them to decrease.

So far in my code I load in a text file with the following format

1 5 5 5 2
8 9 9 9 6
8 9 9 9 6
3 7 7 7 4

It's loaded with infile into a pointer of ints, from left to right, disregarding columns.

The edges and corners of the map above, are sides and corners of tiles - the middle (9) is a grass tile, that is walkable.

Here is how I get map segments of x and y (Terrain codes according to tileset):

int world_map::get_map_segment_x(int code) {
    if (code == 1) return 0;
    if (code == 2) return 64 * 3;
    if (code == 3) return 64 * 0;
    if (code == 4) return 64 * 3;
    if (code == 5) return 64 * 2;
    if (code == 6) return 64 * 1;
    if (code == 7) return 64 * 2;
    if (code == 8) return 64 * 2;
    if (code == 9) return 64 * 1;
    if (code == 10) return 64 * 3;
    if (code == 11) return 64 * 1;
    if (code == 12) return 64 * 2;
    if (code == 13) return 64 * 0;
    if (code == 14) return 64 * 3;
    if (code == 15) return 64 * 2;
    return 0;
}

int world_map::get_map_segment_y(int code) {
    if (code == 1) return 32 * 10;
    if (code == 2) return 32 * 7;
    if (code == 3) return 32 * 9;
    if (code == 4) return 32 * 9;
    if (code == 5) return 32 * 9;
    if (code == 6) return 32 * 8;
    if (code == 7) return 32 * 10;
    if (code == 8) return 32 * 7;
    if (code == 9) return 32 * 6;
    if (code == 10) return 32 * 6;
    if (code == 11) return 32 * 7;
    if (code == 12) return 32 * 6;
    if (code == 13) return 32 * 1;
    if (code == 14) return 32 * 10;
    if (code == 15) return 32 * 8;
    return 0;
}

Here is my world_map::render function

void world_map::render(int screen_width, int screen_height, float x, float y, int sprite_count) {
    int surroundings = 0;
    for (int row = surroundings; row < 20 + surroundings; row++) {
        for (int col = surroundings; col < 20 + surroundings; col++) {

            if (row >= 0 && row < 20 && col >= 0 && col < 20) {
                al_draw_bitmap_region(this->terrain, get_map_segment_x(map[2 * 20 * row + 2 * col]), get_map_segment_y(map[2 * 20 * row + 2 * col]), SPRITE_WIDTH, 32,
                     -32 / 2 + screen_width / 2 + (row - y) * 32 + (col - x) * 32, 64 - SPRITE_HEIGHT / 2 + screen_height / 2 + (row - y) * 16 - (col - x) * 16, get_map_segment_flag(map[40 * row + 2 * col]));
                    //-32 / 2 + width / 2 + (row - y) * 32 + (col - x) * 32, 64 - SPRITE_HEIGHT / 2 + height / 2 + (row - y) * 16 - (col - x) * 16, get_map_segment_flag(map[40 * row + 2 * col]));
            }
            else {
                al_draw_bitmap_region(this->terrain, get_map_segment_x(1), get_map_segment_y(1), SPRITE_WIDTH, SPRITE_HEIGHT,
                    -SPRITE_WIDTH / 2 + screen_width / 2 + (row-y) * 32 + (col-x) * 32, 64-SPRITE_HEIGHT / 2 + screen_height / 2 + (row-y) * 16 - (col-x) * 16, get_map_segment_flag(1));
            }
        }
    }
}

x & y parameters in render function are player x & y coordinates

If any more information is needed, please let me know, this has been bugging me for hours :(

sentences:
Optimizing 3D tile-based geometry For my game, I have a tool that lets me quickly create map geometry. You can see a (albeit early version) demo of the tool here. The main problem with the tool is that even a semi-large map can EASILY amount to around thousands to even 10s of thousands of tiles. The easiest way to fix this, I found, was to use a script I found online to merge all of the tiles into one mesh at the start of runtime (this is because I want to still be able to edit my tilemap in the editor)
This works and has a noticable improvement to the performance (especially if post-processing is enabled) however I'm left with a mesh that has a bunch of triangles that just aren't needed. You can see an image of the mesh here. The problem with this is that if I want to do any kind of point lights with shadows (baked lighting isn't possible, really, due to the interactivity of my game since you can turn lights on/off and I have a weird day/night system that is split into multiple periods of the day and only changes after a mission/event) would mean I'm rendering that mesh again from each point lights POV (and I need a LOT of point lights). I can't really just not use shadows since it causes very noticable light bleeding at walls.
I've tried to find some sort of algorithm to simplify the mesh and I came across a script that seems to do exactly what I want, but I couldn't get it to do anything except cause my mesh to become completely black with seemingly no change in mesh topology. Here's the script by the way
I've also found an algorithm called Greedy Meshing which seems to also do what I want, but seems to be meant for voxel based worlds like minecraft and I'm not sure how to implement it in my case since my tiles aren't voxels.
I've been trying to find other algorithms but the various game dev servers on discord can't seem to help me. Does anyone know how I can solve this problem? I'm not really smart enough to come up with my own algorithm/system to simplify the mesh.

sentences:
Frequent stuttering, high FPS spikes with VSync option turned on in Unity standalone build I'm experiencing an issue using Unity 4.3.2 and standalone builds. If I turn on VSync in the project's Quality settings, running the game at the native monitor resolution, I'll frequently get high framerate spikes (over 100FPS), and a strong stutter for a few frames, and then it drops back down to 60FPS and runs normally. If I run the game at a lower resolution (800x600 for example), the framerate stays at around 500FPS and the stuttering is consistent.

However, if I turn off VSync in the Quality settings, and force it on in the Nvidia Control Panel, I don't experience any stuttering or framerate spikes, nor when I turn off VSync completely (but lots of screen tearing, which is very ugly and distracting).

Can anyone explain this behavior? Is there anything that can be done to circumvent it? I'd imagine other Unity developers have used the built in Unity VSync with success before (or maybe not?!) so I'm hoping I'm just doing something wrong on my end.

sentences:
Sprite detached from the screen but contact is still made Well, i'm facing a strange problem with my code. I'm trying to remove a sprite named ice when either of player, enemy or the ground comes in contact with the ice. The contact is made successfully and the ice is hidden after the contact but due to some reasons the player,enemy and the ground still comes in contact with the ice. I want the ice object to be completely removed from the scene when contact is made. I'm using the below code:

public void beginContact(Contact contact) {
    // TODO Auto-generated method stub
    Fixture x1 = contact.getFixtureA();
    Fixture x2 = contact.getFixtureB();

if (x1.getBody().getUserData().equals("player")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    Log.i("Contact Made", "CN");
    detachChild(gb);
    gb.setVisible(false);
    score = score + 1;
    scoreText.setText("Score: " + score);
}
if (x1.getBody().getUserData().equals("ground")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}
if (x1.getBody().getUserData().equals("enemy")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}

}

sentences:
Independent Arcade Game Development So I've been looking around, but it seems that information on this is scarce.

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

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

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

sentences:
How to prune an AI game tree for a game like Magic? I've got a game tree structure for my AI that I need to trim in order to gain some depth.

It is a single-player game of perfect information. A good analogy would be a single-player game of Magic the gathering with an oponnenet that plays no card but automaticaly deals you some damage per turn.

Since I don't have an opponent I don't need either minimax (I can do a pure MAX) or a/b pruning.

I got an evaluation function I can use on nodes if necessary. I'm trying to plan ahead and find good combo's of cards to play.

I dont want to hard-code these combos.

I'm finding hard to prune any branch at all since even a branch with bad-scoring node can potentially lead to a good combo that will completely change the game (you know, like : play 5 shitty cards and be almost dead but the 6th card will grant you a win).

Any idea on how to approach pruning in a game tree like that?

sentences:
Hidden Loading with UDK I was wondering, how would I go about creating hidden loading scenes with UDK? For example, a character walks in to an elevator, the elevator fakes movement, whilst the previous floor is destroyed and the next floor is loaded on top.

I assume it's possible with UDK, since it's supposedly rather flexible, but I've never used UDK before (I decided to ask this question first to save me learning it all, finding out it isn't possible, then giving up).

So yeah, is hiding the loading process possible? And if so, how would I go about doing it?

sentences:
Why separate data from logic? I don't understand the purpose of separate SystemClass for functions.
My composition looks like this:

class Color {
   void Blend(uint32_t entityID, float factor) {
      red[entityID] *= factor;
      green[entityID] *= factor;
      blue[entityID] *= factor;
   }

   static std::vector<float> red;
   static std::vector<float> green;
   static std::vector<float> blue;
}
std::vector<float> Color::red;
std::vector<float> Color::green;
std::vector<float> Color::blue;

I am keeping vectors of members to have possibility to iterate over specific member instead of loading whole struct.

My question is: what exactly is the reason for SystemClass with only logic?

class ColorComponent {
   static std::vector<float> red;
   static std::vector<float> green;
   static std::vector<float> blue;
}
std::vector<float> ColorComponent::red;
std::vector<float> ColorComponent::green;
std::vector<float> ColorComponent::blue;

class ColorSystem {
   void Blend(uint32_t entityID, float factor) {
      ColorComponent::red[entityID] *= factor;
      ColorComponent::green[entityID] *= factor;
      ColorComponent::blue[entityID] *= factor;
   }
}

How the second composition suppose to be better for performance?

I will be very grateful for explanation.

sentences:
Determining desktop bounds by D3D9 adapter I've got a Direct3D 9 application which normally runs full-screen. The user is able to select a display adapter to determine which screen it is shown on.

I also offer a Windowed mode which launches on the Primary display - but the user can move it if they wish.

I want to offer a Windowed maximised no border (slight performance hit but it avoids alt-tab issues). The problem is, since the user can't drag the window now, I need to make sure it opens on the appropriate display.

How can I determine the desktop bounds managed by a given adapter index?

Device = New Direct3D9.Device(D3D9,
             Settings.Display.Adapter, //Only applies if PresentParams.Windowed = False
             Direct3D9.DeviceType.Hardware,
             Window.Handle,
             Direct3D9.CreateFlags.HardwareVertexProcessing,
             PresentParams);

sentences:
reading from texture2d resource in directx11 Hi^^ i am trying to read data in resource, which i used to do well without any problems. but suddenly it is not working.

first i made immutable resource that has data in it, which is
XMFLOAT4(1,1,1,1) here.
next i made staging resource for reading.
lastly, i called map/unmap to read and store data into outputArr.

//(all HRESULT checked already)
    int WIDTH = 10, HEIGHT = 2;

    ID3D11Texture2D* resource; // create texture------------------------------
    D3D11_TEXTURE2D_DESC texDesc;
    texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    texDesc.Usage = D3D11_USAGE_IMMUTABLE;
    texDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
    texDesc.Width = WIDTH;
    texDesc.Height = HEIGHT;
    texDesc.CPUAccessFlags = 0;
    texDesc.ArraySize = 1;
    texDesc.MipLevels = 1;
    texDesc.SampleDesc.Count = 1;
    texDesc.SampleDesc.Quality = 0;
    texDesc.MiscFlags = 0;

    XMFLOAT4* initValues = new XMFLOAT4[WIDTH * HEIGHT];
    for (int i = 0; i < WIDTH * HEIGHT; ++i) {
        initValues[i] = XMFLOAT4(1,1,1,1);
    }
    D3D11_SUBRESOURCE_DATA data;
    data.pSysMem = initValues;
    data.SysMemPitch = sizeof(XMFLOAT4)*WIDTH;
    data.SysMemSlicePitch = 0;
    device->CreateTexture2D(
        &texDesc,
        &data,
        &resource);

    ID3D11Texture2D* staging; // create texture for reading --------------------
    D3D11_TEXTURE2D_DESC stgDesc;
    stgDesc.BindFlags = 0;
    stgDesc.Usage = D3D11_USAGE_STAGING;
    stgDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
    stgDesc.Width = WIDTH;
    stgDesc.Height = HEIGHT;
    stgDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
    stgDesc.ArraySize = 1;
    stgDesc.MipLevels = 1;
    stgDesc.SampleDesc.Count = 1;
    stgDesc.SampleDesc.Quality = 0;
    stgDesc.MiscFlags = 0;
    device->CreateTexture2D(
        &stgDesc,
        nullptr,
        &staging);

    XMFLOAT4* outputArr = new XMFLOAT4[WIDTH*HEIGHT]; // READ-------------------
    dContext->CopyResource(staging, resource);
    D3D11_MAPPED_SUBRESOURCE mappedResource;
    ZeroMemory(&mappedResource, sizeof(D3D11_MAPPED_SUBRESOURCE));
    dContext->Map(staging, 0, D3D11_MAP_READ, 0, &mappedResource);

    outputArr = reinterpret_cast<XMFLOAT4*>(mappedResource.pData);
    std::vector<XMFLOAT4> testV;
    for (int y = 0; y < HEIGHT; ++y)
    {
        for (int x = 0; x < WIDTH; ++x)
        {
            int idx = y * WIDTH + x;

            testV.push_back(outputArr[idx]);
        }
    }

    dContext->Unmap(staging, 0);

and it turns out, only when WIDTH is multiple of 16(HEIGHT doesn't seem to be matter here), it copies the data well into ALL element of array, otherwise it fill out just 0 into array until next 16 element.

For example, if width/height is 10/2,
first 10 elements of outputArr will have proper data and next 6 elements have just 0, and next another 10 elements with data, and 6 elements with 0, so on.

i haven't had any problem on dealing with resources. and struggle still.
just my humble assumption is that there might be specific alignment in number of width of resource that i miss. Or silly mistake in my process.

Hope anyone can find something from this question.
thanks

sentences:
(Java) Trying to animate an arraylist of coins with a (working) animation class I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work with this since the method is small and straight forward.

My constructor looks like this:

public Coin(float xPos, float yPos, int numOfCoins, LayoutType layout) {
        setType(ObjectType.COIN);
        coinList = new ArrayList<Coin>(); // arraylist of coins
        setPos(xPos, yPos); // set starting position of coin(s)
        if (layout == LayoutType.LINEAR)) {
            linearLayout(); // display coins in a straight line
        } else if (layout == LayoutType.CURVE{
            curveLayout();
        }

}

And my linearLayout() method looks like this

public void linearLayout() {
        //draw numOfCoins amount of coins in a straight line
        for (int i = 0; i < numOfCoins; i++) {
            Coin coin = new Coin(xPos, yPos);
            coinList.add(coin);
            xPos += 50; // place coins 50 pixels apart
        }
}

I have a working animation class and a spritesheet for the coins - however, the way I have modelled my coins is in such a way that 1 coin object can contain numOfCoins amount of coins, so I can't just directly call the animation in the draw method.

The class' draw() method is in an abstract class GameObject which Coin extends. It looks like this:

public void draw(SpriteBatch batch) {
    // if the object is a coin iterate through the list of coins
    // and draw the sprites, if it isn't a coin, simply draw the objects sprite
    if (type == ObjectType.COIN) {
        for (Coin coin : getCoinList()) {
            coin.getCoinList().draw(batch);
        }
    } else {
        sprite.draw(batch);
    }
}

This draw() method is called in World.render().

How would I create an animation using my Animatorclass for each coin if I have 6 coins in a straight line for instance? I can't seem to find a way. Highly grateful for any help, thanks.

sentences:
Deleting an item in the game world: detecting if an item supports other items I'm writing a 3D construction module similar to the how you build houses in the Sims. Users are able to build walls and floors (which also act as ceilings) on multiple floors (layers). This question needs a little background info:

I'm not using an physics, there is no gravity. I use the term floor/ceiling tile here interchangeably. Essentially all are floor tiles, ceiling tiles are just floor tiles on a higher layer.

I store the build data in a multi dimensional array like:

grid[layer][row][column][position]

The layer represents the layer (ground floor, 1st floor etc..). The row and columns make up the grid. The position can hold any number of 3 positional values, namely:

0 : wall on west side of cell
1 : wall on south side of cell
2 : ceiling

So for example, a south wall on the row/column 2/4 on layer 3 would looks like:

grid[3][2][4][0=>null,1=>item,2=>null]

This works great, and it's easy to write functionality to check if a item can be placed at any position (by looking at neighbouring cells, layers below etc...)

Here is the actual problem and question:

I'm writing functionality to delete items within the game world. The rules by which I decide if something can be deleted are what you would expect in real life:

Any item that's not on the ground floor needs something else supporting it

So for the following examples:

Only 1 of the 2 blue tiles adjacent to the red tile could be deleted

The red tile cannot be deleted because the wall connected to it would no longer have a support.

Walls are simple enough, I just check nothing is in the same row/col above them (since it would only be another wall or ceiling). It's the floor/ceiling tiles that are difficult.

It's easy enough to check if an item has neighbouring items, or if is supported by a wall below, but I can't seem to find an efficient way to do the checks if, for example, a ceiling tile has many neighbouring tiles that it supports:

VS those same neighbouring tiles, but they are supported by another item:

I thought maybe I should be storing the information about which other items support the current item during placement, but that just feels like moving the same complexity to another part of the code.

Is there and algorithm or concept that I could use/adapt to do the checks?

sentences:
How to build list of items available in World of Warcraft? There are a number of non-Blizzard sites that show a complete list of available items in World of Warcraft (such as wowhead, etc). I would like to know the best (easiest) way to compile a similar list.

I believe some sites are based on user-entered input, which I would like to avoid. Looking at the lua API, it seems that there are functions to get a list of items, but it's not clear if I can just download everything (I remember a reference to throttling somewhere, can't find it now). Does anyone have code samples that would do this, or links to source?

Also, Eve Online has made a database of items available (and I do mean SQL database file for download, not the Armory) - is there anything similar for Wow?

I'm just looking for the names and stats, not the graphic icons.

sentences:
Bullet physics convex hull center of mass I am trying to make a convex hull collider for bullet physics. I am using BulletSharp.CompoundShape and BulletSharp.ConvexHullShape.
This is model of a chair in unity with rigidbody and convex mesh collider (how i expect it to behave):

This is that same model in my engine:

Here is the chair in blender:

When attaching collision shapes to CompoundShape there is an option to add offset, i tried setting that offset to center of volume of mesh i calculated, it did not work.
Simple solution would be to center object in blender somewhere around its center of mass, but can this be avoided?
Can i somehow change the chairs center of mass in bullet?
Here is a picture of chairs acting more naturally after changing the center in blender:

All pictures were taken when rigidbodies were still and probably asleep.

sentences:
Gamma adjustment slider implementation Various online sources talk in sufficient detail about gamma correction. By following them, I achieved a rendering pipeline that looks somewhat like this:

// Both are set to 2.2
uniform float gammaIn;
uniform float gammaOut;

void main()
{
    vec3 color = pow(texture(material.albedo, texCoord).rgb, vec3(gammaIn));
    // Do lighting and then HDR tone mapping here.
    //   color = ...
    FragColor = pow(color, vec3(1.0 / gammaOut));
}

That is the easy part.

Now, many games implement the gamma correction adjustment slider that is meant to accommodate for display differences in various monitors that players may have. This presents some questions that I couldn't find any definitive answer to:

Which value should the adjustment slider affect? I reckon it will be gammaOut because gammaIn deals with decoding of the sRGB picture and assuming that all textures are sRGB, this should always be the const 2.2. With this approach a lower gammaOut means darker picture.
What's the reasonable value range for the slider? Should it start at 1.0 or somewhere higher? Where should it end?
If I were to display the "barely visible / invisible" comparison combo picture to help the user with doing the adjustment correctly, what should be the color values for the "should be barely visible" dark picture and its background and ditto for the "should be invisible" bright picture and its background?

sentences:
How do I get line numbers in a unity headless server's stack trace? For some reason Unity 5 doesn't allow me to do a developement build of a headless server, and this is quite a problem when debugging, since I get stack traces without line numbers, such as:

NullReferenceException: Object reference not set to an instance of an object
  at ClientServer.Update () [0x00000] in <filename unknown>:0

Trying the xvfb trick to run a pseudo-headless server, which doesn't prevent enabling debugging symbols, doesn't work (it crashes mono for some reason).

I'm really at a loss on how to debug an headless server… is there something I'm missing?

sentences:
Gradle Build Error Unity 2019.1.6 I found out that unity has deprecated the internal build system and has defaulted to gradle. I've not built with the gradle build system before, and now after upgrading to unity 2019.1 full version, I can't build an android project.
And, I installed the android module using unity hub, what can I do to fix this?
Screenshot1
Screenshot2
Screenshot3
Screenshot4
Screenshot5
Screenshot6

sentences:
Unity Animation Controller and walking diagonally keeps switching between the two diagonals? Using Unity 2019.4.1f1 Personal.

I have the above Animation Controller. When only walking in one direction at a time and when you stop you stay facing that direction, this works as planned.

All of the transitions do not have an exit time and have a fixed duration of 0. I don't know what info to give as this is the first time I've used animation. Let me know and I'll add relevant details.
Here's my update function that updates the variables in the animator:
void Update() {
  float h = Input.GetAxisRaw("Horizontal");
  float v = Input.GetAxisRaw("Vertical");

  animator.SetFloat("Horizontal", h);
  animator.SetFloat("Vertical", v);

  if (Mathf.Abs(v) < Mathf.Abs(h)) {
    // flips the renderer to reuse other handed image
    spriteRenderer.flipX = h > 0;
  }

  // no actual movement until I figure this out
}

What I'm experiencing that I want to fix is when running diagonally:

It seems that when walking diagonally then the animator variables for Horizontal and Vertical are both either 1 or -1 and this causes the alternating of the sprites. What I'd like to happen is that the state machine would deterministically pick either N/S sprites or E/W sprites when moving diagonally. Turning on "Can Transition To Self" seems to properly pick a direction and stick to it but it fails to animate when only moving in a single direction. It looks like it's constantly transitioning to itself which starts over the cycle so I've left that unchecked on all transitions.
I'm not sure what the best way to fix this is. Most attempts I've tried so far complicate the state machine to the point it's unmaintainable. I also couldn't find anything about introducing priorities in a way that fixed the jitter.
What's the idiomatic Unity way to achieve clean diagonal movement in 2D?

sentences:
Run Love2D on iphone and android I have a game developed in lua using love 2d, and now i want to run it in ios/android.

Is there any porting or way available to do that.

Thanks.

sentences:
Sprite sheet generator I need to generate a sprite sheet with squared sprite for a 2D game. How can I generate a sprite sheet where each frame has x = y? The only think I have to do is to "insert" some blank space between sprites (in case y were > x in the original sprite). Is there any program that I can use to trasform "irregular" sprite sheets to "squared" sprite sheets?

An example of non-squared sprite sheet: http://spriters-resource.com/gameboy_advance/khcom/sheet/1138

sentences:
Error OpenGL null Cocos-2D/Visual Studio When I try to execute a game code fully functional on Visual Studio 2013, using Cocos-2D (3.8.1) library this error jumps on screen. (I'm working on a laptop)

  OpenGL 1.5 or higher is required (your version is (null)). Please upgrade the driver of your video card.

And then this one:

My Graphic card is an AMD Radeon HD 7600M (OpenGL version 4.x), with de drivers fully updated.

Neither my college teacher nor me know how to fix it.

What can I do to fix it?

sentences:
Transparency sorting in 3D world with different render types I am rendering a world, object, and models from an older game format. The world is presented in a BSP tree so I can quickly iterate through. The opaque surfaces are rendered front to back. Then transparent surfaces are rendered back to front. For the world, that is all fine. I add the transparent pieces into a stack and pop them off one at a time and render.

Now I am realizing that characters that move in the world also support transparency and there is a possibility for error if I render them after the world and they happen to be overlapping with other semi transparent surfaces. Similarly, I have objects to handle.

The solution I have been kicking around in my head is to create a vector of containers that hold my current render structure and a distance from the camera. I would then sort these structures based on distance and then render them one by one.

As it stands now, my render call accepts a pretty generic object:

struct RenderCall
{
    GLuint textureID;
    int indexStart;
    int indexCount;
};

struct TransparentRenderCall
{
    float distanceToCamera;
    RenderCall call;
};

What do you think? Is there a more streamlined way to do this?

sentences:
Circle Collision Resolution and Angular Momentum I have a 2D engine working pretty well that involves rectangles and circles.  I just reworked parts of the collision detection/response system for better handling of angular speed/momentum.

The collision response algorithm I'm using is described here: http://www.myphysicslab.com/collision.html (the complicated "j = ..." equations towards the bottom of the page under "Physics of Collision for Rigid Bodies in 2 Dimensions").

Everything's working great, but I'm wondering about circles.  No matter how another another rectangle or circle hits a circle, it's impossible for the circle to gain angular speed through a collision, since the collision normal vector is always perpendicular to surface of the circle.

This makes sense to me mathematically, but it goes against my real-life intuition.  For example, in the picture below, if I poke a ball on the side with a rectangle (tangentially, not towards the middle of the ball), I expect the ball to start spinning (counter-clockwise in this case).

Why isn't this happening for me?  Do I need some kind of non-instantaneous collision (deformation maybe?) to experience this effect?  If so, is there a way to "fake" it? (Realistically! I don't want to mess up the realistic linear/angular momentums and energies of my system!)  Thanks in advance for the help!!

sentences:
Unity: how to position items into a Scroll View? I'm trying to add items (prefab) into a Scroll View but either if I simply add items without set positions and trying to setting position it not work.

Case 1: without setting position

Result: All items overlapping

Case 2: forcing positions (like commented row code below)

Result: Items not overlapped but X position take the same value (that not is 0)

 for (int i = 0; i < rows.Length; i++)
 {
        GameObject newObj= Instantiate(MyRowPrefab);
        newObj.transform.SetParent(ScrollViewObject.transform, false);
        //newObj.transform.localPosition = new Vector3(0, (-1 * ((i * rowHeight))), 0);
        // If i decomment this line, X isn't set to zero... why ?
  }

sentences: Why has it become commonplace for NPCs to have one weapon per class instead of variants? For instance, in Half-Life 2 you have Civil Protection, Combine Soldier and Combine Elite. Each class has a weapon. Is there a shift away from this at all, where the NPCs are matched with the player in the sense that the weapon they choose to use is based upon their advantage, while still maintaining some sense of competitiveness? Is there a reason this became the norm? Does it have to do with all the variables and complications that can arise from doing that?

sentences:
Smooth decelerate, interpolation? I have two points A and B.  I want to perform a smooth deceleration from A stopping at B over time t.  The only thing I managed to do so far was a lerp, which isn't right of course because it's unnatural.  I also tried multiplying the velocity by some factor (0.9 or similar), but then I don't know how to choose the factor such that the end point B is reached (or as near to it as some epsilon value seems reasonable).

Does anyone have something relatively simple that I could use?  I can read C++ and C# code.

sentences:
Tone mapping and eye adaptation - pale colors and darker image I'm trying to implement tone mapping along with eye adaptation and HDR. Actually I implemented this already but I'm not satisfied with result and I think that I made something wrong.

My final image (before postprocessing) I store in half float texture. I have also 2 helper textures. The first one stores log luminance and avg, min and max color of it in last mip-map. The second one stores adapt value which is computed as:

prevLum + (avgLum - prevLum) * (1.0 - exp2(-adaptionRate))

where prevLum is previous adapt value (size of this texture is 1x1). Log luminance texture is R8B8G8 format and the second one is R8. In tutorials I saw that half float textures are used but in my case I've got too bright images (almost white).

In the final postprocess shader I'm using all of there values to obtain eye adaptation and tone mapping using this code:

float autokey(in float lum) {
    return 1.03 - 2.0 / (2.0 + log10(lum + 1.0));
}

float hejl(in float color) {
    float x = max(0.0, color - 0.004);
    return (x * (A * x + B)) / (x * (A * x + C) + D);
}

float adaptedLum = texture(adaptedLuminance, vec2(0.5)).r;
float exp = exposure * autokey(adaptedLum) / adaptedLum;
result *= exp;

result.xyz=RGB2xyY(result.xyz); // conversion to CIE xyY

result.z = hejl(result.z);

result.xyz=xyY2RGB(result.xyz);

And here is my results:

eye adaptation and tone mapping turned on

eye adaptation only

tone mapping only

everything off

As you can see when tone mapping is turned on bunny color is paler. And when eye adaptation is turned on final image is much darker. Could someone explain me what could cause that, because I think that something here is wrong. Maybe it's something with color spaces which I don't understand well? Or with bloom which is applied before tone mapping and eye adaptation?

I have also another strange behaviour with eye adaptation. When I'm looking on dark areas, background (sky) get brighter. It's ok but it happens always when the center of camera is on black area (no matter how far camera is from this area).

I basen on implementation included in projects on this pages:
John Chapman,
Nutty Software

sentences:
how to slide pieces for a slide puzzle game for android(libgdx) I want to make a small one-screen game in which the player has to slide pieces of an image until the image is completed. I used texture regions to create the pieces from an image

int numOfTiles_Horizontal = 5;
int numOfTiles_Vertical = 5;

float tile_width = img.getWidth() / numOfTiles_Horizontal;
float tile_height = img.getHeight() / numOfTiles_Vertical;

TextureRegion[][] tiles = new TextureRegion[numOfTiles_Horizontal][numOfTiles_Vertical];
for(int col = 0; col < numOfTiles_Horizontal; col++) {
    for(int row = 0; row < numOfTiles_Vertical; row++){
        tiles[col][row] = new TextureRegion(img, col * tile_width, row * tile_height, tile_width, tile_height);
    }
}

, but I'm unsure about how to allow the player to move the tiles into a blank space as well as making a "blank space" to allow tiles to move.

The game would look like this:

I followed some tutorials for libgdx but cannot find much on achieving this.

I am new to the engine and Android development so any help is appreciated.

sentences:
AndEngine Font Issue I am learning AndEngine. I am displaying Hello world using this code:

public class myactivity extends SimpleBaseGameActivity
{

 private final int CAMERA_WIDTH = 320;
 private final int CAMERA_HEIGHT = 480;

 private Camera  m_Camera;
 private Scene  m_Scene;

 private Font  font;
 private Text  text;

 @Override
 public EngineOptions onCreateEngineOptions()
 {
  m_Camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
  EngineOptions en = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(
    CAMERA_WIDTH, CAMERA_HEIGHT), m_Camera);

  return en;
 }

 @Override
 protected void onCreateResources()
 {
    //determine the density
 WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
 Display display = windowManager.getDefaultDisplay();
 DisplayMetrics displayMetrics = new DisplayMetrics();
 display.getMetrics(displayMetrics);
 int density = (int)(displayMetrics.density);

 //scale desired size 25 by density
     int fontSize = (int) (25 * density);
  font = FontFactory.createFromAsset(this.getFontManager(), this.getTextureManager(), 1024, 1024, this.getAssets(),
    "times.ttf", fontSize, true, android.graphics.Color.BLACK);
  font.load();

//Texture fontTexture = new BitmapTextureAtlas(1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
//font = new Font(fontTexture, Typeface.create(Typeface.DEFAULT, Typeface.NORMAL), fontSize, true, Color.WHITE);
//mEngine.getTextureManager().loadTexture(fontTexture);
//mEngine.getFontManager().loadFont(font);

 }

 @Override
 protected Scene onCreateScene()
 {
  m_Scene = new Scene();
  m_Scene.setBackground(new Background(Color.WHITE));

  text = new Text(0, 0, font, "Hello Android", this.getVertexBufferObjectManager());
  m_Scene.attachChild(text);

  text.setPosition(CAMERA_WIDTH/2 - (text.getWidth()/2), CAMERA_HEIGHT/2 - (text.getHeight()/2));
  return m_Scene;
 }

}

It is displaying the font like this:

As you can see that pixels are stretching and font is looking ugly with too much pixelation. How do I display proper font text with no pixelation or add anti-aliasing to the font?

sentences:
Scaling web game to suit any screen size I've made a simple multiplayer game, and now trying to make it fit on any screen size. I've tried stretching it out to fit the browser size, but it just appears weird and distorted. I'm also trying to avoid having borders around the edges as it doesn't look particularly nice.

Is there a way to solve this that is fair to all players?

sentences: How to adjust my games speed to fps Hi so i am making a small sort of physics engine, but if your fps is really slow the physics will update slower and objects will move slower. How do i make the speed of objects greater if the fps is lower so that on a computer with 5 fps the object will land at the same time as on a 60 fps computer? (just with that slow framerate)

sentences:
Animator has not been initialized My animation is working but unity keep saying that my Animator has not been initialized error
Here my Code:

using UnityEngine;
using System.Collections;

public class Player: MonoBehaviour {

public float maxspeed = 10f;
bool facingRight = true;

Animator anim;

bool grounded = false;
public Transform groundCheck;
float groundRadius = 0.2f;
public LayerMask whatIsGround;

void Start ()
{
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
    if (move > 0 && !facingRight){
        Flip ();
    } else if (move < 0 && facingRight) {
        Flip ();
    }
}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

}

sentences:
Fade a texture effect as it nears the end of a cylinder mesh In my game I have a laser beam that travels for about 15m, but abruptly stops due to the mesh the texture is attached to. How can I setup my shader graph so that the end of the texture fades away? I can't find anything similar to this anywhere online, and have tried multiple things (gradient/colors with lerp attached to alpha) but just can't figure it out as I'm too new to the whole shader graph thing. Anything helps, thank you.
Note: The texture is 'animated' and scrolls along the path of the beam using the shader graph

sentences:
XNA and HLSL shaders - Instancing using World Matrix array I have posted this question on StackOverflow and was directed here, so I'll just copy the question:

I am attempting to improvise some sort of hardware instancing in my game. I wish to draw multiple trees with only one Draw Call.

So far, I have set up a class which holds the model, texture, and an array of Matrices. Each matrix corresponds to a location of one tree in the game world.

I have determined to use 50 copies of object as hard coded limit within my class and my shader.

I am sure that the matrices generated are correct ones. Using Basic effect with multiple draw calls and switching out World matrices between them does yield in correct number of trees on their correct locations.

I have tried a shot-in-the dark approach:

float4x4 View;
float4x4 Projection;
float4x4 World[50];

...

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output[50];

    for (int i=0; i<50; i++)
    {
        float4 worldPosition = mul(input.Position, World[i]);
        float4 viewPosition = mul(worldPosition, View);
        output[i].Position = mul(viewPosition, Projection);
        output[i].texCoord = input.texCoord;

        return output[i];
    }

}

To my surprise, this actually did compile, and to even greater surprise, didn't melt my GPU.

To not so big of a surprise, this draws only one tree, the first one, as the loop ends as soon as it hits the "return" keyword as any sane mind would expect it to.

I have tried my google-fu skills with googling this kind of problem, but majority of the results deal with C++ code (I'm using C# + XNA), and their approach to the problem is basically to collect all needed model's vertices and forward all that, as one huge model drawn with one World matrix position.

Is there a reliable way to draw one model using an array of World matrices on a shader, or must I collect all vertex data and batch it that way?

P.S. I am attempting to toy around with nested structures, like these:

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 texCoord : TEXCOORD0;
};

struct VSOUT
{
    VertexShaderOutput output[50];
};

VSOUT VertexShaderFunction(VertexShaderInput input)
{
    VSOUT output;

    for (int i=0; i<50; i++)
    {
        float4 worldPosition = mul(input.Position, World[i]);
        float4 viewPosition = mul(worldPosition, View);
        output.output[i].Position = mul(viewPosition, Projection);
        output.output[i].texCoord = input.texCoord;

    }

    return output;
}

But, of course, as the loop gets unrolled, the very next instance of Output gives an overlapping semantic error. I am pretty sure there are no POSITION50 and TEXCOORD50 semantics :p So, how would I go about solving this problem?

Thank you in advance!

sentences:
How can I implement simple distributed processing in a Unity game? I'm looking to set up a game which uses distributed processing. Just a simple brick shooter in unity with the distributed part being that the calculations for the falling blocks are handled by another PC and the transformations are sent back and applied to a clients machine.

To use this in Unity I assume I'll be using Remote Procedure Calls?
Will I also require socket programming? Any other networking elements I require?

sentences:
Are there cases where globals/singletons are useful in game development? I know that having global variables or singleton classes creates cases that can be difficult to test/manage and I have been busted in using those patterns in code but often times you gotta ship.

So are there cases where global variables or singletons are actually useful in game development?

sentences:
How can I change the hardness and blast resistance of Minecraft blocks? I want to make the strength of the iron block and obsidian switch places, along with other changes to block strength and blast resistance. I am not allowed to swap the textures or anything like that. I need to actually change the values of each block.

To do this, I need to know where Minecraft stores the blast resistance and hardness.

Is decompilation required? If so, which class file do I need to look into?

sentences:
Unity block chunk generation pattern I am trying to do something like Minecraft game in Unity. Currently I am trying to generate a chunk of blocks, given dimensions. I can successfully create a chunk of N x 0 x 0 sized chunk, but due to lack of logic, I have no idea on how to make triangles and vertices match for other blocks.

Basically, what I mean is, I can generate something like this:

But can't do this:

My Block vertices and Triangles:

Vector3[] cVerts = {
        new Vector3 (0, 0, 0), //0
        new Vector3 (1, 0, 0), //1
        new Vector3 (1, 1, 0), //2
        new Vector3 (0, 1, 0), //3
        new Vector3 (0, 1, 1), //4
        new Vector3 (1, 1, 1), //5
        new Vector3 (1, 0, 1), //6
        new Vector3 (0, 0, 1), //7
    };
int[] cTris = {
        0, 2, 1, //face front
        0, 3, 2,
        2, 3, 4, //face top
        2, 4, 5,
        1, 2, 5, //face right
        1, 5, 6,
        0, 7, 4, //face left
        0, 4, 3,
        5, 4, 7, //face back
        5, 7, 6,
        0, 6, 7, //face bottom
        0, 1, 6
    };

Chunk creation method:

     void CreateChunk(){
        ...
        for (int x = 0; x < 100; x++)
        {
           for(int y = 0; y < 10; y++){
               for (int z = 0; z < 1; z++)
               {
                  AddBlockAtPosition(new VectorInt(x, y, z), "Grass");
               }
           }
        }

        ChunkMesh.vertices = CurrentChunkVerts.ToArray();
        ChunkMesh.triangles = CurrentChunkTris.ToArray();

        //ChunkMesh.uv = uvs.ToArray();
        ChunkMesh.RecalculateNormals();
   }

AddBlockAtPosition() method:

    void AddBlockAtPosition(VectorInt pos, string name)
    {
       int x = pos.x, y = pos.y, z = pos.z;

       //create separate cube data
       CubeMesh cube = new CubeMesh(vertices.ToArray(), triangles.ToArray(), uvs.ToArray());
       //I use MoveCube() to change each Block's vertex and triangle numbers, so they will "match" in a Chunk mesh, when they become part of it.
       cube.MoveCube(new Vector3(x, y, z), (x + y + z) * 8);
       //cube.MoveUV(new Vector2(x + y + z, x + y + z));

       CurrentChunkVerts.AddRange(cube.Vertices());
       CurrentChunkTris.AddRange(cube.Triangles());
       //CurrentChunkUV.AddRange(cube.UVs());
    }

And most importantly, that's where my problems are, MoveCube();

Class Cube{
    private Vector3[] vertices;
    private int[] triangles;
    ...
    public void MoveCube(Vector3 direction, int n)
    {
        for(int i=0; i<vertices.Length; i++)
        {
            vertices[i] += direction;
        }
        for (int i = 0; i < triangles.Length; i++)
        {
            triangles[i] = triangles[i] + n;
        }
    }
}

I know that I am not the first to re-create minecraft, I have found this tutorial https://www.blockstory.net/node/56

But for me as a beginner, some "simple" parts like these I have problems with are skipped. And other tutorials just generalize the idea, which isn't enough for me.

sentences:
Game Maker - Create Instance When Health Is 0 I have five objects: obj_Boss, obj_bossHealth, obj_GameOver, obj_BtnOK, and obj_rec2.
This is what I want. When obj_Boss has no more health, obj_GameOver and obj_BtnOK will appear.
This is my first method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)
No More Health: create instance of obj_GameOver; create instance of obj_BtnOK

This is my second method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar
Step Event: if global.bossHealth is equal to 0 then create instance of obj_GameOver and create instance of obj_BtnOK

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)

The result of both methods:
obj_GameOver and obj_BtnOK won't appear. How can I fix this? Please explain your answer. Thanks.
I add some images: method1 method2

sentences:
Draw 3D ellipse in monogame/xna I am programming a 3d solar system (simulator).
To describe the path of a planet I wanted to add 3D rectangles.. and draw them.
But to no surprise it decreased the frame rate extremely.
Also it does not look nice:

Do You know how to handle this problem?
Is there another way to solve this?
Didn't found anything on 3D HLSL Circle Plotting.

sentences:
C# - console application, array problem I have problem in very simple console app, code looks like this.

int x - player moving and changing axis "x" and I want make full history of moving via array. See code(only example) below...

Thank you for your help and answer

  int round = 0;

  while(infinity){

  int[] PosXSave = new int[round + 1]; //theoretically infinity size of arrray.

  PosXSave[round] = x; //every round i want save current value of x, but
                       //only last save have propertly value and rest are
                       //zero or other number

  round++

  }

sentences:
unity animation won't play unless input key is held The code is simple. If the player presses the right arrow key, one animation clip plays. If the left arrow key, another clip plays, etc. However, the clip doesnt play fully unless the input key is held continuously. The second you release it, the second the clip stops playing. I think it's something to do with update() and the input not being remembered over next frame.

The code is simple:

using UnityEngine;
using System.Collections;

public class animatorcontroller_Logic : MonoBehaviour
{

    Animator anim;

    enum MovementState
    {
        Idle = 0,
        run = 1,
        walk = 2,
    }

    MovementState currentMovementState;

    void Start ()
    {
        anim = gameObject.GetComponent<Animator> ();
    }

    void Update ()
    {

        if(Input.GetButton("right"))
        {
            currentMovementState = MovementState.run;

        }

        else if(Input.GetButton("left"))
        {
            currentMovementState = MovementState.walk;

        }

        else
        {
            currentMovementState = MovementState.Idle;    //set movement state to idle
        }

        anim.SetInteger("MovementState", (int)currentMovementState);

    }

}

sentences:
Recognize pattern in 3D building environment I'm currently developing 3rd person building game (as bacheleor thesis). I need to recognize constructed patterns co I can mark corresponding structure as some building (so player can start using that building).

I have folowing rules:

3 types of building blocks (all based on cube) (and in future there will be more types)
any block can be scaled up to k multiple in each axis (k = 20)
blocks can be rotated by any axis (but stays in 3D grid)

  Problem definition:
  4 cubes of base size (1,1,1) in a grid 2x2 should be equivalent to 1
  box size (2,2,1), so all possible variants (mainly different in rotation) could be evaluated as valid pattern construction.

I expect that my patterns will be up to 30x30x30 multiple of base size.

For example, I'd like to recognize structure like this: (currently placed in level by hand)

Size is 21x21x22 and it is constructed from multiple objects.

As a limitation, I will border pattern search from exact point (lets say control console for that structure). Current limitation constant is around 50x50x50 multiple of base cube. (Limit is subject to change based on answers here.)

I searched over 20hrs and result was only papers to recognize 3D structure from 2D image or recognize exact structure in 2D.

  My problem is that with growing K( each X,Y,Z) there is exponencially growing number of structures, which should be accepted as correct pattern construction.

  Question: What algorithm (+ heurestic) should I use?

EDIT: following 3 images contains visualization of structures, that are considered as correct variant of pattern at image 4, thus they should be found and accepted.

All together has same final shape (and has same material at same places). I simplified the problem only to 2D shape, but extending in 3D space is obvious.

Thank you for all answers / comments.

sentences: How to track and find entities within radius in realtime game? What is best approach to implement tracking in real time for, say, 1000 npcs? Every frame update simple a square grid (remove or insert into linked list) and every time check in square radius? I tried kd-tree but its really bad in real time updates even with 100 entities I can't reach 10 FPS.

sentences:
Baking artifact in Unity I am using unity 2017.1.0 f3, Enlighten baking, with Generate lightmap UV ticked in import settings. Also the object has prioritized illumination and the light map resolution is high. An example of the artifact is shown.

The lightmapping settings is as follows.

The issue doesn't appear in Realtime illumination.

The object is marked static. Can someone help me?

sentences:
How do I determine that the edge of the camera intersects the edge of the background sprite? UE4 I'm trying to make sure that when the camera reaches the border (left or right) of the sprite's background, a copy of it is spawned from the corresponding side. But I seem to be missing something in the Unreal Engine.
Now I define the intersection of the camera and the sprite boundary as follows:

I take the X coordinate of the sprite and subtract half of its size. (Get it's left border)
I also take the camera coordinate and subtract half of the orthographic length (Left border of a screen?)

    ParallaxItems[Index]->GetActorBounds(false, ActorOrigin, BoxExtent, false);

    FVector ActorOrigin, BoxExtent;
    if ((NewBackgroundPos - BoxExtent.X) >
        CamManager->GetCameraLocation().X - (CamManager->GetOrthoWidth() / 2)) {

      UE_LOG(LogParallax, Warning, TEXT("Background %d LeftBorder! need spawning"), Index);
    }

This seems to be true, but I'm missing something else, perhaps a scale. (But box extent changes correctly) For some reason, the condition is triggered already on the blue line. And this is true for all backgrounds. Somewhere earlier, somewhere later, but player can always see that the background is over. Maybe it's the orthographic width of the camera? Now it's 2048.
If I am wrong, please tell me how to do it correctly? Thank you.

sentences:
How to scale openGL textures by a ratio based on height/width (or alternative)? I have been able to successfully allow my UI to extend over edges of my game on higher resolutions by using the Android Guide and by implementing this code on the GL10 object:

gl.glTranslatef(GTEngine.get_SCREEN_RATIO(), 0f, 0f);

Where the first parameter is the ratio calculated by dividing the width by the height.

My confusion arises in the ability to use :

gl.glScalef(n,n, 1f);

... to scale the image by using the same screen ratio in order to account for the "growth" or "shrinkage" that comes with different resolutions. Does anyone have a solution for this n variable? I cannot seem to make up some mathematically solution that works, and am worried that I may be forced to build a case by case logic (>.>)

sentences:
Libgdx How to overlay two images on Table I'm trying to set the player image inside the circle of the bars. I've tried to use stack, to position it topLeft but it does not work.

    Stack stack = new Stack();

    healthbar = new Image(new Texture(Gdx.files.internal("data/ui/healthbar.png")));
    playerLook = new Image(player.getFrame());
    stack.add(healthbar);
    stack.add(playerLook);

    Table table = new Table();
    table.top();
    table.setFillParent(true);

    table.add(healthbar).expandX().pad(10).left();
    table.add(playerLook).expandX().pad(10).left();

    stack.add(table);
    stage.addActor(stack);

sentences:
3d immersive Virtual Conference meeting environment development on the web (3d website)-Help required I want to develop 3d immersive virtual collaborative conference meeting environment on the web i.e an immersive virtual environment for our university Teachers to attend and address conference (meeting) Virtually in 3d

Each attendee have login with their customized avatar and can collaborate and discuss different issues(USING SPEECH IN REAL TIME) with each other by using their personalized avatar(other teachers present in meeting Virtually ) I want to implement these features + some other like text support , Multimedia Projector for presentation etc

I need help regarding platform selection preferably I want to Implement it as a webpage (3d website) with no installation or plugin support (plugin independent ) other wise I'll go for Plugin Solution I don't know WebGL and graphics programming I want to do it more by designing in 3d and integration with reusable components

I'm confused in choosing platform I've explored these names so far [ WebGL/Google O3d/web 3d's X3D ,VRML /X3doom/Sirikata Platform/yogurt3d/Unity3d/Jibe/OpenSim/Papervision3d/Flash/3dmlw/Java3d/Infinity3d/ Cube3/CloudMach] also please tell me if other are available and appropriate for me

sentences:
unity emission map bleeds (bug?) I have a material with a spritesheet texture (albedo) and an emission map.
The spritesheet has 32x32 squares. The emission has a 32x32 square that is an emission for the magma-looking square.

It works well on the magma, however, the glow also spreads to the sand, grass, planks, and snow_grass textures. You can clearly see it spread on the sand (bottom-rightmost opaque texture) in the right because it isn't directly touching the magma. Here is another picture where it is attached

You can still see the spreading of glow if you look closely.
Now, you can definitely see it glow here

How do you stop that from happening? That artifact is really weird and i really need it to go away. I've tried decreasing the size of the square in the emission map but it still was there. Please help.

Thanks.

EDIT 1
Here is how I apply uv

`
public static Dictionary textureMap = new Dictionary();

public static void Initialize(string texturePath, Texture texture)
{
    Sprite[] sprites = Resources.LoadAll<Sprite>(texturePath);

    foreach (Sprite s in sprites)
    {
        Vector2[] uvs = new Vector2[4];
        uvs[0] = new Vector2(s.rect.xMin / texture.width, s.rect.yMin / texture.height);
        uvs[1] = new Vector2(s.rect.xMax / texture.width, s.rect.yMin / texture.height);
        uvs[2] = new Vector2(s.rect.xMin / texture.width, s.rect.yMax / texture.height);
        uvs[3] = new Vector2(s.rect.xMax / texture.width, s.rect.yMax / texture.height);
        //Debug.Log(s.name);

        if (!textureMap.ContainsKey(s.name))
        {
            textureMap.Add(s.name, uvs);
        }
    }

}

public static bool AddTextures (Block block, Direction direction, int index, Vector2[] uvs)
{
    string key = FastGetKey(block, direction);

    Vector2[] text;
    if (textureMap.TryGetValue(key, out text))
    {
        //Debug.Log(key);
        uvs[index] = text[0];
        uvs[index + 1] = text[1];
        uvs[index + 2] = text[2];
        uvs[index + 3] = text[3];
        return true;

    }

    text = textureMap["Default"];

    uvs[index] = text[0];
    uvs[index + 1] = text[1];
    uvs[index + 2] = text[2];
    uvs[index + 3] = text[3];

    return false;
}

`

Where Direction is a direction (example north) and Block is a short. Index is the vertex index of the mesh. Texture is the sprite texture (.png)

sentences:
Blue, Red and pink Materia Hi guys i just started using unity recently but today after working on some animation blending, most (not all) prefabs changed to look like this:

What's the cause, and how can i fix it? i tried creating a new project then copied my Asset directory to it but still. also when i try importing a new character i still see the same.

Material structure.

sentences: Should all stats only exist on MySQL database for my Flash browser RPG? I'm creating a browser RPG in Flash which will have some multiplayer elements and in-app purchases so security is a high concern. Would it be better to have all game stats like health and such exist only in the MySQL database and retrieve them every time I need them? The game is turn based, but that would still require very frequent connections to the database. I could use local copies to cut down on the number of connections, but I imagine that would make it much easier for people to cheat.

sentences:
C++ SFML: Keypressed Event not registering half the time? I have a very simple event handeling system at the moment.

void LevelScreen::PollInput()
{
    sf::Event event;

    while (pWindow->pollEvent(event))
    {
        if (event.type == sf::Event::KeyPressed)
        {
            int x = 0;
            int y = 0;

            if (event.key.code == sf::Keyboard::Left)
            {
                x = -1;
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                x = 1;
            }
            else if (event.key.code == sf::Keyboard::Up)
            {
                y = -1;
            }
            else if (event.key.code == sf::Keyboard::Down)
            {
                y = 1;
            }

            pCursor->Move(x, y);
        }
    }
}

The system gets updated every single cycle, yet many keypresses are not even registered eventhough there is no lag. Mouse movement is always registered, but when I press, for example, Down alot it fails to register from 30% to 50% of the time. Same counts for the mouse button, if I hold it down I can see that it registers it for 6 times in a row, then stops for about 5 seconds, continues, etc.

Putting it in the main loop doesn't change anything. I cannot find any reason for this input lag.

sentences:
Unrealscript splitting a string Note, this is repost from stackoverflow - I have only just discovered this site :)

I need to split a string in Unrealscript, in the same way that Java's split function works.

For instance - return the string "foo" as an array of char.

I have tried to use the SplitString function:

  array SplitString( string Source, optional string Delimiter=",", optional bool bCullEmpty ) Wrapper for splitting a string into an array of strings using a single expression.

as found at http://udn.epicgames.com/Three/UnrealScriptFunctions.html but it returns the entire String.

simulated function wordDraw() {

local String inputString;
inputString = "trolls";
local string whatwillitbe;
local int b;
local int x;
local array<String> letterArray;

letterArray = SplitString(inputString,, false);
for (x = 0; x < letterArray.Length; x++)
{
        whatwillitbe = letterArray[x];
        `log('it will be '@whatwillitbe);
        b = letterarray.Length;
        `log('letterarray length is '@b);
        `log('letter number '@x);
}

}

Output is:

b returns:

  1

whatwillitbe returns:

  trolls

However I would like b to return 6 and whatwillitbe to return each character individually.

I have had a few answers proposed, however, I would still like to properly understand how the SplitString function works. For instance, if the Delimiter parameter is optional, what does the function use as a delimiter by default?

sentences:
Phaser.io with Socket.io - What should the Server calculate and what the Client? I'm currently playing around with phasio.io and socket.io to create a really simple multiplayer.

For the beginning i created basic movement which is synched via socket.io. The clients are sending their positions to the server and the server broadcasts it to the other clients. This works fine, however I'm aware of the fact that every user could simply cheat by emiting wrong positions.

Exactly this is where I need some new ideas. I'd really like to use phaser because it is really helful with all the animations and rotations etc. However, I kinda know i should calculate movements etc. in the backend - not in the client.

But is there a way to use phaser.io on a node server to run a game instance which then calculates the positions? Or do I need to build my "own game engine" in the backend?

An basic example would be:
A player shots ( in a tank game for example ) towards another player. Using phaser only this would be very simple. But in a multiplayer i would now need to do the collision calculation on my own - right?

Any ideas ?

sentences:
vertices, better to have more but draw a smaller area or less but expand a larger area I have a simple question really. I am creating water for a game and had two different design approaches:

Make a single plane that expands the entire playspace, which would take 6 vertices but cover a much larger area. The idea being the plane would be at a certain height so the sourrong land if higher should cover it.
Check at regular intervals around the created land, ask if the height of that peice of land is below a certain height if so, draw a small square to cover the area and then check the next interval and the next... The idea being you'd have a lot more vertices but much less area will be drawn.

Any help would be appreciated as to which design approach makes more sense.

sentences:
Coroutine problem, I don't know what's happening Calling function.

 private const int deathHangTime = 2;
 private void Die()
    {
          Debug.Log("1 " + Time.time);
          StartCoroutine(DelayForTime(deathHangTime));
          Debug.Log("4 " + Time.time);
    }

  Coroutine

IEnumerator DelayForTime(float time)
{
     Debug.Log("2 " + Time.time);
     yield return new WaitForSeconds(time);
     Debug.Log("3 " + Time.time);
}

Why doesn't it wait for 2 seconds?
Why doesn't it print the 3rd Debug line?

sentences:
Is there a way to setup a notification from Unreal Engine when it finishes packaging / building my game? In Unity I was able to use a post build script to send myself an email when Unity finishes building a game. Is there a way to make a script run when Unreal Engine is done packaging a game?

Or any other way to set up a notification sound or visual prompt in my Windows PC to alert me when it finishes packaging?

sentences:
First time working on 3D game: exporting steps after designer finishes 3D characters? First time making a 3D game so could use advice. The designer is creating 3D characters with Cinema 4D (https://www.maxon.net/en/products/cinema-4d/overview/).

What steps are required to go from his 3D models to generate the files and texture maps (e.g., diffuse, normal) required to render the characters on iOS?

Is this export done within Cinema 4D, or does there need to be an intermediary step?

Does the process change if the characters are animated?

sentences:
How can I move an object over linerenderer lines positions? I have 4 cubes the first 3 cubes connected with two lines one of the lines is curved. The fourth cube I want to move over the lines. The lines is built using linerenderer and in the linerenderer there are 397 positions. I created a small script that move an object over the positions. I checked and I have in the array 397 positions and the loop get to 397 but the object (Cube (3)) never moving all the positions only some. Or maybe the positions I get are not the same in the linerenderer ?
This screenshot show some of the positions in the linerenderer this is the positions I want the object to move on :

Why the object is not moving over all the positions , only on some ?
And this is the script I created that should move it :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveOnCurvedLine : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public GameObject objectToMove;
    public float speed;

    private Vector3[] positions = new Vector3[397];
    private Vector3[] pos;
    private int index = 0;

    // Start is called before the first frame update
    void Start()
    {
        pos = GetLinePointsInWorldSpace();
    }

    Vector3[] GetLinePointsInWorldSpace()
    {
        //Get the positions which are shown in the inspector
        var numberOfPositions = lineRenderer.GetPositions(positions);
        //Iterate through all points, and transform them to world space
        for (var i = 0; i < numberOfPositions; i += 1)
        {
            positions[i] = transform.TransformPoint(positions[i]);
        }

        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if(index <= pos.Length - 1)
        {
            objectToMove.transform.position += pos[index] * Time.deltaTime * speed;
            index++;
        }
    }
}

Now I checked using a breakpoint the first position in the linerender at index 0 is : X = 30.57, Y = -6.467235, Z = 4.98
But in my script in the pos array I see that in index 0 the position is :
X = 30.6, Y = -6.5, Z = 5.0
And the result is that the object that move Cube(3) is moving only some of the way and also it's not exactly on the line :

Why the object is not moving over all the positions , only on some ?
Something is wrong in my script with getting the right positions from the linerenderer and maybe also the loop and the move is wrong. I can't figure out ho to do it.

sentences:
How to post player´s score on Facebook (with js) I have my game made with Phaser (and compiled with cocoon.io) and on the leadersboard state I want to let the user to post his score on Facebook.

Well, I created an App on Facebook and I´m not finding a good solution to create this simple post, something like "I scored 10 points on this riduculous game..." Pretty easy on Twitter and not so easy on Facebook, I can find information about posting links and that stuff but I´m not finding a proper way to create a simple post just with text.

How do you guys do this? I guess I´m missing something, it shouldn´t be so complicated.

(I already tested this link and it´s not working for me Simple way to post score from my game to Facebook and Twitter? API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.)

sentences:
Event-/Input system with SFML: Cannot move diagonally in 2D I am a beginner in anything with game development. I written a small prototype in which i can move a square around with the arrow keys. For that i use SFML.

At the moment i experiment around with my Event System: First, to keep things simple, i was polling for the arrow keys using sf::Keyboard::isKeyPressed(), which works fine for this small kind of "game"

// in handleUserInput():
if(Keyboard::isKeyPressed(Keyboard::Left))
{
        player_.moveLeft();
}

// in player the player class:
void moveLeft()
{
    velocity.x = -x_speed; // sf::Vector2f
}

// in my player-class update() method:
void update()
{
// Out of bounds check and so on...
shape.move(velocity);
velocity.x = 0;
velocity.y = 0;
}

With this i was able to move horizontally, vertically and diagonally.

Then i moved to create my "real" EventSystem based on callbacks.
It wraps around sf::Window::pollEvent(). E.g. i register a callback method for the event type sf::Event::EventType::KeyPressed. So i changed my code to first register for the movement keys

event_system_.registerCallback(sf::Event::KeyPressed, [&] (const sf::Event& event)
    {
        switch(event.key.code)
        {
        case sf::Keyboard::Left:
            log->info() << "Moving Left";
            player_.moveLeft();
            break;
        case sf::Keyboard::Right:
            log->info() << "Moving Right";
            player_.moveRight();
            break;
        case sf::Keyboard::Up:
            log->info() << "Moving Up";
            player_.moveUp();
            break;
        case sf::Keyboard::Down:
            log->info() << "Moving Down";
            player_.moveDown();
            break;
        case sf::Keyboard::Escape:
            window_.close();
            break;
        }
    });

The problem i encountered was, that i couldn't move diagonally anymore.
After adding the loggin parts i found out, that when i keep two arrow keys pressed the only event that gets fired over and over again was the key pressed latest (e.g. i try to press Left & Down and pressed the Down-Key slightly later the Down-Event would be captured over and over again and the Left-Event only once).

After that i changed my code not to reset the velocity in my player's update-method and also registered for sf::Event::KeyReleased so that it would reset the x/y-part of the velocity when the corresponding key was released.

event_system_.registerCallback(sf::Event::KeyReleased, [&] (const sf::Event& event)
    {
        switch(event.key.code)
        {
        case sf::Keyboard::Left:
        case sf::Keyboard::Right:
            log->info() << "Stopped moving horizontally";
            player_.velocity.x = 0;
            break;
        case sf::Keyboard::Up:
        case sf::Keyboard::Down:
            log->info() << "Stopped moving vertically";
            player_.velocity.y = 0;
            break;
        }
    });

But somehow this does not seem right to me (But it wouldn't seem right to me to poll for every single possible input manually - So i think events is the things to take). Could anyone give me a hint what i am doing wrong and how to do it better?

Kind Regards

sentences:
How to prevent character from jumping multiple times I just started learning Unity yesterday, Ive asked in many forums/servers this question but no one gave me a solution for my problem (in the title) so here's my code:

public class scr : MonoBehaviour
{
    public float speed = 1f;
    private Rigidbody rb;
    public float jumpforce = 1f;
    private bool isGrounded;
    public float disToGround = 0.5f;

    //Vai obter o rigid body do character
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    //Movimentaçao do character
    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0f , moveVertical);

        rb.AddForce(movement * speed);

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

sentences:
GameMaker project works fine when targeting Windows but not when targeting HTML5 As mentionned in the title, my GameMaker project works fine when targeting Windows.

However, when I build it for HTML5, I got those errors in the Chrome developer console:

Destructive Dark.js?VYNZB=1666826811:7 Uncaught TypeError: Cannot read property '_42' of undefined
    at _Qw1._M [as _L] (Destructive Dark.js?VYNZB=1666826811:7)
    at _Qw1._a4 (Destructive Dark.js?VYNZB=1666826811:1490)
    at _a72._a4 (Destructive Dark.js?VYNZB=1666826811:1380)
    at _lK1 (Destructive Dark.js?VYNZB=1666826811:1155)
    at _9v2 (Destructive Dark.js?VYNZB=1666826811:1742)
    at _Mu2 (Destructive Dark.js?VYNZB=1666826811:1748)
    at _Ju2 (Destructive Dark.js?VYNZB=1666826811:1733)

I suppose this error is not really useful since it seems to come from the obfuscated Javascript... However, I noticed that this error appears on the "Left mouse button released" event on one of my object. The code associated with this event is the following:

/// Select the square or switch its place with the current selected square

game_manager = instance_find(obj_game_manager, 1);

if (game_manager.lock_timer == 0) {
    if (game_manager.selected_square == noone) {
        game_manager.selected_square = self;
        inst = instance_create(x, y, obj_selection);
        inst.depth = -100;
        inst.image_alpha = 0.6;
    }
    else if (game_manager.selected_square == self) {
        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }
    }
    else {
        // Lock interactions
        game_manager.lock_timer = 2;

        // Switch the array cells
        var x_temp = game_manager.selected_square.x_grid;
        var y_temp = game_manager.selected_square.y_grid;
        var color_temp = game_manager.selected_square.color;

        game_manager.grid_array[x_temp, y_temp] = color;
        game_manager.grid_array[x_grid, y_grid] = color_temp;

        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }

        with (game_manager) {
            event_perform(ev_alarm, 0);
        }
    }
}

Not much info sorry, but I have no ideas where this error came from.

sentences:
Unlit Node Shadow Shader Graph How to make unlit node cast shadows?
Is is possible with the current state of Shader Graph in LWRP?

In this great article Toon Shader OP grabs pass from VertexLit shader. Is something similar achievable with Shader Graph?

sentences:
How to calculate texture coordinates for a cube? I was reading about texture mapping on 3D shapes in javafx where I came across this code,

static TriangleMesh createMesh(float w, float h, float d) {
if (w * h * d == 0) {
return null;
}
float hw = w / 2f;
float hh = h / 2f;
float hd = d / 2f;
float x0 = 0f;
float x1 = 1f / 4f;
float x2 = 2f / 4f;
float x3 = 3f / 4f;
float x4 = 1f;
float y0 = 0f;
float y1 = 1f / 3f;
float y2 = 2f / 3f;
float y3 = 1f;
TriangleMesh mesh = new TriangleMesh();
mesh.getPoints().addAll(
hw, hh, hd, //point A
hw, hh, -hd, //point B
hw, -hh, hd, //point C
hw, -hh, -hd, //point D
-hw, hh, hd, //point E
-hw, hh, -hd, //point F
-hw, -hh, hd, //point G
-hw, -hh, -hd //point H
);

mesh.getTexCoords().addAll(
x1, y0,
x2, y0,
x0, y1,
x1, y1,
x2, y1,
x3, y1,
x4, y1,
x0, y2,
x1, y2,
x2, y2,
x3, y2,
x4, y2,
x1, y3,
x2, y3
);
mesh.getFaces().addAll(
0, 10, 2, 5, 1, 9, //triangle A-C-B
2, 5, 3, 4, 1, 9, //triangle C-D-B
4, 7, 5, 8, 6, 2, //triangle E-F-G
6, 2, 5, 8, 7, 3, //triangle G-F-H
0, 13, 1, 9, 4, 12, //triangle A-B-E
4, 12, 1, 9, 5, 8, //triangle E-B-F
2, 1, 6, 0, 3, 4, //triangle C-G-D
3, 4, 6, 0, 7, 3, //triangle D-G-H
0, 10, 4, 11, 2, 5, //triangle A-E-C
2, 5, 4, 11, 6, 6, //triangle C-E-G
1, 9, 3, 4, 5, 8, //triangle B-D-F
5, 8, 3, 4, 7, 3 //triangle F-D-H
);
mesh.getFaceSmoothingGroups().addAll(
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5
);
return mesh;
}

How did the calculate and set up the texture coordinates for the cube?

sentences:
How to save and restore Bullet Physics state? I'm looking for information on how to save the runtime state of rigid bodies with Bullet Physics. Most of my world consists of static objects, but I have a few dynamic and kinematic objects as well. I need to take a snapshot of the game state and later restore the exact same state so that it produces the same simulation as if there wasn't any pause. I can easily (and prefer to) recreate the whole world including the rigid bodies, their configuration, collision shapes and constraints.

In addition I need to reset the objects to their initial state, but I think solving the save/restore problem also solves resetting.

I'm using JBullet, which is based on Bullet version 2.72. This means that the built-in serialization is not available for me, as it was added in version 2.76. However answers utilizing the serialization are also welcome, as Java has built-in serialization and others might find it useful. However the description on the wiki page sounds like it's meant for storing whole worlds instead of just the runtime state.

Checking the source code of RigidBody and CollisionObject reveals lots of internal non-final fields of which many are pointers instead primitives. I don't know which of the fields I should save and how to handle the non-primitive fields.

I am surprised to not having found any information on the Internet about this, as I think this is necessary for any game using Bullet physics and requiring exact save and restore functionality. I would prefer a solution that requires only the public API, but I'm open to other solutions as well including modifying the source code as a last resort. I'm also aware of the differences on floating point operations between platforms, but that is not a concern for me.

Edit:

I implemented the solution suggested by Byte56. I'm now saving and restoring worldTransform, linearVelocity and angularVelocity. I also tried motionState, but that did not have any effect. After restoring the state my object seems to continue the correct trajectory until first collision with a (static) wall. After the collision the object doesn't follow the same path anymore. Interestingly there seems to be only 5-7 slightly different paths that the object randomly chooses.

Without the save and restore my simulation is completely deterministic and always proceeds exactly the same results when running multiple times with the same starting values.

I was thinking that the randomness could have been because of uneven number of simulation steps. I'm using frame skipping and passing 1.0 / 60 as the delta time for stepSimulation: dynamicsWorld.stepSimulation(deltaTime, 100, 1.0f / 200);. I tried changing 200 to 180, but that didn't help. I wonder if there is something in the DiscreteDynamicsWorld that I should also save. I also tried to save DiscreteDynamicsWorld.localTime through reflection, but no luck.

Edit2:

After closer investigation even the initial trajectory before any collisions is slightly off. However there seems to be only a constant offset in the coordinates and after the first collision the path changes direction compared to the original.

I implemented a custom serializer using Java Reflection API, which recursively stores all primitive fields from RigidBody and DiscreteDynamicsWorld. That didn't help. I also tried changing physics updating to just dynamicsWorld.stepSimulation(1.0f / 60.0f);, but no luck there either. Now I'm out of ideas how to proceed.

sentences:
What is "convexity" in the context of game design? I have overheard game designers mentioning something called convexity in games. This seems to be a game-design-specific concept, different from (although possibly related to) that in geometry or game theory. Unfortunately there are very few sources online mentioning it, let alone a definition. From what I could gather, it has something to do with player choices.

So what is convexity? How does it manifest in a game? What's an example of it, or the lack of it? Is it a good thing, a bad thing, or if it depends, when is it good, when is it bad?

sentences:
Tile based collision detection errors if player is smaller than tiles I have implemented a tilemap where each tile is at a non-negative x and y position. (So at the moment think like chess)

At the moment a tile is 16, 16 pixels in size

Tile 0,0 is at the left bottom corner

Some tiles should be collidable. I've never implemented something like that and during research stumbled upon: https://jonathanwhiting.com/tutorial/collision/

The general idea + collision response handling:

let mut new_pos = Point2::new(curr_pos.x + x_offset, curr_pos.y);

let collision_on_x = collide_with_world(&new_pos, &world);

if !collision_on_x  {
    transform.translate_x(x_offset);
}

new_pos.y = curr_pos.y + y_offset;

let collision_on_y = collide_with_world(&new_pos, &world);

if !collision_on_y  {
    transform.translate_y(y_offset);
}

The collision detection

fn collide_with_world(new_pos: &Point2<f32>, world: &World) -> bool {
    // TODO make these sizes i16 instead so we can grow in any direction!
    let mut left_tile: u16 = (new_pos.x / TILE_SIZE_IN_PIXELS as f32) as u16;
    // -1 so that we do not collide until we are exactly at the thing
    let mut right_tile: u16 = ((new_pos.x + PLAYER_WIDTH - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut top_tile: u16 = ((new_pos.y + PLAYER_HEIGHT - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut bottom_tile: u16 = (new_pos.y / TILE_SIZE_IN_PIXELS as f32) as u16;

    println!("new_pos: {:?}, left {}, right {}, top {}, bottom {}", (new_pos.x, new_pos.y), left_tile, right_tile, top_tile, bottom_tile);

    // Useless as long as we use unsigned coordinates
    //if left_tile < 0 {
    //    left_tile = 0;
    //}

    if right_tile > WORLD_WIDTH_IN_TILES {
        right_tile = WORLD_WIDTH_IN_TILES;
    }

    // Useless as long as we use unsigned coordinates
    //if bottom_tile < 0 {
    //    bottom_tile = 0;
    //}

    if top_tile > WORLD_HEIGHT_IN_TILES {
        top_tile = WORLD_HEIGHT_IN_TILES;
    }

    let mut any_collision = false;

    for i in left_tile..=right_tile {
        for j in bottom_tile..=top_tile {
            let tile = world.get_tile(i, j);
            println!("tile at {:?} is {:?}", (i, j), tile);

            match tile {
                Some(tile) => {
                    if tile == WALL {
                        println!("hit a wall at {:?}!", (i, j));
                        any_collision = true;
                    }
                }
                None => (),
            }
        }
    }

    return any_collision;
}

I basically took (or tried to take) the optimised version of the linked blog-entry.

Now to the problems:

If PLAYER_WIDTH and PLAYER_HEIGHT are both 16.0 - collision works fine

But note that I had to put -1.0 in the calculation of the right_tile and top_tile, else the collision for UP and RIGHT would occur one pixel to early (so the player would never touch walls to their top or right)

This change alone makes me a bit suspicious - looks like I made an error there.

The real problems start if the player is smaller than a tile:

In the following screenshots the following rules apply:

*) the PLAYER_WIDTH and PLAYER_HEIGHT are both 8
*) Greenish tiles are the only walls!
*) All the screenshots were taken in ONE run - no parameters were changed during this run!

1)  -> Trying to collide with right tile -> overlapping
2)  -> Trying to collide with top tile -> cannot go any nearer than 4 pixels (half the height of the player)
3)  -> Trying to collide with left tile -> cannot go any nearer than 4 pixels (half the width of the player)
4)  -> Trying to collide with top tile -> suddenly overlapping although different tile didn't collide?
5)  -> Trying to collide with bottom tile -> cannot go any nearer than 4 pixels

I cannot grasp 2 and 4 at the moment.

sentences:
Can a UIKit application co-exist with a Unity game as a single application? I have a typical UIKit application with three buttons - one opens an RSS feed in a UITableView, the second opens some kind of gallery view, and the third opens a Unity 3D game.

Is it possible and how easy it is to support both in one application?

sentences:
How are 3D images drawn? When A computer is to draw a 3d model, does it use maths similar to vector projection? Like when a 3d model is drawn and rotated, does it use vectors/and maybe some other math to know where to draw each of the edges?

If so, is this calculation made everytime the screen is refreshed?

Just want to see if I can create a basic square that looks like its spinning in 3D space. Just for the challenge, not anything practical.

Sorry if I wasn't clear, it is one of those questions where it's difficult to explain.

sentences:
How do I apply a Isometric tile to a Diamond shaped Div I want to be able to apply my isometric tile

To a diamond shaped div

However I can't seem to create the isometric shaped div.

Closest I got to it was this http://jsfiddle.net/P3yKr/2/ but even then thats not going to allow me to apply the image as the background for it.

sentences:
How to achieve smooth sprite movement with a scaled up canvas? I'm developing a simple 2d platformer using haxe & openfl (currently targeting flash). To achieve the old school pixelation effect I draw 16x16 sprites over a 4x scaled up canvas. With this approach character movement is very jerky since it seems to consist of a sequence of 4px jumps.

So my question is: how to be smooth & old school at the same time? Thank you for your time.

sentences:
Per instance world matrix is 0.0f/NaN I'm trying to draw some cubes with Hardware Instancing.

However they don't get displayed. So I debugged my code, and found the source of the problem:

In my VertexShader, the var that has the per instance world matrix has a value of:

{ 0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, NaN, NaN, NaN }

The weirdest thing is that it outpus NaN (Not a Number). Here's how I create my instanced buffer:

XMMATRIX trans[4];

trans[0] = XMMatrixTranslation(0.0f, 0.0f, 0.0f);
trans[1] = XMMatrixTranslation(0.5f, 0.5f, 0.5f);
trans[2] = XMMatrixTranslation(-0.5, -0.5, 0.5);
trans[3] = XMMatrixTranslation(0.5, -0.5f, 0.5);

//Store world matrices
for (int i = 0; i < 4; i++)
    XMStoreFloat4x4(&mIV[i].world, trans[i]);

D3D11_BUFFER_DESC instDesc;
ZeroMemory(&instDesc, sizeof(D3D11_BUFFER_DESC));
instDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
instDesc.Usage = D3D11_USAGE_DYNAMIC;
instDesc.ByteWidth = sizeof(XMFLOAT4X4) * 4;
instDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

//Create instanced buffer
HR(mDevice->CreateBuffer(&instDesc, NULL, &mBoxInstB));

Here's how I map the instanced data to my buffer:

D3D11_MAPPED_SUBRESOURCE mapSub;
mContext->Map(mBoxInstB, 0, D3D11_MAP_WRITE_DISCARD, NULL, &mapSub);

VertexI* idata = reinterpret_cast<VertexI*>(mapSub.pData);

idata = mIV;

mContext->Unmap(mBoxInstB, 0);

Thanks for the help!
If you need some more info, write it in the comments!

sentences:
OpenGL multiple mesh management I've been working on coding a new 3D engine in Java. For the moment at least I'm sticking to openGL...

Currently I'm reworking how meshes get transformed and then drawn. ATM each mesh created has its own VBO and IBO along with its own draw method so if I wanted to draw multiple meshes it would look like this:

mesh1 = MeshLoader.loadMesh("cube.obj");
mesh2 = MeshLoader.loadMesh("pyramid.obj");

mesh1.addToBuffers(); //adds vertex and index data to vbo and ibo
mesh2.addToBuffers();

mesh1.draw();
mesh2.draw();

The draw method defined in class Mesh enables vertex attribute arrays, binds the bufffers, and then draws elements based on the ibo.

Then I send my projection matrix (transformation and perspective) as a uniform to the vertex shader.

QUESTION:

Games are made of many many meshes and each has to be identified so that transformation can be applied. I want to be able to apply transformations (translate, rotate, scale) directly to a given mesh, independent of the other meshes. In other words I want to move mesh1 and only mesh1 5 units to the right (on its own axis) without it affecting mesh2.
How do I do all this without making a million draw calls to the gpu?

Any advice appreciated.

sentences:
Downsides to automatic UV unwrapping I have seen several software packages that offer auto UV unwrapping as an option.

My question is why would you ever manually UV unwrap if there is an automated tool to do so? Are there any significant downsides to using an automatically generated UV map?

sentences:
Ranking - which position to show? My company is making Android apps, mostly little games...
Most of them have a view with the users profile and a view with a ranking list.

In the users profile you can see what rank the user is and of course you can see it in the ranking list. The ranking list shows ranks 1 - 100 and if the user is rank 35476 we are showing ranks 35466 to 35486 too, so whatever your rank, you are always in the ranking list.

Now my boss wants me to scroll the ranking list to the users position and I don't understand why you'd want this. You can see the rank in the profile and in my mind, when I go to the ranking list, I want to see the top guys and see how much points or whatever they have and I am not interested in seeing rank 35475 or 35477...this just doesn't make sense to me.

Is there some consensus on where to scroll the ranking list?

sentences:
Animation with pivot-modification in Mecanim Assume I have two animation cycles:

Walking
Crouching

Both assume that the model's pivot is on the same level as the model's feet.

Now I also have two animated transitions:

Get on all fours while walking
Climb onto a (table)

The first is not too complex. The model walks upright, then gets down on all fours (animation 1) and crouches. Pivot remains on the same level, all fine.

What I want:

However, I can't get my head around the second transition. I want the model to

walk up to the table (pivot on ground level)
climb onto the table (animation 2) (pivot..?)
crouch on the table (pivot on table level, 1 m above ground)

What I have:

The climbing animation (2) assumes pivot to remain on ground level and simply animates the model's climbing up. I built a StateMachineBehaviour which raises the model to the table level as soon as the climbing animation is complete. From then on the pivot is on table level and the crouching can continue.

This seems to work fine in a standalone application, however, in multiplayer, where the models' transform and animator state are not necessarily synchronized in the same frame, this prooves problematic. One can clearly see the model jump when the change in the model's position arrives one frame earlier than the switch from climbing to crouching animation.

What I tried:

I thought it might be a better idea to have the pivot move gradually from ground level to table level over the duration of the climbing animation (2), instead of having one instant jump at the end. This way network synchronization would be much more robust because of the relatively small change per frame. Also this approach would much closer resemble the actual thing that's happening in the real world, which is generally a good thing. I tried offsetting the root transformation of the animation clip, and accomodate the modification by adding the negative offset to the root bones. This however did not work, as there seems to be no animatable translations in Mecanim animation clips. So im stuck at this approach.

Question:

Is there a better way? A simpler way? How are you guys tackling this?

sentences:
Image spinning in c# I'm currently in the process of making a top-down shooter for my programming class, and one idea I had, but don't exactly know how to implement is image rotation in order to spin the object continuously. What I have are spaceships, and right now all they do is face one static direction. All I want is to have them non-stop spinning at a rate that people can see (not so fast that it looks like a blur). I've seen some code about rotating by a certain degree, etc; but no constant rotations. I'm not too sure how to go about this, but any help would be appreciated greatly.

Also, I'm using C# and Visual Studio 2010.

sentences:
How do you design a replay system for a frequently patched game Possible Duplicate:
  How do you design a record/replay system for a frequently changing game?

I understand that in order for a game to have a replay system it must:

Have a deterministic engine
Record initial state
Record player inputs

The problem is, what if the game is being patched every few weeks, and these patches change significant parts of the game that can not really be abstracted into an attribute/state? Like, what if something (minor) is completely redesigned? Then you can no longer just play back older player inputs which took place when there were different mechanics on the current engine because it will lead to entirely different results.

Example: Let's say there is a bug in StarCraft that makes marines not take any damage if the damage they receive is greater than their maximum health. Later this is patched, but any replay from the time of the bug would be junk on the patched system. People would be trying to move marines that are dead in the eyes of the game, etc.

Is this reasonably solvable, given there will always be frequency patches that will make structural gameplay changes/fixes?

sentences: When should rendering be performed during a frame? When working with OpenGL or DirectX, should draw calls be done all at once, at the end of the update loop, or is it better to have draw calls occur during the update loop rather than just at the end?

sentences:
SetBase with a KActor descendant does not appear to function I have a KActor descendant, which is a carging shot, kind of like in R-Type. When it starts charging, I do projectile.SetBase(Pawn) in the PlayerController where it is spawned. I've checked in the debugger, and its base is in face the pawn.

But it does not move with the pawn.

I have done this before, where I base KActors on a moving entity, and it moved with them. I must have done something differently, but I can't figure out what it was. Looking at the old code, I just did SetBase like I am now.

Any ideas where I might be going wrong?

sentences:
How do I efficiently perform collision detection on an NxN rectangle grid? I have a simple level that is constructed from an NxN rectangle grid. Some of the rectangles are walls, and some of them are the path. The player is allowed to move only on the path they are on and also the path rectangles on the grid. So I have two kinds of rectangles in the grid:

"path"
"wall"

The player is a sprite above the grid. I want to efficiently find if the player is colliding with the wall. I want to loop through the rectangles, to see if they intersect. What is the best method?

sentences:
Input.GetAxis returns wrong sign only for 1 and -1 I'm using an Xbox 360 controller on Windows 10 with Unity, and the maximum values have the opposite sign as the rest of that side. For example, if I tilt the stick up, I get values from 0.1 to 0.99, but then I get a -1 when the stick is at maximum. Have I configured it to be this way by mistake? I have reproduced the issue in a clean project and using another controller.

void Update () {
    float pitch = Input.GetAxis("Vertical");
    Debug.Log (pitch);
}

I have discovered that if the axis is inverted (i.e. not as shown in the image) then returned values have expected signs. I will add this workaround as an answer for anyone else who may encounter this problem, but I will refrain from accepting it to allow for answers addressing the root cause.

sentences:
Can UNet do Rigidbody2D prediction? (i.e. using gravity) Having a NetworkTransform with transformSyncMode set to SyncRigidbody2D (as opposite to a plain SyncTransform) I assumed it would try to sync all physics, hence handling gracefully forces, especially gravity.

What I got instead, is a very simple linear interpolation, which smooths out the gravity, so that jumping up and down looks incredibly unnatural: I would have expected this wish a SyncTransform of course, but, given the name I would have expected SyncRigidbody2D to solve this sort of problem…

So, am I missing something and might I have some value set wrong, or what?

sentences:
Procedural star field generator Is anyone aware of any code to procedurally generate star fields?

Ideally I'd like it to be physics-based so I can have realistic planets and moons.
Best would be in C++, open source, and workable with Ogre3d.

I'm not afraid of coding something from a university paper if there's nothing available.

sentences:
C# NanoVG Transparency issue Hi I'm trying to change from Cairo (2D Vector image library) to NanoVG.
I'm using C#, openTK and Nano.VG.NET to make my game.

I'm having issues with alpha? Transparency/Blending is an issue…

Here is an output

Without NanoVG Overlay :

With NanoVG Overlay :

I think it has to do with blending or the nano shader….Not sure. Does anyone knows how to solve this?

My OpenGL Initialization :

GL.DrawBuffer (DrawBufferMode.Back);
GL.Disable (EnableCap.Lighting);
GL.Enable (EnableCap.Texture2D);
GL.Disable (EnableCap.Multisample);
GL.Disable (EnableCap.SampleAlphaToCoverage);
GL.Disable (EnableCap.AlphaTest);
GL.DepthFunc (DepthFunction.Lequal);
GL.Enable (EnableCap.DepthTest);
GL.Disable (EnableCap.ScissorTest);
GL.Enable ( EnableCap.TextureRectangle);

GL.Enable (EnableCap.Blend);
GL.BlendFunc (BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

sentences:
Why is my bullet disappearing after I release the shoot button? I'm making a game using DirectXTK for my university project. When I press space bullet moves forward like I wanted, but when I let go it stops my bullet from moving. How do I keep the bullet moving when space was pressed?

void update
{
  //shooting
  if (kb.Space)
    Shoot(true);
  else
    Shoot(false);
}
void Render()
{
  if (draw)
  {
    for (int i = 0; i < 10; i++)
    {
      m_projectile[i]->Draw(m_bullet[i], m_view, m_proj, Colors::Red);
    }
  }
}
bool shoot(bool test)
{
  shoot = test;
  draw = true;

  //bool isShot = false;
  if (!shoot)
  {
    for (int i = 0; i < 10; i++)
    {
      m_bullet[i] = Matrix::CreateRotationY(m_ship._42) * m_ship;
    }
  }
  else
  {
    m_bullet[0] = Matrix::CreateTranslation(-Vector3::Forward *float(1))*Matrix::CreateRotationY(0.f) * m_bullet[0];
    //m_bullet *= Matrix::CreateTranslation(-Vector3::Forward);
  }

  return draw;
}

sentences:
Position vs Destination Rectangle I'm new to programming, and I finally delved into XNA/MonoGame for wanting to practice coding game logic.

I'd like to know what the difference is between a Position (Vector2) and a Destination Rectangle (Rectangle), when it comes to positioning a sprite.

sentences:
Is it ok to use NPOT textures with OpenGL in this situation? I drew some icons to use on orthographic projection and instead of loading each icon file individually as a texture I thought of putting them all together in one single file. Now I have a file 72x36 which is not a power of two. This texture is divide in two icons, both with 36px wide.

I didn't remember about this restriction when designing the texture but I eventually noticed it when the texture didn't load because I have an if statement checking if the texture is a power of two, if it's not, than the texture is not loaded. I commented that code to see if the texture loaded anyway and it did. The texture was loaded and properly applied to the area I wanted.

To draw the first icon I do this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex2f(0, 36);
    glTexCoord2f(0.5, 0); glVertex2f(36, 36);
    glTexCoord2f(0.5, 1); glVertex2f(36, 0);
    glTexCoord2f(0, 1); glVertex2f(0, 0);
glEnd();

And for the second this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0.5, 0); glVertex2f(0, 36);
    glTexCoord2f(1, 0); glVertex2f(36, 36);
    glTexCoord2f(1, 1); glVertex2f(36, 0);
    glTexCoord2f(0.5, 1); glVertex2f(0, 0);
glEnd();

Which is easy to understand, I only use half of the texture depending on which icon I want.

I don't want my icons to be distorted or stretched, the icons were designed with 36x36 in mind. If I use a power of 2 texture, for instance 128x64 (that's the lowest possible to fit a 72x36 texture), how do I properly map the 36x36 texture area I want to the quad?

Or maybe I can keep doing using this NPOT texture or should I still really create a power of 2 texture? How to fix the problem above then?

sentences:
Trying to implement Camera I'm trying to implement a Camera class in order to walk and look on the world as follow:

#ifndef _CAMERA_H_
#define _CAMERA_H_

#include <glm\glm.hpp>

class Camera
{
public:
    Camera();
    ~Camera();

    void Update(const glm::vec2& newXY);
    //if by = 0.0 it means, it will use the const Class speed to scale it
    void MoveForward(const float by = 0.0f);
    void MoveBackword(const float by = 0.0f);
    void MoveLef(const float by = 0.0f);
    void MoveRight(const float by = 0.0f);
    void MoveUp(const float by = 0.0f);
    void MoveDown(const float by = 0.0f);
    void Speed(const float speed = 0.0f);

    glm::vec3& GetCurrentPosition();
    glm::vec3& GetCurrentDirection();
    glm::mat4 GetWorldToView() const;
private:
    glm::vec3 position, viewDirection, strafeDir;
    glm::vec2 oldYX;

    float speed;
    const glm::vec3 up;
};

#endif

#include "Camera.h"
#include <glm\gtx\transform.hpp>

Camera::Camera()
    :up(0.0f, 1.0f, 0.0), viewDirection(0.0f, 0.0f, -1.0f),
    speed(0.1f)
{
}

Camera::~Camera()
{
}

void Camera::Update(const glm::vec2& newXY)
{
    glm::vec2 delta = newXY - oldYX;
    auto length = glm::length(delta);
    if (glm::length(delta) < 50.f)
    {
        strafeDir = glm::cross(viewDirection, up);
        glm::mat4 rotation = glm::rotate(-delta.x * speed, up) *
            glm::rotate(-delta.y * speed, strafeDir);

        viewDirection = glm::mat3(rotation) * viewDirection;
    }

    oldYX = newXY;
}

void Camera::Speed(const float speed)
{
    this->speed = speed;
}

void Camera::MoveForward(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += s * viewDirection;
}
void Camera::MoveBackword(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += -s * viewDirection;
}
void Camera::MoveLef(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveRight(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveUp(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += s * up;
}
void Camera::MoveDown(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * up;
}

glm::vec3& Camera::GetCurrentPosition()
{
    return position;
}
glm::vec3& Camera::GetCurrentDirection()
{
    return viewDirection;
}

glm::mat4 Camera::GetWorldToView() const
{
    return glm::lookAt(position, position + viewDirection, up);
}

and I update and render as follow :

void Game::OnUpdate()
{
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUniformMatrix4fv(program->GetUniformLocation("modelToViewWorld"), 1, GL_FALSE, &cam.GetWorldToView()[0][0]);

}

void Game::OnRender()
{

    model->Draw();

}

Which the Vertix shader is:

#version 410

layout (location = 0) in vec3 inVertex;
layout (location = 1) in vec2 inTexture;
layout (location = 2) in vec3 inNormal;

uniform mat4 modelToViewWorld;

void main()
{
        gl_Position    = vec4(mat3(modelToViewWorld) * inVertex, 1);

}

But in result the model itslef is moving/rotating instead of moving the camera around the model. What am I doing wrong here?

sentences:
Clothing and physics asset collisions not working I"m making a character in Blender where there's a character mesh and a simple skirt.
The skirt has a different material slot, which allows me to use the Unreal Clothing tool. I created the clothing data, applied it, painted it so the top part isn't moving at all and bottom has 100 "dynamics".
I also created a physics asset, however no matter what settings I try, the skirt will always poke through the thighs like they don't exist. All the colliders are capsules. I also get the feeling that the hip collider actually works. But only that one!
The skirt works perfectly with the wind, which makes it even weirder.
Does anyone know what can cause this?

sentences:
Max texture size Android : which settings for 2048x2048? I want to use a texture atlas of 2048 x 2048 in my game, and I would like to warn the users with a "too low" device to not download the game.

With a texture atlas of this size, what requirements should I say, on ANDROID ?

This image (source : https://stackoverflow.com/questions/10392027/recommended-limit-for-memory-management-in-cocos2d ) shows the requirements for IPHONE, what about for ANDROID : 512Mo minimum, with a 1GHz, is a correct requirement ?

Thanks for your answer

sentences:
How to make a registration for my game? Me and my (new) company want to sell a very simple game, but we want it so that only the person that buys it can play it.

I want to know if it's possible to make a "registration" window pop up when the game either first starts or when it is being installed (still haven't decided whether or not to use an installer or not). It would require the person to input a registration key and it would then check that key against a database to 1. check to see if it's actually there and 2. to see if it has not been used already. If both are true, it lets you install or play the game an infinite number of times on that computer up until it is uninstalled.

Is this possible in the c#/xna code, or would i have to use some advanced form of executable programming?

sentences:
Too slow for cycle in Pygame I'm using Pygame for Python 2 and I have the following code:

self.radius = 100
self.light = pygame.Surface((2*self.radius, 2*self.radius), pygame.SRCALPHA)
self.light.fill((0, 0, 0, 0))
pygame.draw.circle(self.light, (255, 255, 255), (self.radius, self.radius), self.radius)
alphas = pygame.surfarray.pixels_alpha(self.light)
for x, col in enumerate(alphas):
    for y, pixel in enumerate(col):
        pixel = 255 - f.distance(pygame.Rect(x, y, 1, 1), pygame.Rect(self.radius, self.radius, 1, 1))

Basically this code creates a new surface, makes it transparent so that it doesn't interfere with the background, draws a circle on it, and then makes two nested for cycles, going through all of the pixels. The problem is, these fors are too slow. How can I improve their performance?

sentences:
How to move a car model on a plane? I want to create a 3 dimensional car game. But i have a problem in moving a car in other directions and accelerating.

I have a car model and a road model placed appropriately. To move car forward, I translate the road model to negative X-axis so my car looks like it moving forward in my case as my car and road track is along the positive X-axis. Now, in the middle I want to turn left or right and for that I rotate the road model, (let's 90 degree). When I do that the car should move away from the road in sideways direction (or, we can say road to be moved), but it does not. As road was being translated to negative x-axis, after rotating the road I thought to be translated along negative x-axis relative the camera but I think the X-axis of the road object is fixed. So what should I do to solve it?

I just want to move a car which can go forward and when it turns left or right it should move forward accordingly.

P.S. I know, my question may not be clear but that's all I could elaborate it. Anyone can notify me if it's not clear and I will try again to clarify my question again.

sentences:
Set up Blob shadow projector My game completely uses baked lighting in URP and because of URP's forward renderer, point and spot lights can't cast realtime shadows on moving characters if I set their types to mixed lighting, and my game mostly takes place indoors, so directional lights wouldn't make sense.
So now, I thought I'd use the blob shadow projector from the standard assets pack and it didn't work then I found out that it does not support URP.
Does anyone know how I can recreate the blob shadow projector for URP? Or is there another way to create fake shadows for non-static characters?

sentences:
How can I check if someone bought a non-consumable product on iOS/Android? In my application are 10 free levels, everyone can play them without doing in-app purchases. But if you want more levels, then you need to buy once a non-consumable product in the application. After you purchased it, you will have access to all levels that are currently available and to all levels that will be released during the next weeks.

But how can I know if someone bought the non-consumable product?
Is it necessary to send at every reboot of the application a request to the Apple App Store to check if the current Apple ID has bought the product?

sentences:
Reading a word list into an array I am making a simple hangman game, I have a small list of words in a .txt file separated by new lines. I put the word list into the assets folder. How can I find the path to the word list so I can use:

string[] wordlist = System.IO.File.ReadAllLines("pathToFile");

Or is there another solution of converting the word list into a string array?

sentences:
Sprite button not triggering "On Click()" event -Unity Hi have created some buttons from sprite and I added image and button components on it.

I am just using sprites because In my game the camera can be moved on x and y. But I don't want my button to move and since UI buttons move with camera that is why I am not using them.

Here is the GIF to explain the scene:

sentences:
Collision Avoidance/Steering around moving obstacles I've done a decent amount of research and I've read up on pathfinding algorithms and such, but I can't seem to find anything to do with the mentioned behaviors when moving around obstacles that also move.

My character has a circular hitbox, as do the obstacles. My character has a fixed velocity, but can also come to a full stop. My character can also change directions near instantly. Acceleration/deceleration of my character is instant. I can predict, with 100% accuracy, where the obstacles will be; I know their velocity, starting position, and ending position. Obstacles are generated by the user, move at a predetermined velocity (depending on which obstacle it is), and have a predetermined length (again, depending on the obstacle).

I want my character to path from point A to point B while moving around all the obstacles (with no collisions). Point A is where my character currently is, and point B is a user picked point which might change at any time (edit: Pathfinding itself isn't the issue; it's just local collision avoidance that I need to deal with).

Let me know if you need any more info; I don't know what is needed!

sentences:
Steam web API won't work with new domain Following code works perfect on localhost (even using LightOpenID('localhost')). "mysite.com" is replaced with current site in real script. But for some reason this doesn't work on an external domain, but on localhost. Anyone knows why?

Seems like $openid->validate() returns false once on a server with a domain name, but on localhost it works fine.

<?php
require "lightopenid/openid.php";

$_STEAMAPI = "XXX";

try{
    $openid = new LightOpenID('mysite.com');
    if(!$openid->mode){
        if(isset($_GET["login"])){
            $openid->identity = "http://steamcommunity.com/openid/?l=english";
            header("Location: " . $openid->authUrl());
        }else{
            $notloggedin = 1;
        }
    }elseif($openid->mode == "cancel"){
        die("cancel");
    }else{
        if($openid->validate()){
            $id = $openid->identity;
            $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
            preg_match($ptn, $id, $matches);

            $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $_STEAMAPI . "&steamids=" . $matches[1];
            $json_object = file_get_contents($url);
            $json_decoded = json_decode($json_object);

            foreach($json_decoded->response->players as $player){
                // now login, etc.
            }
        }
    }
}catch(ErrorException $e){
    echo $e->getMessage();
}
?>

sentences:
How to add ambiant occlusion to a mesh created by script We created a mesh point by point with a script (a huge mesh), and we would like to add ambiant occlusion to this mesh.
We use Unity 2019.1.6 and the LWRP template.

we already tested the unity ambiant occlusion post-processing , but it's not working on any gameobject...
We searched for tutorials but on Unity 2019 it's pretty uncommon.

Edit:
High quality AO isn't our goal, we just want to better see the difference between two faces of same colour.
We create the whole mesh (vertices and triangles) in script following the Sebastian Lague tutorial about planet generation. (Here's the first ep. link )

Our code is basically the same : loop over whole array, determine the world position of the vertex and save triangle indexs, then give all of this to the mesh component.

We "patched" the problem for now by adding a flat shader to it.

Edit 2 : How we determine world position of each vertex.

We are creating a plane mesh of [resolution * resolution] vertices. Then we apply noises to create a landscape.

(localUp, axisA and axisB can be replaced by x, y and z, we use them because we create 6 meshes for the 6 sides of the planet.)

Here's the loop for creating the vertices :

    for (int y = 0; y < resolution; y++)
    {
        for (int x = 0; x < resolution; x++)
        {
            int i = x + y * resolution; //index of this vertex on mesh
            //pointOnUnitCube determines the position of the vertex on the mesh
            Vector3 pointOnUnitCube = localUp + (percent.x - .5f) * 2 * axisA + (percent.y - 0.5) * 2 * axisB;
            //Transforms the cube to a sphere by normalizing
            Vector3 pointOnUnitSphere = pointOnUnitCube.normalized;
            //the ShapeGenerator uses noises to change the "height" of this pointOnUnitSphere
            vertices[i] = shapeGenerator.CalculatePointOnPlanet(pointOnUnitSphere);

            //Add to the triangles index array the 2 triangles this point is part of
            if (x != resolution - 1 && y != resolution - 1)
            {
                triangles[triIndex] = i;
                triangles[triIndex + 1] = i + resolution + 1;
                triangles[triIndex + 2] = i + resolution;

                triangles[triIndex + 3] = i;
                triangles[triIndex + 4] = i + 1;
                triangles[triIndex + 5] = i + resolution + 1;
                triIndex += 6;
            }
        }
    }

Have you any idea how we could achieve this ?

Thanks for your answers.

sentences:
websockets authentication security Im doing a online game havingclient, js html5, and server, nodejs with websockets.
I've read some blogs about websockets security, and its limitations, but no real implementation or example.

Could JWT tokens in the messages sent to the server, be a good option? Meaning when the clients connect to the server, it gets a token and passes it around on every message? And use wss instead of ws.

Thanks in advance!

sentences:
intersection of primitive in a unit wrapping 3D space is there people good enough for a math problem (for a shader)?
I want to write an algorithm that would intersect primitives (triangles, squares, circle, sphere, cube, cylinder) inside a unit wrapping space, no raymarching, at least axis aligned.

The goal is to write a shader. The benefit, is that, since it's analytic, I can do trick by passing parameters with the texture per pixel.

I already do this by abusing simpler variants of of interior design, by cranking the space between side low, and get dense (simple) foliage and grass for free, or brick walls, or any greebles. Except I'm confined to simple convex shapes with interior style shader, with this I could have more interesting parallax to abuse artistically. I use the flow of the polygon surface to create interesting shapes, and UV texture to break pattern artistically. Work wonder for low specs machine!

I figure out how to do it with a single point at the boundaries of the space, using the planet alignment problem (akin to the two clock hand overlap problem). But I failed to generalized it.

This problem is similar to this math problem
https://amininima.wordpress.com/2013/05/27/the-laser-gun/

But without the reflection.

Other potential benefits is that it have a period we can find mathematically, we could probably infer an analytical "overdraw", by "discarding depth" have a "traversed thickness", if we generalized the, such as we can also shift the position of the primitive at each "jump", we could probably find a consistent "integral 3D noise", which would made cloud noise in convex volume much cheaper than marching.

  Optionally "the graal" would be at least 1 period coil repeated on axis aligned.
  But we can't intersect cosine "cheaply", I tried using x²
  approximations but my math melted. A unit coil being an unwrap unit
  cylinder diagonal, was the next step explored, ie to intersect axis
  aligned cylinder then find on its surface the diagonal:
  the idea above is, taking the perpendicular going through the cylinder center, we observe that the tracing "regularly" step through it, using that stepping and the slope of the ray, we can infer point on the wrapping surface of the cylinder, the entire idea is to find the step pattern so we can intersect the diagonal within a certain distance.

EDIT: While talking below in the comment, I realized that I probably could shift the 1D wrapping space to the 2D projection of the ray direction, then find the period of the primitive's "axis" projected on that line, and since I already found the case for 1D, use that to infer the remaining intersection. Just an idea not developed yet. Should make a drawing to show what I mean, it's not clear yet in words.

sentences:
Deleting/Cleaning Screen-Objects with all child-objects in libGDX For my game, Im using

libGDX
Ashley (ECS)
Box2D

Ive got a lot of screens but for simplification: MainMenuScreen and InGameScreen.

In InGameScreen Im init the ECS (Ashley) and create a lot of entities. Some have PhysicsComponent. The PhysicsSystem will catch them and call Box2D to spawn some objects based on the parameters within the PhysicsComponents.

So far so good.

Now, when the player dyes, I run setScreen(new MainMenuScreen()); from my "Main"-Class (MyGame.java).

the game starts and MyGame loading at first the MainMenuScreen
than the InGameScreen will get loaded (when player presses a key)
than the player dyes
MyGame recognized it and loading again (throu calling setScreen(...)) the MainMenuScreen
When Player press key: MyGame loading another round (setScreen(new InGameScreen))

I guess I have to do something like a complete clean up between switching screens. But how should I implement this? Just "deleting" the old InGameScreen-Object shouldent be enought, right?

Do I have to use the dispose()-Method?
Is it enough to instantiate everything new (in the init from InGameScreen) since it will instantiate all child-object new for its own like Box2DWorld world = new World();

sentences:
How to detect 2D line on line collision? I'm a flash actionscript game developer who is a bit backward with mathematics, though I find physics both interesting and cool.

For reference this is a similar game to the one I'm making: Untangled flash game

I have made this untangled game almost to full completion of logic. But, when two lines intersect, I need those intersected or 'tangled' lines to show a different color; red.

It would be really kind of you people if you could suggest an algorithm for detecting line segment collisions.
I'm basically a person who likes to think 'visually' than 'arithmetically' :)

Edit: I'd like to add a few diagrams to make convey the idea more clearly

P.S I'm trying to make a function as

private function isIntersecting(A:Point, B:Point, C:Point, D:Point):Boolean

Thanks in advance.

sentences:
Artificial Intelligence - when to update pathfind? Right now I have a pathfind algorithm A* so I'm already using it to move the player around.
My problem comes to the NPC'S. They find the path to the player but if the player change the position they have to find a new path all the time? or there's something I can do to avoid so many calculations?

Example
I have an enemy 5 units of distance from the player.
He moves to 4 units of distance based in the path he already found and then search the path again? or does he make half of the path until he search for a new path?

I imagine making that for 5 or more enemies may make the game slow? (I never tested it before)
Any toughs?

sentences: Importing a File Containing Two Objects from Blender into Unity Leads to a Single GameObject Not Two I have two separate objects in a Blender file (say a cube and a sphere). Unity import this file (OBJ type) as a single gameObject which is not want I want. I want cube and sphere to be two separate gameObjects.

sentences:
How can I stop the ball from bouncing forever without changing the gravity? I am using Monogame in Visual Studio 2019 and I need to find a method to make the ball that I fired with the cannon stop after bouncing from the ground, and while doing this, I have to not change the gravity.

gravity = 10;
yFriction = 0.2;

    public override void Update(GameTime gameTime)
    {
        position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

        velocity.Y += gravity;

    }
    public void CheckBounce(SpriteGameObject other)
    {
        if (!this.CollidesWith(other)) return;

        CollisionResult side = this.CollisionSide(other);
        Bounce(side);

        // Relocating the ball if it's in the wall
        switch (side)
        {
            case CollisionResult.LEFT:
                position.X = other.Position.X + other.Width + this.Center.X;
                break;
            case CollisionResult.RIGHT:
                position.X = other.Position.X - this.Center.X;
                break;
            case CollisionResult.TOP:
                position.Y = other.Position.Y + other.Height + this.Center.Y;
                break;
            case CollisionResult.BOTTOM:
                position.Y = other.Position.Y - this.Center.Y;
                break;
        }
    }

    public void Bounce(CollisionResult side)
    {
        switch (side)
        {
            case CollisionResult.BOTTOM:
                velocity.Y *= yFriction;
                Stop();
                velocity.Y *= -1;
                break;
            case CollisionResult.TOP:
                velocity.Y = Math.Abs(velocity.Y) * yFriction;
                break;
            case CollisionResult.LEFT:
                velocity.X = Math.Abs(velocity.X) * xFriction;
                break;
            case CollisionResult.RIGHT:
                velocity.X = Math.Abs(velocity.X) * -xFriction;
                break;
        }
    }
    public void Stop()
    {
        if (velocity.Y <= gravity)
        {
            velocity.Y -= velocity.Y;
        }
    }

At this moment it puts it's velocity.Y to 0. But the problem is the gravity. After bouncing because it doesn't collides, it keeps adding velocity to the ball. As a result I printed out this variables:
After gravity adding
39.01105
After gravity adding
49.01105
After Friction
9.80221
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0

And keeps so on.
Thank you all in advance.

sentences:
Rectangular selection on isometric map Before we get started I checked the following questions:
Isometric Tile Selection with rectangular bounding boxes
Isometric rendering and picking?
Calculating the number of tiles shown on an isometric map <- this is exactly how I get my top-left and bottom-right tile, but I can't calculate what's between them
I can pick tiles perfectly, I'm struggling with the automatic selection given two tiles (top-left and bottom-right in screen coordinates).

I've attached a drawing to help you visualize:

As you can see it's a Diamond setup, not staggered isometric. I'm struggling with finding the orange tiles, I have the green tiles' coordinates.

Btw, it's not true isometric, it's 2:1 "isometric".

sentences:
Unity Raycast not detecting layers I am having problems with layers detection using raycasts.

Context: I created a grid to use in a pathfinding algorithm on a 2D plane. I want to implement now different weights according to the layer each node of the grid is in e.g. a node in a normal terrain will have a "terrainPenalty" of 1 and more difficult terrains 2 or more. In order to detect the terrain type on the 2D plane, I am shooting a raycast on the node position for each node previously considered "walkable". The problem comes up now, because I observed that the paths created are neglecting such values, this is the slice of code which is giving me problems:

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

At first I thought that the problem was how the layers were called, because I created a LayerMask combining 2 layers using the bitwise OR operator, but then I tried to play around with all the layers (hence why there is walkableMask = ~walkableMask; now). The result was always a false output for Physics.Raycast(ray, out hit, 100, walkableMask).

I thought that maybe I was getting the wrong coordinates for the ray, but I created some gizmos to actually check that the ray was piercing perpendicularly my plane and it did, as well as trying to change layers to see if anything worked, but the output is always false. What am I getting wrong? Here is the rest of the function, if needed I can upload the whole script as well:

    void CreateGrid()
{
    grid = new Node1[gridSizeX, gridSizeY];
    Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.up * gridWorldSize.y / 2;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
            bool walkable = !(Physics2D.OverlapCircle(new Vector2(worldPoint.x, worldPoint.y), nodeRadius, unwalkableMask));
            //bool walkable = !(Physics.CheckSphere(worldPoint, nodeRadius));

            int terrainPenalty = 0;

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

            grid[x, y] = new Node1(walkable, worldPoint, x, y, terrainPenalty);
        }
    }
}

EDIT : Here is how I create the layerMask:

        foreach (TerrainType region in walkableRegions)
    {
        walkableMask.value |= region.terrainMask.value; // | is the bitwise OR operation, I could have simplified by writing " --- |= ---; "
        walkableRegionsDictionary.Add((int)Mathf.Log(region.terrainMask.value, 2), region.terrainPenalty);
    }

Where TerrainType is the following class:

    [System.Serializable]
public class TerrainType
{
    public LayerMask terrainMask;
    public int terrainPenalty;
}

I basically create an array of TerrainType objects that will store their layerMask and penalty and then upon positive output from the raycast I access the dictionary to retrieve the terrain penalty. For the terrain and obstacles I am using a 2D BoxCollider and 2D PolygonCollider respectively, they do not interact with any other layer.

Thanks for any possible hints, I don't know what else to try :\ .

sentences: Opengl binding shaders vs binding buffers performance Quick question for an opengl guru, I'm in the process of building a render queue and can either reduce the number of shader binding or the number of vertex buffer binding. I just want to know which one is more expensive on newer graphics cards (IE)(opengl >= 3.2)?

sentences:
Why won't my Box2d bodies collide? I'm doing something wrong when trying to get bodies to collide using jBox2d & Slick2d. Here is have just my basic init, update, and render methods. Render and update seem to work fine for drawing (gravity effectively pushes the ball down, and will rotate if I apply an impulse).

I have a feeling I'm overlooking something when creating the edge, but I have no idea what. My shapes/bodies work fine in the testbed, but I'm having no luck in my standalone application. I have experimented with moving the edge body / ball body around, but it doesn't seem to have any effect.

    @Override
public void init(GameContainer gc, StateBasedGame sbg)
        throws SlickException {
    world = new World(new Vec2(0F, 9.8F), false);
    windowCenter = new Vec2(gc.getWidth() / 2, gc.getHeight() / 2);

    circleShape.m_radius = CONSTANTS.BALL_RADIUS * CONSTANTS.SCALE_FACTOR;
    circleFixtureDef.shape = circleShape;
    circleFixtureDef.density = 1f;
    circleFixtureDef.restitution = .6f;

    circleBodyDef.type = BodyType.DYNAMIC;
    circleBodyDef.bullet = true;
    circleBodyDef.position.set(windowCenter);
    circleBody = world.createBody(circleBodyDef);
    circleBody.createFixture(circleFixtureDef);

    bottomEdge.setAsEdge(new Vec2(0, gc.getHeight()), new Vec2(gc.getWidth(), gc.getHeight()));
    bottomEdgeDef.position.set(0f, gc.getHeight());
    bottomEdgeDef.type = BodyType.STATIC;
    bottomEdgeFixtureDef.restitution = .6f;
    bottomEdgeFixtureDef.density = 0f;
    bottomEdgeBody = world.createBody(bottomEdgeDef);
    //bottomEdgeBody.createFixture(bottomEdgeFixtureDef);

    ball = new Image("src/main/resources/bball.png");
    float shapeToImageFactor = ball.getWidth() / circleShape.m_radius;
    ball = ball.getScaledCopy(1 / shapeToImageFactor);
    circleBody.setUserData(ball);

}

@Override
public void render(GameContainer gc, StateBasedGame sbh, Graphics g)
        throws SlickException {
    Vec2 ballBodyPos = circleBody.getPosition();
    ball.draw(ballBodyPos.x, ballBodyPos.y);
}

@Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
        throws SlickException {
    world.step(delta, 10, 10);
    ball.setRotation((float)Math.toDegrees(circleBody.getAngle()));
    System.out.println(world.getBodyCount());
    if (world.getContactCount() > 0) {
        System.out.println("thank god, something hit another thing");
    }
}

Also, the commented out bottomEdgeBody.createFixture(bottomeEdgeFixtureDef) throws a NullPointerException, and I have no idea why. Could this be related to the body not being created properly?

The world body count is at 2 as I think it should be. I was also thinking that when setting the vector's Y position at my screen height, it's actually getting set at screen height meters rather than pixels. Am I overlooking something obvious?

sentences:
Can you decompose a rotation into a rotation around an axis and a quaternion? I have a rotation represented by a quaternion and I want to get a rotation angle around the forward axis together with another quaternion which will together represent the original rotation.

The reason for this is that I am interpolating the rotation along a path and I want to be able to interpolate the rotation around the path in such a way that it does not have any discontinuities or sudden flips.

sentences:
Deferred Shading and Transparency Clarification? So, this is a bit of a simple question, but I can't seem to find a real answer anywhere. I've been looking into implementing deferred rendering using MRT into my in-progress render engine, but I'm a bit hesitant to for the following reason.

I've read in a few places now that deferred shading does not support transparency natively, and if I wanted to achieve transparency, I would need to resort to forward shading of these transparent objects. But, the idea of "transparency" seems a bit vague because it seems as if there might (corrct me if I'm wrong) be two types of transparency.

One type being the sort of overlay transparency, where I, say, tile a wall with a brick texture. Then I want the wall to be 50% transparent so I apply that on top of the already textured object. This appears to be one "mode" transparency in which the engine, as part of its rendering pipeline, inserts this transparency manually.

The next type in my mind is using a texture that already has an alpha value associated with it, i.e. a 256x256 image of a person, where everything that isn't the person has an alpha value of zero. Then, if I were to billboard that image of the man onto a simple quad (which is what I'm actually trying to do in my game, for reference), would that sort of "native" transparency on the parts of the image with zero alpha still render as transparent, even in a deferred rendering situation?

Does such a distinction exist between these two types of transparency, or are they merely two sides of the same coin when it comes to deferred rendering?

sentences:
Advice creating build process for medium sized game project I've been looking through the SCons build script for Doom3 and researching different approaches to build processes used by professional game developers/studios (C/C++) and I've come across a few questions:

When creating a build script (scons/make file etc.) is it used every build when coding within an IDE like say Visual Studio? In other words do you tend to just use the tools in Visual Studio (Project files etc.) when you want to test a small code change? Or do you step outside VS and run the scripts to get the project to a point that it can be run?
An extension of question 1, if you use VS entirely for these kinds of builds, how far do you take it? i.e. do you have it copy the game into a folder with all the assets or run any kind of install scripts?
If your feeling generous could anybody give me a quick overview of the kind of things you're including in your build steps? Asset creation/install scripts/folder structure creation etc.

Many thanks all.

sentences:
WPF & C# - Game Overlay + Streaming Greetings

I'm in the process of making a Scoreboard for a game (Starcraft II). This scoreboard is being made as a WPF Application with a C# code-behind. I already have a version which works for 90% in WinForms but I lacked the support to easily make it look a lot nicer which are available in WPF.

The point of this application will be to form a kind of overlay on top of a running game.
In this overlay people can see the Score, Map, Players, Colors, etc. Basically all the info they need.

Since the main look of the app in WPF is based on an image with a transparent background I have set most Background values to Transparent. However when I do this the entire application does not get registered by streaming software. For example it just shows my Desktop or the game I'm playing but not my application even though it IS there. I can see it with my own eyes but the audience on the stream cannot.

Does anyone have any experience with this matter because it's really doing my head in. My entire application will be useless if it is not visible on streams. If I have to put the background on a color rather than transparent the UI will be completely demolished as well in terms of looks.

I'm basically trying to make a game-overlay in C# & WPF which is able to update with little hassle for the viewer. I have little to no knowledge regarding C++ and DirectX so I would not know where to start in that regard. This project currently holds 1 Developer and 1 Graphic Designer so it isn't a big scaled project, it will also be distributed for free once/if it gets finished. Any tips are welcome!

Thank you for your time reading and your possible insights.

sentences:
Source code of Minecraft servers? Is there any way to get the source code of Minecraft servers? I tried decompiling but I get very obfuscated arguments, classes, and methods.

If the answer is no, how did services like Bukkit and Spigot create their 'servers'?

sentences:
Why would a Bounding Sphere and BoundingBox not intersect (when they should)? I have a bounding sphere and a bounding box that should be intersecting, however, Intersects(...) is returning false. For example, the following returns false:

new BoundingSphere(new Vector3(500, 105, 0), 25).Intersects(
    new BoundingBox(new Vector3(466,219,0), new Vector3(519,26,0))
)

sentences:
Can I create cocos2d animations without using Xcode? I need to have someone do animation work for an iOS game I'm developing (using cocos2d), however this person does not have a Mac and as such cannot run Xcode.

Is there a way for them to create animations for me without the use of Xcode?

sentences:
Using raycast to detect whether a wall immediately blocks a player in Unity C# I am working on a game project of which involves a procedurally generated maze.
Within this maze, there are different types of tiles, such as walls and gates.
I want to program the player so that it cannot move through a tile that is tagged as a "wall", and I am hoping to use ray casting to detect item tags.
Now, you may think it would be simpler to use rigid bodies, but the game is set up so that the player moves 1 unit per movement, instead of being able to move at any randomly input distance, in order to keep the game adhering to a "grid" for the sake of other events that happen within the game.

So, for this reason, i wish to detect if a wall is north of the player (let's call "north" as "up", as I have an "up blocked" boolean to state if a wall is directly "north" of the player)
but, my code doesn't always recognise walls that are immediately north of the player, and instead sometimes the "up blocked" boolean becomes activated as "true" when a wall is left, right, or "below" (down) of the player, irrespective of whether or not there is a wall "above" or down.

here is my code:

Vector2 vUp = new Vector2(transform.position.x, (transform.position.y + 0.05f));

    RaycastHit2D hitUp = Physics2D.Raycast(transform.position, vUp);

    if (hitUp.collider != null && hitUp.collider.tag == "wall")  {
        upBlocked = true;
    } else {
        upBlocked = false;
    }

I have spent many hours looking for a solution for this problem, but most mediums provide information that either didn't work, wasn't applicable or simply was grossly out of date.

sentences:
Help understanding Simplex Noise Introduction

This is less of a "how to" on using 2D simplex noise and more of a quest to understand what is happening both in the math and visually. I would rather not copy and paste the code I've found. I really would like to understand it.

I have done my homework on the subject and have read through Stefan Gustavson's paper and other sources many times. I feel like I understand about 70% of what my sources are saying, but when I try to manually follow my code loop through to check my understanding I either get hung up on what the variables represent or the math just doesn't add up.

I have begun to rename the variables in the code I've found in order to better understand what's going on. If someone with some knowledge of what is actually happening can cross reference the original code (basically Gustavson's code) with my code that would be most excellent. I'm not actually done with renaming the variables though, partly because I'm stuck.

My Understanding

Let's say I pass pixel (2, 3) into my noise function. At this point I'm working with a normal grid and my goal is to translate this normal grid into a simplex. This simplex is in the form of many triangles since we're working in 2D and supposedly this is better for various reasons.

To translate this point from the normal grid to the simplex grid, I must scale the point along the main diagonal line. After doing that, I apparently don't care about the decimals because I then Floor the results putting it back near the closest previous grid point.

Now I'm going to align the simplex cell to the normal grid by unskewing the simplex cell. Why I do all this work to get to the simplex cell, then undo it I'm pretty hazy on. Seriously, I think the best way for me to understand this is if someone could whiteboard out in steps what the heck is going on here. Super lost.

I didn't walk away empty handed though. I now have what I believe to be the distance between the original grid point I passed in and the simplex point I translated from that original grid point. Woo.

I think I'll stop here for now, just because I don't want this to turn into a huge wall of text. I'm pretty sure the rest of this will click once I understand the the beginning part.

Weird Math

Using the (2, 3) point from earlier, this is what I get by stepping through my own code on paper:

x = 2
y = 3

skewfactor = 1.830
unskewFactor = 1.479
unskewed_x = 1.520
unskewed_y = 2.520
simplexCell_i = 3
simplexCell_j = 4
x_distance0 = -1.520
y_distance0 = -1.520
i1 = 0
j1 = 1
x1 = -1.309
y1 = -2.309
x2 = -2.5207
y2 = -2.5207
ii = no idea why this isn't i2 or something like that. No idea what this is.
jj = same

Not sure if plotting on a graph would work, but I tried and it looks so bad. I used the original parameters (2, 3), simplexCell_i & j, i1, j1, x1, y1, x2, and y2. Doesn't make any sense visually.

Not just visually, but mathematically as well. What's with (2, 3) returning negative numbers that go off the chart? What am I doing wrong here?

sentences:
Getting the Bounds of a 2D Cameras View with Zoom I am using a 2D camera, which does rotations and zoom. Currently, I am using the following to get my MinX, MinY, MaxX and MaxY...

    public float MinX
    {
        get
        {
            return pos.X - gameEngine.screenWidth / 2;
        }
    }
    public float MaxX
    {
        get
        {
            return pos.X + gameEngine.screenWidth / 2;
        }
    }
    public float MinY
    {
        get { return pos.Y - gameEngine.screenHeight / 2; }
    }
    public float MaxY
    {
        get { return pos.Y + gameEngine.screenHeight / 2; }
    }

How would I now take into account Zoom? Default Zoom is 1.
I think this will require Matrices, but any help is appreciated.

sentences:
How do I avoid StackOverflow due to circular dependencies in a FSM? I have a FSM defined as the following which essentially iterates though the actions in the current state and transitions to another state depending on the result of calling the Act function on the current action.
public interface IAction
{
    public abstract IState Act();
}

public interface IState
{
    public IAction[] Actions { get; }
}

public class StateController
{
    public IState CurrentState;

    public void Update()
    {
        foreach (var action in CurrentState.Actions)
        {
            var state = action.Act();
            TransitionToState(state);
        }
    }

    private void TransitionToState(IState nextState)
    {
        if (nextState == null || nextState == CurrentState)
        {
            return;
        }

        CurrentState = nextState;
    }
}

If I have start implementing my states and setting their actions then things get ugly pretty quickly as I set one of the return states of the LookAction to a new instance of SleepState which itself sets a return state to a new instance of WakeState.
public class WakeState : IState
{
    public IAction[] Actions { get; }

    public WakeState()
    {
        Actions = new IAction[]
        {
            new LookAction()
            {
                TargetNotVisibleState = new SleepState() // StackOverflow as this calls SleepState instantiates WakeState in its constructor
            },
            new WaitForTimeElapsedAction(2f)
            {
                TimeElapsedState = new AttackState()
            }
        };
    }
}

public class SleepState : IState
{
    public IAction[] Actions { get; }

    public SleepState()
    {
        Actions = new IAction[]
        {
            new LookAction(true)
            {
                TargetVisibleState = new WakeState()
            },
            new WaitForTimeElapsedAction(2f)
            {
                TimeElapsedState = new ScanState()
            }
        };
    }
}

public class LookAction : IAction
{
    public IState TargetVisibleState;
    public IState TargetNotVisibleState;
    public IState TargetOutOfRangeState;

    public IState Act()
    {
        if (TargetOutOfRange())
        {
            return TargetOutOfRangeState;
        }

        return CanSee() ? TargetVisibleState : TargetNotVisibleState;
    }

    ...

How would it be best to avoid this without losing the ability to set any State for the return state in an Action?

sentences:
Should I generate 2 array map or use tilemap? So, I'm trying to build a 2d multiplayer bobmerman game. Right now I have whole map as 2d integer array. I'm thinking if I should change it to tilemap. In the future, I will want to be able to generate map from code, so keep that in mind.
Is it worth changing array to tilemap? What are the pros and cons of it? My server side is responsible for all the actions (movement, collision, placement), is it possible to connect with tilemap?

sentences:
glfw resizing causing image scaling I have a quad rendered that extends from the top left of the window to with width of the window that is also 64 pixels high. When I resize the window, from its initial size, the quad and text scales proportionately bigger or smaller in the same say Photoshop can scale a image. What I'm seeking on a basic level is that regardless of how I resize the window, everything drawn remains the same. From the below image, the right side is the initial size and the left side is what happens when I drag the window to be a smaller size. The red bar and text scales with it. This is how Im handling my resizing:
glfwSetWindowSizeCallback(pWindow, WindowSizeCallback); // initialized after context

void WindowSizeCallback(GLFWwindow* window, int width, int height)
{
    glfwSetWindowSize(window, width, height);
}

sentences:
How can I refactor an enum so that it is still available in the inspector? I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?

sentences:
How can switch GLSL "version #120" to "version #330"? I am using GLSL "version #120" and i want to change it with "version #330".
I added "GLM" library for this purpose. But i have some problems. Therefore i will ask you what is equal to this setting ?

My version #120 init():

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,aspectRatio, 1, 1000);
glMatrixMode(GL_MODELVIEW);

My version #120 draw():

glClearColor(0.5,0.5,0.5,1.0);
glLoadIdentity();
//-------Camera--------
glRotatef(-camPitch,1.0,0.0,0.0);
glRotatef(-camYaw,0.0,1.0,0.0);
glTranslatef(-CamLoc.x,-CamLoc.y,-CamLoc.z);

//----Objects---------
glPushMatrix();
    glTranslatef(obje_1LocX,obje_1LocY,obje_1LocZ);
    drawObject_1();
glPopMatrix();

glPushMatrix();
    glTranslatef(obje_2LocX,obje_2LocY,obje_2LocZ);
    drawObject_2();
glPopMatrix();
....
....etc

Also one mini question. Can I continue using glPushMatrix() and glPopMatrix() at "version #330" ?

EDIT : I did it, i think.  But is it good setup ?

i delete codes inside init() and it is my new
draw() function:

glClearColor(0.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

glUseProgram(program3);
    glm::mat4 projection = glm::perspective(glm::radians(45.0f), 1280.0f / 720.0f , 0.1f, 10000.0f);
    //------Camera----------
    glm::mat4 view = glm::lookAt(
    glm::vec3(0,120,-1000), // Camera is at (4,3,3), in World Space
    glm::vec3(0,0,0), // and looks at the origin
    glm::vec3(0,1,0)  // Head is up (set to 0,-1,0 to look upside-down)
    );

    glm::mat4 model = glm::mat4(1.0f);

    glm::mat4 MVP = projection * view * model;

    int mvpIndex = glGetUniformLocation(program3, "MVP");
    glUniformMatrix4fv(mvpIndex, 1, GL_FALSE, glm::value_ptr(MVP));

    //----Objects---------

    drawObject_1(); // it will be drawing at origin right ?

    //----And i want to draw second object at x=400 y=0 z=0-----
    model = glm::translate(model, glm::vec3( 400.0f,  0.0f,  0.0f) );

    MVP = projection * view * model;
    mvpIndex = glGetUniformLocation(program3, "MVP");
    glUniformMatrix4fv(mvpIndex, 1, GL_FALSE, glm::value_ptr(MVP));

    drawObject_2(); // it will be drawing at x= 400.0f y=0 z=0 right ?

glUseProgram(0);

sentences:
XNA 4.0 keeping fonts/sprites without the use of a content project Note: The actual title of my question does not really reflect my problem but is actually one of the possible solutions to my problem. I couldn't find a proper way to express my question so feel free to propose a different title.

So I've recently moved to XNA 4.0 and I'm new to this whole content project idea.
I made a simple component based "engine" as a game library that I reuse over all my projects.

I implemented some basic debugging tools like a frame rate counter which used a SpriteFont, which was stored within the actual engine library.

Now that all the content was moved out of the library with XNA 4.0, I don't know where to put the SpriteFont and all other content used by the engine.

I'd rather avoid having to include both the content project and the engine library every time I start a new program, but is this my only option?

Or is there a way to include content within a library without resorting to content projects?

sentences:
How do I handle cyclic dependencies, in an entity/components system? I built a standard C++ entity/component system, a bit like the one from this question). Components can access other components through their associated Entity. This is usually done by getting some kind of reference/pointer once, during component initialization. For example, a Jetpack component can access a RigidBody component, and use it to apply force to the entity. Components can be removed, during a scene, but most often, they don't. Subsystems, like Renderer, PhysicsEngine, and InputManager each listen for specific types of components, and processes them during each frame.

How should these components access each other? I see several solutions, but no good ones.

These are the potential solutions:

Raw pointers: Fast, but violates the idea of RAII. How do I check, if a component is deallocated? It feels like an unsafe path.
shared_ptr: This seems to work rather safely. I can live with the fact that it is a little slow, due to reference counting; the pointers are usually only setup during initialization, anyway. What about cyclic references? If two components reference each other, they'll never be deallocated. This can be remedied by manually clearing the shared_ptrs in some kind of Component::terminate(), that is called when the component is removed from the scene. The idea of "cleaning up", manually, seems to defeat the purpose of using smart pointers in the first place. Also, making sure terminate() is called at the right time adds complexity, as I cannot use the destructor - it's never called, due to the cyclic refs.
shared_ptr and weak_ptr: Internally, in the engine, components are stored as shared_ptrs; but the outside (i.e. components) can only get weak_ptrs. The downside, here, is that all components have to call weak_ptr::lock() each time they want to access another component, which could be several times each frame. This is also true for components that use components that are known to exist throughout the entire scene, and thus don't need an existence check. Contrary to the shared_ptr solution, this performance penalty is incurred every frame, instead of only at initialization. Maybe it is worth it overall, but it just seems clumsy, and potentially very slow.
Avoiding direct access: By adding a level of indirection between components, via a message system of some sort, the problem of cyclic dependencies may never emerge in the first place. I haven't experimented with this, as it seems to be overly complicated. Could this be overly complicated?
Avoiding cyclic deps: I'm not quite sure how do it, but maybe you could just forbid cyclic shared_ptrs altogether, in some way.

Can the downside of these solutions be remedied, or are there better ways to handle cyclical dependancies in an entity/component system?

sentences:
How to keep sprite on screen while increasing its width to screen width I have been able to increase the width of a sprite to the width of the screen size, but the sprite exceeds the borders of the screen width to the right or left when I try expanding it when it's not at the center. How can I scale the sprite in such a way that it's width increases on both sides till it occupies the screen width without exceeding it's bounds, regardless of the sprite's initial position? Please see my code below:

bool isScaling = false;

IEnumerator scaleToX(SpriteRenderer spriteToScale, float newXValue, float byTime)
    {
       if (isScaling)
         {
           yield break;
         }
       isScaling = true;

       float counter = 0;
       float currentX = spriteToScale.transform.localScale.x;
       float yAxis = spriteToScale.transform.localScale.y;
       float ZAxis = spriteToScale.transform.localScale.z;

       Debug.Log(currentX);
       while (counter < byTime)
        {
          counter += Time.deltaTime;
          Vector3 tempVector = new Vector3(currentX, yAxis, ZAxis);
          tempVector.x = Mathf.Lerp(currentX, newXValue, counter / byTime);
          spriteToScale.transform.localScale = tempVector;
          yield return null;
        }

       isScaling = false;
  }

sentences:
How to prevent intepolated texture in fragment shader (Unity CG) Think about minecraft - all the textures in minecraft have a very nice crisp pixelated look.  Well, I'm trying to write a shader that will do this but it appears "sampler2d" returns some sort of interpolation between pixels of the underlying texture.  I'm pretty new to shader writing and I'm not even sure if it can be done - but I'm hoping to get a nice crisp blow up of small textures rather than a blurry one like this:

If anyone knows a way to make a shader crisp rather than interpolated like this (using Unity), I'd be thrilled to know as this hitch is pretty detrimental to what I'm trying to accomplish...

Here's the subshader as it is right now (it's skipping all the light calculations and just outputting the sampler as I'm just trying to resolve the blurry texture sampling):

SubShader
{
    Pass
    {
        Tags { "LightMode" = "ForwardBase" }
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        //user
        uniform float _BlendVal;
        uniform sampler2D _DiffuseTex;
        uniform sampler2D _NMTex;
        uniform sampler2D _PixelMap;
        uniform float4 _DiffuseTex_SV;
        uniform float4 _SpecColor;
        uniform float _SpecIntensity;
        uniform float4 _RimColor;
        uniform float _RimIntensity;
        uniform float _RimCoefficient;

        //unity
        uniform float4 _LightColor0;

        struct vI
        {
            float4 pos : POSITION;
            float3 norm : NORMAL;
            float4 uv : TEXCOORD0;
        };

        struct vO
        {
            float4 pos : SV_POSITION;
            float4 uv : TEXCOORD0;
            float3 worldPos : TEXCOORD1;
            float3 normDir : TEXCOORD2;
        };

        vO vert(vI i)
        {
            vO o;

            o.uv = i.uv;
            o.worldPos = mul(_Object2World, i.pos).xyz;
            o.normDir = normalize(mul( float4(i.norm, 0.0), _World2Object).xyz);
            o.pos = mul(UNITY_MATRIX_MVP, i.pos);

            return o;
        }

        float4 frag(vO i) : COLOR
        {
            float3 lightDir;
            float3 viewDir = normalize( i.worldPos - _WorldSpaceCameraPos.xyz);
            float atten;
            float3 normDir = normalize(i.normDir);
            float4 RimLight;
            float4 DiffuseLight;
            float4 SpecularLight;
            float2 UVCoord = i.uv.xy;

            float4 test = tex2D(_PixelMap, UVCoord);

            //float4 Clrx0 = lerp(

            //Directional Light
            if(_WorldSpaceLightPos0.w == 0)
            {
                lightDir = normalize(_WorldSpaceLightPos0.xyz);
                atten = dot(lightDir, normDir);
            }
            //point light
            else
            {
                float3 dist = i.worldPos.xyz - _WorldSpaceLightPos0.xyz;
                lightDir = normalize(dist);
                atten = (1/length(dist))*(dot(lightDir, normDir));
            }

            DiffuseLight = atten * _LightColor0;
            SpecularLight = atten * _LightColor0 * _SpecColor * _SpecIntensity * pow(max(0.0,dot(reflect(lightDir, normDir), viewDir)), 1)*(1-tex2D(_DiffuseTex, i.uv.xy).w);
            RimLight = atten * _LightColor0 * _RimColor * _RimCoefficient* pow((1-saturate(dot(-viewDir, normDir))),_RimIntensity)*saturate(dot(lightDir, normDir));

            float4 totalLight = DiffuseLight + SpecularLight + RimLight;

            float4 fin = float4(UVCoord.xy,0,0);

            return test; ///Fin * totalLight;
        }

        ENDCG

sentences:
Scaling sprites in XNA 4.0/Monogame So I looked up a tutorial on how to scale sprites in XNA and I think I have it all figured out.

The only problem is that I want to use a spriteBatch.Begin() method overload without changing anything except for the Matrix.

The only spriteBatch.Begin() method that has a Matrix as a parameter is this one:

public void Begin (
         SpriteSortMode sortMode,
         BlendState blendState,
         SamplerState samplerState,
         DepthStencilState depthStencilState,
         RasterizerState rasterizerState,
         Effect effect,
         Matrix transformMatrix
)

I don't really want to mess around with any of the parameters except to pass in my matrix. How would I do that?

sentences:
Hill-jumping game mechanic like Tiny Wings I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill-jumping game mechanic?

I've used some basic features of Box2d. I imagine the flying character is just a circle, tapping the screen increases the downward force on the character, and the hills are some sort of curve object from the physics engine.

Edit #1 Here's more info: I'd like to understand which objects from the Box2d physics library are used to create the bare-bones hill-jumping mechanic. This mechanic would look like a "curvy" horizontal line that just scrolls across the screen. The most basic shape for this line that comes to mind is a sine wave so that's probably a good starting point.

Then there's the character that moves around. Note the character's horizontal position is fixed while the vertical position moves up and down. I'm curious about which Box2d body shape, type etc is used for this character. What are some values for the coefficient of friction that work well? How about the density etc.

I've searched around the web for tutorials that ideally will answer the above questions and perhaps provide additional resources regarding efficiency, camera motion and so on.

sentences:
How could an offline app store images so that they aren't trivially discoverable? There is an app I play which has lots of images. I have reverse engineered the app but couldn't find the images in the APK. The app is an offline app so it doesnt retrieve images from a server.

My question is, then, where did this app store its images? I'd like to achieve the same level of protection (to deter casual observation of the images).

sentences:
Creating a Static function inside my class to handle small housekeeping tasks I have used Unity 3D for quite some time, and a lot of my game programming experience originates from using UnityEngine.

Writing in XNA, I am setting up a nested list of objects. Each object will be an instance of a class, GameObject. At the point of creation, I will have to perform some administration on each element, to sort through them and allow correct operation.

My understanding is that if I have the administration function inside the class, each instance will contain the instructions to perform the task, effectively having N times the same instructions. I have seen some functions instead use the static identifier, in UnityEngine. My understanding is that each instance will instead reference the same copy of the instructions, tidying everything up a bit better.

From what research I have done, all I can find supports that creating static functions inside instantiated instances of a class is impossible. However, I have functions inside UnityEngine that are static, and linked to instantiated copy's of a single class.

My question is: How do I contain a static function inside my class, to perform routine administration function? I am wanting it to be able to crunch numbers derived from the instance calling it, in order to set up other fields within the instance. Would I have to send a ref type of that field, to ensure I am editing the exact instance of it, or do I have a keyword that automatically points to the instance calling the function?

sentences:
Do game programming just let all the objects in the program to interact with themselves and what about preventing infinite loop? Does game programming use the method of

1) using time as the main controller to let objects interact with each other, so each step, let 1 object send messages to N objects, and the second object to any number of objects, and 3rd, 4th, until all objects done, and that's it, and display the results on screen (or think of it as just a loop that always repeat, with each iteration considered "a tick in time")    (so object 1 call object 2's method, and object 2 cannot call other object's method immediately?  otherwise, there can be infinite loop like (2) below.  but how do you implement: "cannot call other objects until next time?" )

Or,

2) let the objects freely call other objects' methods (send messages to them), with no "Time" concept like the above

Are they both feasible solutions?  But what if in (2), you have stones in a circular tube, and stone 1 pushes stone 2, and 2 pushes 3, and so forth, until stone N pushes stone 1 again, then the program will go into infinite loop and not able to do anything else (say if the program is a single process, single thread)

sentences:
How do bullets work in video games? I came across this question when I was designing a video game in C#.

If we consider games such as Battlefield or Call of Duty, hundreds or even thousands of bullets are flying at the same time. Events are triggered constantly, and from what I know, this sucks a lot of processing power … or does it? I want to know how various game developers manage (2D and 3D) bullets and what the most efficient method for each is.

I read the question How are bullets simulated in video games? but it doesn't touch on how bullets work from a program design perspective.

I had a couple ideas, but each have their drawbacks:

Most efficient method I could think of (for 2D games):

Say I was to create a class called Bullet, and for however long the user holds down a button, every 0.01 seconds a Bullet object would be made. This Bullet has:

1 Velocity
2 Starting position of where it is being shot from
3 Sprite texture
4 An on-hit effect

Since the bullet would be its own class, it could manage the drawing, moving, and action listeners itself.

Wouldn't it be hard on the processor to process thousands of these objects being instantiated, then destroyed (when on-hit effect is triggered)? RAM space?

Efficient method for 3D games - Another thought I had was:

Lets say I create a weapon class. This weapon has various features, some of which:

1 Detect where the weapon is aiming, and determine if it's looking at a target
2 Trigger an animation of the gun shooting
3 Has a doDamage() method that indicates something to subtract health from whatever the gun is pointed at
4 Notifies a bullet animation class when button pressed

I could then create a static class, say BulletAnimation, that could get notification from where the gun that triggered it is, where that gun is pointed at (for the bullet destination), and information on an appropriate sprite and velocity to use for the bullet. This class then draws sprites (on a new thread maybe, idk) based on both positions and desired sprite, to simulate a bullet being fired from a gun.

The latter seems much harder to code, and wouldn't it take lots of processing power to constantly call the static to do this for thousands of bullets at a time? Getting constant updates on both starting and ending positions would be hard as well.

My question is, what is the most efficient way game creators do it? Does this method change from 2D to 3D games?

sentences: How to 9 slice meshes? So let us assume I have a 3D model of a window and I would like to stretch it like a 9 sliced sprite. How would you go by doing 9 slice on meshes? All I found online was about quads. What about more complicated meshes?

sentences:
Programmatically creating new tags in Unity I'm writing a custom editor script to add tags programmatically.

I got the error of IndexOutOfRangeException: Array index is out of range from the lines below:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

These are my codes:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

// Adding a Tag
string s = "Instantiated";

// First check if it is not already present
bool found = false;

for (int i = 0; i < tagsProp.arraySize; i++)
{
    SerializedProperty t = tagsProp.GetArrayElementAtIndex(i);
    if (t.stringValue.Equals(s)) { found = true; break; }
}

// if not found, add it
if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
}

Latest Update:
Error IndexOutOfRangeException: Array index is out of range is solved by resolving file location in my original script. I apologized for that.

Fixed:
Added a line in the script to update the properties

if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
    tagManager.ApplyModifiedPropertiesWithoutUndo();
}

sentences:
Why do I get an exception when accessing my sprite members in this fashion? I'm getting a NullReferenceException error on the line where I do new Vector2(...).

I think the problem is with the variables I'm using even though they're working to control the player sprite, so surely they can't be null, right? That is, however, in a different class and is initialized at the top of this one.

Here is the method in question:

public void Shoot()
{
    //if bullet delay resets then shoot
    if (bulletDelay >= 0)
        bulletDelay--;

    //if bullet delay is 0 then create a bullet at player bulletPosition
    if (bulletDelay <= 0)
    {
        //Here I create the new bullet passing in the texture and then modifying the bulletPosition were the bullet will appear from
        bullets newBullet = new bullets();
        bulletPosition = new Vector2(mySprite.imgX, mySprite.imgY);

        newBullet.isVisible = true;
        //These two lines mean that you can have no more that 20 bullets on screen at once
        if (bulletList.Count < 20)
        {
            bulletList.Add(newBullet);
        }
    }

    //reset bullet delay
    if (bulletDelay == 0)
        bulletDelay = 10;
}

bulletDelay is so the player can't spam the shoot button and have it be too easy. I tried to add a breakpoint on that line, when I run the program and hit the space bar that runs the Shoot() method the program stops and tells me about the error. When I hover over though it still says they are null.

I had the instances of the classes in the following code below. I've changed it so they are in the Shoot() method and all seems to well however I'm curious as to why the below code wasn't the correct way to do it:

public void Initialize()
{
    mySprite = new PlayerSprite();
    bulletList = new List<bullets>();
}

sentences:
Detect which Entity caused the collision I have a 2D plane with two or more moving entities (polygons with an AABB). On collision both of them will go through a "collidesWith" Method, where I have access to both entities but only want to modify the other one to avoid that something is applied twice. For collision detection I am using a custom implementation of the SAT Algorithm.

The entities will only move in x or y direction not diagonal. (Though I would like to add diagonal, if there is a solution that works for diagonal as well)

What I want to achieve is:

a moves vertically and b moves into it, b should invert its movement
d moves horizontally and c moves into it, c should invert its movement

How do I approach this without a huge amount of if statements?

sentences:
Identify a selected prefab rather than all of them I am trying to play a particle effect when an enemy is killed but it seems to play on a randomly selected one rather than the one that was hit. However the enemy that was hit still disappears and still add points to the score.

At the moment I have three scripts to carry this out (All have been shortened so I'm only showing the relevant code):

One which is attached to boxes that are thrown at enemies that detects if they have collided with an enemy prefab.

void OnCollisionEnter (Collision theCollision) {

        if (canProjectileKill == true) {
            // If the projectile hits any game object with the tag "Enemy" or "EnemyContainer".
            if (theCollision.gameObject.tag == "Enemy") {
                GameObject.Find("EnemyExplosion").GetComponent<enemyDeath>().ProjectileHasHitEnemy();
                // Destroy the projectile itself.
                Destroy (gameObject);
                // Destroy the game object that the projectile has collided with (E.g. the enemy).
                Destroy (theCollision.gameObject);
                GameObject.Find("Manager").GetComponent<projectileSpawner>().deleteProjectile();
            }
        }
    }

Another that is attached to the enemy prefabs which detects if they have been hit by a box.

void OnCollisionEnter (Collision theCollision) {
        if(theCollision.gameObject.tag == "Projectile") {
            GameObject.Find("EnemyExplosion").GetComponent<enemyDeath>().EnemyHasBeenHit();
        }
    }

I then run an if statement asking if both the box has hit the enemy prefab AND if the enemy prefab has been hit by the box in an attempt to identify a single prefab rather than all of them. However this still doesn't work.

    public bool HasProjectileHitEnemy;
    public bool HasEnemyBeenHitByProjectile;

    void Start () {
        gameObject.particleSystem.Stop();
        HasProjectileHitEnemy = false;
        HasEnemyBeenHitByProjectile = false;
    }

    public void ProjectileHasHitEnemy () {
        // From projectile.
        HasProjectileHitEnemy = true;
    }

    public void EnemyHasBeenHit () {
        // From enemy.
        HasEnemyBeenHitByProjectile = true;
        PlayParticleSystem();
    }

    public void PlayParticleSystem () {
        if (HasEnemyBeenHitByProjectile == true && HasProjectileHitEnemy == true) {
            gameObject.particleSystem.Play();
            HasProjectileHitEnemy = false;
            HasEnemyBeenHitByProjectile = false;
        }
    }
}

I am aware this is a long question but I have been stuck on this for over a week, so any help would be much appreciated. Thank you :)

sentences: Phaser Editor / Phaser 2 Resize State I’m working with Phaser Editor, and I was wondering if it was possible to resize the scene with the editor or just plain Phaser 2. I want to resize the world, by which I mean to make a camera follow the player past the screen, but I can’t figure out how in the docs for phaser 2 or phaser editor. Can someone help?

sentences:
When does a parallel-tasks engine becomes a good solution? I'm often tempted to break the game I'm working on to try a parallel-tasks based architecture, but that don't seem a big requirement for my project so I avoid this for the moment. I'm planning to just try it in a toy project first, to "play with the concept."

Now, what I'm asking is, as lot of (non AAA) games do not require really really high performance, it feels like using a task-based engine isn't worth bothering until... what cases?

At the moment, I'm only guessing that it's necessary when you really need to exploit maximum performance of the (multi-core) hardware. Is there other cases where it's a good idea to use task-based engine? Or maybe, for new projects, it's always good to start with a task-based engine?

sentences:
TiledMap problem in android device (LIBGDX) I'm a noob when it comes to programming Java apps, so I'm trying to make a very simple platformer game.
All is running very well on desktop project, but when I put the game on my Xperia a "strange" thing happens...I'm using Tiled to draw the map, and on code OrthogonalTiledMapRenderer and TiledMap, with a OrthographicCamera, I "zoom" with camera.setToOrtho a part of the map. The problem here is...

I have an elevated floor and other tiles, and on phone screen, this all appears squashed: the tiles and the elevated floor display in a lower position than the desktop version, which is an ugly problem. Resizing the window on PC, all runs and resizes good, mantaining the aspect ratio.

Sorry if I don't explain the problem very well, I'm lost on this theme! xD
I thank tutorials, examples and all other things for noobs.
I tried all viewports and still have not solved the problem, a good way I think is cut off the top part when resize, but I don't know how to do it!

Edit:
I add the screenshots, this part of code is from a good book from packt, and I don't know if I can share here here, I prefer not do it, I'm only learning at the moment, and a comment that saying a track to try solve this is sufficient, here are:

The figure is a sprite on code, the floor and the "door" are layers on tiled (floor and doors). I configured as 16x16 tiles, but configuring as 32x32 or more is the same.

The second image is the regular window, and the last is at the minimum size window, but the aspect is the same that on the more big window...If I stretched out the window, all is stretched, but the upper floor and the sprite maintains the same distance. I don't understand what is happening on the mobile version...

sentences:
How would you generate details like trees, water or caves in a 2D terrain? Yesterday I made a post about generating a 2D planet, which resulted in this:

I did it by subtracting a radial gradient from simplex noise (explained in my other post).

Now of course thats a bit boring, what technique should I use to add details like trees, lakes or caves? Would be able to do something like this (but of course across the whole planet):

I know doing it on a planet would make it a bit harder, because you would have to know if f.E. the tree is on the north of the planet or the south. To make it easier, if you want, just assume a flat 2D surface like this:

sentences:
Reasons to disable game save during combat (e.g. Mass Effect 2) So I've been playing Mass Effect 2 (PC) and one of the things I've noticed is that you can only save your game when you're not engaged in combat.  As soon as the first enemy shows up on your radar, the save button is disabled.  Once combat is over, save functionality reappears.

It seems reasonable to assume that Mass Effect 2 is a state machine, and therefore, the internal state of the program at any moment can be captured and reloaded later.  This is basically a solved problem - games have been designed this way since the Half-Life era.  It also seems reasonable to assume that BioWare knew what they were doing when they made the decision not to follow this model - it's a tried and true system; BioWare wouldn't have done it the way they did without some good reason.

What reasons are there to disable game save functionality during combat?

sentences:
How can animate a set of rigs without reinventing the wheel? I have a set of rigs of my own defined 3D doll in Javascript. I would like to animate a set of rigs to simulate walking, jumping, etc. Obviously I could do it by myself, but I'm sure I would be reinventing the wheel.

Are there algorithms, libraries (won't matter the language) or anything that I can download and it will give me the position of the rigs in function of time for many animations like walking, jumping?

sentences:
opengl - flickering of fragments even with disabled depth test I'm trying to render a quad with a coloured border. I'm using texture coordinates to detect whether the fragment should be considered part of border or not. If it is part of border, then render it with green colour or else with black colour.

Here are my vertices / normals / tex coordinates.

    float vertices[] = {
        // posistions          // normals           // texture coords
      -0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  0.0f,
       0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  0.0f,
       0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  1.0f,
       0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  1.0f,
      -0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  1.0f,
      -0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  0.0f,
    }

Here's my fragment shader

#version 330 core

in vec3 frag_pos;
in vec3 frag_nor;
in vec2 frag_tex;

out vec4 frag_color;

void main()
{
    vec2 origin = vec2(0.01, 0.01);

    float width =  1.0 - origin.x * 2.0;
    float height = 1.0 - origin.y * 2.0;

    if( (frag_tex.x >= origin.x && frag_tex.x < origin.x + width) &&
        (frag_tex.y >= origin.y && frag_tex.y < origin.y + height) )
    {
        frag_color = vec4(0.0);
    }
    else
    {
        frag_color = vec4(0.0, 1.0, 0.0, 0.0);
    }
}

And this is how I'm rendering

glDisable(GL_DEPTH_TEST);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 6);

In right, I'm drawing the same quad with another pass-through fragment shader in wireframe mode.

As you can see the left quad is flickering while moving the camera. Any ideas how to fix this.

sentences:
Unity5 imported models show no texture I've got a problem with Unity materials.
I'm a beginner- so I used Wings3d for creating 3d models.
But there's a little Problem.
Both objects on the picture below have the same material(a Standart Material with 0 smoothness, 0 metallic and only a only an Albedo picture)-but obviously the right one has no texture( and that's the problem).

First I ignored it and used a custom shader ("Custom/WorldCoord Diffuse) which I found in a package for fixing it. Poorly this shader doesn't support Normal or Height maps and strangely slows down my game extremly (my scene with only Standart shaders ~80 FPS | my scene with this strange shader~7 FPS).
I don't know how to write my own shaders and I don't know blender, and I don't have much time to fix this.

sentences:
A trigger collider in Unity doesn't allow the player to pass through It's my understanding that checking "Is Trigger" on a collider should allow rigid bodies to pass through without collision prevention, but my trigger isn't doing that consistently.  The player cannot pass through, but other objects can.

The trigger is a cube primitive with "mesh rendered" unchecked so that the cube won't be visible.  The cube has a box collider with "is trigger" checked, and also a script.  The script currently doesn't do anything except output from Debug.Log in OnTriggerEnter() as a test.

Primitives are able to pass through.  The test is just a basic Unity sphere with all the default settings, including a sphere collider.  The only change was that I added a RigidBody.

Imported models also pass through.  I have a simple .blend model with a rigid body and box collider.

The player does not pass through.  The main difference between the player's object and the other imported model is that the player is using a custom mesh collider which is different than the player's rendered mesh.  The rendered mesh is the game object and the low-poly collision mesh is a child of that object.

I've tried several variations, including switching the player from a mesh collider to a box collider, and also moving the box collider to the main mesh rather than a child mesh, but the results are the same.  The player stops moving as soon as he hits the location of the trigger's box collider.

Any ideas are appreciated.  Thanks in advance.

MORE INFO:

Here's a screenshot of the scene layout, with the invisible trigger collider selected.

Also pictured is the hierarchy showing that the trigger collider ("Jump Pad Trigger") has no children.  On the right is displayed every component that the trigger object has.  I've also moved the collider from its original location several times to prove that it's not another object in the scene that the player is colliding with.

sentences:
How can I improve the display of my png files? I develop a mini Android game available from my github (also the release apk file). The game is for kids and you are supposed to catch falling object and get points for that. Now I just created png files for the sprites and added alpha channel in gimp. It looks better, before alpha channel:

After:

But I'm not 100 % satisfied with the rough edges of the sprites. Am I correct that if I do the alpha channel more exact then the sprites will look even better (without the edges) or is there some other mistake that I make with the sprites?

Edit: With new background image, it looks like this.

Edit 2: I used jamie the monkey now of BSD license which renders better. It seems to be more exact work in GIMP that is needed.

Edit 3. Now I am satisfied. Thanks.

sentences:
How does collision detection work? I was curious on how hit collision works in games. I know there is a simple method that gives every object in a 2D or 3D world a recengular hitbox that makes it easy to detect a collision, but when rotating object, this becomes complocated. Because simple math can't be used to determine whether two rotated lines cross.

To explain my question I will give you an example of what I mean. If you have two lines: (1, 1, -1,-1) and (2,-2,-2, 2). How do you know if these two hit/cross each other and what if you take a circle with radius 1 and center (0, 0), and a line (2, 2,-2,-2). How would you possibly know if these objects hit or cross each other, also keeping in mind that the performance must be good.

sentences:
How to debug a DirectX crash on client machine? I have customers who are experiencing crashes which I can't reproduce on my machine.

From the minidumps they sent over, it appears that their crashes all seem to be in unexplained Direct3D calls, deep in the callstack in d3d11.dll.

How can I debug this problem? Is there any way to log client d3d error messages? I can't use the debug layer since they don't have the DirectX SDK, right?

sentences:
How to free the GPU from a long task? I'm developing an application that uses the GPU. Some tasks might be rather long (like a fragment shader with a loop). I have the impression that I can make the entire OS visually freeze by asking the GPU to perform a job that doesn't end. Of course, I'm not doing this on purpose, but when that accidentally happens, I have to force power off my machine and this is very difficult to debug.

Some questions:

Is this behaviour normal? Or could this be a bug in the hardware or driver?
Is there a technique to recover from this without force stopping my machine?
Since the OS is still functioning (only not rendering), I could try to ssh into my machine and kill the process. Would that free the GPU from its job? Update: I tried to ssh into my machine and sudo kill -9 *pid*, but didn't work.

I would like to know if there is an OS independent answer for this. If there isn't, my setup is macOS, with OpenGL (running on Intel HD Graphics 3000).

sentences:
How to restart the game when pressed enter in XNA If the following code allows the game to exit when pressed esc ..

if (gamePad.Buttons.Back == ButtonState.Pressed
    || keyboard.IsKeyDown(Keys.Escape))
{
    this.Exit();
}

Then this code should allow the game to restart when pressed enter...

if (gamePad.Buttons.Back == ButtonState.Pressed
    || keyboard.IsKeyDown(Keys.Enter))
{
    this.Reset(); //<< PROBLEM HERE!!
}

What do I put here? Because Reset is not the keyword for it...
I'm a beginner so if this is so wrong and stupid I am  sorry.

sentences:
A Simple Method To Create Island Map Mask I'm searching for a nice and easy way to generate a mask for an island map with C#.

Basically I'm using with a random heightmap generated with perlin noise, where the terrain is NOT surrounded by water.

The next step would be to generate a mask, to ensure the corners and borders are just water.

Then I can just subtract the mask from the perlin noise image to get an island.

and playing around with the contrast..

and the gradient curve, I can get an island heightmap just like I want it..

(these are just examples of course)

so as you can see, the "edges" of the island are just cut off, which is not a big problem if the colour value is not too white, because I will just divide the grayscale into 4 layers (water, sand, grass and rock).

My question is, how can I generate a good looking mask like in the second image?

UPDATE

I've found this technique, it seems to be a nice starting point for me, but I'm not sure how exectly I can implement it to get the desired output.
http://mrl.nyu.edu/~perlin/experiments/puff/

UPDATE 2

this is my final solution.

I've implemented the makeMask() function inside my normalisation loop like this:

        //normalisation
        for( int i = 0; i < width; i++ ) {
            for( int j = 0; j < height; j++ ) {
                perlinNoise[ i ][ j ] /= totalAmplitude;
                perlinNoise[ i ][ j ] = makeMask( width, height, i, j, perlinNoise[ i ][ j ] );
            }
        }

and this is the final function:

    public static float makeMask( int width, int height, int posX, int posY, float oldValue ) {
        int minVal = ( ( ( height + width ) / 2 ) / 100 * 2 );
        int maxVal = ( ( ( height + width ) / 2 ) / 100 * 10 );
        if( getDistanceToEdge( posX, posY, width, height ) <= minVal ) {
            return 0;
        } else if( getDistanceToEdge( posX, posY, width, height ) >= maxVal ) {
            return oldValue;
        } else {
            float factor = getFactor( getDistanceToEdge( posX, posY, width, height ), minVal, maxVal );
            return oldValue * factor;
        }
    }

    private static float getFactor( int val, int min, int max ) {
        int full = max - min;
        int part = val - min;
        float factor = (float)part / (float)full;
        return factor;
    }

    public static int getDistanceToEdge( int x, int y, int width, int height ) {
        int[] distances = new int[]{ y, x, ( width - x ), ( height - y ) };
        int min = distances[ 0 ];
        foreach( var val in distances ) {
            if( val < min ) {
                min = val;
            }
        }
        return min;
    }

this will give an output like in the image #3.

with a little bit of change in the code, you can get the originally wanted output like in image #2 ->

    public static float makeMask( int width, int height, int posX, int posY, float oldValue ) {
        int minVal = ( ( ( height + width ) / 2 ) / 100 * 2 );
        int maxVal = ( ( ( height + width ) / 2 ) / 100 * 20 );
        if( getDistanceToEdge( posX, posY, width, height ) <= minVal ) {
            return 0;
        } else if( getDistanceToEdge( posX, posY, width, height ) >= maxVal ) {
            return 1;
        } else {
            float factor = getFactor( getDistanceToEdge( posX, posY, width, height ), minVal, maxVal );
            return ( oldValue + oldValue ) * factor;
        }
    }

sentences:
Float, double or both for 2D Vector class? I'm currently writing a small cross-platform OpenGL-based 2D game engine for our studio. When I researched which 2D Vector class to use, I stumbled across three different design paradigms:

Float & Call-by-value, like in this Gamasutra article. Seems to be fast but offers little precision (see also this Thread). Pro: Fast, portable and compatible with most libraries.
Double & Call-by-reference. If I understand the above article right, I could also use 2 double precision variables instead of the 4 float numbers. According to the above thread double's still slower than float.
Template for double and float: The widely popular book "Game Engine Architecture" uses templates to make it possible to use float and double as needed. The obvious downside is code bloat. Also, I doubt it that the code can be optimized without basically writing two classes, anyway.

I would appreciate to learn what solutions you're using in your in-house engines and how precise e.g. popular game engines are, so I can decide what solution I'll implement in our engine. In the moment I'm thinking about simply using float precision and live with it.

sentences:
How to efficiently implement a 7-segment display? I want to construct a 7 segment display (as shown below). When you input a number, the script will read the input number and light up the respective segment
(change the spriterenderer color to red) to display the number.
But I think the code has become too long, since there is 0-9 digit to display, I need 10 if statements, 8 scripts and the function of each statement is to light up the respective segment so it displays the number correctly.
Is there any better way to make the code shorter?
using UnityEngine;

public class ClockController :  MonoBehaviour
{
    Rect1 rect1;
    Rect2 rect2;
    Rect3 rect3;
    public GameObject othergameobjectrect2;
    public GameObject othergameobjectrect3;

    void Start()
    {
        int x = 1;
        if (x == 1)
        {
            rect1 = GetComponent<Rect1>();
            rect1.Rectangle1();

            rect2 = othergameobjectrect2.GetComponent<Rect2>();
            rect2.Rectangle2();

            rect3 = othergameobjectrect3.GetComponent<Rect3>();
            rect3.Rectangle3();

        }
    }
}

using UnityEngine;

public class Rect3 : MonoBehaviour
{
    public void Rectangle3()
    {
        GetComponent<SpriteRenderer>().color = Color.red;

    }
}

using UnityEngine;

public class Rect2 : MonoBehaviour
{
    public void Rectangle2()
    {
         GetComponent<SpriteRenderer>().color = Color.red;
    }
}

using UnityEngine;

public class Rect1 : MonoBehaviour
{
    public void Rectangle1()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }
}

sentences:
Should I make a FPS game on Fixed Function Pipeline or Programmable Pipeline OpenGL? I have a “FPS” game I have programmed in Fixed Function Pipleline and one made in Programmable pipeline OpenGL. While the programmable pipeline has lots of weird things that you can edit, it does not have glLoadIdentity that I need for the gun to be attached to the camera. There is little to no information on this subject and most of the information that I can find is in the fixed function pipeline rather than the programmable one. Keep in mind that with the fixed function pipeline, I can just use the glloadidentity function and attach it then move on to another thing. On the programmable one, I don’t know how to do this, so I have spent a whole week looking up how I can do it.

Should I just use the fixed function pipeline one and abandon the programmable pipeline?

What shall I do?

Thanks!

sentences:
What is the correct order to multiply scale, rotation and translation matrices for a proper world matrix? Assume DirectX as the platform, if that is important. (Pretty sure it isn't)

Assuming I have a proper scale, rotation and translation matrix, in what order do I multiply them to result in a proper world matrix and why?

By "proper", I mean "I could throw them straight into DirectX and get the most commonly-used 3D frame."

sentences:
Where should input be used? I'm working on an input system (in C#) and now I'm wondering, what is the best place to put input functionality?

Currently what I was coding was a bunch of delegates which act as callbacks (i.e. onkeypress, onmouseclick, etc) and the idea is when the input manager checks for input it invokes these delegaetes.

However this means that input is updated when the input manager updates and not when a game class has its own update function called.

The way I see it is moving input functionality out of a classes update function and deferring them would forecefully reduce the codes complexity (particularly the update function) but on the other hand I'm thinking it might be a better idea to move update and input to the same place as it would give the coder more freedom to work with the input systems.

Anyone have any ideas on this matter?

sentences:
Generate random starting points at same distance between them Is there an algorithm to generate random 2D points that are at the same distance between each other? Useful for starting points. Check map:

Don't be picky, I know in the image points are not at the same distance, lol, but you get the idea.

sentences:
"Squeezing" a game object based on distance to another game object I am trying to "squeeze" a gameObject. When distance starts to be 6.98, execute this code: "The smaller the distance between gameObject1 and gameObject2, the thinner and longer this gameObject is". Somehow, this code has no effect. Why?

public Transform gameObject1;
public Transform gameObject2;

void Update ()
{
    float distance_squeeze = Vector3.Distance(gameObject1.position,
                                              gameObject2.position);
    if(distance_squeeze < 6.98F)
    {
        transform.localScale = new Vector3(-distance_squeeze, distance_squeeze, 1);
    }
}

sentences:
Godot 3.0 Constant 2D Angular Velocity I am making a Top-Down shooter in Godot 3.0 on Linux.

I would like to have my character rotate to face the mouse-pointer at a constant speed, and have rotation speed power-ups that allow the player turn faster.

So far, this is done by having a Position2D object called "Center" share the same position (but not be a child of) the player (below just called "Sprite"). The center always looks to the mouse, and the Sprite rotates with linear interpolation to eventually reach the same rotation as the "Center".

The weight of linear interpolation is calculated by dividing the difference in rotation (in radians) by an arbitrary constant speed.

Problem: The speed of rotation increases as rotation occurs, or more specifically, the time it takes to reach the same rotation (a rotational difference of zero) becomes shorter over time.

I have the following code:

extends Sprite

onready var center = get_parent().get_node("Center")

var current_time = 0
var total_time = 0
var start_rot = 0
var end_rot = 0

func _process(delta):
    center.look_at(get_global_mouse_position())
    var amt = 0
    var theta = abs(self.rotation - center.rotation)
    var speed = 0.05

    total_time = theta/speed

    start_rot = get_rotation()
    end_rot = center.rotation

    if not total_time == 0:
        amt = current_time/total_time

    current_time += delta
    amt = clamp(amt,0,1)
    var rot = lerp(start_rot,end_rot,amt)
    center.rotation = fmod(rot,(PI*2))
    set_rotation(fmod(rot,(PI*2)))

    get_parent().get_node("Control/rotation").text = str(int(self.rotation_degrees))
    get_parent().get_node("Control/theta").text = str(theta)
    get_parent().get_node("Control/time").text = str(total_time)

What am I doing wrong?

sentences:
Calculating the difference between two numbers using exponential growth I think this is a very basic game programming question, but I am bad with math and new to programming & game programming so I'm looking for some advice. I'm making a 2D sprite game for iOS. Every frame in my game loop I check to see if player moves past a boundary in the game; if so, I scroll the camera's view:

    if playerPosition.x > rightBound {
        let amt = playerPosition.x - rightBound
        camera.position = CGPoint(x: camera.position.x + (amt * 0.1), y: camera.position.y)
    }

This works OK; the camera scrolls slowly when the player exceeds the boundary by a small amount and scrolls more quickly when they exceed the boundary by a larger amount. So the scrolling speed scales up linearly. However, I would like the scrolling speed to scale up faster, perhaps in at a more "exponential" rate. (Enter my terrible understanding of math...)

I don't know the best way to express this mathematically. I know that exponential growth is an actual thing in math, but I actually had to look it up on Wikipedia. And I don't know the best way to implement that in game programming.

To clarify with a simple hypothetical, say that the boundary x position is at 0. When the player moves past it in the first frame his position is 1, so the difference between the two positions is 1. Then next frame his position is 2 so the difference increases to 2, and so on. So the difference between the positions grows like 1, 2, 3, 4, 5, 6, etc. However, I want to calculate the difference between these positions so that my result grows more like 1, 2.1, 3.3, 4.5, 6.1, 7.8, etc.

This graph suggests that I might want to use cubic growth or exponential growth:

But I'm not sure how to express such a formula programmatically. Perhaps more importantly, I don't know if that is the best way to approach this sort of calculation from a game programming perspective. This calculation will run four times every frame, and performance is a concern so I'm trying to find an efficient solution rather than some crufty version I arrive at by myself.

Can anyone provide some advice? I'm working in Swift but I think this is a language-agnostic problem. If you express the answer in another language I can probably figure out how to implement that in Swift.

UPDATE:

Thanks to tom10, I ended up going with this formula for exponentially increasing my camera scrolling speed based on how far the player has passed beyond a boundary:

if playerPosition.x > rightBound {
    let dx = playerPosition.x - rightBound
    let baseAmt = dx * 0.033
    let amt = baseAmt + pow(2, baseAmt * 0.25)
    camera.position = CGPoint(x: camera.position.x + amt, y: camera.position.y)
}

0.033 and 0.25 are "magic numbers" that work well for my game; I arrived at them by trial & error.

sentences:
When rendering on two different computers, the texture is glitchy I am using Ogre3D, and have been using it for a while. Also lately, I have been using the Opengl Rendering system that is included in Ogre, only because Directx will not compile correctly(Will post errors on request through comment).

But as of now the main problem is when i render my model(it is a plane with simple, unblended pixelated texture), it looks like this on my Laptop(Left Image), but when I render on the desktop(Right Image), it looks the way its supposed to be.

Im pretty sure this problem might not be relevant to this site, but im not sure on where else to post this(if it needs to be moved then so be it), but i felt it would fit here just a bit, since its a game-dev type question.

Anyways, My compiler is MinGW that uses the IDE Code::Blocks.
also the operating system that im using on both computers are windows Vista 32 bit.

Now if anyone would know why this would happen then please do tell(but my guess is that maybe the graphics card is not compatible)

Here are the images:

Left:Laptop

Right:Desktop

there both about the same image, and if you notice on the desktop screenshot: it looks more clearer and you can see the "mountains" better, where on the laptop picture, you cant see any pattern at all...Also, you can notice an odd stopping of light(or maybe called something else), but that has me confused also.

sentences: How can I set a MonoGame window's position? How do I set the position of my window in MonoGame?

sentences: Why does Unity increase the size of image when I use the image in Unity? I try to make a game in Unity 2d. But when I drop the image in Unity the image size increases 3 or 4 times. Can I fix that or is this normal?

sentences:
How to make an object move outside the map and appear on the other side with a tilemap? I have a tilemap where a character moves from tile to tile. I'm trying to make it possible for the character to move outside the screen and reappear on the other side, just like the tunnel in Pacman.

The movement works like following:

Look for which arrow key is being pressed.
Check if the tile where the user wants to go to is walkable. If not, go back to 1.
If walkable, set it as target and start moving towards the tile.
When arrived to the target, go back to 1.

The problem I have is that there're no tiles outside the screen. I've tried to set the target to the tile on the other side of the map if the target doesn't exist, but then the character would move across the whole screen.

I've tried a couple other solutions that either don't work or require lots of additional code in many different files.

Does anyone know a good solution or recommend another approach?

I'm programming in Python with Pygame but know other languages in general. Here's MVCE code for my class:

import pygame
import math

TILE_SIZE = (16, 16)

class Player(pygame.sprite.Sprite):

    def __init__(self, pos, size):
        super().__init__()
        self.rect = pygame.Rect(pos, size)  # Rectangle representing the character's pos.
        self.image = pygame.Surface(size)
        self.position = pos  # In order to have the position in float precision, (x, y).
        self.speed = 80  # Pixels per second
        self.tile_index = (pos[1] // TILE_SIZE[1], pos[0] // TILE_SIZE[0])  # (Row, column).
        self.moving = False
        self.target = self.rect

    def handle_events(self, level):
        key = pygame.key.get_pressed()
        if key[pygame.K_w] or key[pygame.K_UP]:
            self.set_target(level, y_offset=-1)
        elif key[pygame.K_s] or key[pygame.K_DOWN]:
            self.set_target(level, y_offset=1)
        elif key[pygame.K_a] or key[pygame.K_LEFT]:
            self.set_target(level, x_offset=-1)
        elif key[pygame.K_d] or key[pygame.K_RIGHT]:
            self.set_target(level, x_offset=1)

    def set_target(self, level, x_offset=0, y_offset=0):
        tile = level.get_tile(self.tile_index, x_offset, y_offset)
        if tile.is_walkable:
            self.target = tile.rect
            self.moving = True

    def move(self, dt):
        distance_x = self.target.x - self.rect.x
        distance_y = self.target.y - self.rect.y
        # Make sure the player move at 'speed * dt' or distance, depending on the smallest.
        x = math.copysign(min(abs(distance_x), self.speed * dt), distance_x)
        y = math.copysign(min(abs(distance_y), self.speed * dt), distance_y)
        self.position = (self.position[0] + x, self.position[1] + y)
        self.rect.topleft = self.position

    def stop_if_arrived(self):
        if self.rect.contains(self.target):
            self.moving = False
            self.tile_index = self.target.y // TILE_SIZE[1], self.target.x // TILE_SIZE[0]

    def update(self, level, dt, *ignore):
        if not self.moving:
            self.handle_events(level)
        else:
            self.move(dt)
            self.stop_if_arrived()

sentences:
Computing a full revolution for an arbitrary orbit? I'm making a game in which the goal is to get as many planets as possible to orbit around a star.  The user launches planets at any distance away from the sun (as long as it's on-screen), and in any direction (possibly even directly at the sun, though their game won't last very long).

This means orbits can be circular, elliptical, or--more than likely--irregular, something like this:

(Image originally from here)

The rules for my game that the player may launch planets as frequently as s/he likes...but they will only score a point for their first revolution (so spamming planets isn't likely to score very much).

Right now, the gravitational force is just F = ma (i.e. a constant force towards the sun).  I'm trying to figure out when a planet in arbitrary orbit has completed a full revolution.  This is how I'm doing it currently...

// If this planet is active...
Vector2 a = _body.position.normalized;
Vector2 b = (a + _body.velocity).normalized;

float angle = Vector2.Angle (a, b);
this._total_angle += angle * Time.deltaTime;

if (this._total_angle >= 360) {
    // If this planet has made a revolution...
    ++this._revolutions;
    this._total_angle = 0;
    this.OnRevolution.Invoke (this);
}

However, this is incorrect for anything besides circular orbits.  No good.

Given all of this (and my near-total unfamiliarity with orbital mechanics), how can I tell when a planet in an arbitrary orbit has completed one full revolution?

EDIT: No, the planets will not affect each other's orbits (though they can collide into one another, but they'll just explode).

sentences: How do I right-align text? I'm using SpriteBatch.DrawString, which seems to not have an overload for text alignment. How can I draw aligned text?

sentences:
Collisions between two objects in 2D space I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to make it a little more interesting when the player plays with other objects in motion, they collide and separate. This is a very physical 2D issue itself.
If an object A is at positive velocity at x collides with an object B is at negative velocity at x, collide head-on, what would be the best calculation to do so that they separate naturally after the collision?

What if they go in the same direction in x? and if one has going on x and another on y? How do I deal with all this?

Should I add mass and acceleration to make this separation calculation after the collision?

sentences:
Stop Camera up movement I am developing 3D game , the main camera is child of player.

When player jumps camera too gets move up with player as its child of player.Is there anyway to stop this behavior?

The only thing I can guess is to make camera separate gameobject and let it follow player

EDIT
After applying @Everless Drop 41's script, here is what main problem arises

sentences: Creating multiple fixtures in one body I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?

sentences:
How to start encouraging team collaboration? I am working on converting a single player game to multiplayer, but I am concerned that if I simply do a 1-1 conversion, even in modes with "multiple players" there won't be any incentive for team work. And since I have more experience with single player mechanics than multiplayer ones, I could use some advice on this. Here is what I have implemented so far:

points that reward team based achievements higher than single player achievements eg. single kill vs team kill
a "spotting" mechanic which allows players to show their team the enemy's position on the minimap
health & ammo items which can be shared to resupply the team
team based game modes such as capture the flag, TDM etc

My main concern with the above, is that there is a heavy reliance on individual players to want to play in a team based way. If they don't want to, they can still lone wolf it in most cases which can have a negative effect on the rest of the team who is trying to play collaboratively. It only takes one person in a team to spoil the fun!

For example, the COD series has had a number of perks, achievements and streaks designed to encourage team collaboration; but I have rarely seen these used in multiplayer since a lone wolf strategy seems to be more common. Another example, the Battlefield series has had an entire class devoted to supporting team members with health packs, repairs, ammo resupplies etc and in multiplayer it is common to see this being used to fully effect. So why do such features/mechanics work in one game of the same genre but not in another? I assume the type of player is relevant here, but there must be more to it than that.

What are some tried and true ways to encourage team-based play or collaboration? This does not necessarily mean players talking to each other, but rather working together to achieve the same goal or different parts of the same goal.

sentences:
How does one prevent homing missiles from orbiting their targets? I am developing a 2D space game with no friction, and I am finding it very easy to make a homing missile orbit its target. I am curious about anti-orbiting strategies.

A simple example is a homing missile that simply accelerates directly toward its target. If that target were to move perpendicular to the missile's trajectory then stop, the missile's acceleration toward the target would not be enough to overcome it's own velocity, and the missile could be driven into orbit around the target, as depicted:

In frame 1, the missile is heading straight for its target, no problems.
In frame 2, the target has moved to a new position as demonstrated. The missile continues to accelerate directly toward the target (in red), while still moving toward where the target used to be (in black) due to its existing velocity.
In frame 3, the missile's velocity continues to carry the missile around the side of the target (black) while the acceleration vector tries desperately to pull the missile toward the target.
In frames 4 and beyond, the missile falls into a potentially stable orbit around the target and never reaches its goal. The black arrows indicate a velocity vector while the red lines indicate acceleration vectors at the same moment in time.

Considering that there is no friction in space, there is nothing to slow the velocity of the missile down and collapse the orbit. A possible solution would be to aim "behind" the target, and this would cause the orbit to close, but how is this done from a programming point of view?

How do I make a homing missile reach its target?

sentences:
How bad would be to focus on iOS/Android development for an indie developer? After some time developing games for others I'm thinking of moving towards my own productions. My background is 10+ years of software development, with last 2 years spent on the iOS development (Objective-C and CoronaSDK).

With my current experience in Corona I can quickly develop for iOS and Android systems. And this is something that I'm probably gonna do with several of the game ideas I have, at least for the prototype part.

But - I'm wondering if it's not a bad idea to focus on those 2 systems only. After all there are other mobile platforms, there are PCs, Macs and Linux boxes... All of them having gamers using them.

I was wondering if it wasn't a good idea to try some other SDK, giving me more flexibility when it comes to platform-independance. There's Unity3D (I think I can develop a 2D game in it though), there's MoAI from what I checked.

I see a few options, not sure which one is best as I have little experience in this field (publishing own games):

Stick with CoronaSDK for the whole time, release for iOS and Android platforms, screw other mobile devices and PCs,
Use Corona for prototyping, then when the idea goes more into the "production" phase rewrite it in MoAI or Unity3D for more platforms support,
Start with one of those 2 SDKs right now (which means the prototype phase will be delayed a bit, but after that I can jump right into real coding).

Any clues here, what to do?

sentences:
Kinematic rigidbodies push each other in unet https://youtu.be/j3f44E-ExLc
I have a bunch of rigidbodies on each player, ALL set to kinematic. And this stuff happens. All the sword swinging is animation state driven, and basic back and forth and sideways motion is using Rigidbody.MovePosition. There is not supposed to be any rotation on the players' local x axis. This only seems to happen using Unet networking . Any ideas how to fix this?? Thanks!

sentences: What is the purpose of the beginning of HL1, from the perspective of game design? At the beginning of Half Life 1, player is locked into watching an introductory film that can't be skipped and doesn't teach anything about game mechanics. Player can only move their camera around. A similar technique was applied in Deus Ex 4. Given that it's irritating not to be able to skip it on subsequent gameplays, what is the purpose of those?

sentences:
How to join two cubes? If I want to make a character (in Blender) made of cubes, to export it to unity later, should I leave these cubes and all the other body parts as separate objects, or join them all into one mesh?

And, If I should join them - is it a good idea to leave the cubes elements inside of each other?

Or I should remove them, add some loops and connect the vertexes?

In the last case it will be difficult to keep the cubes surfaces flat, because of the vertex shifting during joining.

sentences:
What is the "MSN Game API"? The other day I herd this "MSN Game API" mentioned, but I can not find any information about it anywhere. This particular API seems to be for browser based games (Such as Flash, and ActiveX embedded games).

What exactly is this API for? And is that its correct name? is it to do with the MSN Zone? Where can I find more information about it, and maybe even some documentation on the actual API.

sentences:
How do I create a wide-angle / fisheye lens with HLSL? What are the concepts that need to be implemented in order to achieve the effect of a wide angle lens of varying extremities?

Pseudocode and specific explanation referring to the various stages of the content pipeline, as well as what information needs to be passed in from the source code to HLSL would be very useful.

Also, what are the differences between implementing a wide-angle lens, and a fisheye?

sentences:
Adding -90 degree Y rotation into script I'm using the following script to move a spray bottle around a head.

It should looke like in a barber shop.

The code works fine: I have assigned the script to the spray bottle, and I have set the head as the target.

One thing that is wrong is that the spray bottle needs to have a -90 yaw rotation in order to face the head.

I have tried the wildest things to include these -90 degrees, all produced weird results.

Could anybody state how to include this -90 Y rotation into the script?

Thank you very much!

using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Orbit with zoom")]
public class MouseOrbitImproved : MonoBehaviour {

public Transform target;
public float distance = 5.0f;
public float xSpeed = 120.0f;
public float ySpeed = 120.0f;

public float yMinLimit = -20f;
public float yMaxLimit = 80f;

public float distanceMin = .5f;
public float distanceMax = 15f;

private Rigidbody rigidbody;

float x = 0.0f;
float y = 0.0f;

// Use this for initialization
void Start ()
{
    Vector3 angles = transform.eulerAngles;
    x = angles.y;
    y = angles.x;

    rigidbody = GetComponent<Rigidbody>();

    // Make the rigid body not change rotation
    if (rigidbody != null)
    {
        rigidbody.freezeRotation = true;
    }
}

void LateUpdate ()
{
    if (target)
    {
        x += Input.GetAxis("Mouse X") * xSpeed * distance * 0.02f;
        y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f;

        y = ClampAngle(y, yMinLimit, yMaxLimit);

        Quaternion rotation = Quaternion.Euler(y, x, 0);

        distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel")*5, distanceMin, distanceMax);

        RaycastHit hit;
        if (Physics.Linecast (target.position, transform.position, out hit))
        {
            distance -=  hit.distance;
        }
        Vector3 negDistance = new Vector3(0.0f, 0.0f, -distance);
        Vector3 position = rotation * negDistance + target.position;

        transform.rotation = rotation;
        transform.position = position;
    }
}

public static float ClampAngle(float angle, float min, float max)
{
    if (angle < -360F)
        angle += 360F;
    if (angle > 360F)
        angle -= 360F;
    return Mathf.Clamp(angle, min, max);
}
}

sentences:
Make a flying object rotate so the camera sees the rotation When I attach a camera to my flying object (plane), when I rotate the object, the camera is perfectly following it so you can't really "feel" the plane rotating. I want to create the effect that you see in flying games where you see the plane rotating along the x axis (so you see the nose go up and tail down) while also semi-following the plane, creating a better effect.

How do I achieve this?

sentences:
Unity3D : Prefab Instancing Issue I am using latest unity engine and I am having a scripting issue.

I create a prefab , added a few scripts to it and I am trying to instantiate a few of those objects like this :

        GameObject go = Instantiate(Prefab) as GameObject;
        var co = go.GetComponent<MyScriptA>();

Issue here is co is always null, this means that MyScriptA is no on the go instance.
Accessing the prefab.GetComponent also returns null, but the prefab has the scripts in the editor and its assigned also in the editor to the Prefab variable (drag dropping). So I am not sure what might be wrong.
For example if I Debug.Log(prefab) its not null.

So what am I doing wrong here?

sentences:
Are frequent game updates a solution for preventing multiplayer cheating? I'm creating a game on Android where the enforcement of rules can only take place on client side (I can't shift it to server side...think aimbotting but in my case I wouldn't even be able to use heuristics to detect it!).

As I've read many times, the client side is impossible to 100% protect from modification/hacking.

I am going to include protections such as ProGuard obfuscation. But also I'm going to use a formula in the code which encrypts data from the client.

Hackers/cheaters can decompile the code and locate this formula eventually.

But how long will it take for them to uncover the encryption formula? A day, a week? Actually, how long in general does it take for a game to be modded for cheating?

Can I release updates to my game so that by the time hackers release modded versions of my app to public, they become obsolete? If I did release updates, I wouldn't require updates for single player mode, but only when they tried to do multiplayer would a message display telling them they must update.

I just really want to make multiplayer fair and not scare off players because they face opponents with uber-awesome hax.

sentences:
How to correctly synchronize a shared surface? I am trying to share a direct3d9 surface between two processes. One process (let's call it A) writes to the surface, and the other (B) displays it on screen. Currently, process A does a StretchRect of its rendering surface to a shared surface, and then sets a flag in shared system memory to tell B that it's done. When B sees the flag, it then does a StretchRect of the shared surface to its own display surface. Process B then sets the flag again to tell A it is done.
It seems however that after the StretchRect on the shared surface returns, the texture has not necessarily finished copying, because sometimes Process B gets the previous picture, or sometimes even there is tearing (i.e. one half of picture N + one half of picture N + 1).
As I understand it, Direct3D is largely asynchronous under the hood, and does not ensure synchronisation between processes. I therefore need to ensure by myself that Process A has finished copying before displaying in process B, and vice-versa. Am I correct in my interpretation of the situation, and how would I achieve this? I am experimenting with LockRect() but I'm not sure if that's optimal or even guaranteed to work.
From MSDN documentation:

Shared cross-process surfaces provide no synchronization mechanism.
Read/write changes to a shared surface may not reflect a referencing
process's view of the surface when expected. To provide
synchronization, use event queries or lock the texture.
Only the
process that initially creates a shared resource can lock it (any
process that opens a reference to that shared resource cannot lock
it).

sentences:
HTML5 without a framework I am looking to get into game development, after a lot of searching I have decided to try with html5 and, while I can see the advantages of frameworks, I would like to learn the basics without a "crutch".

Is it realistic to even try and start learning game development without using a framework? Also, if I decide to use one, what should I consider when deciding on one?

sentences:
Is JavaScript viable for serious multiplatform 2D game development? Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn this into a career.

I would like to develop strategy games like "Stronghold" and "Age of Empires".

The problem is that my language of choice is JavaScript.

sentences:
Swing GUI for games (performance) I'm developing a game in Slick2D and I'm trying to make GUI.

I've already tried TWL library, but it seems to me a bit complicated and it doesn't cover what I need. In my own implementation of GUI I've encountered a problem with positioning of components. That's why I'm interested in Swing. I would use only its layout system and I would render components on my own (in Slick render loop).

So I'm asking, is it good for performance to do so? May I encounter other problems with Swing?

sentences:
Java applet game design no keyboard focus THIS IS PROBABLY THE WRONG PLACE. POSTED ITHERE (STACKOVERFLOW)

I'm making an applet game and it is rendering, the game loop is running, the animations are updating, but the keyboard input is not working. Here's an SSCCE.

public class Game extends JApplet implements Runnable {

    public void init(){
        // Initialize the game when called by browser
        setFocusable(true);
        requestFocus();
        requestFocusInWindow();  // Always returning false
        GInput.install(this);    // Install the input manager for this class
        new Thread(this).start();
    }

    public void run(){
        startGameLoop();
    }

}

And Here's the GInput class.

public class GInput implements KeyListener {

    public static void install(Component c){
        new GInput(c);
    }

    public GInput(Component c){
        c.addKeyListener(this);
    }

    public void keyPressed(KeyEvent e){
        System.out.println("A key has been pressed");
    }

    ......

}

This is my GInput class. When run as an applet, it doesn't work and when I add the Game class to a frame, it works properly.

Thanks

sentences:
Label does not maintain correct position within a Table I'm hoping the fix is quite simple, but this has become increasingly frustrating. I've built a minimally reproducable example. This is how the table is rendered:

And this is the corresponding code:

    private Table testTable() {
        Table table = new Table();
        Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
        Label label1 = new Label("String", skin);
        Label label2 = new Label("Hello", skin);
        Label label3 = new Label("World", skin);

        table.add(label1);

        table.row();

        table.add(label2).width(100).height(100);
        table.add(label3).width(200).height(200);

        table.setFillParent(true);
        table.debugAll();

        return table;
    }

As you can see, the "Hello" and "World" labels are not centered within their logical tables. Further, even if I try .width(100).height(100).center(), or even .bottom().right(), for example, the two labels' positions are always fixed to the left, center of their logical table.

The only way I could 'fix' the problem is by excluding the .width().height(), but I need them for my UI.

Any thoughts?

sentences:
Keeping object a fixed distance from the ground, buggy behavior I'm trying to make a script that will keep my object exactly 1 meter from the ground. So far I've got the following code :
    using UnityEngine;
    using System.Collections;

public class HoverScript : MonoBehaviour {

    public Transform target;
    public float hoverDistance;
    void Start ()
    {

    }

    void Update ()
    {

    }

    void FixedUpdate ()
    {
        if (Physics.Raycast(transform.position, Vector3.down, hoverDistance))
        {
            RaycastHit hitInfo;
            Physics.Raycast(transform.position, Vector3.down, out hitInfo, hoverDistance);
            float correction = hoverDistance-hitInfo.distance;
            //Debug.Log(correction);
            //Debug.Log(target.position);
            target.position = new Vector3(target.position.x, target.position.y+correction, target.position.z);
            //Debug.Log(target.position);

        }
    }
}

Basically, if the raycast hits, then it finds the distance of the hit. If it's .9 and the hoverDistance is 1, it would push the object up by .1, and keep checking every update. It seems like it would work, but I get this result : http://www.gfycat.com/IllfatedMediocreAquaticleech

In case the link goes down, basically the object falls like normal because of gravity until the distance is reached, then it slows down dramatically and slowly sinks into the ground.

The objects are set up like this

gameObject(has hover script, rigidbody, the camera following script)
 |
 ----> mesh(just a mesh, mesh renderer, and collider)

The target of the script is the parent gameObject.

Any ideas why this script isn't working?

sentences:
What economic books would you suggest for learning about economic valuation of goods and simulations thereof? I'm looking to create an economic model for a game based on goods created procedurally.

Every natural resource and produced good would be procedurally generated, with certain goods being assigned certain uses.

  Fakesium might be used for the
  production of Weapon A and produced
  from Fakesium factories which use
  Dilithium and Widgets as reagents,
  where Widgets are also the product of Foo
  and Bar

The problem is not creating the resources and their various production utlities - but getting the game's AI empires and merchants to (Addendum: somewhat) correctly value the goods according to their scarcity, utility and production costs.

I need to create a simulation of goods which allows the various game factions to assign a common value denominator (credits) to each resource, depending on how much its worth to that empire.

I see the simulation being something like: "I have a high requirement for Weapon A. Since I don't have much of Fakesium, which is needed for Weapon A - I must have a high demand for Fakesium. If I can acquire Fakesium, devalue it. If not, increase its value - and also increase demand for Dilithium and Widgets too."

This is very naive - because it may be much much cheaper for the empire to simply purchase Dilithium and Widgets directly rather than purchasing Fakesium, for example. Another example is two resources might allow the creation of Weapon A (Fakesium and Lieron), so we'd need to consider that. I've been scratching my head over the problem and it keeps growing.

By the time the player joins the world, I'd expect enough iterations of this process to have occurred that prices would have largely normalised - and would then only trigger rarely to compensate for major changes (eg. if the player blows up the world's only Foo mine!)

Could anyone suggest resources (books, largely) which outline this style of modelling, preferably in the context of simulations? Since this problem would never occur outside fantasy worlds, I figured this is probably the most likely place to find people who have encountered similar problems and I'm sure there's people who know of good places for Games Developers to start looking at less specific economic theory too.

Additionally, does anyone know of any developers with blogs whose games or research applications perform similar modelling?

EDIT: I think I should underline that I'm not looking for optimal solutions. I'm looking to make the actors impulsive - making rudimentary decisions based on fuzzy inputs about what they care about or don't. I'm aiming to understand the problem area better not derive answers. All the textbooks I've found seem to be about real-world economics or how to solve complex theoretical problems, neither of which are terribly relevant to the actor's decision making.

sentences:
Clamp camera view angles relative to moving object I have a camera attached to an entity that moves in a circular pattern around a fixed center position. I am attempting to clamp the rotation of the camera such that it can only look inward toward the center of the circle.

I have tried for some time to accomplish this but haven't had much luck.

Simply clamping the angles like this will not work:

rotation = Vector3.Clamp(rotation, new Vector3(-50.0f, rotationY, 40.0f), new Vector3(-20.0f, rotationY, 100.0f));

(the rotation angles are relative to world space, and not the local rotation of the entity)

I need to get a clamp value that is relative to the direction the entity is facing.

Is there any way I can accomplish this?

Update-

Adding the rotation of the entity to the camera rotation like in the following seems to work intermittently, but now it seems the camera starts stuttering at certain points around the circle.

Still stuck.

Vector3 clampMin = new Vector3(-50.0f, 0, 40.0f);
Vector3 clampMax = new Vector3(-20.0f, 0, 100.0f);

public void Update()
{
       // adding the users input
       rotation = camera.Rotation + (new Vector3(GetInputY(), 0, GetInputX()) * 4.0f);

       float clampX = ClampAngle(rotation.X, clampMin.X, clampMax.X);

       float clampZ = ClampAngle(rotation.Z,
                entity.Rotation.Z + clampMin.Z,
                entity.Rotation.Z + clampMax.Z);

       camera.Rotation = new Vector3(clampX, 0, clampZ);

}

sentences:
Steering constantly turning in circles I've been working on a fish system in a compute shader but bugs have been drowning me. The latest bug had me strip almost all the functionality to track down:

Fish keep turning in circles. It starts slowly, the fish gains velocity in the proper direction, then it reverses. The fish slowly loses velocity until it does a 180 and then the forward wander then applies acceleration behind it repeating the process. However the reverse isn't exactly 180 degrees behind it. It goes from doing roughly 180 degree instant turns to tracing smooth circles over a period of roughly 10 seconds.

float desiredSpeed = 0.2f;
// Wander Behavior substitute
float3 acceleration = (fish.mat._21_22_23 * desiredSpeed  - fish.velocity) * velocityMultiplier;

// Acceleration
float accelMag = length(acceleration);
float3 steerDirection = fish.mat._21_22_23;
if (accelMag > 0)
    steerDirection = acceleration / accelMag;
if (accelMag > desiredAccel)
{
    acceleration = steerDirection * desiredAccel;
    accelMag = desiredAccel;
}

// Direction
if (accelMag > 0)
{
    // Removed rotation smoothing
    fish.mat._21_22_23= normalize(acceleration); // forward
    fish.mat._11_12_13 = normalize(cross(fish.mat._21_22_23, float3(0, 0, 1))); // right
    fish.mat._31_32_33 = normalize(cross(fish.mat._11_12_13, forward)); // up
}

// Velocity
fish.velocity += fish.mat._21_22_23 * accelMag * fishDeltaTime;

speed = length(fish.velocity);
if (speed > desiredSpeed)
{
    fish.velocity = fish.velocity / speed * desiredSpeed;
    speed = desiredSpeed;
}
fish.mat._41_42_43 += fish.velocity * fishDeltaTime;

Once the fish is going in circles I understand what is happening. The fish has a velocity off to one side and it calculates the desired velocity as (forward * speed - velocity). That translates to an acceleration added at an angle pointing inwards away from the velocity so the fish continues to turn. You can sort of see it in this picture:

The light gray line is the current velocity, dark blue the desired wander velocity (forward), light blue the wander acceleration that is causes the fish to turn to the left.

My questions are:

Why does the fish slow and start to turn if acceleration is only added in the forward direction?

How do I rewrite the code so that the this sort of situation doesn't happen? Ideally the current velocity would become more forward and the corrective acceleration would lower until it went back to a normal straight line.

sentences:
How to project a foam trail on dynamically changing mesh I am trying to create water, and right now I got it through dynamically generating waves on a mesh. But now I want to make my boat manipulate these waves, and cause a Kelvin Wake on top of this.

Fact is I generate the water using different tiles, repeating the same pattern dynamically. So How would I generate this on top of a dynamically generated mesh(plane)? Without also manipulating the other tiles (planes)?

sentences:
App Store Optimisation-Package Name I have a game in play store and trying to get it to the upper places on the search engine. As I read, the package name should be similar to the game title. What is the effect of it in the searches?

I also made a lot of keyword research and added the relevant keywords to the title and description. Hovewer, I still can not see my game in a good place when I make a search.

What other things are necessary for my game to be at a better point in search results?

Thank you very much for your answers and suggestions.

sentences:
Correctly done level scaling? A lot of role playing games have a system where npcs scale with the player level and become stronger, on the surface it might seem genial but in most games either it doesn't change anything or it makes low levels enemies ridiculously hard to beat or sometimes impossible, like in oblivion.

I came up with the idea of making nps not scale with the level of the player but scale with stats.

For example a level 1 wolf has a base attack that deals 5% of the players maximum HP as damage with each hit, but is mitigated by defense. Therefore the attack will remain consistent in strength even when the player is max level but can be blocked by sacrificing damage to build  a lot of denfese or by becoming better at parrying attacks.

Is there any other mechanism I can implement to make the npcs stronger through all the levels without making them ridiculously invincible or giving them one hit mechanics that instantly kill the player?

sentences: Recommended Polling Rate I'm using the XInput API to support gamepads. As XInput is not event-driven, but requires polling, my question is, what is the recommended polling rate (ms) for gamepads or specific, the XBOX 360 controller?

sentences:
Use of NetworkHash128 assetId in Custom Spawn Handler I was learning Custom spawn handler on Unity Manual. It says before spawning we need to Register Spawn handler using ClientScene.RegisterSpawnHandler(coinAssetId, SpawnCoin, UnSpawnCoin);
 I understood SpawnCoin and UnSpawnCoin is Handler function that will be invoked on clients but what is the use of coinAssetId?

sentences: How can I apply different actions to different parts of a 2D character? I am developing a 2D platform game in Java. The player has a gun in his hand every time. He needs to walk and shoot with the gun(arrow keys for walk and X key to shoot). The walk cycle takes 6 frames and i am able to import the sprite sheet and animate the sequence when I press arrow key. But i need to add the gun motion. The player holds the gun upwards and when X key is pressed he brings it straight and shoots. How to implement the walk + shoot action?

sentences:
How can I create a mesh of triangles made from the vertices of a polygon and contained within that polygon? I'm trying to programatically generate a mesh, given the vertices of a polygon, which is contained within that polygon. For example, starting with these points:

I would want to generate a mesh similar to this:

My first port of call would be a Delaunay triangulation, but having implemented this, I came up against the problem that this was not contained within the polygon, i.e. it produced a mesh like this:

My question then is, is there either an algorithm which produces the desired result rather than the Delaunay result (because I can't find one online), or a modification that I can make to the Delaunay triangulation algorithm that will fix this?
I'm using the Bowyer-Watson algorithm, by the way. Thank you!

sentences: How to increase MagicaVoxel size limit? I need to increase the size of the field you make models in by at least 20. It really doesn't make sense why you cannot go beyond 126x126x126 because in the MagicaVoxel viewer, there are sample models of 1000x1000 so there's gotta be a way to make larger models in MagicaVoxel. Anyone know how?

sentences:
Player losing alignment with tilemap after moving I'm using an isometric tilemap(2:1) and I can't figure out how to make grid based movement on it's surface. I managed to get a code working for the grid based movement, moving my character with 0.5 along the Y axis and 0.86 ( sqrt(3)/2 ) along the X axis since I imagine it should work as if they are diamonds with the side of 1 unit, but it doesn't align with the center of the next tile. Here is my movement code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions.Must;

public class Movement : MonoBehaviour
{
    Vector3 pos;         // For movement
    float speed = 5f;   // Speed of movement
    public float x = 0.86f;
    public float y = 0.5f;

    void Start()
    {
        pos = transform.position;          // Take the initial position
    }

    void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.A) && transform.position == pos)
        {        // Left
            //pos += Vector3.left;
            pos += new Vector3(-0.86f, 0.5f, 0);
        }
        if (Input.GetKey(KeyCode.D) && transform.position == pos)
        {        // Right
            //pos += Vector3.right;
            pos += new Vector3(0.86f, -0.5f, 0); // miscare in diagonala
        }
        if (Input.GetKey(KeyCode.W) && transform.position == pos)
        {        // Up
            //pos += Vector3.up;
            pos += new Vector3(0.86f, 0.5f, 0);
        }
        if (Input.GetKey(KeyCode.S) && transform.position == pos)
        {        // Down
            //pos += Vector3.down;
            pos += new Vector3(-0.86f, -0.5f, 0);
        }
        transform.position = Vector3.MoveTowards(transform.position, pos, Time.fixedDeltaTime * speed);    // Move there
}

sentences:
How to find the "up" direction of the view matrix, with GLM Using OpenGL and the GLM matrix library, I want to translate my camera relative to the world coordinate system. This requires me to compute the necessary view matrix. To initialise the view matrix, I used:

view_matrix = glm::lookAt(eye, centre, up);

Where eye = (0, 0, 10), centre (0, 0, 0), and up = (0, 1, 0). Suppose I want to now translate the view matrix by 5 unites in the camera's y-direction, i.e. to move upwards relative to the model. I tried:

view_matrix = glm::translate(view_matrix, glm::vec3(0, 5, 0));

This works fine at first, because the view and world coordinate systems are aligned. However, if I then rotate my camera a bit, and then perform this translation, it no longer works. Instead, it moves the camera along the world coordinate system, rather than the camera coordinate system.

So what I need to do, is to find the vector which represents the "up" direction of the camera, and then translate along this vector. This is similar to the inverse of the glm::lookAt(eye, centre, up) function.

In summary: Is it possible to find the "up" vector of the view matrix using the GLM library?

sentences:
Representing realistic population What's the best way to represent a realistic population number (e.g USA:317,569,000) in game?

For example, Civilization your city has 1 Citizen. Obviously, a city can't just have one person in a city but Civ seems to do a good job at representing citizens that way.

What I'm after is to represent 300+ million in an easy to swallow number to a player.

I have a calculation which states that, in theory, to have 300+ people you would need 79 million 4 person dwellings. (I understand this may not be totally accurate, but it works for my needs)

It seems tedious to have the player do that with a couple of methods I've thought about.

So my question then is I need some way to make the game and the player aware that the player's city has 100,000 people in it without making the player create 25,000 dwellings.

Update 1:

As @Patrick M states, in Civ you only have to build one of a building type.

Much like dwellings, it doesn't make sense to force the player to build one police station/1000 people.

I have a formula that calculates the theoretical population limits of an area and I want to constrain the player to this limit. (Players have a reason for wanting larger regions)

However, I don't want the player to instantly have 10,000 citizens simply because he built a "house/neighborhood".

I want to represent real world constraints and requirements without the super micro management that would be present in forcing the player to build 2,500 dwellings (to get the 10k)

sentences:
Rotating fps rigid body on the Y axis I'm currently attempting to make a first person character using a rigid body.  I am aware that the character controller exists, but I believe my game will be very physics based so it's better if my character is a rigid body.  I currently can walk, and rotate the camera up and down with the mouse.  I am now trying to rotate my character left and right with the mouse, but this requires me to rotate my rigid body, not just the camera.  Here's my code so far.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    [SerializeField] float walkSpeed = 3;
    [SerializeField] float cameraSpeed = 3;

    Vector3 direction;
    float cameraX;

    Rigidbody myRigidBody;
    [SerializeField] Camera myCamera;
    // Start is called before the first frame update
    void Start()
    {
        myRigidBody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        direction = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        cameraX = -Input.GetAxis("Mouse Y") * cameraSpeed;

        myCamera.transform.Rotate(new Vector3(cameraX, 0, 0));
    }
    void FixedUpdate()
    {
        myRigidBody.AddRelativeForce(direction * walkSpeed, ForceMode.Acceleration);
    }

I believe that the rigid body function I should use to rotate left and right is MoveRotation (I'm still new to rigid bodies), but I'm open to ideas.  MoveRotation uses Quaternions, and I have no idea how to translate my mouse axis into a quaternion.
Here's my question, How do i implement the Y rotation for my rigid body first person controller?  Should I use torque, or somehow directly alter my rotation without using forces? Also, How do i translate the Mouse Axis into something I can use to rotate something?  thnx.
Edit:
I tried adding this line of code:
myRigidBody.MoveRotation(Quaternion.Euler(0, mouseX * cameraSpeed, 0));

for some reason it has no effect on my character at all, but I feel Like it's on the right track.  Why isn't this working?
Edit 2:
I added this line in Update:
rotateDirection = new Vector3(0, Input.GetAxis("Mouse X"), 0);

And this line in FixedUpdate:
myRigidBody.MoveRotation(Quaternion.Euler(rotateDirection));

Now when I move my mouse (I commented out my camera up and down movement to test) my character moves left and right for a tiny bit, but jitters back to it's original position, so It feels like I'm fighting it.  The rotation in the inspector jitters in the correct direction, negative if i move the mouse left, positive if right, but only for a very small amount, 1.45 being the most, and then reverts back to zero.  Also, it doesn't rotate smoothly, but jitters.  Anybody know whats going on?
Edit 3: changed it from addforce to addrelativeforce because that make it move forward based on local coordinates not global.

sentences:
Is learning OpenGL2.1 today a bad idea? Possible Duplicate:
  Is learning OpenGL 2.1 useless today?

This question was asked around 2 years ago and i have well read the answers to it, but that was 2 years ago, i would like to know if it's a bad idea for me to learn OpenGL2.1 today.

I bought the OpenGL superbible (4th edition) and not the 5th because some user in the ratings said that it was much better and i believed him. But now i'm affraid that was a long time ago.

Thanks for all your feedback!

sentences:
Algorithm for "healing" multiple rectangles into a smaller number of rectangles? Say I have a grid of rectangles of different shapes and colors and I want to reduce (reasonably close to optimal is fine, optimal is not necessary) the number of rectangles to represent the same layout of colors.

The image above is a very simplified case and the whitespace between the rectangles is for visualization only -- they would actually be tightly packed.

What is an approach or algorithm name (happy to google) that can help me do this?

sentences:
How to change TPS camera angle in Unity I'm very new to Unity and this may simply be a failure of google-fu but I hope someone here can help me out.

I'm working through a series of tutorials on how to create an RPG in Unity, making small improvements and embellishments as I go to make sure I understand the concepts.

I've built a player character with walk and run animations and a camera which follows the player around and stays aimed at the centre of the character model using the following code.

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

public class CameraFollowPlayer : MonoBehaviour
{
    GameObject target;

    // Start is called before the first frame update
    void Start()
    {
        target = transform.parent.gameObject;
    }

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(target.transform.position);
    }
}

The problem with this is the angle this leaves the camera pointing at in-game is to acute, making it difficult to see what is ahead of the character. How can I adjust the target of the LookAt instruction to result in a shallower X-axis rotation of the camera?

sentences:
Cocos2d background sound not playing a second time C++ I'm using cocos2d-x on windows10 UWP project. I use the SimpleAudioEngine to load the music:

CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("level_music1.wav",true);

On the close button handler I use the end method:
CocosDenshion::SimpleAudioEngine::getInstance()->end;

When I run the debugger a second time I get these exceptions:

  Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x000006BA: The RPC server is unavailable.
  Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x0000000E: Not enough storage is available to complete this operation.
  Assert failed: getFileSize should be override by platform FileUtils
  Assertion failed!

only if I rename the file to say like "level_music.wav" it works again but failed again the second time so I have to constantly rename it to work.

sentences:
Client code handling its own generics when returned by an engine I'm writing a game engine in Java 8, and have prototype client code written in Groovy.

New Game objects can be created with a builder which defines everything which fills in the blanks. To simplify things, suppose the only thing the Game class needs is a mapping of keyboard inputs (which both the client and engine know about) to dynamic input events (which only the client knows about).

The input events are defined by the client, and are only ever dealt with by the client. The engine acts only to notify the client that an input has occurred which has been mapped to that input event. At that point, it then calls a method implemented by the client with that input event as the sole parameter.

My goal is to have the client code which receives the input event know at compile time the type of the event which is first provided by the client when the Game object is instantiated. My initial naive attempt at this was to turn all my engine code into generic type of <T extends Enum<?>> but this just made a mess of everything, and solved nothing since the client code, as far as I know, only knows it's dealing a generic enum when it gets a callback.

Is this what I'm attempting even possible? Am I heading down the road with enums and generics?

sentences:
Constant Buffer size mismatch on PS, fine on VS and GS I have the following C/C++ struct:

struct ShadowMapCB {
        Math::Matrix4 cropMatrix[4];
        Math::Matrix4 textureMatrix[4];
        float splitPlane[4];
    };

and my HLSL constant buffer:

cbuffer CBShadowMap : register(b4)
{
    matrix g_CropMatrix[4];
    matrix g_TextureMatrix[4];
    float g_fSplitPlane[4];
};

When i bind it to pixel shader i get an error:

  D3D11: WARNING: ID3D11DeviceContext::DrawIndexed: The size of the Constant Buffer at slot 4 of the Pixel Shader unit is too small (528 bytes provided, 576 bytes, at least, expected). This is OK, as out-of-bounds reads are defined to return 0. It is also possible the developer knows the missing data will not be used anyway. This is only a problem if the developer actually intended to bind a sufficiently large Constant Buffer for what the shader expects.  [ EXECUTION WARNING #351: DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL ]

and infact the last 4 floats (array[4]) are messed up, the weird thing is that on the VS and GS it works fine..., and yes i did bind them with PSSetConstantBuffers and update it ofcourse.

What could be causing this?

sentences:
what happens when you set transform.position in Unity? Unity has both transform.positionandtransform.localPosition.
When I do transform.position.x += 3f; does unity automatically update transform.localposition?
and vice versa?

Why can I not see this when I go to the definition of transform.position in VS?

sentences:
Sprite draw-order in libgdx From other frameworks I know methods for easy ordering sprites within a spritebatch (to determine if a sprite has to be drawn in front or behind another sprite). For example in MonoGame/XNA this is called Sprite.depth or Pyglet has its OrderedGroups.

But I cannot find anything like that in libgdx. I've read that libgdx' scene2d has something like that but I don't want to use that as I use a entity system (ashley) and want to keep rendering separeted from the other logic.

What is the appropriate way to set the draw-order of libgdx sprites?

sentences: Recreate UI or move it out of view? Which method would be best? What are the pros and cons? For example, if I have a main menu screen, I can easily start my game loop right as the user presses 'Start'. Which would be better, moving the 'Start' button as well as, 'settings, leaderboard, etc' buttons out of view? or to erase them and then recreate them when needed?

sentences:
Finetuning movement based on gradual rotation towards a target I have an object which moves towards a target destination by gradually adjusting its facing while moving forwards. If the target destination is in a "blind spot", then the object is incapable of reaching it.

This problem is ilustrated in the picture below. When the arrow is ordered to move to point A, it will only end up circling around it (following the red circle) because it is not able to adjust its rotation quickly enough.

I'm interested in a solution where the movement speed is multiplied by a number from 0.1 to 1 in proportion to necessity. The problem is, how do I calculate whether it is necessary in the first place? How do I calculate an appropriate multiplier that is neither too small nor too large?

    void moveToPoint(sf::Vector2f destination) {
        if (destination == position) return;

        auto movement_distance = distanceBetweenPoints(position, destination);
        desired_rotation = angleBetweenPoints(position, destination);

        /// Check whether rotation should be adjusted
        if (rotation != desired_rotation) {
            /// Check whether the object can achieve the desired rotation within the next adjustment of its rotation
            if (Radian::isWithinDistance(rotation, desired_rotation, rotation_speed)) {
                rotation = desired_rotation;
            } else {
                /// Determine whether to increment or decrement rotation in order to achieve desired rotation
                if (Radian::convert(desired_rotation - rotation) > 0) {
                    /// Increment rotation
                    rotation += rotation_speed;
                } else {
                    /// Decrement rotation
                    rotation -= rotation_speed;
                }
            }
        }

        if (movement_distance < movement_speed) {
            position = destination;
        } else {
            position.x = position.x + movement_speed*cos(rotation);
            position.y = position.y + movement_speed*sin(rotation);
        }
        updateGraphics();
    }

sentences:
Adapting tilemap algorithm to support isometric tilemap I'm using Phaser to build an isometric game. The framework doesn't have support for isometric tilemaps yet, so I'm starting to write a PR for it to support.

What I currently have, loading an isometric tilemap on the current Phaser.Tilemap object, is this:

As you can see, the tiles are wrongly positioned because of the simple 2D tile positioning approach the framework currently uses.

The class that actually makes the parsing of the JSON map and converts it into a tilemap is Phaser.TilemapParser, specifically at line 185.

What I need is some help on where to start adapting this parser – or any other part of the code – in order for it to support isometric tilemaps.

I don't know exactly where to start extending this parser – or even writing a new parser just for isometric tilemaps. Also, I know the calculations are different for positioning isometric tiles, and I want to know too where that change should go here, as I didn't find that either.

sentences:
How to prevent showing outside of Game Map ( Cocos2D-x ) ( Scrolling game ) I'm trying to make a tower defense game and it can zoom in/out and scrolling over my world map. How to scroll over the game and how to restrict it not to show outside of my map(black area).

At below I scroll over the map by using CCCamera but I don't know how I can restrict it.

CCPoint tap = touch->getLocation();
CCPoint prev_tap = touch->getPreviousLocation();
CCPoint sub_point = tap - prev_tap;

float xNewPos, yNewPos;
float xEyePos, yEyePos, zEyePos;
float cameraPosX, cameraPosY, cameraPosZ;

// First we get the current camera position.
GameLayer->getCamera()->getCenterXYZ(&cameraPosX, &cameraPosY, &cameraPosZ);
GameLayer->getCamera()->getEyeXYZ(&xEyePos, &yEyePos, &zEyePos);

// Calculate the new position
xNewPos = cameraPosX - sub_point.x;
yNewPos = cameraPosY - sub_point.y;

GameLayer->getCamera()->setCenterXYZ(xNewPos, yNewPos, cameraPosZ);
GameLayer->getCamera()->setEyeXYZ(xNewPos, yNewPos, zEyePos);

And for zooming I used such code:

GameLayer->setScale(GameLayer->getScale() + 0.002); //zooming in

sentences:
P2P network hiding positions? I have been working on a P2P architecture for secure gaming and I have divided the problem into five sub-problems:

Unlawful modification of sent game state
Accurately drop cheaters
Agreeing on a game state
Avoiding "look ahead" cheat
Hiding sensitive information from opponents

The first four I have pretty much all solved but it is the last one which I am having trouble with.

Before I go into details I just want to ask if there's anything I've missed in my list of making a "cheat proof" p2p network. I am not interested in cheats such as using aimbots, I am only interested in making the p2p network as secure as a centralized server.

So in my effort so far on hiding sensitive information I've focused on the position of players in a game where the position of your opponent should not always be known. The problem then becomes how to determine if you should send you position to your opponent without knowing the position of your opponent.

I have ruled out methods such as the opponent sending multiple false positions for you to compare yours too since your opponent can easily abuse such a system since he will get your position if one of the false positions happened to be "visible" from your position.

The method I have been focusing on one in which you receive a "visual field" from your opponent and can thereby determine if you should send your position or not. This is however a problem in games such as League of Legends where the visual field of your opponent is also highly sensitive information. I have tried to solve this by transforming the visual field using a singular matrix meaning you cannot go from the transformed version of the visual field back to the original version, but since it is a linear transformation you can still figure out if your position is inside the visual field or not.

This does not however work perfectly, the exact visual field cannot be restored after transformation, but information about the "slopes" in the visual field (the visual field is constructed by several lines, and the slope of each line can be determined) can be restored and this can be used to relatively inexpensively  reconstruct the original visual field.

In essence, what I need is a function which can determine if a position is "visible" or not, and reconstructing this function/visual field has to be so computationally demanding that once you are done reconstructing the visual field it is no longer relevant for the game in action. Is there any super smart person out there who happens to know of such a method?

Edit
People seam kind of confused about the whole "vision field" so I aim to give a more detailed explanation here. The vision field consists groups of a set of lines, you can easily check if a position is inside one of these groups by just checking which side of the line your position is, if it's on the same side for all lines in that group you know it's inside that group and thus inside the vision field.

The information being sent however is not this line, but a transformation of the line and the transformation (2 by 2 singular a matrix), you can still check which side of the line your position is on by first transforming it using the transformation you received and comparing that value to the transformed line. The key here is that the transformation is singular, meaning it is impossible to find an inverse to go back to the original line. However it is possible to determine the slope of the line which makes reconstructing the line by just checking on which side of the transformed line a lot of points lie until you have pinpointed the origin of the line a lot computationally cheaper than if you did not know the slope of the line.

What I am looking for is a method for determining if a point is inside of an area, where reconstructing the area from the method is either impossible (which I doubt exists since you can always brute force it) or very computationally heavy.

sentences:
How to change from 60FPS to 30FPS while keeping things smooth? Here is my current game loop:

final int ticksPerSecond = 60;
final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;

while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){
        updateLogic();
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

On most devices I've tested my game on (this is an Android game BTW) it runs quite nice.

As you can see, I'm using a fixed time-step (defined as my ticks per second).

If I reduce my Ticks Per Second to 30, everything runs at the same speed but is nowhere near as smooth.  I keep hearing people say that 30fps should be OK for mobile games and everything should run great at 30 fps, but that's just not my experience.

Would be grateful if someone could give me some pointers on how to achieve this.

sentences:
unity how to automate changing sprite editor setting I have a bunch of hex tiles that I want to import into a tile palette. However their pivot point needs to be set to y 0.35 when the default is 0.5

I could edit the import settings in the sprite inspector or change the pivot point in the sprite editor but that takes forever with hundreds of tiles.

Is there any way I could automate that?

sentences:
How to instantiate a prefab only when something is hit, and for some seconds? How do I instantiate a prefab only when something is hit for a few seconds? I mean, I just need to activate the particle system when something is hit. Now it always runs, even before I hit something. I need it to activate the particle system when something is hit and for 2-3 seconds.

This is what I do now:

public void Shot()
{
    Destroy(gameObject);
    Instantiate(effect, transform.position, transform.rotation);
}

sentences:
2D pixels change size when scrolling I'm working on a 2D side-scroller, OpenGL, pixel art. And I'm having trouble getting the pixels to remain square when scrolling the camera. By that I mean, when scrolling the camera at low speed when you have tile pixels being draw at 2x2 scale, you can see some pixels become 3x2 in size rather than 2x2. I've tried different ways of calculating the size of the orthographic projection in order to get the pixels sized correctly, and while they do usually appear correct when stationary, they always wobble while scrolling.

Here is my latest attempt at calculating window size for the orthographic projection:

#define TILE_SIZE 32 // Each tile is 32x32
#define TILE_MIN_HEIGHT 10 // Adjust pixel size to fit at east 10 tiles vertically in the window

float windowRatio = (float)window->width / (float)window->height;
int pixelSize = window->height / TILE_SIZE / TILE_MIN_HEIGHT;
float tileHeight = (float)window->height / (pixelSize * TILE_SIZE);
gameState->windowTileWidth = tileHeight * windowRatio * TILE_SIZE;
gameState->windowTileHeight = tileHeight * TILE_SIZE;

window->orthoProjection = matrix44_createOrthographic2D( gameState->windowTileWidth, gameState->windowTileHeight );`

So far, I've tried all of these in an attempt to eliminate the wobble:

Calculate orthographic projection as above, to fix at least 10 tiles vertically, adjusting projection size to fit window ratio.
Calculate orthographic projection to exactly fit a 20x10 tile scene, scaling pixels to fit window.
Render the scene to a 1:1 scale framebuffer, then blit that buffer to the window to scale it up to desired pixel size.
Disable offsetting of texture coordinates (I draw tiles from a texture atlas, and so offset the coordinates by 0.001 inside each quad to eliminate bleed from surrounding textures).

None of these have eliminated the wobbling. Sometimes it is extremely subtle, but still present when examining the movement closely.

What is the correct way to draw a 2D image to the scree with perfect square pixel accuracy, at a given pixel size?

sentences:
Damping in Unity Shuriken Particle System Is there no damping functionality in Unity Shuriken Particle?
"Velocity Over Lifetime" is different from damping.

I try to find it on particle system, but can't.
Or is there any other way to apply particle damping?

I want to control each particle's velocity decrement?

Update: Add a poor art work :)

sentences:
Java Game How to find the x and y for a tile? Hello I have a java game where you build houses I want to be able to dag my mouse form point a to point b and I want to fill that area with tiles when I release the mouse. What I cant do is get the first x and y coordinate of the selected area then put the tile there then move on to the next area I tried to do something like this:

    bx = Math.min((dragX / 20) * 20, (curX / 20) * 20);
    by = Math.min((dragY / 20) * 20, (curY / 20) * 20);
    w = Math.abs((curX / 20) * 20 - (dragX / 20) * 20);
    h = Math.abs((curY / 20) * 20 - (dragY / 20) * 20);

    if (dragging & w >= 20 && h >= 20) {
        g.setColor(new Color(26, 216, 26, 128));
        g.fillRect(bx, by, w, h);
        g.setColor(new Color(17, 142, 17, 255));
        g.drawRect(bx, by, w, h);

        int posx = play.bx * 20;
        int posy = play.by * 20;
        for (int i = 0; i <(play.w * play.h / 20) / 20 ; i++) {

            play.b.add(new wall((posx), (posy), play.selectedRot));
            posx +=20;
            posy+=20;
        }
    }

dragX and dragY is where it starts and curx and cury is where it is currently
the tiles are 20x20 pixels so I place them every 20 pixels on the screen so it is like a grid.
if I select an area that is 2 tile wide and 2 tiles high and each tile is 20 x 20 pixels that is 1600 pixels I divide that number by 20 and get 80 and then divide that by 20 again to find out how many tiles I need to place in total which in this case is four. what I don't know is how to find the x and y that I need to place that tile then I don't know how to move on to the next one. Please help me. Thx to everyone who reads this.

sentences:
Stretched textures in Blender First of all: I'm relatively new to Blender.

I discovered a weird bug in Blender 2.78c. On my object some textures are stretched although they are UV mapped. Since I have no clue why this is happening I took some screenshots which hopefully explain the problem.

I tried various things, but found no way to solve this. Things I tried:

Unwrap again
Apply Rotation and scale
Manually adjusting verts in UV map
Looking for "dead" verts somewhere in the model

Does anyone know this strange behavior?

Edit: I uploaded my .blend file -> http://pasteall.org/blend/index.php?id=47124 | merged screenshots due to low reputation :P

sentences:
How do I use SharpDX with the .NET Core framework? I started a project to build a game engine. As a result of circumstance, I won't have the luxury of building the engine in C++, so I'm going to have to settle for C# with the .NET Core.

Given that background, I thought I would use SharpDX to supply me with some basic functionality to build my engine on top of, except it seems like SharpDX doesn't support .NET Core, and only supports .NET Native. After testing it, and trying to include SharpDX in my dependencies file, Visual Studio Code explicitly tells me that SharpDX conflicts with .Net Core and it couldn't be installed. However, an issue posted to their GitHub page seems to imply that they might support .NET Core.

Unfortunately, this is the only piece of information I found regarding SharpDX supporting .NET Core, so I'm not entirely sure if support was ever implemented or not. Perhaps I'm just not including it correctly in my project file.

Does SharpDX support .NET Core, and if so how do I link against those libraries properly in VS Code?

sentences: Is there any way to enable the HiDef graphics profile property on a Silverlight 5 3d Web App? I have an XNA Windows Game that uses the HiDef profile to load complex fbx and obj files. Trying to move it over to a Silverlight 3d Web App, Silverlight seems to only want to use the Reach profile, and I get an error that the Reach profile does not support a sufficient number of primitive draws per call. Is there any way to change to HiDef in Silverlight 5? It is not in the project properties and attempting to change it in mainpage.xaml.cs only gives me the option of setting it to Reach.

sentences:
How remove banner adView from a Screen in libgdx? I have an AdMob banner in the game. But I need this banner not to be shown in Screen_1 and when user enter Screen_2 I need to show the banner.
When I call AdView.gone() it dissapears from screen but coordinates becomes wrong and touch position doesn't match with coordinates. How can I properly remove AdView.

sentences:
In Unity, how do I create a drag and drop object? I have a 2d scene. I want the player to be able to pick up an object, move it around the scene and drop it somewhere. I can't find any way to do this, and all of the resources for Unity are really daunting and I can't find anything relevant to what I'm doing.

I've tried adding the drag rigidbody script to both my camera and the sprite I want to drag, to no effect.

Where can I find relevant documentation for stuff like this? Basic things like how to implement a script or what objects I need to attach these scripts to - the stuff on the unity website is a little too advanced.

sentences:
Non-real time simulation of overlapping repulsive balls I want to make a non-real time simulation of overlapping repulsive balls, initially in 2D and later in 3D. With "non-real" I mean that rendering is not needed after each time step.

First of all, consider a simple closed domain for simplicity. In practice, domains will be complex and irregular but always closed.

The balls on the boundaries are fixed and could be overlapping. A fixed ball duplicates itself to produce a free ball of the same size whenever no other ball overlaps it. Both fixed and free balls repel each other but fixed balls cannot move. Note that, duplicant ball should be sufficiently tilted to start repulsion. In elastic colliding balls case, after two balls collide they change direction with some velocity but in this case the balls can stop quickly once they stop overlapping. Free balls move until there is no motion or let's say we solve motion problem until convergence. Then each fixed ball produce a free ball again and this process goes on until no fixed ball can duplicate due to being overlapped by any other ball(s).

I think GPU (CUDA) would be faster to solve this problem but initially I am thinking to write on CPU. However, before proceeding to coding I would like to know "feasibility" of this work. That is, considering a million of balls, approximately how long it would take to simulate this or similar kind of problems in non-real time. For a million of balls, if solution time is in order of minutes, I will dive into the problem. So, my question to experienced programmers is that approximately how long it takes to simulate this kind of problem for a millions of variables? Is it in order of seconds, minutes or hours?

sentences:
Publishing a game -- any way to target both WP7 and Win8 Store? I'm at a dilemma which seems should soon become an important issue for a lot of developers.

If I build a game in XNA, I won't be able to publish it on the Windows 8 Store, as it would be a classic application -- and classic applications can't be sold on the store.

If I build a game in Metro DirectX, I would be able to sell it on the Store, but porting it to Windows Phone would involve porting it to Reach XNA, which in fact would likely involve more effort even than porting to OS X or Android -- both of which support C++. Of all the WinRT API that is supported on C++/JS/.NET, DirectX can only be programmed from C++. It's also unlikely that Microsoft will update Windows 7 or Vista to support the new DirectX features, although that would make the Metro DirectX the first new version of DirectX to stop supporting the immediate predecessor OS.

If I build a game in Pre-Win8 DirectX 9/10/11, I won't be able to sell it on the Windows Store or Windows Phone, but I could sell it on something like Steam. It would also involve the most amount of manual plumbing. In fact, DirectWrite, despite being part of DirectX 11, doesn't talk to Direct3D.

I'm getting really tired of all these restrictions -- artificial and otherwise -- and I'm coming to a point where I'm considering switching to a platform with a less fragmented API, like Android or Mac/iOS.

As far as bringing a game into market goes, excluding the actual market share of any platforms that I might consider, what other factors would help me in making a decision?

Just a few years ago this question was a lot easier to answer: if you were primarily concerned with Windows platforms, all you had to answer was whether you wanted DirectX, XNA, or something like SlimDX. If you made the wrong decision, no biggie -- all you really would have lost is XBox and the fairly small Windows Phone market.

sentences:
How to create HDR and bloom in Unity3D? Unity3D's reference describes the HDR Bloom as:

  Using HDR allows for much more control in post processing. LDR bloom
  has an unfortunate side effect of blurring many areas of a scene even
  if their pixel intensity is less than 1.0. By using HDR it is possible
  to only bloom areas where the intensity is greater than one.

My question is how to achieve it in a surface shader? I have tried to output both the Albedo and Emission greater than 1, but still when I set the Threshold of Bloom equal to or greater than 1, no visible effect can be seen.

The relevant part of shader snippet is:

float rim = saturate(dot(normalize(IN.viewDir), o.Normal));
if (rim >= 0.98) {
    o.Emission = 1.5; // or any large value
}

Which basically outputs a bright white circle when view angle and normal are at almost same angle, and I want to enhance it with HDR. But outputting a value greater than 1 is not being registered and setting the threshold almost equal to 1 (0.98 or above) creates the Bloom on areas other than the bright white spot, which is not what is needed. I have tried to output extremely large values of Emission and have also tried output Albedo > 1.

Please tell what I am doing wrong or missing. I think I have not been able to figure out what is the meaning of pixel intensity > 1 and what settings does this translate to.

sentences:
Unity5 How can I create this particle effect I have been trying to replicate this particle effect that moves with the mouse:

https://my.pottermore.com/patronus

I have got close with the following settings

but I can't get the movement of the particles to be the same or to have to same intense white glow. It's like they have random direction from the center of the cursor but depending on the mouse speed it's like they have spread out more instead of being clustered on the mouse (hard to explain).

Does anyone know how I would achieve this effect?

sentences:
Unity (UNET) Pass custom data when creating and joining a match in multiplayer I've written some simple stuff to make a lobby for matchmaking. Now I want to pass some extra info besides the match name to the lobby. Something like Player's avatar and a number of players connected and what not.
Thereto, I also want to pass information to the game from the players.
For example, two players connect to a match and the character pick starts. For this I want to have the player's info regarding the characters they've picked and the character's weapons info (e.g. customized weapons info). I store all that in a json file and load from it to a class object. Is it ok to add these classes to, say, the player connection prefab that holds Network Identity or is it done somehow differently?

Can someone maybe help me with that in the context of Unity 2018 (i.e. give some advice or referrences to some relevant information)?

Appreciate all the help and thanks in advance.

sentences:
Rendering detailed martian terrain for an RTS I am trying to develop a RTS game that has:

Various planets
Each planet topology could vary between chock full of craters, to smooth hills and mountains planets
In sum each "biome" should be unique-ish (try to reusable textures/objects)

I'd like to achieve an appearance similar to Mars Battle, with its usual terrain with craters and rocks, smoothly transitioning to giant features like this detailed crater:

What I've already know/tried in my tests of terrain:

Unity terrain - it does the job for the small gravel and rocks but for example the finest detail of ridges on the crater edges is not achievable. The amount of mesh detail is not enough, makes blurry.
2D tilesets - I have experimented in the past with 2D tilesets and read some articles about how Starcraft II uses some hacks to give the impression of relief while only being a 2D image, but still this is so seamless!
2D tilesets for terrain, meshes for crater - could be a mix? In that case my doubts are the seamlessless between terrain and crater mesh. And also how can there be constructable buildings inside the crater if is a mesh?

How can I achieve something like this?

sentences:
Parallax scrolling with 2D camera I'm developing a 2D Platform game, I have a 2D camera, some backgrounds, and everything is working good. Now I want to implement parallax scrolling to give the illusion of depth in my game, but i can't imagine how to make my different layers of background to move (most correctly, be rendered by the camera) with a different speed from each other).

In brief this is my game structure:

I have 3 layers of backgrounds: the first is the road level, where the player runs; the second is the intermediate; the third are some mountains very distant (in my mind). Everyone of these layers is created with seamless textures and organized with the tilemap technique, with every texture positioned one after the other. Of course I make the spritebatch draw only the visible ones.

The camera is a rectangle that follows player movements and goes just horizzontaly.

Since layers aren't moving, but only the camera is moving, I don't know how to make a background scroll with a different speed from another!

sentences: How to display number of collisions on UI in Unreal Engine using nodes only? I am using Unreal Engine and I want to show on UI the number of collisions using nodes only. How can I achieve that?

sentences:
Wrong angles given by atan2 I have a method to calculate angle between two vectors, but it is giving wrong values.

here is the code  :

float Vector2_Dot(Vector2 a, Vector2 b)
{
    return a.x * b.x + a.y * b.y;
}

float Vector2_Cross(Vector2 a, Vector2 b)
{
    return a.x * b.y - a.y * b.x;
}

float Vector2_Angle(Vector2 a, Vector2 b)
{
    return atan2f(Vector2_Cross(a, b), Vector2_Dot(a, b));
}

As you can see in the image bellow the angle is slightly wrong.

I'm giving the two positions marked by a black cross.
is the code correct or Do I have a problema elsewhere?

Here's is where I do my transformation matrix calculation:

float Transform_GetLocalAngle(DeadTransform *transform)
{
    if (transform->parent != NULL)
        return transform->parent->angle - transform->angle;
    else
        return transform->angle;
}
void Transform_Update(DeadTransform *transform, GLfloat depth)
{
    float angle     = Transform_GetLocalAngle(transform);
    Vector2 position    = Transform_GetLocalPosition(transform);
    Vector2 scale       = Transform_GetLocalScale(transform);

    GLfloat data[16] = {(GLfloat)cosf(angle) * scale.x,     (GLfloat)(-sinf(angle)) * scale.y,  0.0f,   position.x / 1000,
                        (GLfloat)(sinf(angle)) * scale.x,   (GLfloat)cosf(angle) * scale.y,     0.0f,   position.y / 1000,
                        0.0f,                               0.0f,                               1.0f,   depth,
                        0.0f,                               0.0f,                               0,      1.0f};
    Matrix_SetData(transform->transformationMatrix, data);
}

This is where I create the road:

direction = Vector2_Subtract(*tile->top->transform->position, *tile->topLeft->transform->position);
            pos.x = tile->top->transform->position->x + direction.x / 2;
            pos.y = tile->top->transform->position->y - direction.y / 2;

            float angle = Vector2_Angle(*tile->top->transform->position, *tile->topLeft->transform->position);

            CreateConnection(application, pos.x, pos.y, angle);

void CreateConnection(struct Application *application, float x, float y, float angle)
{
    DeadGameObject *zone = GameObject_Create("Connection");
    zone->transform->position->x = x;
    zone->transform->position->y = y;
    zone->transform->angle = angle;
    zone->transform->scale->x = 64;
    zone->transform->scale->y = 6;
    DeadRenderer *renderer = Renderer_Create(Texture2D_Create("Images/Connection.png", GL_CLAMP, GL_LINEAR));
    Renderer_SetDepth(renderer, -2);
    GameObject_AddComponent(zone, renderer, Type_Renderer);

    Application_Instantiate(application, zone);
}

sentences:
A*Pathfinding lose target after spawning from script? I have been using A*Path finding to enable object tracking. It works fine if I have both objects on the scene at the same time.

However, if I were to use a script to spawn the seeking object instead, it will only track the first path to the object and not repath again.

I am using the default AI Follow script and a prefab variable as the object to be tracked (which is an empty child game object to a moving character).

Code :

import Pathfinding;

//var tankTurret : Transform;
var tankBody : Transform;
//var tankCompass: Transform;
var turnSpeed : float = 10.0;

var targetPosition : Vector3;
var seeker : Seeker;
var controller : CharacterController;
var path : Path;
var speed : float = 100;
var nextWaypointDistance : float = 3.0;
private var currentWaypoint : int = 0;

function Start()
{
    //targetPosition = GameObject.FindWithTag("GTO").transform.position;
    GetNewPath();
}

function GetNewPath()
{
    Debug.Log("GETTING NEW PATH!");
    seeker.StartPath(transform.position,targetPosition,OnPathComplete);
}

function OnPathComplete(newPath : Path)
{
    if(!GetNewPath.error)
    {
        path = newPath;
        currentWaypoint = 0;
    }
}
function FixedUpdate()
{
    if(path==null)
    {
        return;
//          Debug.Log("NO PATH!?");
    }
    /*if(currentWaypoint >= path.vectorPath.Length)
    {
        return;
    }*/

    var dir : Vector3 = (path.vectorPath[currentWaypoint]-transform.position).normalized;

    controller.SimpleMove(dir);

    //tankCompass.LookAt(path.vectorPath[currentWaypoint]);
    //tankBody.rotation = Quaternion.Lerp(tankBody.rotation, tankCompass.rotation, Time.deltaTime*turnSpeed);

    if(Vector3.Distance (transform.position,path.vectorPath[currentWaypoint]) < nextWaypointDistance)
    {
        currentWaypoint++;
    }

}

Any help will be greatly appreciated.

sentences:
Sprite drag drop andengine How to drag an andEngine sprite anywhere on the phone screen?

I have written this code in onAreaTouched function of IOnAreaTouchListener interface which is implemented in my activity, but its not working:

public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
      ITouchArea pTouchArea, float pTouchAreaLocalX,
      float pTouchAreaLocalY) {
    // TODO Auto-generated method stub

    Log.v(TAG,"Sprite Touched ##########");

    secondSprite = new
    Sprite( CAMERA_WIDTH/2, CAMERA_HEIGHT/2,
            playerTextureRegion, this.getVertexBufferObjectManager()){
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                                     final float pTouchAreaLocalX,
                                     final float pTouchAreaLocalY) {
            secondSprite.setPosition(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
            System.out.println(String.format("spriteB %fx%f", pSceneTouchEvent.getX(),
                pSceneTouchEvent.getY()));
            return true;
        }
    };
    scene.registerTouchArea(secondSprite);
    return true;
}

sentences:
Java - 2d Array Tile Map Collision How would I go about making certain tiles in my array collide with my player? Like say I want every number 2 in the array to collide. I am reading my array from a txt file if that matters and I am using the slick2d library.

Here is my code if needed.

public class Tiles {

Image[] tiles = new Image[3];

int[][] map = new int[500][500];

Image grass, dirt, mound;

SpriteSheet tileSheet;

int tileWidth = 32;
int tileHeight = 32;

public void init() throws IOException, SlickException {
    tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight);

    grass = tileSheet.getSprite(0, 0);
    dirt = tileSheet.getSprite(7, 7);
    mound = tileSheet.getSprite(2, 6);
    tiles[0] = grass;
    tiles[1] = dirt;
    tiles[2] = mound;

    int x=0, y=0;
BufferedReader in = new BufferedReader(new FileReader("assets/map.txt"));
String line;
while ((line = in.readLine()) != null) {
        String[] values = line.split(",");
    for (String str : values) {
            int str_int = Integer.parseInt(str);
            map[x][y]=str_int;
            //System.out.print(map[x][y] + " ");
            y=y+1;
        }
//System.out.println("");
x=x+1;
    y = 0;
}
    in.close();
}

public void update() {

}

public void render(GameContainer gc) {
    for(int x = 0; x < 50; x++) {
        for(int y = 0; y < 50; y ++) {
            int textureIndex = map[y][x];
            Image texture = tiles[textureIndex];
            texture.draw(x*tileWidth,y*tileHeight);
        }
    }
}

}

Edit - Solved

public boolean collision() {
    playerRect = new Rectangle(x,y, playerWidth, playerHeight);

    for(int i = 0; i < tiles.map.length; i++) {
        for(int j = 0; j < tiles.map.length; j++) {
            if(tiles.map[j][i] == 2 || tiles.map[j][i] == 3) {
                tileRect = new Rectangle(i*tiles.tileWidth, j*tiles.tileHeight, tiles.tileWidth,tiles.tileHeight);
                rect.add(tileRect);
            }
        }
    }
    for(Rectangle collision : rect) {
        if(collision.intersects(playerRect)) {
            return true;
        }
    }
    return false;
}

sentences:
Avoid players getting stuck by placing items in the same place Let's assume a multiplayer game of two players. These two players have to place six elements at six different positions. The order or exact place does not matter. As the items are placed correctly, they cannot be replaced anymore.

Issue: Both place an item at the same position and now there are basically two items at a position where only one should be. This makes the task impossible to complete, as one item is missing now for the last position.

My assumption is that while both are really doing that in parallel, the communication between both computers is too slow so the other player can't know there is already an item.

I encountered this issue in a game recently and I wonder how to avoid this.

The simplest solution would be that the items can be replaced when placed. But let's see it more technical: A correctly placed item cannot be replaced - so how to circumvent or how to avoid this situation?

sentences:
Build pipleine between 2 points take rotation into account Given a start point and start rotation and end point and end rotation, how can i find a path from start to end, that takes rotation into account and moves only on the axis. I currently have a code that can handle straight line and a L turn. I want it to be able to handle also S or U turn (like on this image), but i cant figure out how to do it. Below is my current code for handling the pipleine building.
How do different games handle that? Like satisfactory fluid pipes on vertical mode.
 Vector3 endPos = endPosition;
        Vector3 startPos = startPosition;
        Vector3 dir = startRotation * Vector3.forward;
        Vector3 diff = endPos - startPos;

        Conveior prev = startTarget;
        int dist1 = Mathf.RoundToInt(Vector3.Scale(diff, dir).magnitude);

        BuildStraight(dist1, ref startPos, dir, startRotation, ref prev);
        Vector3 endDir = endRotation * Vector3.forward;
        GameObject temp;
        if (dir != endDir)
        {
            temp = GameObject.Instantiate(turnRight, startPos, Quaternion.AngleAxis(Vector3.Angle(prev.transform.right, endDir), dir) * startRotation);
        }
        else
        {
            temp = GameObject.Instantiate(straight, startPos, startRotation);
        }
        temp.GetComponent<RaycastController>().dontIgnoreRaycast();
        temp.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior t = temp.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(t);
        }
        prev = t;

        diff = endPos - startPos;
        int dist2 = Mathf.RoundToInt(Vector3.Scale(diff, endDir).magnitude);
        startPos += endDir;

        BuildStraight(dist2, ref startPos, endDir, endRotation, ref prev);
        if (endTarget)
        {
            prev.SetNext(endTarget);
        }

    private void BuildStraight(int distance, ref Vector3 startPos, Vector3 dir, Quaternion rotation, ref Conveior prev)
{
    for (int i = 0; i < distance; i++, startPos += dir)
    {
        GameObject go = GameObject.Instantiate(straight, startPos, rotation);
        go.GetComponent<RaycastController>().dontIgnoreRaycast();
        go.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior c = go.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(c);
        }
        prev = c;
    }
}

sentences:
How to make custom shaped holes in terrain So I'm trying to create a game where you fit certain shaped objects into the hole that fits them (similar to the young children's game with different shaped blocks) in Unity 3D.

I've encountered a problem, how do I make the holes in the terrain? Or what type of object should I use for making holes in?

So far I've tried to make a 3d model in unity by using other cubes and planes, it just doesn't feel right.
I guess I need to create a model in another software and import to unity, I don't know any other software I can use. Tips would help.

sentences:
How do I make objects' speeds appear the same despite screen resolution? I'm working on my HTML5 game with Intel XDK. I'm stuck on making all devices display the same number of frames per second.

The first generation iPad has a screen resolution of 1024 pixels horizontally, while the Motorola Moto G Android phone has ~2657 pixels horizontally. With my game running at 30 FPS and sprites moving at 1 pixel per frame on the Motorola, this can take up to 5 mins to get from one side to the other.

Changing the FPS to 300 makes it work normally on the Motorola but too fast on the iPad.

Is there a work-around for this?

sentences:
Error binding indices to device context [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER] This is how i initialized the D3D11_BUFFER_DESC for my indices. When i go to bound it to the deviceContext i get this error.

D3D11 ERROR: ID3D11DeviceContext::IASetIndexBuffer: The Buffer trying to be bound as an IndexBuffer did not have the appropriate bind flag set at creation time to allow the Buffer to be bound as an IndexBuffer. [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER]

And is kinda of strange becouse i setted the bindFlags to "D3D11_BIND_INDEX_BUFFER"

   D3D11_BUFFER_DESC buffDescIndices;

    ZeroMemory(&buffDescIndices, sizeof(D3D11_BUFFER_DESC));
    buffDescIndices.MiscFlags = 0;
    bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    buffDescIndices.Usage = D3D11_USAGE_DEFAULT;
    buffDescIndices.ByteWidth = sizeof(UINT) * ARRAYSIZE(indices);
    buffDescIndices.StructureByteStride = 0;
    buffDescIndices.CPUAccessFlags = 0;

    D3D11_SUBRESOURCE_DATA subResData2;
    subResData2.pSysMem = indices;
    HRESULT hr=device->CreateBuffer(&buffDescIndices, &subResData2, &mBoxIB);

And this is the deviceContext call

    deviceContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0);

sentences:
How to make sure user is running the newest version of mmo client? In typical mmorpg game, you have a launcher and a client. You first run the launcher to update the client, then you run the client. In every mmo I tried if you run a client without updating first (if update is available), it automatically closes and (usually) starts launcher.

My question is, how can you check if user has the proper version of client? I though about server asking client about its md5 however it's so easy to cheat. I think that there is no safe way of handling it yet every mmorpg I know uses such a system.

So how do mmorpg games handle this problem? To make sure that the client is at the newest version?

sentences:
How can I use Unity AR without cloud services? From what I've read so far, it looks like if I want to build AR apps with Unity, I need to use some kind of cloud service.

Is there a way to use AR without sharing my (and my users) data to some 3rd party? If so, how do I do this?

sentences:
RTS Networking in Unity: Client-Server vs. Lockstep I am trying to make a RTS game in Unity, and I've got a few non-networked features working and so I want to start working on the multiplayer aspect so I don't dig myself into too deep a hole with mechanics I have to recreate to make it online.

I've done a bunch of research into using either a lockstep model (http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php?page=1), or a more typical client-server model where all of the units' positions, velocities, and other traits are synced every fraction of a second.

From what it seems, using the client-server model used to require way too much bandwidth, hence the development of lockstep, but nowadays internet has improved to the point where people actually have enough bandwidth to do this practically. The client-server method seems like it would be easier to implement in Unity also, although UNET seems to be designed for games where the player controls one character, as opposed to the syncing of possibly hundreds of units required in an RTS. The lockstep model would most likely require going somewhat underneath Unity's high level API and implementing a whole slew of time step stabilizers and checks to make sure all the commands are received and executed in the exact same way.

What I'm curious about, however, is something in between the two, where most of the time, I send simple commands to the other clients, saying something like "at xx:xx game time, the player told this unit to move here." The other clients then receive that, and discover that two ticks have passed since that game time, run the two ticks on that object, and then let it continue running in that state until it receives that next update. Every second or so, I could then sync up all of the positions and other data to iron out any inconsistencies. I feel like this could be the best of both worlds in terms of not requiring the insane amount of synchronicity for lockstep but also not requiring as much bandwidth guzzling. I'm probably missing something big or understating the simplicity of implementing such a system, because to me it seems this would be simpler than implementing pure lockstep.

What networking model should I use?

Thanks!

sentences:
Unity RTS Multiple Selection Approacah I've recently solved the single selection problem but now I want to do multiple selections. I know I need to find two points with the mouse position to draw a box but it just won't work for me.

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            bool dragging = true;
            Debug.Log("Multiselect active");
            MultiSelect(dragging);
        }
    }
    private void MultiSelect(bool dragging)
    {

        mouseDownPoint = Input.mousePosition;
        if (Input.GetMouseButtonUp(0) && dragging)
        {
            mouseUpPoint = Input.mousePosition;
        }
        Debug.Log("First pos: " + mouseDownPoint + " Second pos: " + mouseUpPoint);
        dragging = false;

    }

What is a better way to achieve what I'm trying?
If someone can tell me a way that can also detect any units inside the area that'd be nice too.

sentences:
Smooth+Flat shaded meshes cause shadow artifacts (understanding the source of the problem) I'm using blender to create assets to use in Unity3D, and I'm having some trouble understanding how the smooth/flat shading interacts with shadows, I'm sorry if it has been asked before, but all the "related" answers refer only to the shading of the object itself, not the shadow it casts.

I'm a 3D artist, I do not understand Unity and the mechanics behind it the same way I understand 3D stuff, I'm also trying to understand if the problem lies in the 3D object or some configuration in Unity.

I'm using a real time directional light.

1 and 2 are flat shaded. 2 has open geometry while 1 has closed geometry, both have such artifact but it's clearly seen on 2.

3 and 4 both have closed geometry. 3 is fully smooth shaded while 4 is flat shaded.

Solution A: Mess around with Bias and Normal Bias. With Normal Bias at 0, the shadow artifacts are gone but the mesh itselt gets some other artifacts.

Solution B: Use Two-sided shadows, this method completely fixes the problem, in any situation, but it adds another draw call and makes it more expensive (I'm not 100% sure it does) - is this an optimal solution?

This same issue was discussed in a closed group but no one could give me a conclusive answer. However, someone who works with 3DS Max said that exporting a mesh with proper smoothing groups does not result in these artifacts, I tested that in 3DS Max and it did not work - I think I did it the right way, but I'm not 100% certain.

For all the proposed methods, I tested several times, with diferent mesh/modifier and exporting options. I'm using mostly .fbx but I also tested in .obj format (which includes a specific option for smoothing groups in blender).

Smooth shaded objects work perfectly, flat or smooth+flat shaded objects result in this drama.

Please help me to bring light to this issue, I might be blind to some obvious aspect, I'm confused because in the other discussion I was presented with contradicting arguments without conclusive proof of anything. Now I don't know if the problem lies with Blender/export or Unity configuration.

Let me know if I can provide more information.

sentences:
gl_VertexID values when calling glDrawElements I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed.

I have the standard modern rendering pipeline, in which after setting up shaders, buffers, etc I call the code below to render a mesh

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, auxMesh->indicesBuffer);
    glDrawElements(GL_TRIANGLES, auxMesh->numIndices, GL_UNSIGNED_INT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

In the vertex shader I want to manually access to the current vertex being rendered retrieving it from the original buffer (I know this sounds nonsense, but I need to do this for a reason), therefore I pass the vertex buffer as the texture buffer u_tbo_tex and I access to the actual coordinates as follows:

vec3 vertex_1 = texelFetch(u_tbo_tex, gl_VertexID + 0).xyz;
vec3 vertex_2 = texelFetch(u_tbo_tex, gl_VertexID + 1).xyz;
vec3 vertex_3 = texelFetch(u_tbo_tex, gl_VertexID + 2).xyz;

And the values of these vertex vertex_1, vertex_2, vertex_3 make perfect sense.

However, I can't really understand what values gl_VertexID got in each iteration. Is gl_VertexID sequentially assigned following the range of [0...auxMesh->numIndices].  Or are the values increased +3 at every iteration because I am drawing triangles?

I need to understand this because I am interested in calling textureFetch(u_tbo_tex, i) where i is a arbitrary triangle in my mesh (or whatever i needs to be to access an arbitrary triangle), but I can't find the right way to access to it.

sentences:
Multiple Render Targets, Multiple Fragment Shaders I render a normal and a depth image of a scene. Then I want to reuse these two images to do further texture/image processing in a second fragment shader. I use a framebuffer with 3 textures attached to it. 2 for the normal and the depth textures and one is supposed to contain the final processed image. The problem is, that I can't get the first two images to the second fragment shader to use them as texture samplers.

Here is my code:
First I create a fbo and attach 3 textures to it.

    // create FBO
glGenFramebuffers(1, &Framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, Framebuffer);

glGenTextures(1, &renderedNormalTexture);
//glBindTexture, glTexImage2D, glTexParameteri ... left out for clarity
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderedNormalTexture, 0);

glGenTextures(1, &renderedDepthTexture);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, renderedDepthTexture, 0);

glGenTextures(1, &edgeTexture);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, edgeTexture, 0);

ndbuffers[0] = GL_COLOR_ATTACHMENT0;
ndbuffers[1] = GL_COLOR_ATTACHMENT1;
ndbuffers[2] = GL_COLOR_ATTACHMENT2;
glDrawBuffers(3, ndbuffers);

Fragment shader 1:
This is the first fragment shader which outputs 2 textures to position 0 and 1

in vec3 position_worldspace;
in vec3 normal_cameraspace;
in vec4 vpos_to_fragment;
uniform float zmin;
uniform float zmax;
layout(location = 0) out vec3 normalcolor;
layout(location = 1) out vec3 depthcolor;
void main() {
normalcolor = normalize( normal_cameraspace ) * 0.5 + 0.5;  // normal out
  vec4 v = vec4(vpos_to_fragment);
v /= v.w;
float gray = (-v.z - zmin) / (zmax - zmin);
depthcolor = vec3(gray);  // depth out
 }

fragment shader 2:
And the second fragment shader which is supposed to receive two texture samplers from position 0 and 1 and do sth. with them:

uniform sampler2D normalImage;
uniform sampler2D depthImage;
uniform float width;
uniform float height;
in vec2 UV;
layout(location = 2) out vec3 color;

void main() {
vec3 irgb = texture2D(normalImage, UV).rgb;
// do sth here...
color = irgb ;
}

And finally the rendering step:
Maybe I am mistaken here. I render the geometry/scene (once?!) and apply two fragment shaders.

glUseProgram(FragmentShader1);
SetMVPUniforms();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
RenderScene(); // render geometry

glUseProgram(FragmentShader2);

GLuint nID = glGetUniformLocation(FragmentShader2, "normalImage");
GLuint dID = glGetUniformLocation(FragmentShader2, "depthImage");

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, renderedNormalTexture);
glProgramUniform1i(FragmentShader2, nID, 0);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, renderedDepthTexture);
glProgramUniform1i(FragmentShader2, dID, 1);

Now what I get is either nothing or a wrong colored image.

sentences:
How to get point depth in shadow space for point light? I'm implementing exponential shadow maps, and so far I have directional lights and spotlights working perfectly.  Currently I'm trying to apply this technique to point lights with cubemapped shadows.

The theory is, the visibility factor should be computed as a product of two exponentials:

visibility = exp(k*occluderDepth) * exp(-k*receiverDepth)

So the shadow map, instead of storing depth, stores exp(koccluderDepth), and the lighting pass multiplies this value by exp(-kreceiverDepth).

My shadowmap renderer looks like this:

//vsh
#version 410

uniform mat4 viewProjectionMatrix;
uniform mat4 modelTransform;

in vec4  position;

void main (void) {
    gl_Position = viewProjectionMatrix * modelTransform * position;
}

//fsh
#version 410

float lightExponentialConstant = 200.0;

layout (location = 0) out float exponentialMapVaule;

void main (void) {
    exponentialMapVaule = exp(lightExponentialConstant * map_01(gl_FragCoord.z, lightNearPlane, lightFarPlane));
}

The visibility for spot and directional lights is computed like so and it works perfectly:

uniform sampler2D shadowmapSampler;
uniform mat4 shadowSpaceProjection;

float map_01(float x, float v0, float v1) {
  return (x - v0) / (v1 - v0);
}

float computeVisibility(vec3 position) {

    mat4 shadowBias = mat4(
        0.5, 0.0, 0.0, 0.0,
        0.0, 0.5, 0.0, 0.0,
        0.0, 0.0, 0.5, 0.0,
        0.5, 0.5, 0.5, 1.0
    );

    vec4 shadowCoord =  shadowBias * shadowSpaceProjection * vec4(position, 1.0);
    float occluder = texture(shadowmapSampler, shadowCoord.xy/shadowCoord.w).r;
    float reciever = map_01(shadowCoord.z/shadowCoord.w, lightNearPlane, lightFarPlane);
    float visibility = clamp(occluder * exp(-lightExponentialConstant * reciever), 0.0, 1.0);

    return visibility;

}

So basically the receiver value is the depth of the world position projected into shadow space, and then mapped to the range [0, 1] according to the offset of that point from the shadow projection's near plane and far plane.

I have tried to apply the same logic to the cubemap shadowmap for my point light:

float map_01(float x, float v0, float v1) {
  return (x - v0) / (v1 - v0);
}

uniform samplerCube shadowCubemap;

float computeVisibility(vec3 position, vec3 lightPosition) {

    vec3 ray = position - lightPosition;
    float distance = length(ray);
    float occluder = texture(shadowCubemap, normalize(ray)).r;
    float receiver = map_01(distance, lightNearPlane, lightFarPlane);
    float visibility = clamp(occluder * exp(-lightExponentialConstant * reciever), 0.0, 1.0);

    return visibility;

}

So here, if I understand correctly, distance should be the length of the vector between the world position and the light position (which should be equivalent to the reprojected depth from the 2D example).  But everything is occluded when I use this method.

What am I missing?  In particular, I'm not sure if I am not confident about the cubemap sampling, or if I'm missing some step to ensure that the distance value used to compute the receiver value is actually being transformed correctly to shadow space.

sentences: How do I deal with scale of the universe when generating a simulated universe? I have a dataset of 100,000 actual stars. I wish to create a game where I can fly between the stars and fly up to them and click on them etc. How do I go about dealing with the problem of the scaling of the universe, even If I were to allow fast as light travel it would be too vast. Should I cluster my data and then implement a subtle sort of scaling to move around? Sorry for the broad question but I'm rather stuck at the moment.

sentences:
Why does the player fall down when in between platforms? Tile based platformer I've been working on a 2D platformer and have gotten the collision working, except for one tiny problem. My games a tile based platformer and whenever the player is in between two tiles, he falls down.
Here is my code, it's fire off using an ENTER_FRAME event. It's only for collision from the bottom for now.

        var i:int;
        var j:int;
        var platform:Platform;
        var playerX:int = player.x/20;
        var playerY:int = player.y/20;
        var xLoopStart:int = (player.x - player.width)/20;
        var yLoopStart:int = (player.y  - player.height)/20;
        var xLoopEnd:int = (player.x + player.width)/20;
        var yLoopEnd:int = (player.y + player.height)/20;
        var vy:Number = player.vy/20;
        var hitDirection:String;
        for(i = yLoopStart; i <= yLoopEnd; i++)
        {
            for(j = xLoopStart; j <= xLoopStart; j++)
            {
                if(platforms[i*36 + j] != null && platforms[i*36 + j] != 0)
                {
                    platform = platforms[i*36 + j];
                    if(player.hitTestObject(platform) && i >= playerY)
                    {
                        hitDirection = "bottom";
                    }
                }
            }
        }

This isn't the final version, going to replace hitTest with something more reliable , but this is an interesting problem and I'd like to know whats happening. Is my code just slow? Would firing off the code with a TIMER event fix it? Any information would be great.

sentences:
Unity 2D Sprite Bending between Hinge Joints I've created a tentacle that consists of multiple game objects, each attached to eachother using HingeJoint2D's. Gameplay wise this multiple segmented approach is great because I can use Unity's built-in physics, but it doesn't look very good art wise.

Is it possible to 'bend' 2D sprites, so the tentacle segments look like they're attached to eachother? Or perhaps take a single image and bend it using splines of some sort?

I would prefer to keep using multiple game objects to represent the tentacle.

sentences: Basic collision issues in gamemaker studio I'm really new to the game design world so I'm sorry if this question is stupid, but here it goes! I have 3 objects, a square that the player controls, a wall that the square should collide with and be unable to pass, and a floor that the square should be unable to pass through. I have tried playing around with the Solid and the Use Physics characteristics when I create the objects but I cannot get them to collide properly. Any ideas would be appreciated. Could you please help me out?

sentences:
Problem of activities My game consists of a player that hopes between ropes.
For now, I created the player and the rope classes.
 Each one contains details about the object and its movement patterns.
What is the next step in orfer to link between them?
  Iwant the player to stick on a rope once they have the same x.
Should i create an activitt Game that implements this attach method?
Thank you.

sentences: Change the colour of all particles on screen I'm trying to make it so when the user clicks a button, the colour of all particles on screen change to a certain colour. Is there a way to change the colour of all particles on screen coming from the same particle emitter at runtime? I know there is the main module's startColor property, but that only changes the particle colour for new particles, not ones currently on screen. Currently I've tried messing around with the colorOverLifetime module, but I just get these weird blend between the original colour and the new one.

sentences:
client/server Silverlight turn based game - domain model question I am making multiplayer (2 players) Minesweeper like the one that's available on MS Live Messenger.

Client side is going to be silverlight, server side will be MVC Application. Client (the one who is waiting for his turn) will poll server every X seconds to get current state, the other client (who's turn it is will post his click to server and than roles will reverse)

Now my question is: should domain model classes be the same for client and server side?
I mean you need Minefield class on both sides, but while server-side class will have rules and logic, client-side will be more or less a data holder.

sentences: Moving lights or scene objects in Unity seems to cause a second point light to shrink or dim Moving a Point Light in 2d space seems to be dimming lights around it. What is this and how can I solve it?

sentences: How to simulate wind in 2D For a 2D scenario, I want to have a fan blow at an object and make the object move with the "wind". How can I simulate the wind force blown by the fan?

sentences:
How to get tilemap transparency color working with TiledLib's Demo implementation? So the problem I'm having is that when using Nick Gravelyn's tiledlib pipeline for reading and drawing tmx maps in XNA, the transparency color I set in Tiled's editor will work in the editor, but when I draw it the color that's supposed to become transparent still draws.

The closest things to a solution that I've found are -

1) Change my sprite batch's BlendState to NonPremultiplied (found this in a buried Tweet).

2) Get the pixels that are supposed to be transparent at some point then Set them all to transparent.

Solution 1 didn't work for me, and solution 2 seems hacky and not a very good way to approach this particular problem, especially since it looks like the custom pipeline processor reads in the transparent color and sets it to the color key for transparency according to the code, just something is going wrong somewhere.  At least that's what it looks like the code is doing.

TileSetContent.cs
    if (imageNode.Attributes["trans"] != null)
        {
            string color = imageNode.Attributes["trans"].Value;
            string r = color.Substring(0, 2);
            string g = color.Substring(2, 2);
            string b = color.Substring(4, 2);
            this.ColorKey = new Color((byte)Convert.ToInt32(r, 16), (byte)Convert.ToInt32(g, 16), (byte)Convert.ToInt32(b, 16));
        }
        ...

TiledHelpers.cs
    // build the asset as an external reference
            OpaqueDataDictionary data = new OpaqueDataDictionary();
            data.Add("GenerateMipMaps", false);
            data.Add("ResizetoPowerOfTwo", false);
            data.Add("TextureFormat", TextureProcessorOutputFormat.Color);
            data.Add("ColorKeyEnabled", tileSet.ColorKey.HasValue);
            data.Add("ColorKeyColor", tileSet.ColorKey.HasValue ? tileSet.ColorKey.Value : Microsoft.Xna.Framework.Color.Magenta);
            tileSet.Texture = context.BuildAsset<Texture2DContent, Texture2DContent>(
                new ExternalReference<Texture2DContent>(path), null, data, null, asset);
       ...

I can share more code as well if it helps to understand my problem.  Thank you.

sentences:
How to reapply force applied to one object to another object Edit: While I wasn't able to make the code work completely, I believe my question has been sufficiently answered.

I want to make two objects move, react to collisions and other stuff as if they were one.

For example, Objects A and B are entangled.

When Object C rams into Object A and starts moving with it, Object B should start moving with it. When Object B hits a wall, Object A should act like it also hit a wall.

I tried changing position/speed every frame, but this only works when done in one direction.

Now, I want all forces applied to any of the objects to also apply to the other objects entangled to it.

EDIT: The next step is making the thing work with one of the objects moving along a different axis(e.g. the opposite direction of the others) and at a different scale (e.g. speed is proportional to size). So fixed joints, while a working solution for the simplified version of the problem, don't work for me.

UPDATE: Here's the code so far, trying to figure out how to send the other object spinning in the same way as the first one, not sure how to set the position for the force(s?) applied

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<GameObject> activeObjects;

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

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

    private void OnCollisionStay(Collision collision)
    {
        OnCollisionEnter(collision);
    }

    private void OnCollisionEnter(Collision collision)
    {
        Rigidbody rigidbody = gameObject.GetComponent<Rigidbody>();
        foreach (GameObject obj in activeObjects)
        {
            Rigidbody rb = obj.GetComponent<Rigidbody>();
            if (rb is null || rb.gameObject==gameObject) continue;
            Debug.Log(collision.gameObject.name+"->"+obj.name);

            for (int i = 0; i < collision.contactCount; i++)
            {
                ContactPoint co = collision.GetContact(i);
                Vector3 relativePoint = co.point - rigidbody.centerOfMass;
                Vector3 normal = co.normal;
                Vector3 impulse = collision.impulse;
                if (Vector3.Dot(normal, impulse) < 0f) impulse *= -1;
                rb.AddForceAtPosition(impulse, relativePoint + rb.centerOfMass, ForceMode.Impulse);
            }
        }
    }
}

sentences:
What is a good path-finding algorithm when a target is moving? I've been looking for a path-finding algorithm for a moving target.
If there are no obstacles in proximity Seek behaviour would be good.
However, A* or some other path-findings are needed when obstacles are on the way to the moving target.

The problem I'm facing now is that calculating a path using A* seems not efficient for a moving target.
so I want to know if there are some good or preferred ways to solve this problem.

The image below shows some basic background of the problem.
The red arrow shows the direction my Seek behavior calculates.
But I want the "Chaser" to take the green direction instead.

Thanks in advance.

sentences:
What sprite size should I use for 2D game? I try to create a 2D game for Android. It looks like Cut the rope (it isn't a clone but it have same level representation) if it has a value.
My problem that I can't understand that optimal sprite sizes I should use. I.e. what target screen resolution should I use to sprites didn't have anomalies on HD-devices (like Samsung Galaxy S7 and etc., phones and tablets)?

To make my question is clearer I ask about this 1 unit = X pixels for xxhdpi-screens. What is X?

P.S. Sorry if it's a duplicate I will be grateful for link on this post cuz I couldn't find it.

sentences:
Send Geometry Data to Multiple Shaders So I am implementing a deferred rending model for my engine, and I want to be able to send all scene geometry into a single shader to calculate ambient, diffuse, normal, ect thats not the question.
Once I have all of this data buffered into the GPU I can render all of that geometry from a camera perspective defined by a uniform for the cameras position in the scene. I am wondering if I can reuse this model data already in VRam in another shader translated by a light sources projection matrix to calculate the shadows on this scene geometry without needing to send the same data to the GPU again.
Is there a way to tell my light shader, hey all that juicy geometry/scene data you want is already in V-Ram, just use this matrix transformation instead.
Alternatively when I am sending the VAO to the GPU is there a way to send it to two shades in parallel, one for the deferred rending model, one for shadow casing light sources?
Thanks so much!

sentences:
A big light with shadows To have better texture2D quality in my 2D game, I had to recreate every textures with 300% of their original size.
But the lights have to bright 3 times more.

For lights, I'm using this : Catalin's blog

I have to render some lights, but with only 1 with 800 pixels of radius, my game works with around 15fps or less.
And if I improve the light quality, I have an issue with the (gpu ?) memory.

How must I do to render a light with 800 pixels of radius without this gpu cost ?
Should I use another effect ? Do you have some to suggest ?
(example : Andrew Russell's game : "Dark" has a lots of big lights, and the game works perfectly)
Hope you can help.

sentences:
Bounding Box Collision Glitching Problem (Pygame) So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, I've made a simplified example of the problem. (It's worth noticing that I don't have rotating sprites on my game or anything like that. After showing the code, I'll explain better).

Here's the whole code:

from pygame import *

DONE = False
screen = display.set_mode((1024,768))
class Thing():
    def __init__(self,x,y,w,h,s,c):
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.s = s
        self.sur = Surface((64,48))
        draw.rect(self.sur,c,(self.x,self.y,w,h),1)
        self.sur.fill(c)
    def draw(self):
        screen.blit(self.sur,(self.x,self.y))
    def move(self,x):
        if key.get_pressed()[K_w] or key.get_pressed()[K_UP]:
            if x == 1:
                self.y -= self.s
            else:
                self.y += self.s
        if key.get_pressed()[K_s] or key.get_pressed()[K_DOWN]:
            if x == 1:
                self.y += self.s
            else:
                self.y -= self.s
        if key.get_pressed()[K_a] or key.get_pressed()[K_LEFT]:
            if x == 1:
                self.x -= self.s
            else:
                self.x += self.s
        if key.get_pressed()[K_d] or key.get_pressed()[K_RIGHT]:
            if x == 1:
                self.x += self.s
            else:
                self.x -= self.s
    def warp(self):
        if self.y < -48:
             self.y = 768
        if self.y > 768 + 48:
             self.y = 0
        if self.x < -64:
             self.x = 1024 + 64
        if self.x > 1024 + 64:
             self.x = -64
r1 = Thing(0,0,64,48,1,(0,255,0))
r2 = Thing(6*64,6*48,64,48,1,(255,0,0))
while not DONE:
    screen.fill((0,0,0))
    r2.draw()
    r1.draw()
    # If not intersecting, then moves, else, it moves in the opposite direction.
    if not ((((r1.x + r1.w) > (r2.x - r1.s)) and (r1.x < ((r2.x + r2.w) + r1.s))) and (((r1.y + r1.h) > (r2.y - r1.s)) and (r1.y < ((r2.y + r2.h) + r1.s)))):
        r1.move(1)
    else:
        r1.move(0)
    r1.warp()
    if key.get_pressed()[K_ESCAPE]:
        DONE = True
    for ev in event.get():
        if ev.type == QUIT:
            DONE = True
    display.update()
quit()

The problem:

In my actual game, the grid is fixed and each tile has 64 by 48 pixels. I know how to deal with collision perfectly if I moved by that size. Nevertheless, obviously, the player moves really fast.

In the example, the collision is detected pretty well (Just as I see in many examples throughout the internet). The problem is that if I put the player to move WHEN IS NOT intersecting, then, when it touches the obstacle, it does not move anymore. Giving that problem, I began switching the directions, but then, when it touches and I press the opposite key, it "glitches through". My actual game has many walls, and the player will touch them many times, and I can't afford letting the player go through them.

The code-problem illustrated:

When the player goes towards the wall (Fine).

When the player goes towards the wall and press the opposite direction. (It glitches through).

Here is the logic I've designed before implementing it:

I don't know any other method, and I really just want to have walls fixed in a grid, but move by 1 or 2 or 3 pixels (Slowly) and have perfect collision without glitching-possibilities. What do you suggest?

sentences:
Problems with imported model animation from Blender to Unity I've downloaded a free sculpted arm and created my own rig and animation for it in Blender. So here is how it looks like in Blender :

And the model itself looks fine in Unity, but as soon as the animation starts, the vertices are partially glued together like this :

I've simply imported the .blend file for the moment, is there some better way to import this?

sentences:
How to get an axe chopping animation to stop on collision with tree and smoothly go back to idle state? Been stuck on this one for a few days.

I have an axe that moves around with the mouse.  When the mouse is in range of a tree, you can left click to start the axe swing animation.  Once the animation is complete, it goes back to the idle state in the Animation Controller.

The problem with the current solution is the axe can clip through the geometry of the tree.  I tried the 2 camera system (setting depth) to render the axe on top, but it didn't feel good.

The tree and axe has colliders on them.  The axe has a rigidbody.

I then tried another idea.  I disabled the animation controller for the axe on collision enter, and set the axe isKinematic to true.  This worked, the axe would not clip the tree, however, once I enabled the animation controller, the axe animation would continue to playing.  So I tried to switch the state back to idle and thought maybe cross fading would solve it, but it didn't work.

Is there a better way to do this?

sentences:
Javascript board game: looking for optimization I posted this question on stackoverflow before but received no answers so I decided to post it here and see if someone could suggest me something.
I'm working on a html/javascript game for android. It's a board game which does the following.
It has tiles of different colors and user can place one tile (chosen programatically) on the board. If we get 4 or more tiles of the same color/shape we score some points and these tiles will disappear. The tiles above the removed tiles will replace them and new tiles will be added to the empty places. The image below shows how it works (this is just an example, the real board can have different dimensions):

The Tiles are <img> elements with their ids stored in an array which I use to check for matches and replacement.
It all works pretty well but once the new tiles are added to board I need to examine the whole board to check if new matches are avalable. And I want some advice here, because examining the whole board can be really slow. Is there a way I can do this efficiently?
Here's what I thought about doing:

Given the previous example, I thought about examining only the elements in the red area, i.e. only the elements that have been moved or added. It can be effective if the tiles move vertically, as I'll only have to check the moved/added tiles and it'll give me the new matches. But in case where I remove tiles horizontally it can be problematic, because if these tiles are at the bottom i'll have to examine the whole board and i confront the same problem.
Any advice or suggestion will be appreciated.
Note: I didn't add any code because it simply consists of checking the lines and columns for a given tile and look for matches. But if needed I can provide it.
EDIT: Adding horizontalMatchCheck function that for a given index checks for matches horizontally. It's the same thing for vertical check.
function horizontalMatchCheck(itemId) {
    hArray = new Array();
    if (rightMatch(itemId)) {
        var index = itemId + 1;
        hArray.push(itemId + 1);
        while (rightMatch(index)) {
            hArray.push(index + 1);
            index++;
        }
    }
    if (leftMatch(itemId)) {
        var index = itemId - 1;
        hArray.push(itemId - 1);
        while (leftMatch(index)) {
            hArray.push(index - 1);
            index--;
        }
    }
    //if >=4 matches found I replace the indexes with 5 (because no other tile can have this id) which'll then be removed and shifted.
    if (hArray.length >= 3) {
        hArray.push(itemId);
        for (var i = 0; i < hArray.length; i++) {
            board[hArray[i]] = items.length;
        }
    }
    else
        hArray = new Array();
}

function rightMatch(pos)
      return (!isRight(pos) && board[(pos+1)] == current) ? 1 : 0 ;
function leftMatch(pos)
      return (!isLeft(pos) && board[(pos-1)] == current) ? 1 : 0 ;

sentences:
Unity 3d: Animating Offset on a Quad is causing stretching issue only with iOS devices - Using Wrap Mode: Repeat I added a 3D Object > Quad and added a graphic on it with the Wrap Mode set to Repeat. I'm animating the Offset to scroll the repeating image for a parallax effect. Everything is working perfectly with in Editor and Android devices. On iOS devices, the image shows fine and then stretches as the offset is changing. I'm attaching 2 screen shots of the image import settings - Quad settings, and the issue on the iPhone. Below is my code:

 public float scrollSpeed = 0.05f;
 private Vector2 savedOffset;
 Rigidbody2D player;

 void Start () {
     GameObject player_go = GameObject.FindGameObjectWithTag("Player");

     if (player_go == null)
     {
         //Debug.LogError("Couldn't find an object with tag 'Player'");
         return;
     }

     player = player_go.GetComponent<Rigidbody2D>();

     savedOffset = GetComponent<Renderer>().sharedMaterial.GetTextureOffset("_MainTex");
 }

 void FixedUpdate()
 {
     if(player.GetComponent<BirdMovement>().dead)
     {
         return;
     }
     float vel = Time.fixedTime * scrollSpeed;

     float y = Mathf.Repeat(vel, 1);
     Vector2 offset = new Vector2(y, savedOffset.x%1);

     offset.x = (float) System.Math.Round (offset.x, 3); //Mathf.Round (offset.x * 10) / 10;

     Debug.Log ("Offset:" + offset.x);
     if (offset.x > 1) {
         offset.x = 0;
     }
     GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", offset);
 }

 void OnDisable()
 {
     GetComponent<Renderer>().sharedMaterial.SetTextureOffset("_MainTex", savedOffset);
 }

sentences:
Common practice when handling sprite animation Let's say I'm using the following sprite as a sample to try LibGDX Animation and TextureRegion.

http://www.smackjeeves.com/images/uploaded/comics/7/8/78bc6b62fEySW.gif

As you can see, the provided image above has different width & height per image. The width when Zero performs a slash is different when Zero stands.

Is it a good practice to create a padding / margin for every image so they have similar width & height. Or should I just have all the sprite cramped like that and try to handle it in the backend?

Thanks

sentences: Fire simulation using java and opengl i'm newly working with opengl. I'm trying to create a simple program that will simulate fire. My question is what are the ways other than particle effects to simulate fire. And can fire simulation really be done without particle system effect??

sentences:
Using SQL for a Realtime Multiplayer Game Server's Working Data (Fast Enough?) The game I'm working on currently has a Client in Flash AS3, and a Server in C# (multithreaded).

Currently I use mySQL to handle logins (Raw access: no middleman for accessing the database) which seems to be extremely quick.

My question is would using a mySQL database be quick enough for a fairly simple real time game?

My game functions in a similar way to Diablo2, League of Legends, or even Starcraft:

User logs in
User is taken to lobby
From lobby user may view active games
User's group into 2-8 for games which exist on the server in it's own thread

Now, the game has been designed in such a way to minimize server calculations, while still providing zero trust to clients.  Is it possible to use SQL in a way to store and manipulate all game data, for each game? ie:

Users 1 through 8 all create 50 units
Each user commands all of their units to move to a location on the map
Units attack each other
etc.

Is SQL fast enough to handle this kind of data traffic?  Or would it be better to store it all in memory?  Or is there some alternative (such as paging) I haven't considered?

sentences:
Rendering without VAO's & VBO's? I am trying to port a demo I found on PositionBasedDynamics . It has a generic function which does the rendering and on their example works but they don't generate/bind any Vertex Array Object or Vertex Buffer Object even though they use Core OpenGL and shaders.

The function is this:

template<class PositionData>
void Visualization::drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color, GLuint text)
{
    // draw mesh
    const unsigned int *faces = mesh.getFaces().data();
    const unsigned int nFaces = mesh.numFaces();
    const Vector3r *vertexNormals = mesh.getVertexNormals().data();
    const Vector2r *uvs = mesh.getUVs().data();

    std::cout << nFaces << std::endl;

    glBindTexture(GL_TEXTURE_2D, text);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_REAL, GL_FALSE, 0, &pd.getPosition(offset)[0]);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_REAL, GL_FALSE, 0, &uvs[0][0]);
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 3, GL_REAL, GL_FALSE, 0, &vertexNormals[0][0]);

    glDrawElements(GL_TRIANGLES, (GLsizei)3 * mesh.numFaces(), GL_UNSIGNED_INT, mesh.getFaces().data());

    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);

    glBindTexture(GL_TEXTURE_2D, 0);
}

I did the same thing and it render's a white screen . I used RenderDoc to check what's going on and it show's these: https://puu.sh/rM1wB/80620ade8d.png .

How can they get it to work while i can't?

sentences:
Calculate Player Level in PHP So in my program, I currently know how much Experience a player has. I was using this formula to figure out what level the Player was:

function calcLevel($XP,$const){
     $L = sqrt($XP)*$const;
     return floor($L+1);
}

Then I wanted to figure out what Percentage of the way the player was to the next level, so I needed to figure out how much Experience they needed to get to that point. I thought this would work:

function xpNeeded($L,$const){
    $XP = pow($L,2)/$const;
    return $XP;
}

I would also need to know how much previous Experience the player had earned in other levels so I could calculate the percentage based on the Experience earned at the current level only:

function prevXP($L,$const){
    $XP = 0;
    for($i=1;$i<$L;$i++){
        $XP = $XP + xpNeeded($i,$const);
    }
    return $XP;
}

This all made sense to me, but the calculations are a bit off.

For instance, using Level 2, and Constant of .1:

$const = .1;
$lvl = 2;
$a = xpNeeded($lvl,$const); //returns 40
$b = prevXP($lvl,$const); //returns 10
$c = $a+$b; //50
calcLevel($c,$const) //returns 1, should return 2

I can't really tell where my calculations have gone wrong, obviously, it is in the xpNeeded function, I just do not know what I did wrong.

sentences: How to change the geometry of the scene in Unity? I'm trying to experiment with 3D spherical geometry in Unity, but it seems like Unity objects are inherently set in flat space. My first idea was to create a class inheriting from Transform that would override most of the methods, but I discovered that the transform member of a game object is read only so I cannot replace it with my custom class. I know this sort of thing is possible because the game Hyperbolica is being built in Unity using curved space. I have the math all figured out, I'm just not experienced with Unity. Anyone have other ideas for things I could try?

sentences:
How do I calculate the points of a brush from a Source engine VMF? I'm trying to render the brushes from a Source engine .vmf file in C++, using OpenGL.

The .vmf stores solid brushes as a series of planes which I would like to use to calculate the points for each brush. I'm pretty sure this would be done exactly the same as for all Quake engine based .map files as well.

Basically each point of the brush is the point where 3 planes intersect. I found a similar question to mine on stackoverflow and the explanation is to get the unit normals for the 3 planes, then use equation 8 on this page mathworld.wolfram.com/Plane-PlaneIntersection.html. My problem is that I have no idea how to implement that

Here's some code for a single 6 sided cube shaped brush:

"plane" "(0 0 256) (0 256 256) (256 256 256)"
"plane" "(0 256 0) (0 0 0) (256 0 0)"
"plane" "(0 0 0) (0 256 0) (0 256 256)"
"plane" "(256 256 0) (256 0 0) (256 0 256)"
"plane" "(0 256 0) (256 256 0) (256 256 256)"
"plane" "(256 0 0) (0 0 0) (0 0 256)"

I really have no idea where to start.

sentences:
Proper sphere collision resolution? I am implementing a sphere to sphere collision resolution and I am a little confused on where to start. First question, is there a standard way that games/engines do sphere to sphere collision resolution? Is there only like a couple standard ways to do it? Or does the resolution vary very heavily based on whats needed?
I want to implement this in my engine and I wrote a basic one that pushes a sphere and another sphere (so basically the one interacting can push the other) but this was just a super simple concept. How exactly can I improve this to make it more accurate? (Mind you the code isn't optimized since I am still testing)
It seems like there is a lack of solid documentation on collision resolution in general as it's a more niche topic. Most resources I found only concern the detection part.
bool isSphereInsideSphere(glm::vec3 sphere, float sphereRadius, glm::vec3 otherSphere, float otherSphereRadius, Entity* e1, Entity* e2)
{
    float dist = glm::sqrt((sphere.x - otherSphere.x) * (sphere.x - otherSphere.x) + (sphere.y - otherSphere.y) * (sphere.y - otherSphere.y) + (sphere.z - otherSphere.z) * (sphere.z - otherSphere.z));
    if (dist <= (sphereRadius + otherSphereRadius))
    {
        //Push code
        e1->move(-e1->xVelocity / 2, 0, -e1->zVelocity / 2);
        e2->move(e1->xVelocity / 2, 0, e1->zVelocity / 2);
    }
    return dist <= (sphereRadius + otherSphereRadius);
}

sentences:
Same dimension feel no matter what FOV Does anyone know a formula, way, ... to make a FPS player feel like an object has the same size on different FOVs (given that it's at the same distance of the player, of course)? I know that this can't be done perfectly, because of the distortion various FOVs cause and the position of the object (near the edges of the FOV = more distortion).
Let's ignore these distortions, and aim for a same size feel for objects that are directly in front of the player (so in the exact center of the FOV).

To clarify things a bit further: I want 1 object in my game to have the same scale feel on different FOVs, not my entire game world.

I've tried giving it a percentage of the frustrum height, but that doesn't seem to give me consistent results.

Note: I'm using vertical field of view in my game.

sentences:
Not placing tiles correctly on a grid I recently created a map editor, and i came across a problem: I can't position some tiles on some grid blocks, but if i go farther from Y-axis near 0, i can place blocks correctly.

This is the video: Test_001

Map.cpp - createBlock func

void Map::createBlock(sf::Vector2f position, std::string name) {
        double gridPositionX = floor(position.x / grid) * grid;
        double gridPositionY = floor(position.y / grid) * grid;

        double ceiledGridPositionX = ceil(gridPositionX);
        double ceiledGridPositionY = ceil(gridPositionY);

        int mapPositionArrayX = ceiledGridPositionX / grid;
        int mapPositionArrayY = ceiledGridPositionY / grid;

        sf::Vector2f gridPosition( ceiledGridPositionX, ceiledGridPositionY );

        if (!isPositionOccupiedByBlock(mapPositionArrayX, mapPositionArrayY)) {
            Block block = blockTypes[ findBlockNameVector(name) ];
            block.setPosition(gridPosition);

            worldBlocks.push_back(block);
            wMap[ mapPositionArrayX ][ mapPositionArrayY ] = block.getID();
        }
    }

bool Map::isPositionOccupiedByBlock(int mapX, int mapY) {
    return (wMap[mapX][mapY] != 0) ? true : false;
}

sentences:
Saving Complex Data to File Javascript My game uses lots of complex objects to store game data. (Each block and entity has its own instance of a class)
I am trying to create a saving and loading system, where the user can save game progress to a text file.
But a simple JSON.stringify won't cut it. These objects are very complex and nested, with instances of different classes contained within. (For example, one instance of the Block class may contain multiple instances of the Text class)
I need a way to boil all this meta data down into text. I've tried multiple libraries, but those don't work with my custom classes.
Any advice on this would be super appreciated!
EDIT: An attempt at writing my own method for doing this
function superString(obj) {
let result = "";
for(var property in obj) {
if(Array.isArray(property)) {
  result += superString(property)
}
else if(property instanceof Block) {
  console.log("EXPORTING BLOCK")
  result += property.exportString();
}
else if(property instanceof Entity) {
  result += property.exportString();
}
else if(typeof property === 'object' && property !== null) {
  result += superString(property)
}

else result += JSON.stringify(property)
}return result;
}

sentences:
particle - interpolate I want to make a particle that interpolates in Alpha and velocity.

public class Particle extends GameObject implements Updateable
{

    int time;

    int lifetime;

    int Alpha;

    double dx;

    double dy;

    int[][] alphaEnvelope;

    double[][] speedEnvelope;

    @Override
    public void update()
    {
        time++;

    }

}

this is my particle class.

alphaEnvelope[x][y] changes the Alpha over time where X is the time and Y is the Alpha Value.

For example:

[1][100]

[60][70]

[70][0]

the Alpha is 100 at lifetime 1,
70 at lifetime 60
and 0 at lifetime 70.

How do I interpolate between these values fluently?

sentences:
Unity 2D angular velocity center I try to add angular velocity to my GameObject with this command:

rigidbody2D.angularVelocity = Random.value * tumble;

All works, but I want center of velocity be in the center of my rigidbody, but center is outside my GameObject and looks like every time in different place. How can I set rotation center to the center of my rigidbody?

IMPORTANT: when my GameObject is stay on place (no movement) then all works fine, when I add linear movement it begin rotate around some outside center.

Thanks!

sentences:
Libgdx if statement is not working well I am trying to make the player die when it hits the rock or the time is up and the score is not reached, in this code at the first if statement it works when  Rockhit is true, the player jump and disappear at the bottom of screen and the music is work very well, but when the time is 0 and score is not reached , the player is jump and keeps going out of the top of screen and the sound is work but slow and not clear. (notice: that before I adding the Rockhit condition the player was going up out of screen and the voice wasn't clear)
this is the code:

  public State getState()
        {
            //Gdx.app.log(Float.toString(b2body.getLinearVelocity().x),"hi");
            if ((Hud.getTime()==0&& Hud.getScore()<(level*15)+50)|| Rockhit()) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                collectoIsDead=true;
                Filter filter = new Filter();
                filter.maskBits = Fruits.NOTHING_BIT;
                for (Fixture fixture : b2body.getFixtureList())
                    fixture.setFilterData(filter);
                b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
                //b2body.applyLinearImpulse(new Vector2(0,-2.5f), b2body.getWorldCenter(), true);
                Fruits.manager.get("music/fail.mp3", Sound.class).play();
                return State.DEAD;

            }

            if((Hud.getTime()==0&& Hud.getScore()>=(level*18)+50)|| (Hud.getScore()>=(level*15)+50)) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                Fruits.manager.get("music/cheering.mp3", Sound.class).play();
                return State.SUCCESS;
            }
            if (b2body.getLinearVelocity().x!=0)
                return State.RUNNING;
            else
                return State.STANDING;

}

sentences: XNA server client model Hi what is the best model for creating client server application in one solution in xna, client as xna application, server as console and model as reference added to client and server? or maybe one xna application with global variable isHost passed from separate client/ server application running this xna application, or mayby different?

sentences:
Representation of trains on a simplified rail grid I'm working on a hobby game, basically about train dispatcher's job.

(stack: Typescript, phaser.js)

My map is based on a grid, each tile can hold 1 rail tile (well, except junctions, but we can simplify it for now, since junctions are just multiple tiles, from which only one is active).

Example (black is grid, white is rail):

As you can see, we have basically three different tiles: straight rail, 45 degree turn and diagonal rail (which can be also considered straight rail). I don't plan to add more tiles, as you can already build pretty complex setups from these tiles.

On these rails, trains would drive. Each carriage has two "wheels" - positions, where it snaps to a track. This may be seen on the following example from my prototype:

However the existing system (see below) has some issues:

when a train travels diagonally, sometimes it's x and y coordinates fit in a field than it should (example: traveling from 1|1 to 2|2, but at one point the train's coordinates correspond to the field 1|2 or 2|1).
axles sometimes get closer or futher away from each other. This has almost no effect on resulting simulation (as the carriage is centered between those two axles), but may cause carriages to be closer or futher away from each other (this effect is visible on the prototype as weell)
moving the train in a certain direction is handled by a big chunk of code that essentially lists all possibilities of directions and handles it. I'm interested if there's a better way to do it, so I could simplify the code.

I decided that I would improve the core. I'm wondering, what would be the best way to do this?

What I am looking for:

how to save the rail pieces on the map?
how to move train (I know it's x, y, speed and acceleration)?
how to have the train continue to the next piece on the grid?

Current solution (broken in some edge cases, also not ideal):

each rail piece has it's class (CurvedRail, StraightRail)
each rail piece class has method movePoint, that accepts x, y, direction and distance and returns new point (that is distance away from the original point, but also considering track turns). It may also return delta, if the movement reached edge of the tile and it needs to be moved futher (on another piece). This is handled by a separate class, that finds the following rail piece and calls movePoint with the delta instead
it has issues, because sometimes trains passing diagonal connection don't exactly follow the diagonal, so they instead of ending up on the next diagonal piece, they end up on neighboring horizontal or vertical piece and derail.

One of the issues I may be facing is that tiles are 32x32 pixels, so it's hard to travel exactly in the "middle" of the piece, because it's "between two pixels", and although I'm using decimals, it may be a problem. Is it better to have a grid from odd-sized tiles?

sentences:
Deferred lighting and point light volumes I'm doing deferred point light shadow mapping and I am drawing my point lights using light volumes. Normally I access the position/diffuse texture/normals using this in the fragment shaders:

vec2 texcoord = gl_FragCoord.xy / UnifPointLightPass.mScreenSize;

vec3 worldPos = texture(unifPositionTexture, texcoord).xyz;
vec3 normal   = texture(unifNormalTexture, texcoord).xyz;
vec3 diffuse  = texture(unifDiffuseTexture, texcoord).xyz;

When doing directional lights, I just draw a fullscreen-rectangle, but when doing point lights I use light volumes - drawing a 3d sphere from the cameras point of view to limit the amount of fragments processed.

Does light volumes change the way I get the texcoord?

sentences:
Libgdx: how does dispose() work? My game uses a lot of images, for the over-world, battle screens, chats, etc. I'm really meticulous when it comes to memory management, and I've noticed that even though I dispose every image when I load in a new one, the memory never goes down.

Isn't this what Dispose() should do or is my understanding wrong?

sentences:
What is the difference between Sprite and SpriteBatch, specifically in the context of libGDX? I'm using libGDX and I'm confused about the difference between the Sprite and SpriteBatch.

Anybody can explain it to me in a simple way?

sentences:
Sliding loose dirt shader/material/effect Im sure there is some sort of technique with a name I don't know or didn't think to search, but how would I go about making an effect similar to loose dirt sliding down the face of a slope when something disturbs it? I guess I think of it as a mini avalanche or something.

I have attempted it a couple times with pretty poor results, but some of the properties i tried to replicate was: the sliding dirt spreads out the further it gets from its start position depending on the surface shape, angle of repose, rocks or larger pieces of debris causing even more dirt to slide(quasi-recursion?), loose dirt 'sliding' over other dirt, etc. I assume id need to combine the right ratio of shaders, particles and textures to look right but I cant seem to find any real info on this type of effect. Would something like this be too intensive to do real-time?

sentences:
Designing AI/NPC Task System I am designing a game in Unity which has NPCs (Non-player controllers). I have worked out the path-finding but I need some help with how to implement tasks. I need the task system to be flexible and allow me to easily add new tasks. I also want to be able to have a task trigger another task.

Example for turning light on:

When mouse clicked on light switch
Wait for available/idle NPC
NPC walks to light switch (Using a walkToPostion(pos) task)
Light turns on
NPC is set to available/idle and can perform another task

Another example could be emptying the trash can:

When trash can is full
Wait for an available NPC
NPC walks to trash can (Using a walkToPostion(pos) task)
Trash can is set to empty
NPC takes garbage bag outside (Using a walkToPostion(pos) task)
NPC walks back into house/given position. (Using a walkToPostion(pos) task)
NPC waits to be given next task.

I haven't done a lot with AI before so some hits on how I could go about implements this would be very helpful.

EDIT: One thing I specifically need help with is performing a task inside a task. How do I pause the TurnOnLight task while the player is doing to WalkToPos task?

sentences:
LibGDX player movment I'm working on a project in LibGDX.
It's a 2d platform game; you can say it's like Super Mario.

So this is how I move my player to the right:

if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
    player.b2body.applyLinearImpulse(
               new Vector2(0.1f, 0),
               player.b2body.getWorldCenter(),
               true);
}

When I release the key, the player is still moving a bit. (It still has a "Linear Impulse" force on its physical body, I think).

How can I make it stop?

My question could be simple as:
What is the best way to move a physical body on LibGDX in one direction while holding a key. When I release the key, the body stops immediately.

I have tried with "setTransform" and it's causing issues when the body is touching other objects - plus the shape comes "before" the rest of the game in the screen (you can see it on debug)

Thanks.

sentences:
Matrix rotation of a rectangle to "face" a given point in 2d Suppose you have a rectangle centered at point (0, 0) and now I want to rotate it such that it is facing the point (100, 100), how would I do this purely with matrix math?

To give some more specifics I am using javascript and canvas and I may have something like this:

var position = {x : 0, y: 0 };
var destination = { x : 100, y: 100 };
var transform = Matrix.identity();

this.update = function(state) {

  // update transform to rotate to face destination

};

this.draw = function(ctx) {
  ctx.save();
  ctx.transform(transform); // a helper that just calls setTransform()
  ctx.beginPath();
  ctx.rect(-5, -5, 10, 10);
  ctx.fillStyle = 'Blue';
  ctx.fill();
  ctx.lineWidth = 2;
  ctx.stroke();
  ctx.restore();
}

Feel free to assume any matrix function you need is available.

sentences:
Going from using XMLSerializer to using the XNA Content Pipeline A well known limitation of using the XNA Content Pipeline is that it is not included in the XNA redistributable. So, if you want to create an editor for your game, the designer must download the whole deal: your editor, your engine, XNA Game Studio and Visual Studio Express. Even then, I'm not sure you can compile your XML data into xnb outside of Visual Studio.

So I decided to simply use XMLSerializer, which works fine. However, I'm thinking that, once all the content of my game is done, prior to release, it would be great if I could convert the whole system into using the XNA Content Pipeline. In my mind, I think that the compiled xnb files would load faster than deserializing XML into objects.

Is the conversion possible? More importantly, is it worth it?

Note: my intention is to release the game as an XBOX Live Indie Game.

sentences:
Using SurfaceFormat.Single and HLSL for GPGPU with XNA I'm trying to implement a so-called ping-pong technique in XNA; you basically have two RenderTarget2D A and B and at each iteration you use one as texture and the other as target - and vice versa - for a quad rendered through an HLSL pixel shader.

step1: A--PS-->B
step2: B--PS-->A
step3: A--PS-->B

...

In my setup, both RenderTargets are SurfaceFormat.Single.

In my .fx file, I have a tachnique to do the update, and another to render the "current buffer" to the screen.

Before starting the "ping-pong", buffer A is filled with test data with SetData<float>(float[]) function: this seems to work properly, because if I render a quad on the screen through the "Draw" pixel shader, i do see the test data being correctly rendered.

However, if i do update buffer B, something does not function proerly and the next rendering to screen will be all black.

For debug purposes, i replaced the "Update" HLSL pixel shader with one that should simply copy buffer A into B (or B into A depending on which among "ping" and "pong" phases we are...).
From some examples i found on the net, i see that in order to correctly fetch a float value from a texture sampler from HLSL code, i should only need to care for the red channel.

So, basically the debug "Update" HLSL function is:

float4 ComputePS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,0,0,1);
}

which still doesn't work and results in a all-zeroes ouput.
Here's the "Draw" function that seems to properly display initial data:

float4 DrawPS(float2 inPos  : TEXCOORD0) : COLOR0
{
  float v1 = tex2D(bufSampler, inPos.xy).r;
  return float4(v1,v1,v1,1);
}

Now: playing around with HLSL doesn't change anything, so maybe I'm missing something on the c# side of this, so here's the infamous Update() function:

_effect.Parameters["bufTexture"].SetValue(buf[_currentBuf]);
_graphicsDevice.SetRenderTarget(buf[1 - _currentBuf]);
_graphicsDevice.Clear(Color.Black); // probably not needed since RenderTargetUsage is DiscardContents
_effect.CurrentTechnique = _computeTechnique;
_computeTechnique.Passes[0].Apply();
_quadRender.Render();
_graphicsDevice.SetRenderTarget(null);
_currentBuf = 1 - _currentBuf;

Any clue?

sentences:
Collision Detection for a 2D RPG First of all, I have done some research on this topic before asking, and I'm asking this question as a mean to get some opinions on this topic, so I don't make a decision only on my own, but taking into account other people's experience as well.

I'm starting a 2D online RPG project. I am using SFML for graphics and input and I'm creating a basic game structure and all for the game, creating modules for each part of the game.

Well, let me get to the point I just wanted to give you guys some context.

I want to decide on how I'm going to work with collision detection. Well I'm kinda going to work on maps with a tile map divided in layers (as usual) and add an extra 2 layers - not exactly in the map - for objects. So I'll have collisions between objects and agents (players - npcs - monsters - spells etc) and agents and tiles. The seconds one can be easily solved the first one need a little bit of work.

I considered both creating a basic collision test engine using polygons and a quadtree to diminish tests since I'm going to be working with big maps with lots of objects - creating both a physical and graphical world representation. And I also considered using a physics engine like Box2D for collision tests.

I think the first approach would take more work on my part but the second one would have the overhead of using a whole physics engine for just collision detection and no physics.

What do you guys think ?

sentences:
Render order in 3/4 view game I'm writing a 2D game with an internal 3D space. The view is 3/4 view. I've run into trouble with the render order of entites.
Context: The world uses a tile system, like a 3 dimensional lattice, each tile is a 1x1x1 space. Entities have a 3D coordinate position and do not snap to tiles(may straddle two tiles). Entities have their own width, height, and depth, all entities are strictly oblongs and do not rotate(only exist in right angles). Since the view angle is fixed and there is no perspective, the graphical representation of the tiles and entities are all 2D images(they are all sprites)
Question: How do I code for render orders in a 3/4 view?
So far, I've defined the render order using the y and z coordinate of the entity(I believe x coordinate is irrelevant in 3/4 view). However, it quickly dawned how using a single point to define the layer of an entity with a height and depth was bound to have issues. This is illustrated in the following image:

The horizontal axis is y, while the vertical axis is z. The dashed line represents the view angle.
The blue box and green box should be rendered above the red box. However, when the render order is determined by either the y or the z coordinate of the entity's origin point(highlighted), it is impossible for the system to be consistant.
For instance, if the renderer renders from lowest to highest(layer based on z coordinate), the red box would cover the green box, which is incorrect. If the render renders from back to front(layer based on y coordinate), the red box would appear on top of the blue box, which is incorrect. A mixture of y and z coordinate(e.g. y + z = layer) would be inconsistant also, though it does agree with the example shown.
Without assumptions about the features of the game I am creating, is there a way to have a system that can consistantly order render layers correctly, given information of 3D coordinate position and dimensions of all entities? Also given that each entity is represented as a flat, 2D sprite?
I have encountered numerous sites warning people away from 3D, since it is "orders of magnitude" harder than 2D. Could I walk the tightrope and introduce some 3D elements to solve this issue, while keeping the game 2D and in 3/4 view angle? Thanks in advance.

sentences:
Scaling a sphere to give identical result, regardless of rotation how can I maintain a consistent scaling of a sphere regardless of the rotation of the model? For example, take the following (scaled) sphere:

In this image, we start with a sphere, looking at it directly through the Z-azis. The sphere is scaled by 0.7x on the Y (up/down) axis, giving it a 'squashed' appearance.

A 3D vector that describes the scaling of this sphere is [1.0, 0.7, 1.0]. The red dot indicates an arbitrarily chosen point on the surface of the sphere that we will mark as the 'top'.

Now, after the sphere rotates 90 degrees through the Z-axis, the same scaling coefficients [1.0, 0.7, 1.0] when applied will produce a result like this:

My question is as follows:

Given a rotation quaternion Q that represents the rotation of the sphere, how can I use Q to correctly alter the scaling coefficients vector in order to produce a result like this instead:

Notice that the eventual 'oriented shape' of the sphere is the same as in the first image, even though a 90-degree-through-Z rotation has been applied. In this instance, a corrected scaling coefficient vector would be something like [0.7, 1.0, 1.0].

I've tried simply multiplying the scaling coefficients vector by Q but this gives an incorrect result. This is actually trivial to see if you imagine rotating [1.0, 1.0, 1.0] by 45 degrees through any angle. The answer should always remain as [1.0, 1.0, 1.0] but it does not.

sentences:
Why isn't my sprite being drawn in the correct position in XNA? Sorry if this has been asked before, but I can't seem to find it here. I'm trying to make an asteroids clone in XNA. I took the Game State Management project and am making new classes for things like the player and placing them in the GameplayScreen class. For some reason my ship isn't being draw correctly.

GameplayScreen's Draw method:

 public override void Draw(GameTime gameTime)
    {
        ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
                                           Color.CornflowerBlue, 0, 0);

        SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

        spriteBatch.Begin();
        //draw fps
        if(showFPS)
            spriteBatch.DrawString(framerateFont, "FPS: " + frameRate, new Vector2(15, 15), Color.White);

        player.Draw(spriteBatch);

        spriteBatch.End();

        // If the game is transitioning on or off, fade it out to black.
        if (TransitionPosition > 0 || pauseAlpha > 0)
        {
            float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

            ScreenManager.FadeBackBufferToBlack(alpha);
        }
    }

And my ship's drawing code:

 public PlayerShip(Game game)
    {
        this.game = game;
        Viewport view = game.GraphicsDevice.Viewport;
        center = new Vector2(view.Width / 2, view.Height /2);
        sourceRectangle = new Rectangle();
        Reset(center);
    }

    public void Reset(Vector2 position)
    {
        this.position = position;
    }

    public void LoadContent()
    {
        ship = game.Content.Load<Texture2D>("ship");
        sourceRectangle = new Rectangle(0, 0, ship.Width,
            ship.Height);
        origin = new Vector2(ship.Width / 2, ship.Height);
    }

    public void Update(GameTime gameTime)
    {
        HandleInput();

    }

    //handles all keyboard input by user. rotates ship based on current rotation.
    private void HandleInput()
    {
        input = Keyboard.GetState();
        float x = position.X;
        float y = position.Y;
        Matrix m = Matrix.CreateRotationZ(rotation);

        if (input.IsKeyDown(Keys.Right))
            rotation += turnFactor;
        else if (input.IsKeyDown(Keys.Left))
            rotation -= turnFactor;
        else if (input.IsKeyDown(Keys.Up))
        {
            x += m.M12 * directionFactor;
            y -= m.M11 * directionFactor;
        }
        else if (input.IsKeyDown(Keys.Down))
        {
            x -= m.M12 * directionFactor;
            y += m.M11 * directionFactor;
        }
        position.X = x;
        position.Y = y;
        Console.WriteLine("Y: {0} ", y);
        Console.WriteLine("X: {0} ", x);
    }

    public void Draw(SpriteBatch sb)
    {
        Vector2 origin = new Vector2(ship.Width / 2, ship.Height);
        sb.Draw(ship, ship.Bounds, null, Color.White, rotation, origin, SpriteEffects.None, 0f);
    }

I hooked the project up to a console window and it seems that the X and Y positions are updating correctly code wise, but not visually. It seems to update where it is rotationally, but going up or down doesn't draw correctly.

Image of what it's doing http://imgur.com/4cKBk

sentences:
JOGL runs extremely slow from a jar file on other machines. I am currently messing around with JOGL and JBullet, with some success. I'd like to share what I've created with my friends. I created a jar file and a .bat to open it with the argument -Dsun.java2d.noddraw=true. The jar runs perfectly on my machine. It opens and runs on my friends system and my laptop, but at an extremely low frame rate. What is the cause of this and how can I fix it?

Also for some reason it loads the wrong textures for an object, again only when ran on another system. They are both Windows 8.1 x64 systems. The graphics drivers of all systems are up to date as well. This is really disconcerting because i want to be able to distribute this program, even if only amongst friends. .

sentences:
How define coordinates for bodies in outer space What is a simple way of representing celestial bodies in outer space using a coordinate system? There are actual scientific coordinate systems (see https://en.wikipedia.org/wiki/Celestial_coordinate_system) but they may be too complicated to really understand and bring up the barrier of entry to my game.

I could just end up using a two-dimensional system to make things simple, but I'd like to inject some realism into the game and make it 3D. Any thoughts?

Edit: This is for a completely text-based game. The coordinates are for the user to situate themselves in 3D space and for me to be able to calculate distances between celestial objects.

sentences:
I see free asset being sold on another site. How and where do I complain? We all know that there are many repositories and marketplaces for 3D models on the internet. The specific problem I have now is with this 3D asset for sale on a site. It was made for sale a short while ago. The same model is available at another place for free under a CC license, and was first uploaded years ago. Furthermore, the same 3D model was made available for download for free under a personal use license at another place even earlier, about 6 years ago.

My problem is I don't know who to complain to or which person I should complain about. Normally my gut reaction when I see this sort of stuff is that the paid product has made its way around and been made available for free by someone. However it could easily be the other way around. The seller most who most recently uploaded the model looks suspicious. There is hardly any information that would reflect their knowledge of the actual model. Anyone who's done modelling of real objects before will know the extensive references one must use to make an accurate model

At least one person is in breach of copyright, and most likely the code of conduct on their respective site.

If for example the original author is Person 1, then Person 2 selling the model is breaching this license, because it's a non-commercial license. If on the other hand the original author is Person 3, then Person 2 may sell the model, but they need to fulfill the attribution requirement, which they haven't. If however the original author is Person 2 (the person selling the model), then the other two are in breach of the license.

Most likely the model (which appeared in 2013) is proprietary and copyrighted content and all three are in fact in violation of copyright (well, that's what I think is most likely). The asset may be ripped from a AAA commercial game, as was the case with a model I found recently which came from an ARMA military game.

I don't who to complain to or who to complain about. I thought someone could point me in the direction of the best way to go about this, as I think this community has some experience in handling 3D assets and licenses, and many of you who are in the industry or are experienced with this sort of misconduct might know the best way to approach this.

sentences:
What causes "ETC1 cannot be resolved" errors when building AndEngine? I just got the latest AndEngine code from Mercurial, added Android 1.6 to my Order/Export tab, and cleaned everything (including a "Fix" command as instructed by the console). Regardless of which version of Android I specify in my project settings (1.5, 1.6, 2.2, 3.2), I get around 523 compilation errors.

The most unique I can see is ETC1 cannot be resolved, accounting for 5 out of 105 errors I can see.

The other 100 are all some variation of The method [...] must override a superclass method.

What am I missing? I installed the JDK, Eclipse classic, SDK manager, and everything in the SDK.

sentences:
How to convert an octree to a 3D array I have an octree that I'm planning to use for 3D pathfinding. My plan was to break down the world such that all the leaf nodes of the tree would be of equal dimensions that would create a nice grid and then adapt A* by adding an extra dimension and just run searches on the grid. The image below shows a sample of my leaf nodes to demonstrate what I'm talking about (ignore the spheres, they are for something else).

What I'm not sure about is how do I perform A* on a tree structure. My thought was to convert the tree structure to a 3D array, which would make it really easy to perform A* on, but I'm not sure how I would go about this. I can recursively work my way down the tree and tell which nodes are the leaf nodes, but I don't know how I could necessarily work my way down in an ordered fashion such that I could index nodes into an array properly. How would I go about this? Is it even the right approach; or it there a better approach to performing A* on the tree?

Note: I am aware the space might not actually be open enough to justify full 3D pathfinding, but this is intended to be a demonstration/test of the concept, so I wanted to keep things relatively simple.

sentences:
Greiner-Hormann clipping problem I have a set of planar polygons in 3D space defined by their vertices in counterclockwise order. Let's define the 'positive face' as being the face of the 3D polygon such as when observed, the vertices appear in counterclockwise order, and the 'negative face', the face which when observed, the vertices appear in clockwise order.

I'm doing perspective projection of the set of polygons onto a projection polygon defined by the points in this order: (0, h, 0), (0, 0, 0), (w, 0, 0), and (w, h, 0), where w and h are strictly positive integers. The positive face of this projection polygon is oriented towards positive Z, and the camera point is somewhere at (0, 0, d), where d is a strictly negative number.

In order to 'clip' the projected polygons into the projection polygon, I'm applying the Greiner-Hormann (PDF) clipping algorithm, which requires that the clipper and the to-be-clipped polygons be in the same order (i.e. clockwise or counterclockwise).

My question is the following:

How can I determine whether the projected face of the 3D polygon is the negative or the positive one? Meaning, how do I find out if I have to work with the vertices in normal or inverted order for the algorithm to work?

I noticed that only if the 3D polygon is facing the projection polygon with its negative face, both of them are in the same order (counterclockwise), otherwise, a modification needs to be done.

Here is a picture that illustrates this:

Note that the planes described by the polygon from the set and the projection polygon may not always be parallel.

sentences:
Meaning of offset in pygame Mask.overlap methods I have a situation in which two rectangles collide, and I have to detect how much did they collide so I can redraw the objects in a way that they are only touching each other's edges.

It's a situation in which a moving ball should hit a completely unmovable wall and instantly stop moving. Since the ball sometimes moves multiple pixels per screen refresh, it is possible that it enters the wall with more than half its surface when the collision is detected, in which case I want to shift its position back to the point where it only touches the edges of the wall.

Here is the conceptual image it:

I decided to implement this with masks, and thought that I could supply the masks of both objects (wall and ball) and get the surface (as a square) of their intersection. However, there is also the offset parameter which I don't understand.

Here are the docs for the method:

Mask.overlap

    Returns the point of intersection if the masks
    overlap with the given offset - or None if it does not overlap.
    Mask.overlap(othermask, offset) -> x,y

    The overlap tests uses the following offsets (which may be negative):

   +----+----------..
   |A   | yoffset
   |  +-+----------..
   +--|B
   |xoffset
   |  |
   :  :

sentences:
Unable to detect continuous keypress event in SDL I am developing a game using SDL, and am unable to do continuous motion for my object when a key is held down.

I'm calling SDL_PollEvent() to retrieve all events during a frame, and passing each resulting SDL_Event structure into this function:

void Avatar::handle_input(SDL_Event keyInput){
if( keyInput.type == SDL_KEYDOWN )
{
    //Adjust the velocity
    switch( keyInput.key.keysym.sym )
    {
    case SDLK_LEFT: Move(1); break;
    case SDLK_RIGHT: Move(2); break;
    }
}

The problem is that when I hold down the right or left arrow keys, the avatar only moves once instead of moving continuously for as long as I hold down the key.  How can I make the motion continue for as long as the key is held down?

sentences:
Unity3D: collider performances on mobile iOS devices I'm experimenting with Unity3D and colliders. Unfortunately I still don't have Unity Pro version and I can't use the profiler.

Consider the following situation:

mobile devices (ios, iphone 3GS).
an infinite runner game (consider something like agent dash or temple run). The player run along its path collecting bonuses and possibly hurting obstacles.
the number of objects along player's path is very high.

The first simple approach is to use a rigidbody with a collider attached to the player (let's say it could be even a shere collider) and use a collider for each object in the scene (coins, obstacles, bonuses,...) .

AFAIK, using hundreds of colliders could have a serious impact on performances,specially on mobile devices, am I right?

So here's some questions:

In the situation described above, is that feasible use collider to
detect objects collectable by a player running along a path?
Could be a better idea to store the location of the collectables
objects inside some kind of data structure and completely avoid to
use Unity collision detection?
What's a reasonable average number of RigidBody/Sphere Collider that can be used in a single scene on a mobile device?

Does anyone has implemented something similar? Could you suggest me the right way to go?

sentences:
Is a recursive game object update better than a linear one? I have a tree of gameobjects, so every node contains a list of children.
In update function:
Is it better to do recursive or linear walking through game objects.

update() {
    update self;
    foreach child call update;//recursive call
}

or

array of children = root.getAllChildrenRecursive
foreach child in array of children call update; //linear walking through gameobjects.

sentences:
Implementing a score system similar to Moon Patrol I am working on an Android game scenario inspired by Moon Patrol.

My beta version is available for beta test from https://play.google.com/store/apps/details?id=dev.android.buggy

In my case, I got the elapsed time in seconds for reaching a checkpoint, and I could reward either a fixed bonus or a bonus based on the time, perhaps the difference between the time and the average time, or another bonus if it is a high score. My specific implementation for completing a checkpoint looks as follows at the moment:

if (checkpointComplete) {
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            //
        }
    });
    canvas.drawColor(Color.BLACK);
    ((ParallaxActivity) getContext()).stopWatch.stop();
    paint.setTextSize(60);
    String s2 = "TIME TO REACH POINT \"" + Background.checkpoint + "\"\n";
    if (runOnce) {
        for (int q = 0; q < s2.length(); q++) {
            final String s2f = s2;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview.setTextColor(Color.RED);
                    checkpointtextview.append(Character.toString(s2f.charAt(r)));
                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    String str = String.format("%03d", ((ParallaxActivity) this.getContext()).countUp);
    String s3 = "YOUR TIME                :   " + str;
    if (runOnce) {
        for (int q = 0; q < s3.length(); q++) {
            final String s3f = s3;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview2.setTextColor(Color.parseColor("#ADD8E6"));
                    checkpointtextview2.append(Character.toString(s3f.charAt(r)));

                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    runOnce = false;
    // canvas.drawText("CHECKPOINT COMPLETE", (float) (screenWidth * 0.35), (float) (screenHeight * 0.45), paint);
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ((ParallaxActivity) getContext()).startTime = SystemClock.elapsedRealtime();
                    ((ParallaxActivity) getContext()).stopWatch.setBase(((ParallaxActivity) getContext()).startTime);
                    ((ParallaxActivity) getContext()).stopWatch.start();
                    checkpointtextview.setText("");
                    checkpointtextview2.setText("");
                    checkpointtextview3.setText("");
                    checkpointtextview4.setText("");
                    checkpointtextview5.setText("");
                    checkpointtextview6.setText("");
                    String str = "Player 1  " + String.format("%06d", score);
                    tvId.setText(str);
                    scoring = false;
                    buggyXDistance = 0;
                    distanceDelta = 0;
                    retardation = 0;
                    checkpointComplete = false;
                    runOnce = true;

                }
            }, 3000);
        }
    });
}

I want to calculate bonus for completing a checkpoint but how is it calculated? If we look at the original it looks like below.

Is it possible to deduce the formula for calculating the bonus? My bonus screen looks the same. So if your time is x and the average time is y and the record is z, what is the formula?

sentences:
How does an iOS developer get his app/game on the AppStores main page? I was looking at the front page of the AppStore, and they display a new game and a new app every day. I was just curious, how does an iPhone developer get their game or app onto that front page? Does Apple choose what goes on there? Or do you pay money?

I was just curious, I don't develop games for iOS.

sentences: Java LWJGL - How can I add water to my 3d world? The title says it all, how can I implement a simplistic water system into my game? I am using Java LWJGL and OpenGL glsl shaders. I am still fairly new to game programming, and a complete noob in the use of shaders so some guidance and a thorough explanation would be great!

sentences:
FSM - Transitioning to another state I am using a Finite State Machine for my character who has the ability to change into various forms (Wolf, bird, ect).

The character changing to each state is not instantaneous and has a transition period to the next state. Most FSM i've seen set the next state instantaneously. My question is what should I do for the transitioning state? For example the "HumanState" is transitioning to the "WolfState" should I make another state class for each transition (Example: HumanState -> HumanToWolfState -> WolfState)? Or should I just have the state stay at the current state until the transition is done by using a coroutine and setting the state on completion?

sentences:
How to make a script's Gizmo toggleable in the Gizmos menu in Unity3D? I've implemented Gizmos for a few behaviours, and I'd like to make them toggleable in the Gizmos menu, just like the built-in ones.

Is this achievable?

sentences:
How do I make a moving object stop smoothly at the end of a path? There are a dozen ways I could word this question, but to keep my thoughts in line, I'm phrasing it in line with my problem at hand.

So I'm creating a floating platform that I would like to be able to simply travel from one designated point to another, and then return back to the first, and just pass between the two in a straight line. However, just to make it a little more interesting, I want to add a few rules to the platform.

I'm coding it to travel multiples of whole tile values of world data. So if the platform is not stationary, then it will travel at least one whole tile width or tile height.
Within one tile length, I would like it to accelerate from a stop to a given max speed.
Upon reaching one tile length's distance, I would like it to slow to a stop at given tile coordinate and then repeat the process in reverse.

The first two parts aren't too difficult, essentially I'm having trouble with the third part. I would like the platform to stop exactly at a tile coordinate, but being as I'm working with acceleration, it would seem easy to simply begin applying acceleration in the opposite direction to a value storing the platform's current speed once it reaches one tile's length of distance (assuming that the tile is traveling more than one tile-length, but to keep things simple, let's just assume it is)- but then the question is what would the correct value be for acceleration to increment from to produce this effect? How would I find that value?

sentences: How to use the box2d contact listener in android (java port)? I don't have any idea about the box2d collision detection in android. I googled and got results that suggest to use the contact listener but I don't know how to use it in android java.

sentences:
How can make an object orbit a sphere in a random direction? How can I move an object on a random orbital path around a sphere?

I've created some objects at an initial position that is essentially a random point on the sphere offset by some distance (say, 10.0).

Now I want to choose a random direction and have the object orbit the sphere in that direction. How can I accomplish that?

sentences:
ConsumeStructuredBuffer, what am I doing wrong? I'm trying to implement the 3rd exercise in chapter 12 of Introduction to 3D Game Programming with DirectX 11, that is:

Implement a Compute Shader to calculate the length of 64 vectors.

Previous exercises ask you to do the same with typed buffers and regular structured buffers and I had no problems with them.

For what I've read, [Consume|Append]StructuredBuffers are bound to the pipeline using UnorderedAccessViews (as long as they use the D3D11_BUFFER_UAV_FLAG_APPEND, and the buffers have both D3D11_BIND_SHADER_RESOURCE and D3D11_BIND_UNORDERED_ACCESS bind flags).

Problem is: my AppendStructuredBuffer works, since I can append data to it and retrieve it from the application to write to a results file, but the ConsumeStructuredBuffer always returns zeroed data. Data is in the buffer, since if I change the UAV to a ShaderResourceView and to a StructuredBuffer in the HLSL side it works.

I don't know what I am missing:

Should I initialize the ConsumeStructuredBuffer on the GPU, or can I do it when I create the buffer (as I amb currently doing)?.
Is it OK to bind the buffer with a UAV as described above? Do I need to bind it as a ShaderResourceView somehow?
Maybe I am missing some step?

This is the declaration of buffers in the Compute Shader:

struct Data
{
    float3 v;
};

struct Result
{
    float l;
};

ConsumeStructuredBuffer<Data> gInput;
AppendStructuredBuffer<Result> gOutput;

And here the creation of the buffer and UAV for input data:

D3D11_BUFFER_DESC inputDesc;
inputDesc.Usage = D3D11_USAGE_DEFAULT;
inputDesc.ByteWidth = sizeof(Data) * mNumElements;
inputDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
inputDesc.CPUAccessFlags = 0;
inputDesc.StructureByteStride = sizeof(Data);
inputDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;

D3D11_SUBRESOURCE_DATA vinitData;
vinitData.pSysMem = &data[0];

HR(md3dDevice->CreateBuffer(&inputDesc, &vinitData, &mInputBuffer));

D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
uavDesc.Buffer.FirstElement = 0;
uavDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_APPEND;
uavDesc.Buffer.NumElements = mNumElements;

md3dDevice->CreateUnorderedAccessView(mInputBuffer, &uavDesc, &mInputUAV);

Initial data is an array of Data structs, which contain a XMFLOAT3 with random data.

I bind the UAV to the shader using the Effects framework:

ID3DX11EffectUnorderedAccessViewVariable* Input = mFX->GetVariableByName("gInput")->AsUnorderedAccessView();

Input->SetUnorderedAccessView(uav); // uav is mInputUAV

Any ideas?

Thank you.

sentences:
Problem with 2d rotation in OpenGL I have a function to perform sprite rotation :

void Sprite::rotateSprite(float angle){
    //Making an array of vertices - 6 for 2 triangles

    Vector2<gamePos> halfDims(_rect.w / 2, _rect.h /2);

    Vector2<gamePos> bl(-halfDims.x,-halfDims.y);
    Vector2<gamePos> tl(-halfDims.x,halfDims.y);
    Vector2<gamePos> br(halfDims.x,-halfDims.y);
    Vector2<gamePos> tr(halfDims.x,halfDims.y);

    bl = rotatePoint(bl,angle) + halfDims;
    br = rotatePoint(br,angle) + halfDims;
    tl = rotatePoint(tl,angle) + halfDims;
    tr = rotatePoint(tr,angle) + halfDims;

    /**
        1st triangle
    **/

    //Top right
    _dataPointer.vertices[0].setPosition(_rect.x+tr.x,_rect.y+tr.y);

    //Top left
    _dataPointer.vertices[1].setPosition(_rect.x+tl.x,_rect.y+tl.y);

    //Bottom left
    _dataPointer.vertices[2].setPosition(_rect.x+bl.x,_rect.y+bl.y);

    /**
        2nd triangle
    **/

    //Bottom left
    _dataPointer.vertices[3].setPosition(_rect.x+bl.x,_rect.y+bl.y);

    //Bottom right
    _dataPointer.vertices[4].setPosition(_rect.x+br.x,_rect.y+br.y);

    //Top right
    _dataPointer.vertices[5].setPosition(_rect.x+tr.x,_rect.y+tr.y);
}

Vector2<gamePos> Sprite::rotatePoint(Vector2<gamePos> pos, float& angle){

    Vector2<gamePos> newv;

    newv.x = pos.x * cos(angle) - pos.y * sin(angle);
    newv.y = pos.y * cos(angle) + pos.x * sin(angle);

    return newv;
}

And the result is

Am i doing something wrong ? It happens also when i put small angle (even if i put here angle 1 )

Thanks for help.

sentences:
What is a good file format for saving game data? I need to save some custom game data.  Map, player, etc.

All of them will have "sub objects".  For example,  a map and map will have an "array" of tiles.  ie, hierarchical data.  Hopefully nothing binary.

What would be a good format for these?

So far I'ved considered:

Serailization: This is FAST and easy, but tends to break when I change the underlying classes :(

XML: I really hate parsing this.  My test case was over 100+ lines of code and seemed likes tons of "busy work" for even a very simple format.

INI: would be really clumsy for hierarchical data.

Protobuf: Never used it, but read you have to do a lot of manual mucking around and breaks if you change the class.

Other options? That's why I'm here!

Edit: this is Java btw.

Edit 2:

I settled on "Controlled Binary Serialization" (see below).

Pros:

it's fast
it's small (on disk) and can be easily compressed/decompressed during read/write.
it's super easy to read/write from game and toolset.
I can decide what to include/exclude of the object.
Objects/Data can be nested.

Cons:

Can't edit it by hand (like XML, YAML, etc)
Can't easily read/modify it with scripts
Java Serialization by default is pretty slow/bloated compared to other implentations, but it's stable and works

sentences:
How can I determine whether a unit is in range or not? I'm programming a small game that's going to be somewhat like a tower defence. I was playing around with how I determin whether a unit is in range or not.

public void Update(GameTime theGameTime)
    {
        Timer -= theGameTime.ElapsedGameTime.TotalSeconds;

        if (Timer < 0)
        {
            bool CreateNew = true;
            foreach (Unit theUnit in Lists.ennemyUnits)
            {
                if (Math.Pow(Math.Sqrt(Vector2.Distance(Location, theUnit.Location)),2) < 999);
                {
                    foreach (Arrow theArrow in Quiver)
                    {
                        if(theArrow.visible == false)
                        {
                            CreateNew = false;

                            theArrow.shootProjectile(Location, theUnit.Location);

                            Timer = 3;
                            break;
                        }

                    }

                    if (CreateNew == true)
                    {
                        Arrow theArrow = new Arrow();
                        Quiver.Add(theArrow);

                        Timer = 3;

                        theArrow.shootProjectile(Location, theUnit.Location);
                    }
                }
            }
        }

I'm running into a problem with this, when the location of my archer in Y is higher or the X is lower the archer doesn't shoot the enemy unit. I do not understand why?

sentences:
Efficient way to compare vectorial direction? I have a bunch of random vectors representing a direction and four other vectors that we can distinguish with their pyramidal arrows at their extremity, they represent a boundary
what i'd like to do is figure out which vectors are within the given boundaries,
how can I do that?
How can I compare them to filter them properly so the only one selected are vectors within the four boundary direction
I have as info:
directional vector / XYZ Euler angle

sentences:
How to design 2D collision callback methods? In a 2D game where you have a lot of possible combination of collision between objects, such as:

object A vs object B => object B vs A;

object A vs object C => object C vs A;

object A vs object D => object D vs A;

and so on ...

Do we need to create callback methods for all single type of collision? and do we need to create the same method twice? Like, say a bullet hits a wall, now I need a method to penetrate the wall for the wall, and a method to destroy the bullet for the bullet!!

At the same time, a bullet can hit many objects in the game, and hence, more different callback methods!!!

Is there a design pattern for that?

sentences:
2D Coordinate Based Game I want to make a game for Android that has a 10x10 Grid Plane as UI.In this game users going to touch on a grid and tihs grid will be painted.

My question is how do I understand which gird or tile was clicked ? I thought maybe I will make this grid on a coordinate system so that if the user touchs a point on the gamescreen aapp will take this point and will find out in which coordinate interval is in.

Like so:

I touched -> [-2.68,3.85]
The grid -> [-3,4] will be painted.

How do I do this in Android Studio?

sentences:
Understanding normal mapping I am trying to understand the basics of normal mapping using this tutorial : http://ogldev.atspace.co.uk/www/tutorial26/tutorial26.html

What I don't get there is the following equation :
E1 = ( U1 - U0 ) * T + ( V1 - V0 ) * B

How do they came to this equation? This it out of nowhere for me. What is E1?
The tutorial say that E1 is one edge of the triangle. But I don't get it, in the equation E1 seems to be a real number, not a vector ( which an edge is supposed to be right? he have a x and y component ).

sentences:
Lightweight lua objects vs. inheritance Although I did this a couple of times from scratch, still no solution really fits.

I'm using lua for scripting in my games. Lua holds the "prototypes" of the game elements, that are copied to each entity on it's creation. A prototype represents a class of objects ("Soldier with shotgun"). Also, each prototype may hold event hooks (OnDie, OnSpotEnemy, etc). Clearly it's a prototype, not the object that will be handled.

So, each time a hook is executed, I need to create an object to represent the calling entity (and any entities it interacts with) only for the lifetime of a single script execution. What it means is that a instance of the object lives in lua only for the time needed to run this script.

Simple execution of this idea wasn't much work -- I used lightuserdata to hold the C++ pointer to the entity encapsuled in a being class. To access the fields of the C++ object, I overloaded the metatable of being. However, the fact that the fields of the object are handled by a metatable practically breaks any reasonable implementation of inheritance.

I pondered with the usage of normal userdata, but I'm afraid that the dynamic allocation needed to run each script (some of them being ran each tick in the game loop) are going to ruin performance.

Any suggestions? Or maybe a better solution altogether?

sentences:
Where can I find fonts which I can distribute with an open source game? I want to be able to release my game as open source, and I need to be able to distribute font files with my game. Where can I find fonts which I can use in this way, and what font licenses should I be looking for?

Are there any further considerations if I want to release my game under GPL rather than a less restrictive open source license such as BSD?

Edit: In response to Olie saying that the question is unclear: My main problem is that fonts which I find on the Internet either do not clearly state their licenses, or have licenses which do not make it clear whether I can distribute the font with software. I know very little about font licenses, but I am looking for sources of fonts which guarantee that the fonts are basically open source / creative commons / public domain / some other font license which allows me to distribute it with a game without paying license fees.

sentences:
Synch clocks between client and server in Java We're developing a simple boggle game in Java for a college project (purely academic purposes, so we're trying to keep it simple).
Our application is composed by a client portion and a server portion. The idea is that when a game starts all the participants have a fixed amount of time (3 minutes) to find words from the grid.
Of course we have to ensure that all timers start at the same time and players with higher ping don't get penalized. By searching on Google and other forums most people suggest the correct approach is to implement the (S)NTP algorithm, even though for a similar question here someone suggested that NTP is overkill. Is it or is it not?
Our idea is basically this: when the game starts, the server sends to all the participants a future datetime to start the timer task and then simply waits for the clients to communicate the results. If indeed NTP is the best approach I'd like to know if there are alternatives to the already available Apache Commons Net library since we're using Java 14 with modules and JavaFX, so we need to use jlink and it doesn't allow for non-modular dependencies. Thanks in advance

sentences:
Using two shaders instead of one with IF statements I've been working on porting a relatively large opengl ES 1.1 source to ES 2.0.

In OpenGL ES 2.0 (which means, everything uses shaders), I want to draw a teapot three times.

The first one, with a uniform color (ala the old glColor4f).
The second one, with a per-vertex color (the teapot has its array of
vertex color as well)
The third one, with per-vertex texture
And maybe a fourth one, with both per-vertex texture and color. And
then maybe a 5th one, with normals as well..

There are two choices I have with implementation, as far as I know. The first is to make a shader that supports all of the above, with a uniform that is set to change the behavior (e.g use the singular color uniform, or the per-vertex color uniform).

The second choice is to create a different shader for each situation. With some custom shader preprocessing, it's not that complicated to do, but the concern is the performance cost in switching shaders between drawing objects. I've read that it's not trivially small.

I mean, the best way to go about this is to build both and measure, but it'd be good to hear any inputs.

sentences:
Am I using libGDX Asset Manager correctly? My understanding is that you initialize the AssetManager as a non-static object in your main class and load the sprites you need...

    manager = new AssetManager();
    manager.load("sprite_sheet.txt", TextureAtlas.class);
    manager.finishLoading();

I then modified my abstract State class by adding AssetManager to the constructor...

 State(GameStateManager gsm, AssetManager manager) {
    this.gsm = gsm;
    this.manager = manager;

Now say I have 5 blocks in my sprite sheet called block0, block1... block5 would it be appropriate to create a BlockTextures class like this?

private static TextureAtlas textureAtlas;

public BlockTextures(AssetManager manager) {
    textureAtlas = manager.get("sprite_sheet.txt", TextureAtlas.class);
}

public static AtlasRegion get(int id) {
    return textureAtlas.findRegion("block" + id);
}

public static void dispose() {
    textureAtlas.dispose();
}

Where I call BlockTextures.dispose() in my Game.dispose() method?

public void dispose() {
    BlockTextures.dispose();
}

While this code seems to work fine I feel like I am not using AssetManager correctly.

sentences:
SFML - Difficulty with Rect Motion when using 1028x720 image per frame Hello their just having a little tediously annoying problem
that I just can't seem to figure out I've tried numerous things
from using for loops on iterators and index values , iterating a index for the usual switch statement  "switch(index)" then rendering the image per frame also tried rendering per delta time all leading to pretty poor results such as
the frames would change but each frame index would have it's own unique
time it took to change too the next frame was rather bizzare actually
anyways the problem is "sorry for that long introduction" :

I'd like to render a HD image animated background in my video game
using SFML and C++ .

The problem is that it won't change the index slow enough
even when using delta time "sf::clock deltaclock = sf::asMilliseconds" , frameratelimiting and or verticlesync also won't move the clip rectangle for the texture correctly enough to give the illusion of an animated hd image...

Id show code but I think the problem doesn't require it
at all unless for showing how to do the solution
all I want is too be able to simply move a clip rect a certain amount
on a 1 HD image per frame for a 3 frame HD spritesheet using SFML and C++.

What that means is I have 3 HD images of 1024 width and 720 height
at different locations on a spritesheet and Id like to use a clip rectangle
too move across this spritesheet fast and correctly enough
to give the illusion that the 3 HD images as a whole 1 HD image
are animated in game without any suttering , lagging or way to fast speeds.

one solution I had was too use a sprite sheet and split up the entire background into little tiles and render them all seperatly using a tilemap text file with numerical digits in it representing certain tiles,etc ... but that seems overkill.

Thank you in advance

sentences:
What is the breakdown of jobs in game development? There's a project I'm trying to start for Indie Game Development; specifically, it's going to be a social networking website that lets developers meet through (It's a secret). One of the key components is showing what skills members have.

Question: I need to know what MAJOR game development roles are not represented in the following list, keeping in mind that many specialist roles are being condensed into more broad, generalist roles:

Art

Animator (Characters, creatures, props, etc.)
Concept Artist (2D scenes, environments, props, silhouettes, etc.)
Technical Artist (UI artists, typefaces, graphic designers, etc.)
3D Artist (Modeling,  rigging, texture, lighting, etc.)

Audio

Composer (Scores, music, etc.)
Sound Engineer (SFX, mood setting, audio implementation, etc.)
Voice (Dialog, acting, etc.)

Design

Creative Director (Initial direction, team management, communications, etc.)
Gameplay Designer (Systems, mechanics, control mapping, etc.)
World Designer (Level design, aesthetics, game progression, events, etc.)
Writer (Story, mythos, dialog, flavor text, etc.)

Programming

Engine Programming (Engine creation, scripting, physics, etc.)
Graphics Engineer (Sprites, lighting, GUI, etc.)
Network Engineer (LAN, multiplayer, server support, etc.)
Technical Director (I don't know what a technical director would even do.)

Post Script: I have an art background, so i'm not familiar with what the others behind game creation actually do. What's missing from this list, and if you feel some things should be changed around how so?

sentences: 3ds Max Rigs to Cinema 4D I exported the rig from 3ds Max as a FBX file and opened it with Cinema 4D. Everything works great, but the model and a different look to it. Also the mask on her head has a different texture, but it was imported with only 1 object. Just wondering if it can be fixed, if not its ok.

sentences:
Question on methods in Object Oriented Programming I’m learning Java at the minute (first language), and as a project I’m looking at developing a simple puzzle game.

My question relates to the methods within a class. I have my Block type class; it has its many attributes, set methods, get methods and just plain methods. There are quite a few.
Then I have my main board class. At the moment it does most of the logic, positioning of sprites collision detection and then draws the sprites etc...

As I am learning to program as much as I’m learning to program games I’m curious to know how much code is typically acceptable within a given method. Is there such thing as having too many methods?

All my draw functionality happens in one method, should I break this into a few ‘sub’ methods? My thinking is if I find at a later stage that the for loop I’m using to cycle through the array of sprites searching for collisions in the spriteCollision() method is inefficient I code a new method and just replace the old method calls with the new one, leaving the old code intact.

Is it bad practice to have a method that contains one if statement, and place the call for that method in the for loop?
I’m very much in the early stages of coding/designing and I need all the help I can get!
I find it a little intimidating when people are talking about throwing together a prototype in a day too! Can’t wait until I’m that good!

sentences: How to zoom in and out the full tilemap from center in phaser? I am developing a game where I need to zoom in entire map also I can be able zoom out. I have created a tilemap using tiled software and rendered it using phaser.js. How can I add this function to my game?

sentences:
Best Practices for Locating Clicks I am building a 2D board game in Unity with a static camera pointed down at the game board. During the active phase of each player's turn, I want to detect where they click on the board. Fortunately, the board is laid out in an easy rectangular grid. (Essentially a trio of 5x5 grids).
Which of the following would be best practice to implement this?

Create invisible colliders for every square on the board and create a translation function that translates those back to board positions (5,3) with Raytracing?

Get the translated coordinates of the click and use a function to figure out which square (if any) the click is in using the mouseclick event handler (by calculating which square the grid coordinates fall in)?

Make each square a button with its grid identity encoded and use that in its OnPressed function?

Edit: 4) Some other idea I haven't thought of yet?
Experience level: I'm just learning Unity, but have written a lot of C# (and tons of other code).

sentences:
How much to modify yaw? XNA 4.0 Heres a picture that explains better than my words can

For rotating an object I'm using quaternions.
    CreateFromAxisAngle(vector3.Right,yaw)

Maybe this isn't how I should be doing it but I also keep my yaw as radians that
are always between 0 and 360;more or less than 0 or 360 puts it at 0 or 360 respectively.

(object is build up of vertices and indices)

I can rotate it no problem. Move it all about.
But what I really want to do is to find how much I should alter the
yaw so that the my models right vector will sync up with the line
I can draw between the objects center and the camera's position(y is always 0).

Which I guess is the problem now, but long term I am trying to find how I modify the yaw to match any direction.

Say I am travelling Left, I may want to rotate my yaw so that my objects forward is also left.

I have been researching here and elsewhere and there seem to be solutions, I just can't wrap my head around any. Maybe someone could help shed some light?

sentences:
Export information to a custom file type from Air So I have an engine (air application) that basically (for now) is loading some windows on the screen/stage, and you can drag them around. And later on, I'll be able to add other objects onto the stage.

How would I export any kind of information (like co-ordinates or sizes of windows) out of my application to an external custom file. And then I would use that file to reload a previous project if I were to re-load the engine.

I'm working in AS3/Air and in FlashDevelop.

Thanks for the help and time. If anymore information is needed please let me know.

Cheers.

sentences: Can geometry grass shaders be painted to a terrain or are they limited to meshes? So I was follow the roystan grass shader tutourial and although it works well I don't understand the use for it. From what I understand the shader is basically just a flat plane that calculates grass on top of it. If I wanted to apply this grass to a terrain and place it on uneven ground would I have to manually add in a "grass plane" all over the environment and at different angles or am I missing something? Thanks.

sentences:
Using Euler angles to rotate object 360 degrees I'm trying to create script that rotates object in given axis by set amount of degrees.
That's my 2 core methods
public Vector3 rotation;

public void RotateDegreesFast ()
{
    transform.DOLocalRotate (GetTargetRotation (), rotationTime);
}

private Vector3 GetTargetRotation ()
{
    Vector3 newRotation = new Vector3 (
        rotation.x + transform.localEulerAngles.x,
        rotation.y + transform.localEulerAngles.y,
        rotation.z + transform.localEulerAngles.z)

    return newRotation;
}

I was using this script for a little while, it was working perfectly in Y and Z axis. Now I try to rotate object 45 degrees in X axis (rotation = new Vector3(45f, 0f, 0f)). It works until rotation in x value equals 135. Transform.localEulerAngles.x is returning 45 instead of 135. So it's stuck between 90 and 135 degrees. I was trying to use transform.localRotation.eulerAngles.x instead, but it doesn't work as well.
I am aware this works that way because specific Euler angle can be represented in many ways. I also know that DOTween has DOLocalRotateQuaternion method, but the thing is that this component is often reused by a designer that sets value of rotation variable in the inspector. It's way easier to use Euler angles for him.

sentences: Scale smaller resolution to full resolution libGDX Short question about the scaling in libGDX. At the moment i have a application with the resolution 480x320. I define this in the main method of the desktop launcher. My whole application is now calculating with this resolution. For example is the player 50x50 pixels. How can i now scale my application to, for example, 1920x1080 on android so my player is now not only 50x50? I use a orthographic camera and give the width and height of 480x320 in the constructor.

sentences:
intellectual property and non disclosure agreements on artwork I am developing a game and would like to work with an artist. I am interested to know what other developers have done with regards to creating characters.  How does one draft up agreements that might be fair to both parties?

What I think might be good is: give the artist proper attribution and the right to display the work in portfolio, and agreement to pay the commission fee for the work, but let the game designer (the commissioner of the art) own the character and can do what he/she wants with the character in the future, including choose another artist if desired.

Just wondering how other people might have done it.

sentences: Do I need to use a game engine to make a simple game function on other platforms? I'm a complete beginner really enjoying learning how to code (currently in Python) and my first games will be very simple, mostly text based, but I'd like them to run on friends' phones and computers on various platforms, including windows, linux, mac and android. Is this easy to do without using a game engine, or should I use, say, Unity? If I use Unity will I still be learning to program in code, or is it silly to use a game engine for a game that is simple, like a 'choose your own adventure' game or, later, an ascii roguelike? Thanks.

sentences:
Rotate 3D object relative to the camera I really need the help of an expert. I'm trying to rotate an object in all 3 axes relative to the camera in response to the gamepad sticks. I have succeeded but with an unexpected error, depending on its orientation, the object can rotate in the opposite direction of the stick direction.
For example, if the object is on its back, when I move the stick to the left the object rotates to the left. But, when the object is facing the camera, when I move the stick to the left the object rotates to the right. The same happens in all 3 axes, on each axis I have 180 degrees with the correct stick orientation and 180 degrees with inverted sticks. Also, both the camera and the object can freely move adding more complexity to this problem.
I would like to find a way where the orientation of the rotation always follows the direction of the stick. This is solved with a minus sign applied to the angle according to the object orientation (relative to the camera) but I can't find out how.
This is the code I'm using, it works fine except for the orientation problem. Can anyone find the solution to this problem?
public void ObjectRotate(int dir, float angle) // Object is defined elsewhere
{
    var rotate = 360 * Time.deltaTime * angle;
    var target = Object.transform;

    if(dir == 1) { target.RotateAround(target.transform.position, Camera.main.transform.right,  rotate ); }
    else if(dir == 2) { target.RotateAround(target.transform.position, Camera.main.transform.up, rotate); }
    else if(dir == 3) { target.RotateAround(target.transform.position, Camera.main.transform.forward, rotate); }
}

sentences:
Place hexagons together Just made it with some more investigation thanks to this site: Hexagonal grid math, but the hexagons have a little bit spacing horizontally.

Here is the code:

include('class/hexagon.php');

$hexagon = new hexagon(16);

$png_image = imagecreate(500, 500);
imagecolorallocate($png_image, 255, 255, 255);
$black = imagecolorallocate($png_image, 0, 0, 0);

for($i=1;$i<12;$i++) {
    for($j=1;$j<10;$j++) {
        $x = $i * $hexagon->ver;
        $y = $j * $hexagon->height + ( ($i%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y);
        $last_line = array($points[0][0],$points[0][1]);
        imagettftext ($png_image , 5 , 0 , $x , $y , $black , "C:/Windows/Fonts/Arial.ttf" , "{$i},{$j}" );
        foreach($points as $c):
            imageline($png_image, $last_line[0], $last_line[1], $c[0], $c[1], $black);
            $last_line = $c;
        endforeach;
    }
}
header('Content-type: image/png');
imagepng($png_image);
imagedestroy($png_image);

class hexagon {
    public $size;
    public $width;
    public $height;
    public $hor;
    public $ver;
    public $angle;
    public $rad_angle;
    public $side;
    public function __construct($xsize = 32) {
        $this->angle = 60;
        $this->rad_angle = $this->angle * (pi() / 180);
        $this->side = $this->size * cos($this->rad_angle);
        $this->size = $xsize;
        $this->width = $this->size * 2;
        $this->height = $this->width * sin($this->angle * (pi()/180));
        $this->hor = $this->width * ( 3/4 );
        $this->ver = $this->height;
    }

    public function drawHex($x, $y) {
        $points = array();
        for($i=0;$i<7;$i++) {
            $angle_deg = $this->angle * $i;
            $angle_rad = pi() / 180 * $angle_deg;
            $points[$i] = array($x + $this->size * cos($angle_rad),$y + $this->size * sin($angle_rad));
        }
        return $points;
    }
}

Result:

Any advice?

sentences:
SerializationException: Type UnityEngine.MonoBehaviour in assembly UnityEngine,l is not marked as serializable I am trying to save/persist some data between my scenes but I keep getting the error:

SerializationException: Type UnityEngine.MonoBehaviour in assembly UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as serializable.

Here is my script:

public static void SaveState()
    {

        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/EmpireGame", FileMode.OpenOrCreate);

        SaveClass sc = new SaveClass()
        {
            food = Player.food.amount,
            wood = Player.wood.amount,
            iron = Player.iron.amount,
            stone = Player.stone.amount,
            buildingList = new List<Building>(),

    };
        sc.buildingList = playerBuilt;

        Debug.Log("State Saved!");

        bf.Serialize(file, sc);
        file.Close();
    }
}

[Serializable]
class SaveClass
    {
        public int food, wood, iron, stone;
    public List<Building> buildingList;

}

I've narrowed it down to: public List buildingList; being the offending code, but I don't know how else to save this list. I think the MonoBehaviour part of it is the "" as it inherits from MonoBehaviour.

I've read:

Unity Docs: Serialization

Watched:

persistence-saving-and-loading-data

Saving Data In Unity

I've looked up so many Q&A's over this but still can't figure it out.

sentences:
Why does my game exit immediately if I restart it after calling Exit()? When launching a game multiple times in a console, the first time this.Exit() on the game class is called, all following games do not properly run. Instead they exit immediately.

For example, if I have a function that does:

foreach(var i in options) {
  using(var game = new MyGame()) {
    game.Run();
  }
}

and the game class has

protected override void Update(GameTime gameTime)
{
  if(gameTime.TotalGameTime.TotalSeconds > 3)
    this.Exit();
  base.Update(gameTime);
}

then the first instance will execute just fine (for 3 seconds), but the second will exit immediately.

How can I prevent XNA from making the second games die immediately?

sentences: How do I remove the window border in Godot? I want to show my Godot engine game in a borderless window, but not fullscreen. I want to just have the game view visible on screen with no title bar or window chrome.

sentences:
Unity - How do I make non-convex Meshes collide with physics? Whenever I add a Rigidbody component to an object with a non-Convex Mesh, Unity throws this error:

  Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5.
  If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path "Ship/BlockHolder/MeshHolder [0]", Mesh asset path "" Mesh name "MeshHolderTemplate(Clone)"

https://docs.unity3d.com/Manual/class-MeshCollider.html

After doing some research, it appears that I need to either enable the "Convex" setting for the Mesh Collider (which is NOT what I want - my objects require concavity)

or enable the "Is Kinematic" option for the Rigidbody component (which is NOT what I want either - from what I can see, Kinematic objects cannot be pushed by other objects)

The end goal is this: https://www.youtube.com/watch?v=O_UXKce9-OY&t=41s

(I can add the destruction later, for now, I just want the objects to be able to move and not intersect with each other)

How do I do this? I am completely lost here. Is this impossible in Unity?

sentences: Send a prefab over network in Unity I want to instantiate an object on only the server and one client. This means Network.Instantiate is out of the question and I have to instantiate it manually. Since Network.Instantiate takes a prefab, there must be some way of identifying a prefab over a network( you can't send a reference in an rpc. ) How can I do this? Drag and dropping the prefab from the inspector is also not an option, since the component with this reference is on the server only( the client doesn't have a local reference. )

sentences:
Determine play area size in Unity XR? I need to determine the user's play area size, however it seems as though the only way to achieve this is by using the following code from this forum post:
List<XRInputSubsystem> inputSubsystems = new List<XRInputSubsystem>();
SubsystemManager.GetInstances<XRInputSubsystem>(inputSubsystems);
if(inputSubsystems.Count > 0)
{
    List<Vector3> boundary = new List<Vector3>();
    if(inputSubsystems[0].TryGetBoundaryPoints(boundary))
    {
        // boundary is now filled with the current sequence of boundary points
    }
}

This however only works when using the new XR Plugin Management system, however there is currently no support for the HTC Vive?
Is there another way to achieve this?
Thanks in advance for your help!

sentences:
How can I dissolve using dynamic mask objects? I want to Implement dissolve shader like this youtube video

as you can see minions projected light on house to burning it out.

I like to know how to make a similar effect.

sentences: How does changing weapons and character animation in 2d games work? I know how I can make my character move by changing animation-frames. What if I want to use a weapon database? I want the character to fight with a bow and sometimes with an axe (different moves). Do I need like many pictures/animations for every different kind of weapon (bows, swords)? Or am I totally wrong?

sentences:
Lightweight Simple Fast-Object Collision Detection Algorithm/Logic I'm making a game where i need to give my objects collision, but i have many fast small objects and normal collision algorithms (Intersection of shapes and such) do not work, because the position+speed iteration advances the walls and there's never actually an Intersection.

I've reserched on those algorithms for a while but they all seem so unecessary complicated, checking all the wall's lines (being that the wall is a rectangle, 4 lines needed to check for each wall..) and maybe resource-expensive...

So i've started constructing my own (Maybe it already exists but i didnt see it anywhere) collision algorithm based on saving the last position the object was.

Please see the following image:

The idea is demonstrated in frame 1 and 2 of the image. Basicly by checking if there's a wall between the left side of the last rectangle and the right side of the new rectangle, i never skip zones while i check collision, and there's no risk of skipping a wall (so i thought).

This is the (sloppy and half-assed) code of the algorithm:

    private void bounce(GameElement b, Terrain t)
{
    Rectangle tR = t.getRectangle();
    int tRleft = tR.x;
    int tRright = tR.x+tR.width;
    int tRup = tR.y;
    int tRdown = tR.y+tR.height;

    Rectangle bRnow = b.getRectangle();
    int bRnowLeft = bRnow.x;
    int bRnowRight = bRnow.x+bRnow.width;
    int bRnowUp = bRnow.y;
    int bRnowDown = bRnow.y+bRnow.height;

    Rectangle bRlast = b.getRectangleLast();
    int bRlastLeft = bRlast.x;
    int bRlastRight = bRlast.x+bRlast.width;
    int bRlastUp = bRlast.y;
    int bRlastDown = bRlast.y+bRlast.height;

    boolean leftRight = false, rightLeft=false, upDown=false, downUp=false;
    boolean betweenX = false, betweenY = false;

    if(bRnow.x>bRlast.x)leftRight=true;
    if(bRnow.x<bRlast.x)rightLeft=true;
    if(bRnow.y>bRlast.y)upDown=true;
    if(bRnow.y<bRlast.y)downUp=true;

    if(bRlastRight>tRleft && bRlastLeft<tRright) betweenX = true;
    if(bRlastDown>tRup && bRlastUp<tRdown) betweenY=true;

    if(leftRight)
        if((tRleft>bRnowLeft || tRleft>bRlastLeft) && tRleft<bRnowRight && betweenY)
        {
            b.setX(tR.x-bRnow.width - 1);
        }

    if(rightLeft)
        if((tRright<bRnowRight || tRright<bRlastRight) && tRright>bRnowLeft && betweenY)
        {
            b.setX(tR.x+tR.width + 1);
        }

    if(upDown)
        if((tRup>bRnowUp || tRup>bRlastUp) && tRup<bRnowDown && betweenX)
        {
            b.setY(tR.y-bRnow.height - 1);
        }

    if(downUp)
        if((tRdown<bRnowDown || tRdown<bRlastDown) && tRdown>bRnowUp && betweenX)
        {
            b.setY(tR.y+tR.height + 1);
        }
}

Its called bounce because its not really organized atm, i still have to think how to structure the algorithm so it becomes more generalized and pratical (Would appreciate help on that too)

This way of doing collision has one bug at the moment which is seen in image 3 (sorry for drawing circles, they are supposed to be squares) because FAST objects still pass diagonals :/ On the other hand, direct hits on walls are pretty neat.

How could i improve, optimize and organize this algorithm? Or is there any better algorithm and im just thinking too much for nothing?

sentences:
Opengl in 500 lines barycentric calculation question https://github.com/ssloy/tinyrenderer/wiki/Lesson-2-Triangle-rasterization-and-back-face-culling
I cannot figure out how we go from uAB-vector + vAC-vector + PA-vector = 0 to the linear system with those subscripts x and y? Is there another way of explaining how we take three vectors, split them into x and y type vectors, and produce a cross-product that can be used to find the barycentric coords (u, v, w)?
Also, I am not sure why there is a division by the z component of the cross product in last line of the barycentric function. Maybe the answer to my first question will make this more obvious.
Below is a picture of the section of the tutorial where I am stuck. Link to full page is above.

sentences: What is "ROAM" related to terrain rendering? I saw it mentioned on this question, but no one explained what it is.

sentences: How were art assets created in the late 16-bit/early 32-bit era? How were 2d and 3d art assets typically created in the early-to-mid 1990's (16-bit and 32-bit eras?)

sentences:
Scene for Computer Screen We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API that Unity will fetch JSON data and use that to build out the various parts of the UI. For instance, we get a JSON file that has a list of users and attributes and build out UI elements with that data.

The question is should I build out the display and underlying logic as a 2D scene that I add in to our 3D room or just build it all in the 3D scene.

I want to abstract away as much of the logic as I can for the interactive screen; I want to make sure we can drop this screen in a different Scene down the road without too much reverse-engineering.

Sorry if this is a straightforward question, my background is software dev, not game design.

sentences:
Why does Avatar Mask not work as expected? I have 2 layers: The base layer, and an upper body layer.
On the upper body layer, I have an avatar mask because I only want to affect the upper body.
However, this mask doesn't work as expected.
Here is what it looks like:

This is what is looks like when the upper body layer has a weight of 0:

And this is with the upper body layer with a weight of 1 and with the Avatar Mask:

As one can see, the lower body is affected. The avatar mask doesn't seem to have an effect.
Is that a bug in Unity, or is there anything I could still check?
Thank you!

sentences:
Camera Rotation using angles I currently try to rotate a camera (using gluLookAt()) around a point  , i successfully do it for rotating around one global axis.

But when i want to use more than one axis , I'm stuck . I've searched around and it's seem i need to use something like axis-angle or quaternion (that i don't understand at all for now)

for rotating my camera i have 3 angles (using accelerometer and geomagnetic values).

How can i determine the point of view , using three angle and the radius ? knowing the the camera itself is at the point of origin (0,0,0).

I prefer using gluLookAt() than moving the whole scene if possible(event if i know that almost the same thing).

sentences: Who makes the art assets for mobile games? I know how to develop apps for Android but never tried developing games, and I want to start soon. For developing games we need sounds and high quality images (say a background, characters, logos, etc.), so how to create these? For this should we have a separate team? Or a developer can create these using any tools?

sentences:
Finding the position of a point inside a triangle, based on the position of a point in another triangle (barycentric coordinates in Godot) I'm trying to translate a UV coordinate into a world coordinate. (this is not in a shader, it's in GDScript in Godot, to bake out a texture based on some raycasts).
So I find out which triangle in the UV map the coordinate is in and then I find the corresponding triangle in the mesh and get it's world position, that's all good.
But then I can't figure out how to translate the points relative position inside the UV triangle to the mesh triangle.
I've been trying to use the distance from the point to each of the triangle points as weights to how much of each of the mesh points I should use to find the point I'm looking for, but having no luck.
Any help would be much appreciated.
Not sure how best to illustrate this. But imagine you had a triangle where you knew the corner points a, b, and c, and a position inside it p. And you had another triangle where you knew the corner points A, B and C, how would you find a point that was relative in the same as p is to abc in triangle ABC.

EDIT: I added an answer based on the comments from DMGregory

sentences:
Inventory structure for games like Dragon Warriors I'm wandering what would be a suitable way of storing items in inventory.
Many games have an inventory that stores different items with its quantity. For example, [ "Herbs" x5, "Torch" x2, ..].

so I came up with a data structure like this in Java;

HashMap> inventory // where Integer -> item id, ArrayList -> there are same items stored in the list

but I thought Is this a good way to store items even if the number of items in each list becomes larger (x99 items) ?

or should I just store the quantity of items instead of storing objects in list? in this case, is using tuple going to be ok? like HashMap>

sentences:
Cubemaps turn black OpenGL GLSL Java LWJGL Recently I tried to add cubemaps to my 3D-rendering engine. The objects with a cubemap now turn completely black.
This is how I load my cubemap:

public static int loadCubeMap(String filename)
{
    int id = GL11.glGenTextures();

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, id);

    for(int i = 0; i < CUBEMAP_NAMES.length; i++)
    {
        TextureData data = decodeTextureFile(CUBEMAPS_LOCATION + filename + "/" + CUBEMAP_NAMES[i]);
        GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    }
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    return id;
}

TextureData class only contains: int width, height and a ByteBuffer buffer

private static TextureData decodeTextureFile(String fileName)
{
    int width = 0;
    int height = 0;
    ByteBuffer buffer = null;
    try
    {
        FileInputStream in = new FileInputStream(TEXTURES_LOCATION + fileName + ".png");
        PNGDecoder decoder = new PNGDecoder(in);
        width = decoder.getWidth();
        height = decoder.getHeight();
        buffer = ByteBuffer.allocateDirect(4 * width * height);
        decoder.decode(buffer, width * 4, Format.RGBA);
        buffer.flip();
        in.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return new TextureData(width, height, buffer);
}

This is how I load the cubemap to the samplerCube cubemap[i] in the fragment shader:

public void loadCubeMap(int id, CubeMap cubemap, int cubemapid)
{
    if(cubemap != null)
    {
        super.loadTexture(location_cubemaps[cubemapid], cubemap.id, id, GL13.GL_TEXTURE_CUBE_MAP);
        super.loadFloat(location_cubemap_intensity[id], cubemap.intensity);
    }else
    {
        super.loadFloat(location_cubemap_intensity[id], 0.0f);
    }
}

in super class:

protected void loadTexture(int location, int texture, int i, int texturetype)
{
    loadInt(location, i+1);
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + i);
    GL11.glBindTexture(texturetype, texture);
}

And this is my fragment shader:

#version 400 core

  in vec4 color;
  in vec2 texCoord0;
  in vec3 surface_normal;
  in vec3 to_light_vector;
  in vec3 world_position_out;
  out vec4 out_Color;

  uniform sampler2D sampler0;

  uniform samplerCube cubemap[3];

  uniform vec3 lightColor;

  uniform float cubemap_intensity[3];

  uniform int hasTexture;

  void main(void)
   {
      vec3 unitNormal = normalize(surface_normal);
   vec3 unitLight  = normalize(to_light_vector);

   float nDot1 = dot(unitNormal, unitLight);
   float brightness = max(nDot1, 0.02);

   vec3 diffuse = color.xyz * brightness * lightColor * color.xyz;
   vec4 textureColor = texture(sampler0, texCoord0.xy);
   if(textureColor.a < 0.5)
       discard;
   vec4 shadedTextureColor = brightness * vec4(lightColor, 1) * textureColor;
    vec4 coloredShadedTexture = mix(vec4(diffuse, 1), shadedTextureColor, textureColor.a * hasTexture);

   vec4 reflectionColor = texture(cubemap[0], world_position_out);
   vec4 refractionColor;
   vec4 cubemapColor;

   out_Color = reflectionColor;
  }

sentences:
How to sync game tick in peer to peer game? I am making a 2-player iphone action game using a synchronization service (in this case Firebase). The service allows state syncing through the internet, but I have to execute all game logic on the phones.

I've read a bunch of game networking articles, and since I have no server, it seems like if I can get both phones to start the game at "exactly" the same time in realtime, I can adjust everything from there. (Planning on using a "tick" count on each phone, and sending the tick along with actions, then rewinding the simulation if necessary. The phones divide the game into halves to determine authority).

But how do you get remote clients to start a game tick at the same time?? It seems like this would be necessarily in lock step peer-to-peer, and something like it in FPS games.

The strategy I'm using now tries to have one client "guess" the other client's clock time, including ping time. If correct, they both start the game based on the guess (since for that message it was on).

a: sends a.localTime
b: receives message. Returns b.localTime, and dTime(a-b)
a: receives message. Returns a.localTime, and dTime(b-a)
b: receives message. If a.localTime + dTime(b-a) is very close to new b.localTime, send accept message.
b: starts game at: new b.localTime + 1 second
a: receives accept. Starts game at accepted a.localTime + dTime(b-a) + 1s

I made a little number counter thing to go with the tick, and they're just barely off. I can't see how this is possible though, since A "guessed" B's time, they should start at exactly the same time...

See anything wrong with my method? What's an easier way? I'm trying to avoid using a server if possible.

sentences:
Measuring GPU time from managed code To measure CPU code, I use a Stopwatch. Using a Stopwatch in the Draw method is meaningless for the GPU side of things since the CPU and the GPU run asynchronously.

The questions is simple: Is it possible to measure the total time spent on a chunk of HLSL code? Perhaps as granular as the technique/pass.

sentences:
How to perform a sliding collision between a square and a circle? 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.

sentences: Unity - Scripting Runtime Version Option Missing I have been trying to open and run my couple-months old project in Unity3D, and I'm getting about 500 errors. So idecided to reinstall Unity. On the tutorial for the project, it tells us to make sure the "Scripting Runtime Version" is set to 4.x equivalent. Only problem for me is I cannot see such an option in Unity5.5.4p4. How can I set .NET 4.x in Unity for good?

sentences:
Unity collision help So my problem is this:

I have a block, which is used as a "pointer block" to show where a block will be spawned. It will be green if it isn't colliding anyone, meaning you can spawn a block. It gets red when it's colliding with something.

The pointer block is a trigger.

OnTriggerEnter gets called when the collider touches another collider. I want to know when another collider is in my pointer block, not when something is just on the edge of the colldier.

https://www.youtube.com/watch?v=0yNqSJ3yAxA&feature=youtu.be

sentences:
D3D11 Can only Pixel Shader and Compute Shader stages write to buffers? I am reading Practical Rendering and Computation with Direct3D 11.
In the book the D3D11 pipeline is often described with this image:

In the Chapter about resources, Paragraph about buffers, I understood that the only stages that can write to buffers are the Pixel Shader and the Compute Shader, using Unordered Access Views.
Is it correct? If so, why? Is it because of the inherent architecture of GPUs?

Then, what would be the typical method to output data from a different stage?
For example, how could one get the result of a computation done in the vertex shader, without needing to pass through the other stages?

sentences:
Find shortest path (quickly) on the surface of a 3d model? Imagine this scenario:
we have a 3d model, for instance a doughnut, apple or an orange (possibly something more complex). There's an insect (let's say an ant) on the surface of that food item. Now that ant wishes to reach a certain specific coordinate embedded on the surface of the 3d object in the shortest time possible (using the shortest path, ignoring physics).

Now the ant AI could use Dijkstra on the original mesh but that might be low-res so the ant will zig-zag on the surface, outlining the shapes of blocky faces. You could split the faces but the angular nature of the edges, making up the structure of the mesh will continue to drive the ant to more in ziggy-zaggy like manner (imagine a rougelike with very small squares, you can still only move in 8 directions at any given point).

What we did is split the edges (of the model) to evenly-sized pieces and embedded "navigation vertices" between these pieces, we then connected the vertices of each edge with vertices of other edges sharing a face with it (4 other edges because faces are triangular). This works pretty well cause it means the any can travel freely between faces, ignoring their shape almost completely (unless they are very small and were not split).

We also have the ant "pulled" (dragged even) by an imaginary ant that is a few steps ahead to completely eliminate the more rigid areas in the path (think sharp corners). Sounds great right?

But this is not terribly fast. Any advice about that is appreciated.

sentences:
3D Side-Scrolling Shooter: to use or not to use Lua scripting? I'm programming a Side-Scroller, and I've reached the point where I need to program the enemy behaviour. I don't know what I should choose between hard-coding the enemy ships' behaviour or using a scripting language.

Going with the hardcoded way, all different kind of enemies would be different classes derived from an abstract EnemyShip class with a virtual function redefined for each of them. Going with the scripting instead I could do just a base class and a script manager which moves the ships as needed.

What should I do?

sentences:
Static constants set to default value in HLSL I'm using dx11 and I'm working on SSAO. I am having wierd results, so I tried debugging it using RenderDoc and stepping through the pixel shader log, all the values of the static array seems to default to 0-vector. For example, look at r3-register in the following screenshot.

Here's the pixel shader I'm using. The global static variable that seems to be all null despite my initialization is the gSSAOKernel. Why is this? Isn't this correct?

#ifndef SSAO_PIXEL_HLSL
#define SSAO_PIXEL_HLSL

#include "Constants.h"
#include "Common.hlsl"

static const float gKernelSize = 16.0;
static const float gRadius = 1.5;
static const float gSSAOPower = 2.0;
static const float3 gSSAOKernel[gKernelSize] =
{
    float3(-0.0780436, 0.0558389, 0.0281286),
    float3(0.034318, -0.0635879, 0.0741237),
    float3(0.00230821, 0.0807279, 0.0805477),
    float3(0.0124638, 0.117585, 0.0578601),
    float3(0.093943, -0.0944602, 0.0816459),
    float3(0.139348, -0.109816, 0.0618508),
    float3(-0.181872, -0.129649, 0.0380075),
    float3(0.240066, -0.0494057, 0.118559),
    float3(0.115965, -0.0374714, 0.301286),
    float3(-0.294819, -0.100726, 0.225789),
    float3(-0.149652, 0.37459, 0.202967),
    float3(0.261695, -0.292813, 0.349015),
    float3(-0.37944, -0.425145, 0.206921),
    float3(0.628994, -0.189387, 0.224343),
    float3(-0.331257, -0.646864, 0.307335),
    float3(-0.467004, 0.439687, 0.618459),
};

cbuffer SSAOCBuffer : register(CBUFFER_REGISTER_PIXEL)
{
    float4x4 gViewProjMatrix;
    float4x4 gProjMatrix;
    float2 gScreenSize;
};

Texture2D gPositionTexture : register(TEXTURE_REGISTER_POSITION);
Texture2D gNormalTexture : register(TEXTURE_REGISTER_NORMAL);
Texture2D gNoiseTexture : register(TEXTURE_REGISTER_DIFFUSE);
Texture2D gDepthTexture : register(TEXTURE_REGISTER_DEPTH);
SamplerState gPointSampler : register(SAMPLER_REGISTER_POINT);

float linearizeDepth(in float depth, in float4x4 projMatrix) {
    return projMatrix[3][2] / (depth - projMatrix[2][2]);
}

float4 ssao(in float3x3 kernelBasis, in float3 originPos)
{
    float occlusion = 0.0;
    for (int i = 0; i < gKernelSize; i++)
    {
        float3 samplePos = mul(kernelBasis, gSSAOKernel[i]);   <---------------------- this line
        samplePos *= gRadius * originPos;

        float4 offset = mul(gViewProjMatrix, float4(samplePos, 1.0));
        offset.xy /= offset.w;
        offset.xy = offset.xy * 0.5 + 0.5;

        float depth = gDepthTexture.Sample(gPointSampler, offset.xy).r;
        depth = linearizeDepth(depth, gProjMatrix);

        float rangeCheck = abs(originPos.z - depth) < gRadius ? 1.0 : 0.0;
        occlusion += (depth <= samplePos.z ? 1.0 : 0.0) * rangeCheck;

    }
    occlusion = 1.0 - (occlusion / float(gKernelSize));

    return pow(occlusion, gSSAOPower);
}

float4 ps_main(float4 position : SV_Position) : SV_Target0
{
    float2 coords = float2(1920.0, 1080.0) / float2(4.0, 4.0);
    coords *= float2(position.x / gScreenSize.x, position.y / gScreenSize.y);

    float3 originPos = gPositionTexture[uint2(position.xy)].xyz;
    float3 normal = gNormalTexture[uint2(position.xy)].xyz;

    float3 rvec = gNoiseTexture.Sample(gPointSampler, coords).xyz; //texture(uNoiseTex, noiseTexCoords).rgb * 2.0 - 1.0;
    float3 tangent = normalize(rvec - normal * dot(rvec, normal));
    float3 bitangent = cross(tangent, normal);
    float3x3 kernelBasis = CreateMatrixFromCols(tangent, bitangent, normal);

    return ssao(kernelBasis, originPos);// gFinalTexture.Sample(gPointSampler, coords);//float4(1.0, 0.0, 1.0, 1.0);
}

#endif

Also - offtopic, but this pixelshader murders my framerate, all the way from solid 450+ to 80-90. I guess with all the texture lookups the technique is simply expensive, but still, I must be doing something wrong in regard to performance.

sentences:
How to find the participation id corresponding to a sender id I am creating a real time multiplayer game in unity 3d using Google Play Game Services. In my function where I deal with the positioning of players based on information that is sent from other players, I get a sender id. The sender id is a long string of characters that does not match any participation ids. My participation ids are just strings such as "Player 1234." I keep the participation ids in an array so I can reference them and compare them to the sender of the information that I am receiving so I know which player it is from.

If the sender id and participation id are two different things, how do I make the connection between the two?

Here is a link to the tutorial I have been following for Google play services in unity:
https://www.raywenderlich.com/87042/creating-cross-platform-multi-player-game-unity-part-2

sentences:
Collision Response in Entity Components Systems This question seems to be a duplicate of mine, but I don't think it is.

I'm trying to build a game using an ECS, but I want this ECS to be as simple as possible, therefore I am eschewing messages.

My question is where should the the behaviours go for collision responses. Not physical responses, but logical response (e.g. bullet hurts player, player picks up health, explosion destroys enemies).

Is there a big HandleCollisionsSystem, or does each type of collision have it's own system or should the logic be in one or both of the colliding entity's components (but a component is just data, right?)

I'm sure there are several approaches, but for the moment I would like to err on the side of simplicity.

sentences:
In OpenGL, what does it mean to make a context current? I have a few questions :

1 - What does it mean to make a context current? Does it mean that all subsequent OpenGL calls will apply to that context/window?

2 - With GLFW3, how to use multiple windows (say, 2)? Is it enough to create 2 windows/contexts, make the context current on the first one, draw things, then make the context current on the second window, and draw things?

3 - How does it all fit together with an OpenGL loading library (like gl3w)? When I initialize gl3w once after creating the contexts, will the OpenGL calls work on the context that is current even if I change it alot or will I have to re-initialize gl3w each time I make another context current?

sentences:
High-resolution VR with tethered smartphone display I have an Android SmartPhone with a fairly high resolution + USB-C port, a USB-C-to-USB-A cable, and a Google Cardboard headset.

Is it possible to develop a VR app running on a PC game engine (such as Unreal) but stream the output to the Cardboard headset by using the phone as a display? (rather than running the app entirely on the phone). For instance, if I wanted to render using a beefy NVIDIA GPU and stream the graphics over USB.

What are the options here? I'm aware of this guide, which seems reasonable: https://uploadvr.com/budget-vr-101-get-pc-vr-streaming-phone/

Is this a use case supported by any Game Engines like Unreal/Unity?

sentences:
Taking Physics into account for AI Planning What I've seen in most Game Engines and game engine design is that the Physics Engine is the be all end all system.

Basically, AI for example may want to travel to some position, but it simply sends that request (velocity, direction) to the Physics Engine.  If the AI really gets to that position is up to the will of the Physics Engine.

Is there some Design or Physics Engine which will let you plan out how Physics will react? Before it will actually occur?

Take for example that you can do Motion Planning by the AI to nearly eliminate foot sliding.

images from aigamedev.com - Motion Planning for Fun and Profit!

sentences:
Unity: Create large Terrain with accurate raycast detection? I'm not using the Unity Terrain because it lacks certain features.

Amongst them, you cannot tile them:

You cannot create concave walls or make holes in it:

No custom textures, no detail textures, awful sculpting tools... the list goes on and on. So I imported my own Terrain as a Mesh. The collision works perfectly, however raycasting onto the Terrain is horribly inaccurate. Unity seems to compress the Mesh Collider depending on distance to player. See the video linked below. Since Unity is (by my knowledge) the only Game Engine that supports convex colliders, how do other game engines create Terrain colliders?

For a racing game or a RTS or RPG the colliders are no problem, but for a shooter it's unacceptable. Here's a video showing the problem:

https://youtu.be/coiFS6IT4wI

I've researched long and hard and there seems to be no known solution for this. So my question remains, if it's possible at all, how can i create large scale Terrains for Unity? This problem makes it completely impossible for me to create outdoor scenes. There HAS to be some kind of solution.

1) Raycasting script:

//Spread
        float spreadAmount = Mathf.Lerp(spreadMin, spreadMax, burstTimer / spreadThreshold); //Current Spread lerps between spreadMin and spreadMax by burstTimer (increases per shot)

        int i = 0;
        totalShotDamage = 0; //Buckshot sends 8 rays down the range. totalShotDamage gets total damage done by all rays. Needed for displaying damage text

        while (i < bulletCount) //Repeats Shooting Vector for bulletCount amount (needed for buckshot)
        {
            Vector3 shootDirection = shootOrigin.transform.forward; //Shoot Vector 100% accuracy

            shootDirection += shootOrigin.transform.right * (Random.Range(-spreadAmount, spreadAmount)); //Randomizes Vector horizontally, reduces accuracy
            shootDirection += shootOrigin.transform.up * (Random.Range(-spreadAmount, spreadAmount)); //Randomizes Vector Vectically, reduces accuracy

            Ray ray = new Ray(shootOrigin.transform.position, shootDirection); //Ray from Shoot vector
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo, 2000, shootLayerMask)) //Sets range of gun & sends ray
            {
                Vector3 hitPoint = hitInfo.point; //Point of impact with any object
                GameObject go = hitInfo.collider.gameObject; //GameObject of impacted Object

                string targetTag = hitInfo.collider.gameObject.tag; //Tag of GameObject of impacted Object

                addHitParticleEffects(targetTag, hitInfo, enableBulletholes); //Add hitparticle effects based on Tag (IMPACTmaterial)
                damageEnemy(targetTag, hitInfo, damage, damageRollOff); //Damage enemy
            }
            i++; //total bullet count (needed for buckshot)
        }

2) Terrain Inspector Settings

3) LOD Settings

There are no LOD Settings (yet). Individual Planes of the whole Terrain and objects on top of it simply pop in and out of existence depending on the Players position.

sentences:
Recursive Unity Coroutine I have a co-routine which is heavily reliant on calling itself to get the task done. I have tested it and the code works fine, the problem is that the co-routine will return every time that it enters itself recursively.

IEnumerator test(arg1, arg2)
{
    // I want to pause here
    yield return null;

    // I don't want to pause on any of these
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
}

In the example above I have a yield return at the top that is hit and pauses the co-routine, thats fine. Then there are the calls to itself below which also pause the co-routine. How do I avoid pausing the co-routine on the recurcive calls?

sentences:
How to manage sleep/awake state of physics body 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?

sentences:
XNA: Non-overlapping shadows I want to create an effect similar to the following in XNA / MonoGame:

There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the shadows merge without darkening their overlapping region!

My current approach was the following:

Render all required shadow objects using a DepthStencilState and a AlphaTestEffect.
Then, render a single-pixel semitransparent black texture over the entire screen using another DepthStencilState to display shadows.

However, it didn't work as expected: the shadow objects get rendered to the target, and the stencil buffer seems unaffected.

Here's what I want:

A way to render a sprite to Stencil Buffer only, with absolutely no visible modifications to the target.
A way to render a semitransparent texture using the stencil buffer.

Stencil states and effects are initialized as follows:

StencilCreator = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1
};

StencilRenderer = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    ReferenceStencil = 1,
    StencilPass = StencilOperation.Keep
};

var projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
var halfPixel = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

AlphaEffect = new AlphaTestEffect(GraphicsDevice)
{
    DiffuseColor = Color.White.ToVector3(),
    AlphaFunction = CompareFunction.Greater,
    ReferenceAlpha = 0,
    World = Matrix.Identity,
    View = Matrix.Identity,
    Projection = halfPixel * projection
};

MaskingTexture = new Texture2D(GameEngine.GraphicsDevice, 1, 1);
MaskingTexture.SetData(new[] { new Color(0f, 0f, 0f, 0.3f) });

What am I doing wrong?

sentences:
Handling different aspect ratios on a 2D dodging game I've been making a game where the player is on the ground and has to dodge objects falling to the ground. Since I'm using libGDX (But the question still applies to any other language/framework), The game will have to handle both desktop and mobile apps.

I'm trying to make the game fit vertically into any aspect ratio while making it fair, but this is my first time trying to deal with this, and I'm looking for a good way to do this. My game has 3 main regions: The game, the data (Health/coins), and the GUI (Pause button). Here are my ideas so far:

Horizontal: Game in the center with everything else on the sides

Vertical: Game on the bottom with data on top

Everything else: No room for GUI on sides/bottom, GUI on top of game

I've seen other questions similar to this, but none of them cover a game similar to this type.

sentences:
Why do some networked games use interpolation and some use pathfinding for remote movement? This is a bit of an open question but I'd like to see someone contribute a good reasoning for both.

For a quick example of both:

Interpolation Model

Think the Valve model where the client is receiving position updates frequently and the remotes  update their positions using interpolation on this data.

Path-finding

In this model, think the user sends a destination and everyone pathfinds to it.

What types of games are suited to each and when should one use each?

sentences:
What rendering techniques would I use to draw a drop shadow effect for cards in a card game? What type of shading algorithm might be used to create shadows like these?

the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate.

In addition, for the hand itself, I'd really like to get a shaded feel like seen here:

I'm just not sure how to achieve a shaded look close to that.

The number of cards is bound to change and the cards get thrown onto the table so I can't use any type of light map of sorts.

What sorts of algorithms should I look into (aside from blur which I know 'll need to do?)

Thanks

Update

I'm making a 2D card game. I want to add dropshadows offset from the cards, a bit like:

The way I'm thinking of doing it is:

Keep a texture that is the same size as the backbuffer.
Draw dark rectangles as makeshift cards to that texture.
Blur that texture.
Draw my cards to that texture.
Do additional lighting on the cards.
Draw this texture to the backbuffer.

My questions are:

Is this the right way to do this?
Is there a way to do it without render to texture (keeping a bitmap
as big as the backbuffer)?
Is it safe to assume that the maximum texture size will not be
exceeded by the backbuffer size? (What I mean is, if the backbuffer
is 2000x3000, then is it safe to say that I can create a texture in
video memory of that size?

Thanks

sentences:
How to Handle Lighting from a 3D Game Engine with a Roguelike Game using Shadowcasting Normally the shadowcasting will, from the player position, set a brightness amount to each relevant tile. Yet I'm making a roguelike with a 3D map, and Unity has lighting.

Currently I have the player piece with a point light, and game objects that haven't been seen yet are set to inactive. but it doesn't have the same effect.

Has anyone resolved this situation?  Any suggestions?

Addendum:
Screen shots:

I somewhat like the effect as it is in the screenshots; I'd like to be able to control the amount of light in each 'tile' if possible.

sentences:
Java how to color text without using JNI? I am working on a small text-based game in Java.  I am trying to understand the concept of how to color the output without needing to use JNI. C++ has the ability to modify the console directly and also make system calls but as far as I can tell JAVA doesn't because of its ability to be system independent.

Is this possible or should I look at using a JFrame and the paint object?

sentences: What is the specific name of this UI component? Is there a specific name for this kind of ui component? Sometimes it only renders a symbol (without text) so using name like TextComponent is imo not very fitting.

sentences:
How do I get information about the level to the player object? I have a design problem with my Player and Level class in my game.

So below is a picture of the game. The problem is I don't want to move on the black space and only the white space. I know how to do this as all I need to do is get the check for the sf::Color::Black and I have methods to do this in the Level class. The problem is this piece of code

   void Game::input()
{
    player.input();
}

void Game::update()
{
    (*level).update();
    player.update();
}

void Game::render()
{
    (*level).render();
    player.render();
}

So as you there is a problem in that how do I get the map information from the Level class to the Player class.

Now I was thinking if I made the Player position static and pass it into the Level as parameter in update I could do it. The problem is interaction. I don't know what to do. I could maybe make player go into the Level class. However, what if I want multiple levels?

So I have big design problems that I'm trying to solve.

sentences:
Knowledge of a Language vs. Games in Portfolio How important is the knowledge of a language versus the games that you have developed in your portfolio?

To be more specific. Personally, I dislike C++ for several reason(mainly due to it's complexity, and pointers, and I prefer D as my language of choice thus far. Due to this, I've written two games in D instead of C++ that are my personal projects. Am I wasting my time with D? Should I start using C++ again?

For reference, I have 6 months of experience in C++. It's the first language I learned. I have messed around with SDL/SFML and a bit of Direct3D with C++ as well.

Even though I like D, i'd rather not waste my time learning it, if it in no way will help me get a job in the gaming industry.

sentences:
Why does my SFML game cause screen tearing on Linux? I wrote a little game of a bouncing ball, using SFML and Box2D.

On Windows, the graphics animate smoothly. However, on my Linux machine, the animation stutters randomly. To be precise, I get a horizontal video tearing effect.

I use the Intel graphics driver. I tried multiple solutions I found online to solve video tearing but I haven't been able to solve this. I've never had video tearing before (even in other OpenGL apps): It appears now for the first time.

sentences:
What is the recommended way to store game entity data? The following is specific to my problem, but I believe the principles can be applied to any game.

I am currently working on a 3D game which will have many different types of spaceships.
The physics and behavior of the spaceships are controlled by a base 'Ship' class. This base class in turn derives from a 'Drawable Object' class which handles the transformations and drawing of the ship.

I want the spaceships to have a set of stats such as

Max speed
Cargo capacity
Weapon power
etc

that can be passed into the physics and behavior functions.

However, during gameplay new spaceships will be able to be bought/upgraded, but i want to be able to pre-define a (possibly large) list of setups that will be available to the player.

What is the best way to store the available stat setups?

Should I be using a large JSON/XML file or similar to store the stats which is loaded at runtime?
Or might I just as well hard-code the stats into the constructors of a set of derived classes?

The actual physics attributes (location, velocity etc) and its stats of a particular spaceship are being saved to file when the game is actually played.

I have researched about entity-component-system architecture, but I haven't found much about how to define these entity stats.

Any advice on improving my entity architecture would be much appreciated - this is one of my first attempts at hobby game development.

sentences:
How can I create a screen-space distortion effect? I am trying to create a screen-space distortion effect using shaders. This image demonstrating the effect I'm after is from Nvidia:

Let's consider that I have access to the background texture. How can I create this kind of effect? What should I do in the vertex and fragment function?

It seems that I need to retrieve screen-space normals of my object, but how?

sentences:
How to fix Corner Collision with SAT algorithm? I am making a platformer game, my way of handling collision works most of the times, but when I jump on a platform's corner I get pushed away, it probably happens because my function returns right or left respectively and not bottom collision. Is there anyway to modify this function to work, or is there another algorithm that works better?

public static string RectangleCollision(Rectangle r1, Rectangle r2) {
    string result;

    float w = 0.5f * (r1.Width + r2.Width);
    float h = 0.5f * (r1.Height + r2.Height);
    float dx = r1.Center.X - r2.Center.X;
    float dy = r1.Center.Y - r2.Center.Y;

    if (Math.Abs(dx) <= w && Math.Abs(dy) <= h) {

        // Collision
        float wy = w * dy;
        float hx = h * dx;

        if (wy > hx) {
            if (wy > -hx) {
                // Collision on top
                result = "top";
            } else {
                // On left
                result = "left";
            }
        } else {
            if (wy > -hx) {
                // on right
                result = "right";
            } else {
                // on bottom
                result = "bottom";
            }
        }

     } else {
         result = "false";
     }

     return result;
}
```

sentences:
Screen coordinates to a multilevel isometric world I have an isometric world that has stuff on multiple levels, i.e. it has an XYZ coordinate system, and tiles can be stacked on each other, accumulating screen Y offset as they go. I currently have an algorithm in place that converts the screen coordinates to world XY coordinates, but it doesnt take into account that there might be e.g. a hill under the mouse and selects the tile behind it instead.

Is there a generalized form algorithm for this? I need a generalized form because all the variables are unknown (I'm writing a game engine):

Tile width (as in the width of a single tile rectangle)
Tile height (as in the height of a single tile rectangle)
Tile depth (as in how much Y offset each level contributes)

I suppose one option is run down the map with something like this (pseudo code):

p = screenToMap(screenPos)
bestMatch = null

for (x=p.x, y=p.y, z=0; x<mapWidth && y<mapHeight; x++, y++, z++) {
  b = highestPlacedBlockInPos(x, y)

  if (b.z === z) bestMatch = [x, y, z]
}

But I'm wondering if there's a better way? This seems pretty ineffective especially if you have a big map.

sentences:
XNA games C# application executable work on one win7 not the other one Our company wrote a game in XNA studio 4 almost ten years ago. we try to reinstall it in win7 with only the executable. Both installed XNA Game Studio 4.0. Below is the environments parameter I can find. The one on the laptop is not rendering the effect(I am new to this, this is my guess).

Laptop
Desktop

OS
win7 Service Pack1
win7 Service Pack1

DirectX version
11
11

Graphic Card
AMD firepro M4000 Mobility Prographics
integrated GPU Intel HD graphics 4600

Chip Type
AMD FirePro(0x682D)
Intel(R) HD graphics family

We don't know what make these two executable behave differently. Part of the window image just not shown. Second check on the source code, the different between the image that can be show and can not be shown on the failed Laptop is working one is using Bitmap and the not working on is using Texture2D with  Microsoft.Xna.Framework.Graphics Effect with passes. Any ideas. Thanks.

sentences:
How can I get Unity to tell me the battery status of my OS X laptop? How do I get battery status on an OS X laptop in Unity?

This is un-Googlable: I keep finding either mobile stuff (iOS or Android) or people complaining about laptop battery life.

sentences:
How to generate "Password" to transfer data? Old Handheld games like The Legend of Zelda: Oracle of Ages/Seasons, Golden Sun and Golden Sun : The Lost Age have the possibility to share data between games in the form of passwords.
I was wondering how such a password is constructed and checked.

sentences:
Render Queue Sorting, HOW? Recently I'm trying to implement a render queue sorting system, i.e., ordering my renderable objects in an array in such a way that the overhead of OpenGL state changes are minumum. After some googling, the most ideal one (to me) is to generate an integer key value for each renderable object, and the sorting is based on that value. Once done sorting, objects that have similar rendering states (same shader, texture, distance, etc.) will be close to each other, so we can just loop through the object array and submit the draw calls for rendering.

Here's a detailed explanation: Order your graphics draw calls around!

My problem is, how do I loop through the renderable object's array to submit their draw calls for actual rendering? Do I need to keep track of the current OpenGL states manually?

What have come to my mind is:

(for each renderable object)
{
    if(objects[i].getShader() != m_currentShader)
    {
        m_currentShader = objects[i].getShader();
        m_currentShader.bind();
    }

    if(objects[i].getTexture() != m_currentTexture)
    {
        m_currentTexture = objects[i].getTexture();
        m_currentTexture.bind();
    }

    // ... and so on

    object[i].getMesh().draw();
}

Seems not so performance-friendly to me, but I can't find any further explanation on how to submit the actual draw calls form the object's array either on the article I've provided or other sites I can find. Perhaps there's something I have missed?

sentences:
Box2d C++ x velocity slowing for no apparent reason I'm making a 2d platformer in C++, using Box2d for physics and sfml for rendering, I want the player character to move with a constant velocity in the x direction, and to jump when the spacebar is pressed, maintaining it's x velocity. At the moment however, jumping slows the x velocity to a crawl, and falling large distances does the same

b2Vec2 jumpForce(120.0f , -500.0f);
playerBody->ApplyLinearImpulse( jumpForce, playerBody->GetWorldCenter(), true);

is how the impulse is applied when I want to jump, and

b2Vec2 moveSpeed(120,0);
playerBody->SetLinearVelocity(moveSpeed);

is the velocity the body is initialized with, I've turned both linear damping and friction to 0, but with no success.

If anyone has any idea how to solve this issue your help would be greatly appreciated.

edit: These are a couple of solutions I've tried

b2Vec2 jumpForce(playerBody->getLinearVelocity().x, -500.0f);
playerBody->ApplyLinearImpulse( jumpForce, playerBody->GetWorldCenter(), true);

b2Vec2 jumpForce(playerBody->getLinearVelocity().x, -500.0f);
playerBody->SetLinearVelocity( jumpForce, playerBody->GetWorldCenter(), true);

sentences:
Video play in unity3d skybox I want to play 360 video in skybox. Is there any direct way avaiable to do this task. One long, boring, inefficient  procedure which seems that

Convert 360 to frames
Convert frames into cubmap
Use that cubeMap in skybox and Programatically change it's textures(Frame) quickly so that video effects shown

This is the long task which seems to me possible but is there any other way available?

sentences:
Isometric coords to cartesian coords I'm new to the tilemap feature of Unity, and I'm having a hard time with all those coords.

I created a new project, added an isometric tilemap and left all values to their default. In the Unity Editor (and in-game at runtime as well), the coordinates of the cells are like this:

This is pretty disturbing to me and it will be to most players (not programmers) too I guess.

I would like something like this:

However, I can't figure out how to do the transformation.

I tried this:

Vector3 currentWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int currentCellPos = _grid.WorldToCell(currentWorldPos); // This gives the coordinates as in the Unity Editor except for z
currentCellPos.z = 0; // Set z to 0 so the coordinates of the cell are exactly as in the Unity Editor
Vector3 cartesianCellPos = new Vector3((2 * currentCellPos.y + currentCellPos.x) / 2, (2 * currentCellPos.y - currentCellPos.x) / 2, 0); // Try to transform the Unity coordinates into cartesian coordinates: WRONG RESULT

But this calculation gives weird results, not what I expect at all.

Do you know how I could transform the Unity coordinates shown in the first screenshot into the coordinates shown in the second screenshot?

sentences:
App Programming Question: Converting Code and Project Folders for the Smartphone's OS Compatibility I was thinking about how does the Angry Bird game for the iOS successfully converted into an Android compatible version. Does it involve using Phonegap or something?

When making games for iOS, the programmer preferred XCode. For Android game app, the programmer preferred Eclipse IDE and a LibGDX engine library. Because of this, like Angry Birds for example, this game became compatible for the iOS, Android, and even on the desktop computer.

The question is...how does it work?

sentences: How would I find the SDK folder for Android Studio so I can build my Unity project? So I've been trying to build my unity project for android, but my problem is that I don't know how to find the Android SDK. I have the old developer bundle installed, when it was still the one with eclipse, but this version is not supported by Unity. So, I installed the latest version of Android Studio, the new official Android IDE, but the SDK folder is not in the same place as the rest of the program. How would I find the SDK folder for Android Studio so I can build my Unity project?

sentences:
BasicEffect and SkinnedEffect treating WorldViewProj differently? I made a ModelBatch class that batches and draw rigged/unanimated and skinned/animated models. For now, BasicEffect is assigned to rigged models (XNA Model Processor) and SkinnedEffect is assigned to skinned models (Based on Microsoft's Skinned Model Sample). The problem occurs when setting the shaders parameters. In the RenderBatch() method, I wrote:

...
foreach (Effect effect in mesh.Effects)
{
    if (effect is BasicEffect) // if it's a rigged model.
    {
        effect.Parameters["WorldViewProj"].SetValue(modelInfo.world * viewProjection);
    }

    else // it's a skinned model.
    {
        effect.Parameters["WorldViewProj"].SetValue(viewProjection);
        effect.Parameters["Bones"].SetValue(modelInfo.boneTransforms);
    }
}
...

When running the game, the rigged model's position is locked to the camera position for the first few frames. Afterwards, everything works perfectly (the rigged model position's is correct). The skinned model doesn't have that position displacement problem at runtime even if I only set the "WorldViewProj" parameter (so it's not because of the "Bones" parameter).

In order to work perfectly, I had to changed the rigged model part to:

    if (effect is BasicEffect) // if it's a rigged model.
    {
        BasicEffect basicEffect = effect as BasicEffect;

        basicEffect.World = modelInfo.world;
        basicEffect.View = this.camera.View;
        basicEffect.Projection = this.camera.Projection;
    }

This way, the rigged model is instantly placed at the right place, but I don't like it. Also, what is really stange is that if I do not set any view or projection for the rigged model, like this:

    if (effect is BasicEffect) // if it's a rigged model.
    {
        // do nothing.
    }

I will still see the rigged model locked to the camera's position. Anyone knows why setting "WorldViewProj" parameter of a SkinnedEffect works perfectly, but not for a BasicEffect?

I hope there's enough informations and thank you for answering!

* EDIT  ANSWERED **

I found the source of the problem. The scale and rotation of the rigged model were changed in the content processor options, so the model was modified at runtime. I changed those options back to their default values and set the rotation and scale in the code instead (Matrix.CreateScale and Matrix.CreateRotationX) and the model was at the right place. Hence, I think that changing the model world information at runtime created the displacement lag.

sentences:
Make a triangular mesh from of a map defined by points that follow the coast lines I have a set of points which follow the coast lines of a world map.  I would like to triangulate it so that I can render the continents filled in.  The points seem to be in order so that if you render as lines, the only issue is when a land mass starts and ends you get lines you shouldn't have between them.

Does anyone know of a good way to go about making a triangular mesh out of this data?

sentences:
How can I improve on this engine design? I am trying to come up with a terrain visualization system and I am writing a simple graphics engine for this. For some reason, I wanted to try a new idea. Rather than using dynamic polymorphism and derive from a GameObject like class for all the entities in the screen, I go for something like this.

First, I want to have a very simple scene graph, very non-sophisticated. For this, I am using a heterogeneous vector like given here. My scene graph will be just a heterogeneous vector of possible renderable items. I will iterate through each item using visitors.

For example my Terrain class looks like following

template <typename RenderAPI>
class HeightmapTerrain
{
public:
    // constructor like things
    void render();
    void input();
    // imagine the rest
private:
    Heaightmap hm;
    Transformation tm;
    TerrainInputHandler tih;
};

Then I will have a specialization of this for OpenGL as follows

template <> class HeightmapTerrain<OpenGLAPI> {
public:
    // as an example
    void render()
    {
        BasicTerrainGLSLShader ts;
        ts.bind();
        hm.generateVBO();
        // etc.
    }
private:
};

typedef Terrain<OpenGLAPI> HeightmapOpenGLTerrain;

Assume all of these are in a file called Terrain.h. I am planing to include that file and I will add an instance of HeightmapOpenGLTerrain to my scene graph. This way, I can call render_visitor() in the render function of my scene graph and since it is a heterogeneous vector all will work, I hope.

The reason I am doing this is because if I want to extend the system with new graphics APIs, I will just create a new specialization and implement render etc. methods as

template <> class HeightmapTerrain<VulkanAPI> {
public:
    // as an example
    void render()
    {
        // Vulkan implementation
    }
private:
};
typedef Terrain<VulkanAPI> HeightmapVulkanTerrain;

With this, I can use same scene graph to render and input handle etc. but now using Vulkan. It feels like I can easily change the Input mechanism as well, with this system.

Now, what I am asking is this; I am not really that great at template programming. Is this approach feasible? What are the performance and design disadvantages compared to dynamic polymorphism approach we all know and love? Is this design downright obtuse? Lastly, can I have different private members for different specializations? Let's say I wanted to also have HeightmapTerrain<OfflineRendering> to render using path tracing. Can I add an extra private member to this specialization, like Canvas cs?

sentences:
How do I get the height of an XNA SpriteFont? I have some text in a spritefont and I need to know the height in pixels.

I would have thought that MeasureString() would get me close to it, but it seems to just be about length.

sentences:
Performance and HotSpots Usually, when discussing on performance in games, cache misses and localities come like the real problem. But i feel like videogames are too focus optimization in that way.

For example, the author of this blog entry talks on how essential is a good datastructure to achieve high performance. But out of a situation where you have many entities that will stay on movement almost always, i cannot come with an example where these optimizations can help:

Handling the player inventory is a inherently a complex task. You are not going to iterate every inventory to check whether or not an entity wants to retrieve/add an item from/to its inventory.
Combat is usually intensive and fast, but from the perspective of the cpu, not frequent. Not every entity will be slashing and definitely not every frame.
AI is another good example where you hardly can optimize using big arrays of data. In starcraft linked list were used:

  Linked lists were used extensively in the engine to track units with shared behavior. With twice the number of units of its predecessor — StarCraft had a maximum of 1600, up from 800 in Warcraft 2 — it became essential to optimize the search for units of specific types by keeping them linked together in lists.

So, my question is: Is the cache friendly approach to optimize games wrong or misused?

sentences:
Does interleaving in VBOs speed up performance when using VAOs You usually get a speed up when you use interleaved VBOs instead of using multiple VBOs. Is this also valid when using VAOs?

Because it's much more convenient to have a VBO for the positions, and one for the normals etc. And you can use one VBO in multiple VAOs.

sentences:
Is making an acceptable 3D engine possible using only SDL_* functions? I've been watching Javidx9's 3D engine series and I decided to start making it with SDL because it was something I had heard of and seemed simple enough. I'm not going to implement too complex graphical features anyway. So I start writing code, and I'm drawing my triangles with SDL_DrawLine(), and I'm filling my triangles with SDL_DrawLine, and I go to load up the Utah Teapot and the frames are stuttering quite a bit. I'm pretty sure I already know the answer to this question but I want to be sure: Is it unrealistic to try to create a 3D engine without using raw OpenGL funcions? It would make sense that the frames are so bad because SDL would have to work through something like OpenGL so I'm just calling an abstracted DrawLine function that's just making the computer do extra stuff and slowing it down.

By the way, I do know that SDL has OpenGL, but I (naively?) figured it would just be easier to go without it.

sentences:
Cocos2d/Cocos2d-x Attaching an arrow (sprite) to another body sprite (person) I am trying to set up a simple bow and arrow game. When the arrow hits the enemy body, the arrow's body is deleted and the arrow sprite continues to update, keeping the position correct in relation to the enemy it hit. Picture an arrow sticking into a body and that body still rotating and moving. My problem is that the rotation is completely wrong when the enemy rotates. I know how to do this in 3d with matrix transformation but I can't seem to figure it out in 2d with Cocos.

Here is my method.

I save offset at which the arrow hit the enemy.
Every frame, I make the rotation of the sprite match the rotation of the enemy.
Then, I apply the offset I took initially which is where the arrow hit the enemy.

When they rotate, they rotate about their respective anchors and I am wondering if I need to set the anchor of the arrow to the center of the sprite. Does anyone know of an easy way to do this. If not, I will try to create an algorithm where the anchor is set to the offset divided by the width and height of the sprite image hopefully giving me the correct anchor values.

Then I assume I need to reposition the sprite.

Does anyone have a simpler way to do this?

sentences:
Most efficient way of drawing a lot of cubes OpenGL ES I have to draw a lot of cubes in my OpenGL programme for android. All the cubes have the same size but different colors. I know that calling glDrawArrays is expensive operation so I should call it less as possible. But as I know I have to call it 6 times (one per each side) and since I have more than 500 cubes it's not efficient at all. Does anyone have the idea what to do?

Btw, I am using OpenGL ES 1.0.

I saw that I can use one big VBO but I don't know how to do that.

sentences:
Projective texturing in DirectX11 I'm trying to implement reflections on flat surfaces and render a simple scene with a reflection. So I'm rendering the scene from the point of view of a camera symmetrical to the reflection plane and then I pass the resulting rendered scene as a shader resource to the shader that renders the quad and I use projectiv texturing by sampling the texture using the quad screen space coordinates mapped to 0 - 1:

Texture2D quadTexture;
SamplerState textureSampler;

struct PS_Input
{
    float4 pos : SV_Position;
    float2 texCoords : TEX_COORDS;
    float4 clipPos : CLIP_POS;
};

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (-input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

I assume that since the y and the v axis are inverted with respect to each other that I need to negate the second texture coordinate (and all the code I saw on the net do so).  But my code only works if I DON'T negate the second coordinate. If I negate the second coordinate the reflection is upside down:

The way I compute the reflected camera is I calculate the symmetric direction vector and use it in XMMatrixLookAtLH(). So when I calculate a new direction vector with a horizontal plane I should get a symmetric direction vector and the same right vector so my image is non mirrored on the horizontal axis. All works well when I don't invert the sign which is strange.

EDIT

I was not considering the fact that when rendering reflection on an horizontal plane, I have to take into account that the image being rendered is upside down with respect to the image I need to render on the surface. Not inverting the second projective texture coordinate has the effect of inverting the image (DirectX's v axis goes downwards, while projective texture coordinate y goes upwards). So when rendering a reflection on an horizontal surface I need not negate the coordinate. I need to negate both when rendering on a vertical surface (I always compute the symmetric camera direction vector and use the same world Up vector to compute the "reflected" view matrix):

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    if (normal.y == 0)
    {
        projectiveCoords.x = -projectiveCoords.x;
        projectiveCoords.y = -projectiveCoords.y;
    }
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

Now I have a new question:
everything is fine if I want to render a reflection on an horizontal plane or a vertical one. How can I render a reflection on an (arbitrarily) incined surface? using the same calculations doesn't work anymore.

sentences:
Pixel-perfect rendering to a rendertarget with a fullscreen quad I have some trouble rendering a bunch of values to a rendertarget. The values never end up in the exact range I want them to. Basically I use a fullscreen quad and a pixel shader to render to my rendertarget texture and then intend to use the texture coordinates as basis for some calculations in the shader. The texture coordinates of the quad range from (0,0) in the top left to (1,1) in the bottom right corner... the problem is, after interpolation, these values don't arrive at the pixel shader as such.

An example:
I render to a 4x4 texture and the shader in this case simply outputs the texture coordinates (u,v) in the red and green channels:

return float4(texCoord.rg, 0, 1);

What I want to get out of it is a texture where the pixel in the top left is RGB (0,0,0) and thus black, the pixel in the top right is RGB (255,0,0) and thus a bright red and the pixel in the bottom left is RGB (0,255,0) - a bright green.

However, instead I get this here on the right:

(straight quad rendering, no correction)

The top left pixel is black, but I only get a relatively dark red and dark green in the other corners. Their RGB values are (191,0,0) and (0,191,0). I strongly suspect it has to do with the sampling locations of the quad: the top left pixel correctly samples the top left corner of the quad and gets (0,0) as UV coordinates, but the the other corner pixels don't sample from the other corners of the quad. I have illustrated this in the left image with the blue box representing the quad and the white dots the upper sampling coordinates.

Now I know about the half pixel offset you should apply to your coordinates when rendering screen-aligned quads in Direct3D9. Let's see what kind of result I get from this:

(quad rendered with DX9's half pixel offset)

Red and green have gotten brighter but still aren't correct: 223 is the maximum I get on the red or green color channel. But now, I don't even have pure black anymore, but instead a dark, yellowish gray with RGB(32,32,0)!

What I actually need would be this kind of rendering:

(target render, reduced quad size)

It looks like I have to move the right and the bottom border of my quad exactly one pixel up and to the left, compared to the first figure. Then the right column and the bottom row of pixels all should correctly get the UV coordinates right from the border of the quad:

VertexPositionTexture[] quad = new VertexPositionTexture[]
{
    new VertexPositionTexture(new Vector3(-1.0f,  1.0f, 1f), new Vector2(0,0)),
    new VertexPositionTexture(new Vector3(1.0f - pixelSize.X,  1.0f, 1f), new Vector2(1,0)),
    new VertexPositionTexture(new Vector3(-1.0f, -1.0f + pixelSize.Y, 1f), new Vector2(0,1)),
    new VertexPositionTexture(new Vector3(1.0f - pixelSize.X, -1.0f + pixelSize.Y, 1f), new Vector2(1,1)),
};

However this didn't quite work out and caused the bottom and right pixels to not render at all. I suppose these pixels' centers aren't covered by the quad anymore and thus won't get processed by the shader. If I change the pixelSize calculation by some tiny amount to make the quad a tiny amount bigger it kinda works... at least on a 4x4 texture. It doesn't work on smaller textures and I fear it subtly distorts the even distribution of uv values on bigger textures as well:

Vector2 pixelSize = new Vector2((2f / textureWidth) - 0.001f, (2f / textureHeight) - 0.001f);

(I modified the pixelSize calculation by 0.001f - for smaller textures, e.g. 1D lookup tables, this doesn't work and I have to increase it to 0.01f or something bigger)

Of course this is a trivial example and I could do this calculation much more easily on the CPU without having to worry about mapping UVs to pixel centers... still, there has to be a way to actually render a full, complete [0,1] range to pixels on a rendertarget!?

sentences:
How to Calculate Velocity in a 2D space game I am currently using

screenpos.X = (float)(screenpos.X + velocity * Math.Sin(r));
screenpos.Y = (float)(screenpos.Y - velocity * Math.Cos(r));

For my Movement with r being the Rotation in Radians. However, I want to know how I can calculate my velocity realistically based on values of Thrust and Mass.

Any Idea's?

sentences:
Implementing a resource bar with LibGdx I am developing my first LibGdx game, and I would like some help understanding Scene2D/Ui.

So far I understand a "Stage" contains the various UI elements, and a "Table" contains the layout; an input processor can be assigned to buttons and stuff to define what they will do.

What I don't really understand clearly so far is how to utilise tables and skins, and if I'm doing this correctly.

So far I have a MainGameScreen class which extends Screen, and renders a Tiled map.

I want to render the UI on top of it, I have defined a Stage, a Table and a Skin, as well as a button; here are my relevant code snippets.

//declaration of stage, table, skin
public class MainGameScreen implements Screen, InputProcessor{
    ...
    private Stage stage;
    private Table table;
    private Skin skin;
}

//class constructor
public MainGameScreen(final MyGame game){
   ...
   stage = new Stage(new ScreenViewport());
   table = new Table();
   skin = new Skin(Gdx.files.internal("uiskin.json"));
   table.setFillParent(true);
   stage.addActor(table);
   button = new TextButton("TEST BUTTON", skin, "default");
   button.setWidth(200);
   button.setHeight(50);
   stage.addActor(button);

//Screen render function
public void render(float delta) {
    ...
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}

It works, the Tiled map gets rendered, a button appears on the bottom left.

Now, please take a look at this Warcraft 2 screenshot: http://en.war2.ru/wp-content/uploads/2015/03/screenshot-14.png

I'd like to implement a top bar similiar to that, meaning "Menu" "Pause" buttons as well as rendering an icon + value for each resource (variable) at the top of the screen.

I understand that I'd have to use the Image widget for the icons, Label for text and Button for Menu and Pause, but I don't get how to lay them out properly using a Table and ensuring scaling.

I'd be grateful if someone could provide a simple implementation, or point me on the right direction.

sentences:
How much logic should be in an individual behaviour tree node? Let's say I have a condition node which has to spend a lot of time calculating something to finally return a bool to the behavior tree.
But in the following action, we need this information again.
I now have a few options:

I could just calculate the information again. That could unnecessarily take a lot of time and may result in redundant code.
I could save the information into some kind of state data dictionary but now the action depends on calling the condition first.
I could make it a single action that would just fail if the resulting calculation would end up being False. I would possibly end up with a bunch of very similar, very complex actions. Again possibly a lot of unnecessary redundancy.

How do I tackle something like that?
Is there a pattern that I could apply to the action/condition design (or whatever) or inside the behavior tree implementation that solves this?
Or am I using behavior trees wrong entirely?

sentences:
Character Action Sprite Framelength of Late-90's Something, Industry Standards of that Era? I'm making a 3d character that emulates a sprite. The game as a whole emulates the feel of a classic RPG game.

Old games like Ultima Online, or Diablo...or similar late-90's generation...

For an average run sequence, they must have had general targets for "smoothness". I'm curious if there was an old industry standard of that time for "sprite frames for this action" in game design.

Example. A walk sequence in Diablo. How many frames would they have targeted in those years?

I'm looking for a general guideline to emulate "that cool 90's RPG". I'd love some advice.

If there was no such standard, and designers of old were as hacky as they tended to be, I'll also take a good educated opinion on the matter.

sentences:
MeshBuilder, assembly missing I'm trying to build a terrain starting from a heightmap. I've already some ideas about the procedure, but I can't even get started. I feel like I have to use a MeshBuider. The problem is that Visual Studio (I'm using the 2008 version) wants an assembly. Effectively on the MSDN there's a line specifying the assembly needed by the MeshBuilder, but I don't know how to import/load it.
Any suggestions?

Thanks in advance :)

sentences:
Shader authoring/editing tools for GLSL ES Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material editing aimed at developers and artists alike, but concentrated (or with substantial support for) on embedded GLSL shaders?

Render Monkey itself wasn't that flexible (I'm not aware if it allowed the usage of several textures, each with its own set of texture coordinates - plus, it didn't seem to be that intuitive either).  Apart from complete engines, is there such a stand-alone tool that can be used together with a stand-alone engine (able to interface with a custom application)?

sentences:
UV texture mapping with perspective correct interpolation I am working on a software rasterizer for educational purposes and I am having issues with the texturing.

The problem is, only one face of the cube gets correctly textured. The rest are stretched edges:

You can see the running program online here.

I have used cartesian coordinates, and all I do is interpolate the uv values along the scanlines.
The general formula I use for interpolating the uv coordinates is pretty much the one I use for the z-buffering interpolation and looks like this (in this case for horizontal scanlines):

    u_Slope = (right.u - left.u) / (triangleRight_x - triangleLeft_x);
    v_Slope = (right.v - left.v) / (triangleRight_x - triangleLeft_x);
    //[...]
    new_u = left.u + ((currentX_onScanLine - triangleLeft_x) * u_Slope);
    new_v = left.v + ((currentX_onScanLine - triangleLeft_x) * v_Slope);

Then, when I add each point to the pixel buffer, I restore z and uv:

                z =  (1/z);
                uv.u = Math.round(uv.u * z *100);//*100 because my texture is 100x100px
                uv.v = Math.round(uv.v * z *100);

Then I turn the u v indexes into one index in order to fetch the correct pixel from the image data (which is a 1 dimensional px array):

        var index = texture.width * uv.u + uv.v;
        //and the rest is unimportant imagedata[index].RGBA bla bla

The interpolation formula is correct considering the consistency of the texture (including the straight stripes).

I must get some sleep now, but before I get into further dissecting of every single value to see what goes wrong, Can someone more experienced guess why might this be happening, just by looking at the cube?

"I have no idea what I'm doing" (it's my first time implementing a rasterizer). Did I miss an important stage?

Thanks for any insight.

PS: My UV values are as follows:

    { u:0,   v:0 },
    { u:0,   v:0.5 },
    { u:0.5, v:0.5 },
    { u:0.5, v:0 },
    { u:0,   v:0 },
    { u:0,   v:0.5 },
    { u:0.5, v:0.5 },
    { u:0.5, v:0 }

[EDIT]

The uv values were to blame, and pixel 50 being in the second zone, as Victor pointed out.

My new uv values:

                    {u:0, v:0},
                    {u:0, v:1},
                    {u:1, v:1},
                    {u:1, v:0},
                    {u:1, v:0},
                    {u:1, v:1},
                    {u:0, v:1},
                    {u:0, v:0}

To some extent this was "a bug in my code", but also I had overlooked an important part of the process: the uv values should not just be assigned to the 8 corners of the cube.

sentences:
XNA and Draw rotation From Wikipedia the (image) conversion degrees / radians shows the quadrants so that the increase of radians causes a counter-clockwise rotation but when using the following code the sprite is rotated clockwise:

rotation = (rotation + 0.5f) % MathHelper.ToRadians(360);
...
spriteBatch.Draw(sprite, sprite_center_other_sprite, new Rectangle(0, 0, 50, 50), Color.White, rotation, new Vector2(width/2, height/2),1.0f, SpriteEffects.None, 0.0f);

Why? The direction is a convention or XNA is different?

sentences: Hide movieclip parts that are out of bounds I'm making a game where one takes a picture of their face to use on a character.  I have them zoom in on the picture, but the bitmapdata extends out of its movieclip.  How do I assign bounds to my bitmapdata?

sentences:
Logic level representation that distinguishes "> and > the bridge" I have an logic level/map representation for a 3D game that uses vector<Area> where:

class Area{
    vector<Point2D> bounding; //determines the shape of the Area, its borders
    //bounding of Area is like borders of country
    //(it's easy to test if something is inside area)

    vector<Obstacle> obstacles; //general type for all static objects inside this Area
    //each Obstacle has boundingBox (center, halfSize, rotation)

    vector<Dynamic> dynamicObjects; //same as obstacles, but the use of separated vector
    //for dynamic objects helps with few things

    Player * player = 0; //like Obstacle, but it has special treatment

    vector<Area*> connectedAreas; //I won't went deeper into how Areas are connected.
    //For simplify, let's assume we are working on one Area.
    //Or that when Player leaves Area, all connectedAreas start a test if he entered
    //one of them (it's not the case, but work fine for purposes of that example).
    ...
};

It's quite simple and very low memory-consuming representation for large areas (grid representation would grow and grow with the size of area). I also find it quite good when it comes to some AI algorithms that my game uses. I don't have too advanced collisions in my game (so I don't need to care about them in the level representation). So generally, I'm happy with that representation.

Still, I have one problem: sometimes some parts of the map have "height-levels" - e.g. bridge: you can be either under the bridge or above it (and you can go above only from certain fragments of map). How can I represent that?

For caves or multi-floor buildings I can just use vector<Area> instead of single Area/Area's fragment. That vector<Area> could hold separated Area for each floor.

But when the mesh has kind of "smooth" transitions between levels (bridges, some parts of mountains and any non-separable fragments of map) - it doesn't looks like good solution anymore.

For example, here player is able to go either under the tree or above the trunk:

P.s. I am not asking for the graphic representation. I've separated the game logic and graphic engine as much as possible. The 3D engine uses triangles of course, with much more details then game logic need or want (less data => faster processing).

sentences:
Unity DontDestroyOnLoad not always working after Android build I've been using this small script as a component to any object I want to not be destroyed at scene loading.
public class DontDestroy : MonoBehaviour
{
    void Start()
    {
        DontDestroyOnLoad(gameObject);
    }
}

It has been working fine. It works for my GameOver canvas which I've been using for a long time whilst making the game.
Today I added the same script to a new AndroidControls Canvas I made. In the Editor it worked fine. Then I built it for Android to run on my physical phone (Galaxy S10). It gave me a Null exception.
It turned out to be caused by the AndroidControls Canvas being destroyed between scene loading (even though as I say, I tested in Editor for a few runs and it didnt get destroyed). And it gets a little weirder because after the attempted build to APK, and fail on physical device, it then failed to work in the editor. It continues to not work in each test after this in Editor, however if I remove the component and add it again, the entire process then repeats.
Please help as I don't have a clue how to start fixing this. The only thing I can imagine it being wrong is it started as soon as I used this script on two canvas's simultaneously. (I highly doubt I am correct but it's the only thing I could notice at all that might be causing this).
This picture actually shows my DontDestroy component is attached to Canvas_AndroidControls, but in the Hierarchy you can already see that it is not in the DontDestroyOnLoad section (excuse the pink overlay for play-mode):

Maybe relevant, here are some of my specs:
Win 10
Unity 2020.3.5f1 (Just downloaded NDK/SDK for Android today via Unity Modules)
Android 11 (Samsung Galaxy S10)

sentences:
Unity a ball bounce inside a sphere sometime will penetrate and drop outside i'have made a ball within a sphere (which imported from blender, with mesh collider), see the pic

after the scene started, the ball bounce inside around 5 seconds, and then the ball will penetrate (see the arrow) the sphere and drop out of sphere, anyone knows the reasons?

sentences:
How to make a temporary collision? I have a key and door system working, the character(ball) picks up the key and when it is within the collider it sets the text("press E to open") on the screen to active so that they can open the door. This only needs to be there while the door is closed. How Would I fix this. Thank you so much in advance.

    //GameObject E is the canvas text to instruct the player to press E to open the door.
public GameObject E;
//Door is the door itself, I assigned this manually because the door consists of the doorframe and door.
public GameObject Door;
private bool Unlock;
// Use this for initialization
void Start ()
{
    E.SetActive(false);
    Unlock = false;
}

// Update is called once per frame
void Update ()
{
    if (Unlock)
    {
        if (Input.GetKeyDown("e"))
        {
            Door.GetComponent<Animation>().Play();
            E.SetActive(false);
            CodeManager.GotKey = false;
        }
    }
}
void OnTriggerEnter(Collider other)
{
        if (CodeManager.GotKey)
        {
            if(other.gameObject.CompareTag("Player"))
            {
            E.SetActive(true);
            Unlock = true;
            }
        }
}

sentences:
When I shoot from a gun while walking, the bullet is off the center, but when stand still it's fine. (Video Included) I am making a small project in Unity, and whenever I walk with the gun and shoot at the same time, the bullets seem to curve and shoot off 2-3 CMs from the center. When I stand still this doesn't happen.
This is my main Javascript code:
@script RequireComponent(AudioSource);

var projectile : Rigidbody;
var speed = 500;
var ammo = 30;
var fireRate = 0.1;
private var nextFire = 0.0;

function Update() {
    if(Input.GetButton ("Fire1") && Time.time > nextFire) {
        if(ammo != 0) {
            nextFire = Time.time + fireRate;
            var clone = Instantiate(projectile, transform.position, transform.root.rotation);
            clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));
            ammo = ammo - 1;
            audio.Play();
        } else {

        }
    }
}

I assume that these two lines need to be tweaked:
var clone = Instantiate(projectile, transform.position, transform.root.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));

I just started Unity, and I might have a difficult time understanding some things.
EDIT:
Here is a video - http://www.screenr.com/2pxH
(If there are any more mistakes in my code, feel free to edit it.)

sentences:
How to create a simple "spot light" effect with Sdl or Sdl.Net? i'm wondering: how to create a simple "car headlight" (for i.e) or a torch spotlight in Sdl or Sdl.NET ?
Does anyone know how ?
Thanks

sentences:
OpenGLES 2.0: Rendering Multiple Sprites - Texel Corruption I'm having a tremendous time getting the second (or additional) sprites in my game engine to render properly.  The first one always works great: it is positioned and sized properly in screen coords, and its texture is mapped properly.  When I add a second sprite to the world, its texture does not get mapped properly.  If I reverse the two sprites render orders, the sprite that was rendered second previously (and had corrupt texture mapping) is now correct, and the other sprite is now corrupt.

I think it has to do with something in my shader not getting cleared out properly before it is used again.  I have to admit, I'm fairly new to shaders.  Interestingly, I'm building this engine to support both ES1.1 and ES2.0, and the same code works great in ES1.1 for multiple sprites.

I'll attempt to provide relevant code snippets below.  Any suggestions would be great - I've browsed dozens of good forums and Stack Exchange.  Is there perhaps a call I should be making between primitive renders to clean out the shaders?

Here's the snippet for rendering in ES2.0

void Sprite::Render(GLuint shaderProgram, UniformHandles* uniforms, AttributeHandles* attributes)
{
// Use the shader we were sent
glUseProgram(shaderProgram);

// Enable transparent blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// Performance: could pull this out and only recalculate when moved
PVRTVec2 bottomLeftPos = PVRTVec2((m_viewDims.x - m_position.x) / m_viewDims.x,
                                      ((m_viewDims.y - (m_position.y - m_drawDims.y)) / m_viewDims.y));

PVRTVec2 topRightPos = PVRTVec2((m_viewDims.x - (m_position.x + m_drawDims.x)) / m_viewDims.x,
                                    (m_viewDims.y - m_position.y) / m_viewDims.y);

// Draw the quad for ES2 (positioning is not based on these values: do not change)
DrawQuad((bottomLeftPos.x * 2.0f) - 1.0f, (bottomLeftPos.y * 2.0f) - 1.0f, (topRightPos.x * 2.0f) - 1.0f, (topRightPos.y * 2.0f) - 1.0f, m_textureResource->texture, uniforms, attributes);

// Turn off blending
glDisable(GL_BLEND);

}

And here's the snippet for DrawQuad()

void Sprite::DrawQuad(float x1, float y1, float x2, float y2, GLuint texture,
                  UniformHandles* uniforms, AttributeHandles* attributes)
{

    // Set the uniforms for rectangle position and width
    // Landscape
    glUniform2f(uniforms->LowerLeft, -y1, x1);
    float scaleMatrix[4] = { 0, x2 - x1, y1 - y2, 0 };
    glUniformMatrix2fv(uniforms->ScaleMatrix, 1, GL_FALSE, scaleMatrix);

    // Use the given texture
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);

    // Bind the vertex buffer object
    glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
    glEnableVertexAttribArray(attributes->in2DVertex);
    glEnableVertexAttribArray(attributes->inSpriteTexCoord);
    glVertexAttribPointer(attributes->in2DVertex, 2, GL_FLOAT, GL_FALSE, sizeof(GL_FLOAT) * 4, 0);
    glVertexAttribPointer(attributes->inSpriteTexCoord, 2, GL_FLOAT, GL_FALSE, sizeof(GL_FLOAT) * 4, (unsigned char*) (sizeof(GL_FLOAT) * 2));

    // Draws a short triangle strip
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    glDisableVertexAttribArray(attributes->in2DVertex);
    glDisableVertexAttribArray(attributes->inSpriteTexCoord);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}

And finally the vertex shader and fragment shader for 2D sprites:

Vertex Shader
    attribute highp vec2    in2DVertex;
    attribute highp vec2    inSpriteTexCoord;

uniform highp vec2      LowerLeft;
uniform highp mat2      ScaleMatrix; // Width/height and screen rotation

varying mediump vec2    TexCoord;

void main()
{
   gl_Position = vec4(ScaleMatrix * in2DVertex + LowerLeft, 0, 1);
   TexCoord = inSpriteTexCoord; // formerly in2DVertex
}

Fragment Shader
    uniform sampler2D  sTexture;

varying mediump vec2    TexCoord;

void main()
{
    gl_FragColor = texture2D(sTexture, TexCoord);
}

sentences:
Issue Implementing Ads with Vungle I'm trying to implement ads on Unity for my program with Vungle, I followed the implementation guide at
https://support.vungle.com/hc/en-us/articles/360003455452#reference-sample-app-0-3
But the ads aren't displaying at all. I get a debug.log that seems to indicate the ad was called, but no ad displays, even if I build and run the program. I contacted support, but they haven't been super helpful. They told me to wait a little longer before calling the ad, I put it on a coroutine with a 10 second delay and still no ad. Here's my script for reference,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VungleAds : MonoBehaviour
{
    string appID;
    string iosAppID = "ios_app_id";
    string androidAppID = "android_app_id";
    string windowsAppID = "5fbfc6bc1136b9069f63f0bf";

void Awake()
    {
        appID = windowsAppID;
        Vungle.init(appID);
    }

    private void Start()
    {
        StartCoroutine(ShowBanner());
        Vungle.loadBanner(appID, Vungle.VungleBannerSize.VungleAdSizeBanner, Vungle.VungleBannerPosition.BottomCenter);
    }

    IEnumerator ShowBanner()
    {

        yield return new WaitForSeconds(3);
        if (Vungle.isAdvertAvailable(appID))
        {
            Vungle.showBanner(appID);
        }
        else
        {
            print("No ad");
            StartCoroutine(ShowBanner());
        }
    }

}

It's just printing "No ad." repeatedly.
Does anyone have any experience with Vungle ads? I have been trying to figure this out for like a week haha.
Thanks

sentences:
Low FPS on Java drawing in BufferStrategy I ran into a very strange problem while using BufferStrategy, I've tried searching for an answer but all I have found are non-relevant threads and discussions. So here is my query.

for (int i = 0; i < 10; i++){
    for (int x = 0; x < 10; x++){
        g.drawImage(enlImg(getImg(terrain, x), 4), i*40, x*40, null);
    }
}

(The parameter 'terrain' is a BufferedImage pre-loaded, which will be used to get a sub image from it.)

I'm trying to draw images to a Canvas, where 'g' is the buffer strategies, 'getDrawGraphics()' because that's how I am drawing to the BufferStrategy.
Anyway, straight to the point. I'm only getting ~3fps.

I know this is only drawing 100 images, but other games draw hundreds of thousands with no lag... Any ideas?

Is it maybe because of trying to enlarge, draw and get a sub image all at once, or is it because of my computer?

Extra

enlImg() code

public BufferedImage enlImg(BufferedImage image, int x){
    BufferedImage enlargedImage = new BufferedImage(image.getWidth() * x, image.getHeight() * x, image.getType());
    for (int a = 0; a < enlargedImage.getHeight(); a++) {
        for (int b = 0; b < enlargedImage.getWidth(); b++) {
            enlargedImage.setRGB(a, b, image.getRGB(a / x, b / x));
        }
    }
    return enlargedImage;
}

getImg() code

public BufferedImage getImg(BufferedImage img, int x){
    int y = 0;
    if (x >= 10){
        x=x-10;
        y++;
    }
    return img.getSubimage(x*10, y*10, 10, 10);
}

Computer Specifications (Windows):

AMD Athlon II X2 250 - 3.00GHz
 OS: 32bit
 4GB RAM,
 256GB HHD

sentences:
Creating a bitmapfont from images? A bitmapfont consists of a image and a textfile that hold the position and size of each character on that image. Is there any way to create the text file with just a image? Or do I have to manually create the "atlas" for each character, which is kinda tedious.

Here is a line for a character in such a textfile .fnt

char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0

I think xadvance would mean how many pixels to advance on the line to put the next character. I have 36 characters A-Z0-9 but I want upper and lower case to output the same image.

I need this specifically for libgdx but this would probably be the same for any tool that uses a BitmapFont.

In addition I have a xml file that came with the sheet that includes the characters allong with the other images.

<TextureAtlas imagePath="sheet.png">
  ...
  <SubTexture name="letterA.png" x="412" y="835" width="61" height="64"/>
  <SubTexture name="letterB.png" x="460" y="977" width="52" height="66"/>
  <SubTexture name="letterC.png" x="432" y="1613" width="54" height="66"/>
  ...
</TextureAtlas>

I also have a each character separately in PNG and Vector.

To make clear to what I need this is a complete .fnt it needs to be accompanied by a single image that holds all the images of each character.

info face="FontName" size=78 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=93 base=73 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="fontsheet.png"
chars count=83
char id=32   x=0     y=0     width=0     height=0     xoffset=0     yoffset=73    xadvance=25     page=0  chnl=0
char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0
char id=106   x=46     y=0     width=19     height=82     xoffset=2     yoffset=9    xadvance=26     page=0  chnl=0
char id=41   x=65     y=0     width=20     height=75     xoffset=1     yoffset=3    xadvance=26     page=0  chnl=0
char id=40   x=85     y=0     width=21     height=75     xoffset=2     yoffset=3    xadvance=27     page=0  chnl=0
char id=96   x=106     y=0     width=31     height=75     xoffset=5     yoffset=0    xadvance=39     page=0  chnl=0
char id=64   x=137     y=0     width=72     height=68     xoffset=1     yoffset=7    xadvance=77     page=0  chnl=0
char id=48   x=209     y=0     width=51     height=68     xoffset=1     yoffset=7    xadvance=57     page=0  chnl=0
char id=85   x=260     y=0     width=54     height=68     xoffset=1     yoffset=7    xadvance=60     page=0  chnl=0
char id=79   x=314     y=0     width=60     height=68     xoffset=1     yoffset=7    xadvance=65     page=0  chnl=0
char id=38   x=374     y=0     width=60     height=67     xoffset=2     yoffset=8    xadvance=65     page=0  chnl=0
char id=54   x=434     y=0     width=47     height=67     xoffset=1     yoffset=8    xadvance=53     page=0  chnl=0
char id=121   x=0     y=83     width=43     height=67     xoffset=1     yoffset=26    xadvance=48     page=0  chnl=0
char id=113   x=43     y=83     width=48     height=67     xoffset=1     yoffset=24    xadvance=53     page=0  chnl=0
char id=112   x=91     y=83     width=48     height=67     xoffset=0
// etc...

sentences:
Separate player rating systems for attackers and defenders Imagine a kind of tower defence game where each player specialises either in defence or attack (a player is either one or the other in all games). In each game the attacker and the defender get separate scores. I want a leaderboard for the best defenders and a separate leaderboard for the best attackers. What are appropriate player rating systems in such a scenario? The ideal system is also efficient in that it produces robust rankings even if only a fraction of all possible attacker/defender combinations are actually played.

All the scoring systems I am aware of (e.g. Elo ratings or Microsoft TrueSkill) assume that both players are treated on an equal footing. I'd be extremely grateful for any pointers to relevant scoring systems.

sentences:
How can I constrain motion to a path formed from multiple splines? I want to develop a system to constraint a character movement to a certain path, defined a-priori by the level designer to give some sort of 2D/2.5D look.

Right now I have a list of splines that make a path, I also can project a arbitary point to a specific spline. So what I do is this:

Iterate over all the splines in a path
Find the closest point on all the splines that make a path
And return the point with the minimum distance (thats my current point)

Now one issue that this leaves me with is: how do I find if I am actually out of the current path?

How would you implement this sort of system? I feel my way is not even close to a robust system.

For those of you wondering, lets say I am trying to implement something like Sonic Generations' 2D Segments (just the movement constraints). And by a path I mean like this. Its full 3D environment, but Sonic follows a predefined path.

sentences:
Unity3D URP - How do I approach creating Fog of War for 3D top-down stealth game? What I try to achieve is a fog of war system for 3d top-down stealth game. I have searched the Internet and it seems that behavior I want to achieve can be done by using secondary camera that is rendering its output to a render texture. Then render texture is applied to a plane which sits above a map with a masking shader. I was following this video: https://www.youtube.com/watch?v=PNAvNeOTnSE however my project is using URP in Unity and the Clear Flags on camera settings is missing. So basically after each rendering loop render texture gets cleared and drawn again which makes impossible to "save" areas that already have been revealed by the player.
Maybe this can be done using another technique? I would like to have fog of war that covers entire rooms with black opaque plane and reveals them upon entering them but remains cleared once visited. However visited areas should be gray once left and enemies should be hidden from the player when not in line of sight. Something like in this video: https://youtu.be/jrK_Uvwwk9I?t=1247
I would really appreciate if someone pointed my in right direction.

sentences:
Java 2d Gaming, best practice to update random falling objects I'm new to game development. I do have basic knowledge in Java and also have moderately good experience in OOP from other languages.

I started developing this simple 2D game as my first project.

The game is simple, I have a character, I can move only right and left with constant speed.

I want to add obstacle objects that fall from the sky (top) that I have to dodge. I created the main class (StartingClass) that contains the game loop. receives input from the user's keyboard and moves the character accordingly.

I created a Character class which describes the character position, and reflect its position with painting its image.

Everything is well. However, I'm now trying to add the falling objects. My delima is how to implement them.

I started by creating a new class (FallingObject). In the instructor I create its width, height, falling speed.. etc (randomly). The issue I'm having is to determine how to update this object's position. I would have created an update method for the object and call it every time in the game loop to update its position. But my problem is I will have multiple objects falling simultaneously, each with different speed. So these are the solutions that came to my mind:

Visible/Active falling objects will be stored in an array list *

1) on every game loop, iterate over the falling objects and update them individually, which doesn't sound that friendly to me.

2) In the falling object instructor, when finished assigning the random values, call a synchronized "startFalling" method on the object, so it keeps falling until it hits the ground.

3) My FallingObject class would implement the runnable interface, and run the function described above through thread. But still... thread for each falling object? I'm not liking that idea.

So I would like to know if I'm somewhat in the right direction in my way of thinking to solve this issue, and which of the above suggestions you think is best, or if there's way better solutions (which I believe is true) that I'm unable to see due to my limited experience in game development design / java.

Thank you very much for your help and support!
Cheers
Shady

sentences:
Detecting collision of multiple moving objects I have wrote a simple game that has a 100 balls bouncing off the borders of the canvas. Each ball is an instance of ball class function that has the following definition:

var cnv = document.getElementById("mycanvas");
var ctx = cnv.getContext("2d");
...
...

function ball() {
    // at instantiation, set the ball in a random position
    this.x = parseInt(Math.random()*cnv.width) +1;
    this.y = parseInt(Math.random()*cnv.height) +1;
    this.size = parseInt(Math.random() * 10) + 1;

    // and give the ball a random speed at a random direction
    this.x_speed = parseInt(Math.random()*10) +1;
    this.y_speed = parseInt(Math.random()*10) +1;
    if (this.x_speed>5) {
        this.x_speed *= -1;
    }
    if (this.y_speed>5) {
        this.y_speed *= -1;
    }

    // draw() and update() for the instance will be called from the main game loop
    this.draw = function() {
        ctx.beginPath();
        ctx.fillStyle = "white";
        ctx.arc(this.x,this.y,this.size,0,Math.PI*2,true);
        ctx.fill();
    };

    this.update = function() {
        this.x += this.x_speed;
        this.y += this.y_speed;

        if (this.x >= cnv.width || this.x<=0) {
            this.x_speed *= -1;
        }
        if (this.y >= cnv.height || this.y <= 0) {
            this.y_speed *= -1;
        }
    }
}

In the main game loop, I call gameUpdate() which in turn calls update() for each ball, like so:

var balls = [];   // array to hold all instances
...
...
function gameStart() {

   for(var i=0;i<100;i++) {
       balls.push( new ball() );   // create an instance and store its reference
   }
}

function gameUpdate() {
    for(var i=0; i<balls.length;i++) {
         balls[i].update();     // this ensures that each ball moves on its own

    }
}

Now my question is:
How can I manage to detect collision between all of the instances of balls ?

Here is my attempt, but I already know it is not efficient:

function detectCollision() {
    for(var i=0;i<balls.length;i++) {
        for(var j=0;j<balls.length-1;j++) {
            if (i !== j) {   // make sure we have two different balls to check with
                // assuming that collision() exists and checks x,y for each parameter and return boolean
                if (collision(balls[i],balls[j])) {
                      console.log("boom!");
                }
            }
        }
    }
}

What is a better way for checking collision of moving objects?

sentences:
Mods for Minecraft Server - how does it work? Minecraft server comes as a single jar. How are mods developed? How do they interact with the original jar? What is there under the hood?

What technologies are involved there? I'm mostly a C++/Python guy, but I'd like to learn something about mods development.

sentences:
Unity 2D animation issue I have this weird animation bug in Unity that I believe is how Unity handles the frame. I dont know how to show the image so I'll do my best to explain it. So I put a bunch of 2D sprites in a sequential order right and I made a timer in my code to play animation whenever. The weird thing is that it does complete the whole animation but then it goes back to the first frame and ends it. I tried changing the timer to every number possible but it just does the same thing or repeats the animation twice when I increase my timer.

Here's the code :

using UnityEngine;
using System.Collections;

public class PlayerAttack : MonoBehaviour {

private bool attacking = false;//Switches for all attac combo
private bool attacking2 = false;
private bool attacking3 = false;

//attack 1 stats
public float attackTimer = 0f;
public float attackCD = .3f;

public Collider2D attackTrigger;//Referring to our attack collider

Animator anim;

// Use this for initialization
void Start () {
    anim = GetComponent<Animator> ();
    attackTrigger.enabled = false;//Disable our collider at start
}

// Update is called once per frame
void Update () {
    if (Input.GetKeyDown ("space") && !attacking)
    {
        attacking = true;//We are attacking
        attackTimer = attackCD;//assign variables

        attackTrigger.enabled = true;//Enabled our trigger collider
    }

    //If we are attacking
    if (attacking) {
        //Check if our timer is greater than zero
        if(attackTimer > 0){
            attackTimer -= Time.deltaTime;//Decrease our timer
        }else
        {
            attacking = false;//We arent attacking anymore
            attackTrigger.enabled = false;
        }
    }
    anim.SetBool ("Attack", attacking);
 }
}

sentences:
Delay The Polling Events Of Xbox360 Gamepad With XInput My team and I are currently developing a 2D platformer with SDL/OpenGL and we want to add support to the Xbox360 Gamepad with the XInput library from Microsoft, but we are currently having a problem.

First of all, the method for reading the key states it's this one:

bool InputMapping::Gamepad::checkKeyState(WORD button)
{
  DWORD dwResult;
  DWORD idPlayer = playerID - 1;

  XINPUT_STATE state;
  ZeroMemory( &state, sizeof(XINPUT_STATE) );

  dwResult = XInputGetState( idPlayer, &state );

  if ( state.Gamepad.wButtons & button)
  {
    return true;
  }

  return false;
}

This method returns true or false if the selected key it's pressed or not.

But it seems that the polling of the keys it's ocurring really fast, in the menus, moving through the buttons it's really fast and I can't controlled.

There is a way to limit the time between polling inside of the XInput or I should do it by myself? or what you recommend me?

If I didn't explain me clearly don't hesitate in say that.

Thanks a lot.

sentences:
Weighted random events with conditions I'm building a system for distributing ingame events for a strategy game. The game is heavily driven by the events and each country/player should receive one or more per time unit.

The algorithm is similar to the "The Soft-coded Probabilities Solution" from this question: How do I create a weighted collection and then pick a random element from it?

The main differences are:

I need conditions for if events can happen or not, like only triggers if unrest is above 2% or if you are at war etc. Maybe half the events will have conditions (but this may change over time as more are added while the algorithm probably won't).
I need a mechanism to prevent the same event repeating for the same player in too short a time period. This applies to some events but not all.

It seems that no matter how I go about this I have to do either a lot of condition checking in advance to maintain my list(s) or a lot of iteration over events that are anyway not selectable. So is this algorithm still a good choice to build upon in this case or should I be looking elsewhere?

sentences:
What is the difference between OpenGL 1.x and 2.x? Is there a good tutorial that shows the difference between OpenGL 1.* and 2.*?

It would be very helpful to know which functions I should not be calling (like glBegin(), I assume).

sentences:
Positions are the same but appear in different locations I have a procedurally generated tile that is a part of a turn-based hex tile game. When I try to have the tile instantiate a prefab that is the placeholder for a unit, I used the tile's transform.position as the position part of GameObject.Instantiate(Object, Location, Rotation). Unfortunately, this is the result:

A similar thing happens no matter which tile I use.

More information: I tried placing a cube on where the hex is, supposedly. Its transform is very different. So what it appears to be is that the tile is being placed in the wrong place, not the cube.

Further experimentation shows that the cube is appearing at exactly half the hex's apparent transform (I added a multiplier of 2 to the cube's position and it appeared in the right spot). I still have no idea why.

sentences:
equirectangular panorama rendering? I want to render my scenes as equirectangular panorama frames.

I can get the angular fisheye which is what I actually need by applying the rendered frame as a texture to a correctly UV mapped circle.

But how can the scene be rendered as equirectangular panorama?

I'm using a 3d engine which uses OpenGL and GLSL.

sentences:
How do you create a .XNB Font file for use with CocosSharp? I know the .XNB file format is an XNA thing and that CocosSharp inherits this from its MonoGame roots. However there doesn't seem to be any information on how to create your own .XNB fonts to use with CocosSharp. I've tried searching but can find any information.

Could someone explain it here or point me to a tutorial on how to create .XNB font file for use with CocosSharp?

A site to download already compiled .XNB Fonts would also be acceptable.

Update: Another thing that makes this tricky is that I guess XNA Game Studio could be used, but it's not compatible with Windows 8.1; which is what I currently use for my dev machine...

sentences: How can I optimize the size of my .apk? I noticed that the Flappy Bird .apk is only around 900 KB. I'd like to know how I can achieve a similar optimization in .apk file size for my own games, which use Unity. A small single-scene game developed with Unity will have an .apk size of nearly 10 MB, in comparison.

sentences:
Can a rules engine produce manageable and complex AI? I am currently in the middle of creating an AI village simulation in Java. Having implemented a simple rules engine for dialog, I am wondering if this DSL can be extended for AI. I have previously implemented both GOAP and behavior trees, but considered GOAP to be confusing for the average user. Behavior trees may still be an option.

In this case, I expect the AI to be able to control interactions between villagers (covered within the rules system already) and to manage the goals/daily actions of both individual villagers and the village as a whole. Actions could range from gathering resources, to deciding what to build on a broader scale.

However, I have concerns about whether a rules system will be able to manage hierarchy or many complex situations. There may also be some interaction with non technical users, so understandability is important.

The rules engine as it stands currently takes in a number of facts on an event, matches it to the best rule and executes a number of actions.

The outcome of the AI needs to be sufficiently complex as to be believable; for example, there may be many competing desires to relax, work on a pressing task etc. This needs to be able to be managed and prioritized as tasks come up. A village wide AI can assign tasks to individual villagers based on their abilities and the urgency of the task. There are randomized events that can change the priority of certain tasks. My main concern is whether the rules engine will be performant, be able to schedule tasks well and be responsive to dynamic conditions.

Is a rules based engine desirable for this kind of AI?

sentences:
2D collision > rectangles can glitch into each other I have implemented a simple rectangle based collsion detection where you can "slide" around the edges on diagonal movement.
Works fine but the thing is, it is somehow possible that e.g. the player (rectangle) glitches into the one of a collision object. It seems, that it appears only when the player "slides" around the corners.
I suspect that if the player walks around the corners that the movement direction (Vector2) cuts off the corner and at some point glitches into the collision rectangle.

I hope I've explained the problem somehow understandable?

The code looks like this:

The UpdateCall recieves the playerMovement from the keyboard input

public void UpdatePlayer(GameTime gameTime, Vector2 playerMovement)
{
    //...
    playerMovement = CalculatePlayerMovement(Vector2.Normalize(playerMovement) * movementspeed);
    if (playerMovement.Length() != 0)
        MoveBy(playerMovement);
    //...
}

The CalculatePlayerMovement-Method checks world bounds, collision objects and so on. Depending on what side the collsion happens, the x- or y-movement will be zeroed.

private Vector2 CalculatePlayerMovement(Vector2 movement)
{
    Rectangle destRect = new Rectangle(BoundingBox.X + (int)movement.X, BoundingBox.Y + (int)movement.Y, Width, Height);
    Vector2 returnValue = movement;
    //...
    foreach (Rectangle r in TileMap.collisionObjects)
    {
         if (destRect.Intersects(r))
         {
             string collsionSide = GetCollisionSide(destRect, r);
             if (collsionSide == "top" || collsionSide == "bottom")
                 returnValue.Y = 0;
             if (collsionSide == "left" || collsionSide == "right")
                 returnValue.X = 0;
         }
     }
    //...
}

Finally the check itself. I took this part from HERE since I was not sure what the best way would be.

private string GetCollisionSide(Rectangle destRect, Rectangle r)
{
    float w = (destRect.Width + r.Width) / 2;
    float h = (destRect.Height + r.Height) / 2;
    float dx = destRect.Center.X - r.Center.X;
    float dy = destRect.Center.Y - r.Center.Y;

    if (Math.Abs(dx) <= w && Math.Abs(dy) <= h)
    {
        float wy = w * dy;
        float hx = h * dx;

        if (wy > hx)
        {
           if (wy > -hx)
                return "top";
            else
                return "right";
        }
        else if (wy < hx)
        {
            if (wy > -hx)
                return "left";
            else
                return "bottom";
        }
    }
    return "";
}

I am not sure where the problem is, but it is probably something I don't see myself.

sentences:
Can't refer mesh size after using .BakeMesh() in Unity I can't figure out how to refer to the size of a particular mesh.

The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box collider has a scale of 1 by 1 by 1, regardless of how big the mesh I'm adding it to seems to be.

This doesn't match my understanding of how creating a box collider should work, so I've set up a Debug.Log that outputs the mesh size.

Here the plot thickens. The mesh's size just comes back at 0, 0, 0.
My attempts at getting the size of the object are as follows:

objectToMeasure.GetComponent<Renderer>().bounds.size;

objectToMeasure.GetComponent<MeshFilter>().mesh.bounds.size

objectToMeasure.GetComponent<MeshFilter>().sharedMesh.bounds.size;

Assuming I'm referring to the size of the object in the correct way, this seems like it must be an issue created by baking the object. Do I need to wait a frame (via starting a coroutine) before trying to access the size of the object, or am I referring to the wrong component of the object, or is the BoxCollider setting it's size based on objectToMeasure's scale rather than it's size in the world?

I feel sure that
objectToMeasure.GetComponent().mesh.bounds.size;
should be right, since the script I use to bake to the mesh is:
meshToBake.BakeMesh(meshToMeasure.GetComponent().sharedMesh);

I've been driving myself to the edge of sanity for 24 hours with this script not working, so advice is greatly appreciated.

sentences:
How should I traverse entities and components for their per-frame updates? I am implementing a simple entity/component-based engine in C++ and am unsure about the best way to store references to entities/components and what the best way to traverse them each game step would be.

My current thoughts are to:

Store a reference to the parent entity of each entity in the game.
Instantiate the game engine with a root entity (e.g. a Scene entity).
Traverse all entities in the game starting from the root entity and call the update method.

My entity interface is such that each entity in the game will have an update method which will call the update method for each of the entities components:

class Entity
{
public:
    virtual void update();
};

However I don't think a tree traversal would be the most optimal solution - would it be better to store references to every entity in the game in a flat data structure and loop this every game step?

sentences:
Transfering an inertia tensor from local coordinates to another one If we have an inertia tensor in local coordinates with a basis matrix B and we want to transform it to other local coordinates with basis matrix A, is it right to do the following:

A* inv(B) *Inertia Tensor

Where my idea is to shift the inertia tensor to world coordinates by multiplying it by the inverse of B, then from the world coordinates to the A coordinates by multiplying it with A matrix?

sentences:
should users be asked to submit high score to leaderboard? If a user gets a new high score in a game, should they be asked before having their score submitted to the leaderboard?  Originally I was just going to submit their score to the leaderboard without prompting them, but a friend told me that it is preferred that the user be asked.

thanks

sentences:
enemy behavior with boundary to change direction I'm doing space shooter kind of game, the logic is to reflect the enemy if it hits the boundary. With my logic, sometimes enemy behaves like flickering instead of changing the velocity. It's like trapped in the boundary and checking for if loops.
This is my code for velocity changing:

if(this->enemyPos.x>14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

if(this->enemyPos.x<-14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

How can I get around this? Its going out of boundary and don't know where to go and after sometimes its coming into field. I know whats the problem is, I dont know how to get around this problem.

sentences: Why not just create very high resolution graphics and use them on all screens? I'm creating a game with pretty basic graphics (numbers, blocks, words, and a few nice design elements for the logo and such). My question is: can I create everything in a very high resolution- say 2048x2048- and just let libGDX scale these depending on the screen size? The reason I ask is because I've seen questions that ask about creating a copy of the assets in various resolutions. What's wrong with just using one asset set that's a very high resolution on all devices?

sentences: How to cut a 3D mesh like a lathe? How to simulate the object cutting with a lathe, similar to what's done in the CRAFT: Work VR Shop app?

sentences:
Unreal Engine 4 AI Character Pawn Entirely Unresponsive to Movement Commands I'm new to game development and to Unreal but I cannot for the life of me get my AI character pawn to move at all using any method I know.
I'm developing a 2d Sidescroller game using a Tilemap. I have made sure collision is set up with the map and tiles, the player character can interact with it all just fine, and I made sure to widen the collision thickness of the map so that the navmesh can properly appear (as seen with the green areas).
Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground

I've disabled and enabled collision for the static mesh cube component in the character pawn, but he still doesn't move.
The goal is to get him to follow the player when he sees him. The pawnsensing trigger works just fine, as I had it print whenever he sees him, and he even properly gets to the point of executing the "follow player" function (the print statement works).
However, using AIMoveTo fails every time. I've tried putting the player as the target, the player's worldLocation as a vector, and even an arbitrary point vector to the right of the AI but AIMoveTo fails every time.
I've deleted and replaced the NavMesh, and I've even tried completely skipping using AIMoveTo and just using Add Movement Input in both the AI Thinking Blueprint and Character Pawn Blueprint but neither make it move. I literally put an Add Movement Input function on the Pawn's event tick but it never moves.
Any suggestions?
Code:
AI Logic event is triggered every tick

Character Pawn Tick (for debugging). Does not cause the Pawn to move

sentences:
Are concurrent Update and Draw calls possible in XNA? I am making a real-time game in XNA and I would like to reduce the Update() call frequency while getting as many Draw() calls as possible. This would enable the program to finish long calculations in the Update() method while Draw() is still regularly called to perform interpolation and rendering to have the game appear running smoothly.

But, it seems like Draw() is never invoked before Update() has finished. This creates stuttering.

Is it possible to achieve concurrent calls to Draw() before Update() has finished?

sentences: How can I send Android notifications from my Unity game? I'm want to send local notification on Android with Unity3D but I don't know how to do it. Any suggestions?

sentences:
Why isn't my BoxCollider2D doing anything? I'm trying to make a speech bubble appear when you approach the tutorial board.

The bubble is there and it has its animation states "Appear" and "Disappear"

  Appear is called OnTriggerEnter2D

  Disappear is called OnTriggerExit2D

The collider is on the parent, tutorial board

The animator and script are on the bubble itself.

This is the script I have attached to the bubble, the conditions script.

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

 public class Conditions : MonoBehaviour
 {

     private Animator bubblecondition;
     private BoxCollider2D boxCollider;

     // Start is called before the first frame update
     private void Awake()
     {
         bubblecondition = this.GetComponent<Animator>();
         bubblecondition.Play("Disappear", 0, 1f);
     }
     void Start()
     {
         //bubblecondition.SetBool("Here", false);
         boxCollider = this.GetComponentInParent<BoxCollider2D>();
     }

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

     }

     public void OnTriggerEnter2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Appear", 0, 0f);
         }
         else
         {
             return;
         }
     }

     public void OnTriggerExit2D(Collider2D other)
     {
         if (other.tag == "Player")
         {
             bubblecondition.Play("Disappear", 0, 0f);
         }
         else
         {
             return;
         }
     }
 }

What am I doing wrong? I spent an hour trying to know why.

  I even tried to have the console write a message on collision but it's
  just dead.
  Not only that, but I also tried to make it public and referenced it, still nothing.

Help me see my mistake :)

sentences:
How can I apply an overlay effect to a sprite in XNA? Suppose I have a character sprite and I want to apply some animating effect that overlays its color, how would I do it? What I desire is something along this line:
(From final fantasy tactics)

It is a sprite overlay with animating gray effect and white color for black line.

However, in XNA, pixel shader support only shading of all sprite in the scene. If I am to pixel shade only specific sprite I want, I have to either apply stencil buffer which makes the system more complicated when I have multiple, separated effects for each sprite ( I have to determine stencil buffer clipping for each effects ). Another forum suggest using seperate sprite batch for each sprite drawn (call Begin / End for each sprite) and create my own sorting routine, but I found out that this batching method will really consume alot of GPU performance.

On the other hand, If I have 2D texture filled prerendered overlay effect, then I apply it onto the character sprite for some blending effect, the Sprite batch will not clip out the overlay effect and limit it only to character shapde but will pass it onto the background too.

Therefore, any suggestion to tackle this problem?

sentences: PlayFab Custom Server Integration I want to use PlayFab to host and manage my server instances but I'm unclear on how to implement the requirements they listed here. My server SDK is in .Net and I'm hoping I can fulfill all the requirements with plugins written in C#. How can I and make parameters available in the command line input? Am I supposed to return information by printing on the console?

sentences:
Problem with SDL_Mixer/MikMod playing XM files properly Some of the music I've made for my game have note bends in them (1xx Portamento up)...The problem is that when they play in my game, the note bends and then goes right back to original note instead of staying at the new tone it bends into.

I believe this to be an issue with SDL_Mixer and not with the XM file itself since it plays just fine in any tracker program I load it into.  Is there anything in the SDL_Mixer loading/playing functions that I could do to fix this?

sentences:
How can I implement (almost) infinitely large maps in Unreal Engine 4? I'm making a game where a helicopter travels around.

I'd like that the environment around be as realistic as possible. For instance, since the helicopter can travel at speeds up to 200 km/h, I want the player to see very far away, in a realistic fashion.

I'm talking about a map where let's say there is a "real" mountain 50km away and you could "walk" there, as well as the mountain looking like a mountain in game from the any distance (no matter the quality).

How could I manage my map in UE4 that would allow me to implement such a "real" world?

sentences:
Books for designing virtual economy I am wondering if there are any books on designing virtual economies.

I have encountered some books which have a few lines or paragraphs written about virtual economies, but they mainly highlight how difficult it is to design and control a virtual economy; they don't give any useful advice on how to design a virtual economy.

sentences:
Setting density for Android game I am developing an Android game, in which a ball (bitmap) translates( is in motion). So I have provided motion equations for the ball. I have checked my app on Samsung galaxy S2 whose actual density is roundly 252 dpi, and It works fine on that. So my question is that Does these motions of bitmaps in surfaceView, depends on actual density of phone( i.e 252 dpi for S2) or generalized density(i.e 240 dpi).

I am confused whether if I run this app on 235 dpi smartphone, So will it have the same performance of motion as it is on Galaxy S2( with 252 dpi) or it would be little slow ?

Any help will be appreciated.

Let me elaborate it with coding. For example a linear motion of a ball is defined as with this equation x=x+4;
Now If I run this app, on Samsung galaxy S2(252dpi, and hdpi), So It will give me a particular speed motion, let say P is the speed of the ball.
Now If I run this application on Samsung Galaxy S3(300+ dpi, xhdpi), So the ball speed gonna be slow on this density, meaning less than the speed P.

So I will need the same speed on xhdpi density phone.
So will use these conversion formulas ;
dx= (x*160)/240;
px= (dx*320)/160;
 Hence the speed will be either exact or little different from P.(This is my confusion). That Whether the speed will be as same as it was on S2.

So my Question at this point is that my app worked on Samsung Galaxy S2 with the speed p, that I desired. As S2 is of 252 dpi, So Should I Include 240(Generalized density or 252 (Actual density) in my this line of coding ?
    dx= (x*160)/240;

Thanks !

sentences:
Separate draw and physics loops I there a point in updating the physics at a different rate than drawing / taking input? Is it just to exploit parallelism?

I've heard that many engines update the physics at 15FPS but render at 60FPS. What's the point in rendering the same image four times until it changes if it doesn't add fluidity?

sentences:
Rotating points on a circle I have drawn a 2D circle in X,Y,Z. I wanted to draw something on specific vertices of that circle and I managed to do it. When I wanted to move the circle, I wanted the vertices to get the updated position, so I created another array of vertices and calculated the new vertex positions.

Now I want to rotate the circle, and while rotating it, the vertices should get the new orientation. How can I do this?

void creature::drawCircle(Vec3f Pos,float radius, int segments )
{

    // automatically determine the number of segments from the circumference
    if( segments <= 0 ) {
        segments = (int)math<double>::floor( radius * M_PI * 2 );
    }
    if( segments < 2 ) segments = 2;

    GLfloat *verts = new float[(segments+2)*3];
    GLfloat *vertsNew = new float[(segments+2)*3];
    verts[0] = 0;
    verts[1] = 0;
    verts[2] = 0;
    vertsNew[0] = 0;
    vertsNew[1] = 0;
    vertsNew[2] = 0;

    //Create circle
    for( int s = 0; s <= segments; s++ ) {
        float t = s / (float)segments * 2.0f * 3.14159f;
        verts[(s+1)*3+0] = math<float>::cos( t ) * radius;
        verts[(s+1)*3+1] = math<float>::sin( t ) * radius;
        verts[(s+1)*3+2] = 0;
    }

    //Transform points
    for( int s = 0; s <= segments; s++ ) {
    ci::Vec3f  m_newCirclePos;
        m_newCirclePos.x = verts[(s+1)*3+0];
        m_newCirclePos.y = verts[(s+1)*3+1];
        m_newCirclePos.z = verts[(s+1)*3+2];
        m_newCirclePos += ci::Vec3f(Pos);

        vertsNew[(s+1)*3+0] = m_newCirclePos.x;
        vertsNew[(s+1)*3+1] = m_newCirclePos.y;
        vertsNew[(s+1)*3+2] = 0;

    }

    // Attach tentacles on specific vertices
    for (int i=0; i<m_tentacle.size(); i++)
    {
        m_tentacle[i]->m_Nodes[0].x = vertsNew[(i+1)*3+0];
        m_tentacle[i]->m_Nodes[0].y = vertsNew[(i+1)*3+1];
        m_tentacle[i]->m_Nodes[0].z = vertsNew[(i+1)*3+2];
        m_tentacle[i]->enforceConstraints(Vec2f(0,0),0,0,0,0);
    }
    glPointSize(10);
    glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, 0, vertsNew );
    glDrawArrays( GL_POINTS, 0, segments + 2 );
    glDisableClientState( GL_VERTEX_ARRAY );
    delete [] verts;
    delete [] vertsNew;
}

sentences: Unity crossplatform native plugins I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is there a way to support both with one codebase?

sentences:
Smoothness & performance issues of new game I've written the basics of a new game which just includes a game loop that can update and render basic game objects so far.

I want to ensure that what I've written so far is as good as it can be and provides me with the best & most flexible foundation to build a game on top of. Really don't want to discover something fundamental later which causes a massive re-write.

Even though the game is running at a very decent frame rate the game objects are not moving entirely smoothly. I'm seeing stuttering and what looks like skipped frames, especially when the game objects bounce off the walls.

I'm not sure if this is a problem with my game loop or how I'm updating the game objects, or something else?!

If I increase the number of game objects from 5 to 100 the performance does not seem to change so I don't think it's a processing issue.

The project is only small at the moment - https://github.com/arrwhidev/java2d

sentences:
Half top-down view collision and mechanics I'd like to create a game with a half top-down (2d RPG) view (I don't know the exact name of it). It would be 2d, but I'd like to add 3d-like collisions. For example:

If the grenade lands on the roof, it would roll down and fall. Or if it hits a wall, it would bounce back.

I've never worked with this view, that's why I'm asking for advices for how to do proper collisions and physics. I don't want to use any external libraries.

Thanks in advance!

sentences:
ricocheting off a wall I have a capsule (sphere sweep) that I've computed the collision on a mesh with.

I know the point of impact and normal of the face it collides with.

My moving object - I'm using a capsule to represent it for collision purposes - has a quaternion describing its direction of travel.

How do I compute the new quaternion for the object to travel in on the bounce?

sentences:
TileMapRenderer in libGDX not drawing anything So I followed the tutorial on the libGDX wiki to draw Tiled maps but it doesn't seem to render anything.

Here's how I setup my OrthographicCamera and load the map:

camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

map = TiledLoader.createMap(Gdx.files.internal("maps/test.tmx"));
atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8);

And here is my render function:

Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

camera.update();
tileMapRenderer.render(camera);

Also I did pack the tile map using the TiledMapPacker.

I'm completely stumped... am I missing anything obvious here?

EDIT:

While debugging I noticed that the TileAtlas seems to be empty, which I guess shouldn't be the case, but I have no idea why it's empty.

sentences:
How to save game progress (savefile) I am currently working on a terminal text game just to practice my skills (C). It will be story driven escape the mansion kind of game. Even though the game will be short I want it to support save files.

Since I am new to game programming I am not sure how should I handle save files. The game will be short yet players will be able to find a lot of objects. I was thinking about saving a structure into a .txt file OR saving lots of 1 and 0 into txt file. Where each line represents each item or progress.

Is there a better way or common way how to do it?

sentences:
Level Selector with possible future levels? [Unity] I have a level select screen which is a simple grid layout of my levels. The level data comes from a scriptable object for each level.

The problem I have is what is the best method for populating the grid of levels that use the scriptable object and is able to add more levels to the grid layout if let's say I add an asset bundle in the future?

My thought was that I use a levelDB which holds a list of all of the scriptable objects. Then when an asset bundle is used then it adds the content to the levelDB. The UI would then just use this levelDB to populate the screen.

NOTE: I have very little to no knowledge of how asset bundles work and what you can, and cannot do with them.

sentences:
2D/3D Soft body physics in Unity I want to implement soft bodies in my game similar to this link.
I tried using this Soft body simulation plugin but it has the following problems:

Only works with box colliders.
Doesn’t work with Unity’s physics engine i.e. the bodies don’t react to the forces applied.

For my game,

The soft bodies should be able to collide and interact with any types of colliders (including mesh collider).
The bodies should work with Unity’s physics engine i.e. the bodies should react to the forces and gravity applied.

I am flexible in implementing soft bodies in 2D or 3D.
I would appreciate any suggestions and thoughts on this topic.

sentences:
Unity Hub 2.3.0 Buggy Setup? I recently downloaded the new Unity Hub 2.3.0 setup and since I hadn't used (or downloaded Unity Core) using the previous version of the Hub, I simply deleted the folder containing Unity Hub instead of uninstalling it like any normal person would. Now, every time I open the Unity Hub Setup and try and install it, it always shows the same "Installation Aborted, could not install successfully," error. I can't even uninstall the previous version from Windows Settings! I've tried changing the destination folder, but still doesn't work.

Any help is appreciated!

P.S. This error occurs when installing UnityHub, not the Unity Core Platform! I've also looked at all other similar posts.

Thanks.

sentences:
Python library for scripting (C++ integration) Please advise me good wrapper/library for python. I need to implement simple scripting in c++ app; Under "good" I mean pretty understandable, well documented, no memory leaking, fast. For creating base interface of GameObject on Python and C++; Your own experience and useful links will be nice!!! I found link about it, but I need more specific within gamedev context. What combinations of libraries you used for python integration into c++? For example about ogre-python it said

  built using Py++ and Boost.Python library

And one more question, maybe someone of you know how Python was integrated into BigWorld engine (it's own port or some library)?

Thank you!!!

sentences:
OpenGL - Calculating camera view matrix Problem

I am calculating the model, view and projection matrices independently to be used in my shader as follows:

gl_Position = projection * view * model * vec4(in_Position, 1.0);

When I try to calculate my camera's view matrix the Z axis is flipped and my camera seems like it is looking backwards.

My program is written in C# using the OpenTK library.

Translation (Working)

I've created a test scene as follows:

From my understanding of the OpenGL coordinate system they are positioned correctly.

The model matrix is created using:

Matrix4 translation = Matrix4.CreateTranslation(modelPosition);
Matrix4 model = translation;

The view matrix is created using:

Matrix4 translation = Matrix4.CreateTranslation(-cameraPosition);
Matrix4 view = translation;

Rotation (Not-Working)

I now want to create the camera's rotation matrix.  To do this I use the camera's right, up and forward vectors:

// Hard coded example orientation:
// Normally calculated from up and forward
// Similar to look-at camera.
Vector3 r = Vector.UnitX;
Vector3 u = Vector3.UnitY;
Vector3 f = -Vector3.UnitZ;

Matrix4 rot = new Matrix4(
    r.X, r.Y, r.Z, 0,
    u.X, u.Y, u.Z, 0,
    f.X, f.Y, f.Z, 0,
    0.0f, 0.0f, 0.0f, 1.0f);

This results in the following matrix being created:

I know that multiplying by the identity matrix would produce no rotation.  This is clearly not the identity matrix and therefore will apply some rotation.

I thought that because this is aligned with the OpenGL coordinate system is should produce no rotation.  Is this the wrong way to calculate the rotation matrix?

I then create my view matrix as:

// OpenTK is row-major so the order of operations is reversed:
Matrix4 view = translation * rot;

Rotation almost works now but the -Z/+Z axis has been flipped, with the green cube now appearing closer to the camera.  It seems like the camera is looking backwards, especially if I move it around.

My goal is to store the position and orientation of all objects (including the camera) as:

Vector3 position;
Vector3 up;
Vector3 forward;

Apologies for writing such a long question and thank you in advance.  I've tried following tutorials/guides from many sites but I keep ending up with something wrong.

Edit: Projection Matrix Set-up

Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView(
    (float)(0.5 * Math.PI),
    (float)display.Width / display.Height,
    0.1f,
    1000.0f);

sentences:
wglCreateContextAttribsARB is undefined I've just downloaded the latest headers from the OpenGL registry and included them in my project. I am attempting to create an OpenGL 3+ context. Every tutorial/resource has used wglCreateContextAttribsARB to do this. However, this does not seemed to be defined in the headers I have.

#include <Windows.h>
#include <gl\GL.h>
#include "glcorearb.h"
#include "glext.h"
#include "wglext.h"
...
wglCreateContextAttribsARB = // Not recognised
(PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB"); // Recognised (Why this and not the function name?)

The closest existing function is wglCreateContext, which I don't believe is what I want.

In the wglext.h header, there is this though:

typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#ifdef WGL_WGLEXT_PROTOTYPES
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif

And that can get me the function, but is defining WGL_WGLEXT_PROTOTYPES really the "correct" way to do what I want?

I haven't been able to find any information on the issue, what is the correct procedure? And where can I find information on changes/problems like these?

I'm not interested in using any extension loading libraries such as GLEW to handle this.

Thanks.

sentences:
How to make randomly placed objects not on top of each other? I randomly instantiate game objects, to create a dynamic "sky map". But some planets appear on top of another ones. I'm trying to solve this problem with Collision detection and Colliders, but it doesn't seem to work. How to solve this problem? Maybe there is a better and easier way to do this?

Here is the code I use:

Instantiating:

for (int i = 0; i<planet_one_count; i++) {
            var planets = Instantiate (planet, new Vector3 (Random.Range (-9.0F, 9.0F)+(Random.value), Random.Range (-4.0F, 3.0F)+(i*Random.value), 0), new Quaternion (0, 0, 0, 0)) as GameObject;
            planets.transform.localScale = planets.transform.localScale*Random.Range(0.75f,1);
                }
        for (int i = 0; i<cometcount; i++) {
            var comets = Instantiate (comet, new Vector3 (Random.Range (-9.0F, 9.0F)+(Random.value), Random.Range (-4.0F, 3.0F)+(i*Random.value), 0),Quaternion.Euler(0,0,Random.Range(-34,-24))) as GameObject;
            comets.transform.localScale = comets.transform.localScale*Random.Range(0.75f,1);
        }
        for (int i = 0; i<planet_two_count; i++) {
            var planets_two = Instantiate (planet_two, new Vector3 (Random.Range (-9.0F, 9.0F)+(Random.value), Random.Range (-4.0F, 3.0F)+(i*Random.value), 0), new Quaternion (0, 0, 0, 0)) as GameObject;
            planets_two.transform.localScale = planets_two.transform.localScale*Random.Range(0.75f,1);
        }

Collision:

void OnCollisionStay2D(Collision2D coll){
    coll.gameObject.transform.position = new Vector3(coll.gameObject.transform.position.x+0.1f,coll.transform.position.y+0.1f,0);
}

sentences:
alpha test shader 'discard' operation not working - GLES2 I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6).
I think is not working at all cause I don't see any change with or without it.
Is there anything Im missing?
Any syntax error?
I know its better not using if in shader but for now this is the solution I need.

precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;

        //0 - CMPF_ALWAYS_FAIL,
        //1 - CMPF_ALWAYS_PASS,
        //2 - CMPF_LESS,
        //3 - CMPF_LESS_EQUAL,
        //4 - CMPF_EQUAL,
        //5 - CMPF_NOT_EQUAL,
        //6 - CMPF_GREATER_EQUAL,
        //7 - CMPF_GREATER

        bool Is_Alpha_Pass(int func,float alphaRef, float alphaValue)
        {
            bool result = true;
            if (func==0)
            {
                result = false;
                break;
            }

            if (func==1)
            {
                result = true;
                break;
            }
            if (func==2)
            {
                result = alphaValue < alphaRef;
                break;
            }
            if (func==3)
            {
                result = alphaValue <= alphaRef;
                break;
            }
            if (func==4)
            {
                result = alphaValue == alphaRef;
                break;
            }
            if (func==5)
            {
                result = alphaValue != alphaRef;
                break;
            }
            if (func==6)
            {
                result = alphaValue >= alphaRef;
                break;
            }
            if (func==7)
            {
                result = alphaValue > alphaRef;
                break;
            }
            return result;
        }

void FFP_Alpha_Test(in float func, in float alphaRef, in vec4 texel)
{
    if (!Is_Alpha_Pass(int(func), alphaRef, texel.a))
        discard;

}

sentences:
Calculate smooth transition between local space angles I'm trying to calculate direction of moving character (to rotate it's animation).
I have something like this:

Character can have 4 cardinal directions. The rotation is calculated from the current cardinal direction.
So for example For north we have -90 degrees from N to W and 90 degrees from N to E.
From E to N we have -90 degrees and from E to S we have 90 degrees.

The problem occurs when character is switching directions.It happens at about half the distance between cardinal directions. At this point current rotation is switching from negative to positive number (or other way around), and there is noticeable hitch. When for example going from E to N, it switches to N direction but it was at about -45 degrees which in N space it places for a frame or two between N and W directions.

Why do I calculate angles in cardinal direction space ? Animations are prepared for strafing or moving backward (or any other angle) and I need to assume that the direction of animation is 0 degrees and calculate from here.

Is there way to smoothly change angle between cardinal directions ?

For now I tried to lerping between them when switching (which improved overall look but is far from smooth transition), tried to  track from which direction the switch is coming, but it didn't really improved anything.

FVector Right = Character->GetActorRightVector();
FVector Forward = Character->GetActorForwardVector();
FTransform Transform = Character->GetTransform();
FVector CurrentAcceleration = CMC->GetCurrentAcceleration();
FVector CurrentVelocity = CMC->Velocity;

FVector AccelerationDirection = CurrentAcceleration.GetSafeNormal2D();
FVector VelocityDirection = CurrentVelocity.GetSafeNormal2D();

FVector LocalAcceleration = Transform.InverseTransformVectorNoScale(AccelerationDirection);
FVector LocalVelocity = Transform.InverseTransformVectorNoScale(VelocityDirection);

float DeltaTime = Output.AnimInstanceProxy->GetDeltaSeconds();

float Atan2Angle = FMath::Atan2(LocalVelocity.Y, LocalVelocity.X);
const int32 ChildIndex = FMath::RoundToInt((Atan2Angle * 2 / PI) + 4) % 4;

float VelAngle = FMath::RadiansToDegrees(VelQuat.GetAngle());
float OldOrient = CurrentOrient;

EFCardinalDirection Dir = static_cast<EFCardinalDirection>(ChildIndex);
EFCardinalDirection OldDir = static_cast<EFCardinalDirection>(OldDirection);

float DirDot = 0;
//main switch wihin which I determine from where calculate angle.
switch (Dir)
{
case EFCardinalDirection::N:
{
    FQuat ForwardQuat = FQuat::FindBetween(Forward, CurrentVelocity);
    float OrientN = FRotator(ForwardQuat).Yaw;
    CurrentOrient = OrientN;// FMath::FInterpConstantTo(OldOrient, OrientN, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::E:
{
    FQuat LeftQuat = FQuat::FindBetween(Right, CurrentVelocity);
    float OrientE = FRotator(LeftQuat).Yaw;
    CurrentOrient = OrientE;// FMath::FInterpConstantTo(OldOrient, OrientE, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::S:
{
    FQuat BackQuat = FQuat::FindBetween(Forward*(-1), CurrentVelocity);
    float OrientS = FRotator(BackQuat).Yaw;
    CurrentOrient = OrientS;
    break;
}
case EFCardinalDirection::W:
{
    FQuat RightQuat = FQuat::FindBetween(Right*(-1), CurrentVelocity);
    float OrientW = FRotator(RightQuat).Yaw;
    CurrentOrient = OrientW;// FMath::FInterpConstantTo(OldOrient, OrientW, DeltaTime, 300.0f);
    break;
}
default:
    break;
}

sentences: Approaches on 2D top-view racing game track design I've finished programming the car (acceleration, etc) and now I'll start developing a track editor of some sort. The thing is: I have no idea how I'm going to do that. How would you do it? Perhaps design the tracks on GIMP and use some sort of pixel collision detection, or perhaps use multidimensional arrays to store track data like walls and "dirt". I'm open to suggestions.

sentences:
How to store information about a simulated sport match in a browser game? There is a browser game called Soccerstar where users play in a soccer team and compete in matches against other teams. Matches are scheduled at specific times of the day and played automatically and when the user logs in he can watch an animation representing the last played match.

Now, I want to implement a similar feature: a match is simulated on the server based on the players statistics and tactical choices and the information about the match progression is stored in the database. Please note that I want the outcome of the players actions (tackles, shots etc.) not to be completely deterministic because I want to introduce some randomness.
Once the match has been simulated and stored, the client can retrieve the information and generate the animation at any time.

My main doubt is how to represent and store the information about the match progression: what would be the smartest way to do it?

sentences:
How to emulate Mode 13h in a modern 3D renderer? I was indulging in nostalgia and remembered the first game I created, which used Mode 13h.

This mode was really simple to work with, since it was essentially just an array of bytes with an element for each pixel on the screen (using an indexed color scheme).

So I thought it might be fun to create something nowadays under these restrictions, but on modern hardware. The API could be as simple as:

public class Mode13h
{
    public byte[] VideoMemory = new byte[320 * 200];
    public Color[] Palette = new Color[256];
}

Now I'm wondering what would be the best way to get this data on the screen, using something like XNA / DirectX / OpenGL.

The only solution I could think of was to create a texture with the same size as the VideoMemory array, write the contents of VideoMemory to it every frame, then render that texture in a full screen quad with the correct aspect ratio and using point texture filtering for that retro look.

Is there a better way?

sentences:
Shader - Calculate depth relative to Object I am trying to calculate depth relative to the object.Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL

varying float distToCamera;

void main()
{
    vec4 cs_position = glModelViewMatrix * gl_Vertex;
    distToCamera = -cs_position.z;
    gl_Position = gl_ProjectionMatrix * cs_position;
}

With this example the depth is relative to the camera.But I would like get the depth relative to the object. I would like the same depth and value if I am near from the object or if I am far.

Here is an example of what I am trying to achieve. On the left you can see that the depth is relative to the camera. And on the right even if the camera moves back from the object, the depth remains the same because it is dependant to the object.

sentences:
How to create high quality and fast portal effect? EDIT:
So I've gotten the portal visual effect working with no performance hit, and I've got the physics set up of objects with rigidbodies moving through portals seamlessly, and objects with character controllers moving through it seamlessly. The only thing I'm trying to figure out now is blending two camera views to get the proper first person transition effect. Any ideas on how I'd blend those two? I'm thinking something using a depth only shader, or the normalized viewport rect. My main problem is calculating that in real time, and with angles.

So I've been working on creating a portal effect in Unity3D. Obviously I've taken Valve's Portal as a great influence to programming this. Currently I'm simply using a camera's rendertexture to get the graphical effect across, and then some code to do the rest. The problem is at 2048x2048 it looks as high quality as Portal's, but causes heavy FPS loss. To solve this I'd either have to lower the texture quality or the number of times I update the texture.

Valve has accomplished a high quality portal effect without causing high frame rate loss. How can I do the same? Does anybody have any good ideas for rendering to a high resolution texture without causing frame loss?

I'm considering making my own code for rendering to textures rather then using Unity's built in system, it's doable but would definitely be a hassle. So any thoughts, ideas, or suggestions are highly appreciated.

sentences:
Alpha Value at 0 Shows Black for Android Canvas Bitmap There have been a few questions similar to this but none seem to give a straight answer. If I am creating a Bitmap from a .png image and want to set a color (i.e. true pink) to transparent, the color turns black instead. I am using get and set pixel methods, iterating through an array of pixel colors.

The method I wish to accomplish this in is as follows:

public Bitmap getFormattedBitmap(Bitmap bm, int newHeight, int newWidth, int r, int g, int b, int a) {
int width = bm.getWidth();
int height = bm.getHeight();
int pixNum = width * height;
int[] pixels = new int[pixNum];
int scaleWidth =  newWidth * width;
int scaleHeight = newHeight * height;

bm.getPixels(pixels, 0, width, 0, 0, width, height);

for(int k = 0; k < height; k++) {
   for(int j = 0; j < width; j++ ) {
        int red   = Color.red(bm.getPixel(j, k));
        int green = Color.green(bm.getPixel(j, k));
        int blue  = Color.blue(bm.getPixel(j, k));
        int alpha = Color.alpha(bm.getPixel(j, k));
        int index = k * width + j;

        if(red == 0 && green == 0 && blue == 0 && alpha == 255) {
            pixels[index] = Color.argb(a, r, g, b);
        }
        else {
            pixels[index] = Color.argb(0, 255, 255, 255);
        }
    }
}

bm.setPixels(pixels, 0, width, 0, 0, width, height);

Bitmap resizedBitmap = Bitmap.createScaledBitmap(bm, scaleWidth, scaleHeight, true);
return resizedBitmap;

}

As you can see, I am using the Color.argb() method to set the alpha to 0, but in reality, it just shows those parts as black on the screen. I recognize bitmaps don't take kindly to alpha channels (unless you configure it to ARGB_8888), but this has me stumped.  It is also interesting to note that I do have SOME control of alpha via the Color.argb() method, it is just if it is too close to 0 it turns black anyway. Something in that method or whatever I am doing does not like full transparency apparently.

sentences:
XNA 4.0 Model into parts is there a way to split a .fbx model into parts, and move those parts individualy in XNA 4.0 ?

Thanks

sentences: How to get the file location of missing sprite in unity? I accidentally moved some of my sprites and now I can't remember where they were originally. Now in Unity, it says missign - sprite. So can't I get the location saved in scene file??? i.e. if it is referring to Desktop\file.extension and I move it to Desktop\files\file.extension, can I get Desktop\file.extension in Editor???

sentences:
Why does my frames per second function return inconsistent results? I have a FPS function that:

private static void runGameFPS2() {
    long beginTime; //The time when the cycle begun
    long timeDiff; //The time it took for the cycle to execute
    int sleepTime; //ms to sleep (< 0 if we're behind)
    int fps = 1000 / 40;

    beginTime = System.currentTimeMillis();

    //Update game state
    updateGame();
    //Render state to the screen
    renderScreen();

    //Calculate how long did the cycle take
    timeDiff = System.currentTimeMillis() - beginTime;

    //Calculate sleep time
    sleepTime = fps - (int)(timeDiff);

    if (sleepTime > 0) {//If sleepTime > 0 we're OK
        try { Thread.sleep(sleepTime); }catch(InterruptedException e){}
    }else{
        //suppose will not be
    }
}

public static void main(String[] args){
    while(true){ runGameFPS2(); }
}

When I run my code, Java works at different speeds on same computer or on different computers.

How can I write a consistent code, that Java will always work "same time" (for example 40 FPS) on mycomputer or any computer?

Note: suppose sleepTime will never be sleepTime < 0

sentences:
Client projectile ignores camera Y-axis in multiplayer shooter I'm able to spawn the bullet and make it move. But the problem is, only the host can shoot the bullet in the way the camera is facing(takes both X-axis and Y-axis correctly). The client takes only the X-axis of the camera and keeps the Y-axis at zero.

Here's the code for spawning and applying velocity:

[Command]
void CmdFire()
{
    GameObject fb = Instantiate(fireBall, spawnPoint.position, spawnPoint.rotation);
    fb.GetComponent<Rigidbody>().velocity = gameObject.GetComponentInChildren<Camera>().transform.forward * fireSpeed;
    NetworkServer.Spawn(fb);
}

And the code for the camera attached to the player:

void Update()
{

    mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    //Horizontal Looking
    playerBody.Rotate(Vector3.up * mouseX);

    //Vertical Looking
    xRotation = xRotation - mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);

}

sentences:
Fire range arc behind buildings need some help with HLSL. Each charater in my game shows a fire range arc (which is a textured model) which show how far the guy can shoot, see

It looks ok, but I hate the fact that it shows even behing buildings. Now I already have a shader for rendering the Arc (where I only manipulate the u coordinate to achive oscilating effect) and I'm pretty sure that I can use the Shadow map approach for that - generate Shadow map as seen by the camera (my deferred renderer takes care of that), then when rendering the arc, compare current Depth to the one stored in shadow map and voila..

But I just can't get it to work. I know the theory, but I'm no expert in HLSL and shadow mapping...

Here is the code I have

...
float4x4 World;
float4x4 View;
float4x4 Projection;

float4x4 ObserverWVP; // of the character casting the arc

texture DepthMap; // as seen by the camera
...
struct VertexShaderInput
{
    float4 Position : POSITION0;
    float2 TextureCoordinates : TEXCOORD0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 TextureCoordinates : TEXCOORD0;
    float4 Observer : TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    output.Observer = mul(input.Position, ObserverWVP);

    output.TextureCoordinates = input.TextureCoordinates;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    ...

    float2 temp = (input.Observer.xy / input.Observer.w) * 0.5 + 1; // half pixel
    float depth2 = tex2D(DepthSampler, temp);
    float depth = input.Observer.z / input.Observer.w;

    if (depth < depth2)
    {
        discard;
    }

    return c;
}

And the ObserverWVP calculated in XNA

Matrix ObserverWVP = boneTransforms[mesh.ParentBone.Index] * worldMatrix // world
                        * Matrix.CreateLookAt(pos, pos + direction, Vector3.Up) // view
                        * Camera.Instance.ProjectionMatrix; // projection

Note that the direction vector is not normalized - it signifies the entire vector from the source (the character) to the outter edge of the arc.

I'm guessing the pixel shader is wrong. But I have no idea how to modify it. Any suggestions?

sentences: SDL 1.3 on Windows 7. Better hardware,lower FPS I've just moved from one PC to another.I've been developing a game in SDL with SDL_image and SDL_ttf for about one year. On my old pc, I had about 90 FPS on my game, but now I have about 30, witch I find very strange. My Question is: Why do my FPS dropped from 90 when I used an inferior PC (on windows xp) to 30 when I have a way better PC (on windows 7).

sentences:
Can the GUI be used to create game objects? I want to be able to position 10 various game objects (sprites) within the area of the screen which will be dynamically sized accordingly to the screen size of the device. The area in which I want to position the items will be about 70% of the screen. The objects will be rectangles with irregular size (slightly irregular). The object should be positioned randomly (or in grid) within this area but they should not overlap. The objects will be a drop targets for other object which I will drag onto them.

To summarize I need:

The area in which I can place objects.
Random object position-er.

As I have been reading and watching various tutorials I have become very confused about how should I approach this.

Should I use a Rect to draw the area on which I will then place the objects, or should I use GUI/UI elements i.e. panel? Are the GUI/UI elements suitable for achieving this or are they meant to be only used to create games menus not for actual game play?

sentences:
How to edit and persist serializable Assets in the Editor Window? I have an asset saved in my project which represents a serializable scriptable object.
Code of the object is very simple:

using UnityEngine;
using System.Collections;

public class TestScriptable : ScriptableObject {
    public float gravity = .3f;
    public float plinkingDelay = .1f;
    public float storedExecutionDelay = .3f;
}

There is no problem changing values for this object in the inspector, and the changes do persist and survive after exiting → entering Unity.

I am trying to mimic the inspector behavior in an Editor Window. But any changes I do in the Editor Window, though reflected in the Inspector, do not persist.
Here is my two scripts which lay inside the Editor folder:

the first one (auxiliary) - this script replaces inspector fields (see image above) with button, which calls my custom EditorWindow.

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(TestScriptable))]
public class TestScriptableEditor : Editor {
  public override void OnInspectorGUI() {
    if (GUILayout.Button("Open TestScriptableEditor"))
      TestScriptableEditorWindow.Init();
  }
}

the second (with my problem) - script, where I'm trying to change my asset values:

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class TestScriptableEditorWindow : EditorWindow {
    public static TestScriptableEditorWindow testScriptableEditorWindow;
    private TestScriptable testScriptable;

    [MenuItem("Window/TestTaskIceCat/TestScriptableEditor")]
    public static void Init() {
        // initialize window, show it, set the properties
        testScriptableEditorWindow = GetWindow<TestScriptableEditorWindow>(false, "TestScriptableEditorWindow", true);
        testScriptableEditorWindow.Show();
        testScriptableEditorWindow.Populate();
    }

    // initialization of my troubled asset
    void Populate() {
        Object[] selection = Selection.GetFiltered(typeof(TestScriptable), SelectionMode.Assets);
        if (selection.Length > 0) {
            if (selection[0] == null)
                return;

            testScriptable = (TestScriptable)selection[0];
        }
    }

    public void OnGUI() {
        if (testScriptable == null) {
            /* certain actions if my asset is null */
            return;
        }

        // Here is my tries to change values
        testScriptable.gravity = EditorGUILayout.FloatField("Gravity:", testScriptable.gravity);
        testScriptable.plinkingDelay = EditorGUILayout.FloatField("Plinking Delay:", testScriptable.plinkingDelay);
        testScriptable.storedExecutionDelay = EditorGUILayout.FloatField("Stored Execution Delay:", testScriptable.storedExecutionDelay);
        // End of the region of change values
    }

    void OnSelectionChange() { Populate(); Repaint(); }
    void OnEnable() { Populate(); }
    void OnFocus() { Populate(); }

}

My questions is: what am I doing wrong? What could be the problem? How to fix it?  Am I loading the asset wrongly in the Editor Window? Or what?
Any help/ideas would be appreciated.

sentences:
How do I use TextureRegion? I can't understand how to use texture region.

I have a png file which has images (sprite sheet) and I must "extract" every image I want.

From here it just says TextureRegion(texture, 20, 20, 50, 50);

Where 20, 20, 50, 50 describes the portion of the texture,

How can I find which portion has the image I want to extract?

Should I open the png file with Gimp for example? And then I am search for some coordinates? And if yes, how?

sentences: Why don't we use the whole color depth for normal maps? All normal maps I've seen are pinkish or bluish. It seems like only a small color range is used. Why do game developers give away so much precision?

sentences: Star glowing shader graph How could I make a shader graph that makes spheres that look like on this image? I'm new to shaders and I don't know how to do this. Also, if it's possible I would like a property to change the glowing intensity

sentences:
Can I use music I made in GarageBand or FL Studio in a commercial game? I'm a beginning developer and I'd like to make music for my game. I've searched this question on the site, and when it comes to music in games, I see many people suggesting programs like FL Studio, Reaper, GarageBand, etc.

What are the legal implications of using music made with them in a commercial game? Is it okay to use music I've created on my computer with one of these programs (I was thinking of FL Studio) in a game I plan to profit from?

sentences:
Can I force a manually created texture to not be divided with low quality? I have a texture that I have created that looks something like this:

.

This is a very low texture map, but it helps me in a shader that I'm making that distinguishes between land and ocean, the ocean tiles do different things than the land. To try and figure out what was going on, I used the shader to turn the ocean, as defined by the mask, black. Note that this image doesn't match the ocean texture example from above, but it's the best I had...

The ocean is a binary color, either it is ocean or isn't, and is set appropriately. But what I'm actually seeing is that if the 2x2 tile area has mixed land/ ocean, the value is averaged.

What I've noticed is that the pixels were combining together, a 2x2 pixel area was averaged. After tracing through this for some time, I discovered that the issue was a quality setting that reduced the resolution of certain images.

There are some images that I don't mind lowering the resolution of, but images such as this one I absolutely don't want to lower the resolution. Is there a setting that I can add to a runtime generated texture to tell it not to reduce it's resolution if requested to by the quality settings?

EDIT: Code fragments to produce the results above. It's kind of hard to pull just the fragments that produce this code and not produce an overwhelming bit, but hopefully this will do.

Code to generate textures:

Color32[] windMask=new Color32[world.width*world.height];
for (int x = 0; x < world.width; x++)
{
    for (int y = 0; y < world.height; y++)
    {
        windMask[x + world.width * y] = world.Tiles(x, y).baseType == Tile.BaseType.Ocean?new Color32(255,255,255,255):new Color32(0,0,0,255);
    }
}

sharedMaterial.SetTexture("_WindMask", TextureUtilities.TextureFromColors(world.width, world.height, windMask, FilterMode.Point));

public static Texture2D TextureFromColors(int width, int height, Color[] colors, FilterMode filterMode = FilterMode.Trilinear)
{
    Texture2D texture = new Texture2D(width, height);
    texture.SetPixels(colors);
    texture.filterMode = filterMode;
    texture.Apply();
    return texture;
}

The Shader code:

o.Albedo *= 1 - tex2D(_WindMask, IN.uv_MainTex).r;

The "Fastest" quality settings that show the issue:

The "Fantastic" quality, which correctly isolates the ocean.

Image of the correctly isolated ocean:

The issue is the "Texture Quality", which you will note for the fastest setting is half resolution. I would really like to keep the ability to use lower resolution in the game, but have a few textures that do not use the lower resolution if the quality settings change.

sentences:
Anchor a health bar to a character/enemy I have a game I'm working on where the player can see the health bars of the player's avatar and other creatures in the game.  I want this health bar to always follow the character/creature around.  However, I can't figure out how to do this.  I thought having the position change when the respective object moved would do the trick, but apparently, it doesn't.  When watching the health bar's transform, however, it shows that it is moving with it's respective object but I don't see it on the game screen.  Can anyone explain how I go about accomplishing this?  Here's the Dropbox link to the project.

HealthBar Script

public class EnemyHealthBar:MonoBehaviour{
    public Texture2D healthBar;
    public Texture2D health;
    public Rect healthBarPosition;
    public Rect healthPosition;
    public GameObject monster;

    void Start(){
    }
    void Update(){
        transform.position = new Vector3(monster.transform.position.x, monster.transform.position.y, monster.transform.position.z);
        Debug.Log(transform.position);
    }
    void OnGUI(){
        GUI.DrawTexture(healthBarPosition, healthBar);
    }
}

Video of what's currently happening

Dropbox Link

sentences:
Raycasting center of camera is not working: why? In my game i'm using Unity First Person controller.
I check every second what I am looking with the following code:

 cam = Camera.main;
 RaycastHit hit;
 Vector3 CameraCenter = cam.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, cam.nearClipPlane));
 if (Physics.Raycast(CameraCenter, transform.forward, out hit, 5))
 {
      WhatIamLookinTag = hit.transform.tag;
 }

The problem is that isn't working if move Up and down player "view" (so i move up and down mouse..)

I need the object that is in screen center (based on what am i looking).

Why ?

sentences:
Upgrades in game with leaderboards? I am working on an endless mobile game right now and I'm currently in the designing phase. Most (or all) mobile games especially endless ones now have leaderboards and a player's position in the board is determined by their score. I want to implement a store from which people buy upgrades, new cool stuff that help them gain more score. Will this cause an unfair leaderboards. Should I remove the upgrades and replace them with only customizations in the store like clothes that don't affect the score?

Thanks in advance.

sentences:
Why is the Hiero font not coordinated to fit neatly in the display window? I imported a font with Hiero and I draw the font like:

font.draw(batch, "1", 0, 48);

This is the resultant image:

So the font it moved up to hit the bottom perfectly, but it doesn't touch the left side perfectly. Why does this happen? Is there a way I can fix this? It seems like if I set the x coordinate to -3 it works, but this seems somewhat arbitrary. Any ideas?

sentences: Is it legal to copy stats and abilities of characters from another game? Is it legal to copy stats and abilities of characters from another game?.Please note that my game does have a similar gameplay to the game I am copying. My characters will look different of course.

sentences:
TileMap or Voxel collision detection I have a conceptual question:
In the case of Tile Map, each block has the information from the enemies who are going about it. But what if some of these enemies are far greater than the block?
I have to have the same element in each of the information blocks?
And updating the position must clear each block?
If I have large and small enemies, it means that each block will have a list of enemies?

Now, in the case of Voxel Map:
In Minecraft, for example, its character and most enemies x and z dimensions is smaller than one block, but its height (y) is greater than one block.
This means that these elements will record information in two blocks? and in the case of a "Gast," which is much larger?

I'm using Google Translate, so sorry if my english is very bad.
Thanks in advance.

sentences:
Pointer deleted by object manager on next frame I have a class named GameManager, which job is to manage GameObject allocation and deallocations. The thing is, every GameObject can interact with each other, so there's a possibility that a pointer to another GameObject in a GameObject's script becomes deleted by manager the next frame. (Something like a missile, the missile's target may be already destroyed by another object)

I can't use shared pointer because there are times where a GameObject should be removed, but can't be removed because a GameObject won't release. What is a good design pattern to tackle this problem? Or should GameObject check for null each time?

sentences:
Lighting in Unreal is not fluid, lighting changes drastically at object "borders"? I used the starter content's wall objects, an atmospheric fog, a directional light and this is the result:

As you can see, it's obvious where the new object starts.

Why?

sentences:
Player jitters when Jumping at object edges So I have a bit of an issue with my Player controller script. Everything works fine except with very specific jump cases. If I jump at an object and I don't reach the top edge I will just fall normally with no issue. However, when the object is short enough for me to possible jump on top of it, if I collide with its side when jumping my player will halt in that spot, jitter for a second and then fall normally.
Here is my code:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThirdPersonPlayerController : MonoBehaviour
{
    public CharacterController controller;
    public Transform camera;
    public Transform groundCheck;

    Vector3 direction;
    Vector3 velocity;

    public float moveSpeed = 10f;
    public float turnSmoothTime = 0.1f;
    private float turnSmoothVelocity;
    public float gravity = -39.24f;
    public float groundDistance = 0.4f;
    public float jumpHeight = 3f;

    public LayerMask groundMask;
    private bool isGrounded;

    // Update is called once per frame
    // Unity is currently working on a new input system***
    private void Update()
    {
        IsPlayerGrounded();

        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");
        direction = new Vector3(horizontal, 0f, vertical).normalized; // direction player is moving

        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            Jump();
        }

        MoveAndRotate();
        Gravity();
    }

    private void MoveAndRotate()
    {
        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + camera.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDirection = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            controller.Move(moveDirection.normalized * moveSpeed * Time.deltaTime);
        }
    }

    // Implemented proper gravity from /_\ y = 1/2g * t^2
    private void Gravity()
    {
        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);
    }

    // Check if player is grounded and reset velocity
    private void IsPlayerGrounded()
    {
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }
    }

    private void Jump()
    {
        velocity.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
    }

    // Current issue (Not yet fixed): When jumping against a wall the player will stick/jitter (starts to jitter at the top edge).
}

Here is a visual representation of what I mean by colliding near its top edge

Any help at all is greatly appreciated. Note: I thought it had something to do with objects having the Ground layer attached to them, but the bug is still present if they don't have a layer.

sentences:
XNA and C# Draw method question If I missed the answer to this question being already posted I apologize but I was unable to find it.

I'm new to C# and XNA and converting a VB game I created into them. Im finding a problem I'm not sure how to get around.

I'm using a generic list that contains information about nonplayer characters including the Graphic, Vector2, Rectangle. I'm reading this information from a file. So I have a class to receive all the information then I add it to the generic List. It then passes that information back to the main Game1.cs.

My problem is when it gets to the Draw method after loading all the information into the generic List<> the other methods in the main see the list EXCEPT the Draw and Update methods. I thought this would be because of the protected status of those methods but it will not let me change them to public.

So to sum up NPCClass.cs creates a class to accept the information. LoadLevel.cs reads from a text file and loads a instance of the NPCClass and adds it to a generic list of the NPCClass that is contained in the Game1.cs. The Draw Method in Game1.cs will not see the generic List even tho I have it publicly declared in Game1.cs main.

Thank you for any help and if i'm going at this completely incorrectly please don't hesitate to tell me.

sentences:
Why set the position of both b2Body and Box2DSprite? In a game, we add a body for each sprite, the method is:

createBodyAtLocation:(CGPoint) forSprite:(Box2DSprite*)sprite

In which we create the body and we attach it to the sprite in parameter: sprite.body = body;

Then we set the position of the body, but later on in the code, in the update method, we also set the position of the sprite to the same position as the body. I was wondering: Why are we doing it twice? As we already set the position of the body in the world, and we made a link between the two with sprite.body?

sentences:
GLFW - Camera rotation system I need to make a camera rotation system similar to the one here

http://madebyevan.com/webgl-path-tracing/

To rotate, press the Left mouse button and drag. So far I figured a basic idea of how this could be implemented.

Note that although it looks like the scene is rotating in front of the camera but in my case I want to rotate the camera instead. Since the scene contains hundreds of thousands of triangles and I wouldn't wanna apply a matrix operation to each of them.

I have represented my camera by a 4x4 matrix. The columns from 1 to 4 are side, up, look at and eye respectively.

So here's what I thought so far.

1) Subtract old cursor position from new cursor position. Doing this for X and Y we get a direction vector as to where the mouse is headed.

2) Invert this direction. And translate the camera a little in this direction. So if the mouse is headed right, the camera heads left. This is done by checking the components of the direction vector.

if (dir.x < 0)
    cam.eye += side
if(dir.x > 0)
    cam.eye -= side
if (dir.y < 0)
    cam.eye += up
if(dir.x > 0)
   cam.eye -= up

Note the translations are inverse. If less than zero than add the side vector instead of subtracting it.

3) Now find a vector perpendicular to it. So if the mouse was headed left or right the vector perpendicular to it is the Y axis. I calculate this by taking the cross(vec(0,0,1), direction_vector). Note this is not the inverse but the actual direction vector.

4) Rotate the camera a little along this perpendicular axis a little.

If you imagine these operations for the X axis. This feels like the camera is moving in some sort of circle around the scene. That is, the camera translates a little, then rotates. Next time it translates by adding the side (which was changed when it first rotated) it moves a little diagonally. In this way it feels like it rotates in a circle.

So this works somewhat fine for pure X and Y rotation and upto a certain extent. Fails when i move the mouse diagonally or in Pure X/Y rotation when I go beyond a certain point probably 90 degrees.

Any advice or suggestions? I am not using OpenGL instead doing this with GLFW and GLM. The renderer is a raytracer/pathtracer.

sentences:
Do I need to obtain a license to use real car brands in a game? We are small team which working on car racing game but we don't know about licensing process for branded cars like Nissan, Lamborghini, Chevrolet and etc.

Do we need to buy any licence for using real car brand names, models, logos,... or we can use them for free?

Second option we think about using not real brand with real models is it possible?
If someone have experience with that, fell free to share it.
Any information about that is welcome.

sentences:
How to make UI image bounce back and forth inside another UI image? I've been trying to create a battle system for my game, and I've been trying to get a UI image to bounce back and forth inside another image, but for some reason, the UI image goes out of the other UI and bounces back, like so:

Here's the script I add to the moving arrow image, in order to make it bounce:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JumpSystem : MonoBehaviour
{
    private Vector2 startPosition;
    public int speed;

    // Start is called before the first frame update
    void Start()
    {
        startPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = new Vector2(startPosition.x + Mathf.Sin(Time.time * speed), transform.position.y);
    }
}

Is there any way I can prevent this incident from occurring? Please help me understand this and thank you in advance.

sentences:
Progressively loading the racing arena in a 3D driving sim I need advice and resources on a 3D car simulator.
I want to progressively load the track for the player as I'm thinking of porting the game to mobile devices.
This seems too difficult to me as I'm trying to separate the racing arena model design and the code as much as possible. Is there a structured method for achieving that for any model (arena/map). I think this is something that comes up a lot in games in general not just this instance.

sentences:
How to gain visibility on the Play Store? 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?

sentences:
What are some low-level performance tweaks for iPhone games written in c? I'm interested in some performance tweaks for a relatively simple OpenGL ES based 2D iPhone game.  What performance tweaks have you found?  The performance of the game is pretty good on most devices (3G, 2nd gen touch, and iPhone 4)... But I still want to give the user the best experience possible.

p.s. I'm still using OpenGL ES 1.1

sentences:
Tire mesh rotates faster than wheelcollider in Unity I have a car in Unity. Scripts are C#. I have noticed that my tire meshes' rotation is faster than whellcollider rotation. I am using this code for wheel rotation

 flWheel.localEulerAngles = new Vector3(flWheel.localEulerAngles.x, flWheelCollider.steerAngle - flWheel.localEulerAngles.z, flWheel.localEulerAngles.z);
 frWheel.localEulerAngles = new Vector3(frWheel.localEulerAngles.x, frWheelCollider.steerAngle - frWheel.localEulerAngles.z, frWheel.localEulerAngles.z);

 flWheel.Rotate(flWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 frWheel.Rotate(frWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 rlWheel.Rotate(rlWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 rrWheel.Rotate(rrWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);

I found this from here

Does anyone know how to fix this?

Edit:

Using AquaGeneral's answer I could able to solve rotation problem. But now front right tire position changed to rear left tire position and  rear right tire rotated 180 on Y axis. need help

sentences:
When should I make different LODs? This is something I have been discussing with my team as to how we should approach it on our project.

The question is, what is better practice, make your model already with different Levels of detail, importing everything in one go, or importing the base model on the game and only then making LODs for it later?

sentences:
Need some advice on a java api to use for a 'presentation display board' - based on game 2d/3d tech As part of the project i am working on I am looking to produce some software that works on a LCD display (think call center info boards) and displays various graphs (the bars grow etc in realtime, so incoming call stats etc etc) and flicks between various 'plug-ins'.

I asked before, and WPF was suggested, and it looks excellent.. However i really need to keep to Java (work standards).. So the question is what XNA style API is the best for this, I can see that JMonkey etc seem to provide 3d stuff, but I also need sprites etc.

For example: Think, defused 3d planet rotating in the background, while call stats are printed over the top.

sentences:
How to do placeable electricity cables that work like the ones in "Prison Architect" I would like to know one (of the probably many) ways to code a (sort of) Prison-Architect-ish electricity cable building system.

Here's a picture of what I mean:

How can I detect that cables are connected?
How can I detect if the block it's connected to is a power source?

And these 2 (above) will all be placed inside a dictionary when they are placed.

That dictionary does not yet have a key type, but the second type is a sprite.

How should I do this?

sentences:
How to make score points based on time So the idea is simple.
a) Players why finish the level faster, should get higher score.
b) The levels (1 to N) where every next becomes more difficult should impact the score.
So it's kind of mix of "time to complete" and "level number".
If would know the fastest possible time the user can complete the level, I would do the fallowing:
a) If player completes the level in fastest time, it gets max score 100.
b) If it takes, for example, twice as long I divide by 2 and get 50.
c) Then I multiple by the level number assuming that every next level is twice as difficult.
Example: Player completes level N two times slower than fastest time, so: Score = 100/2 * N = 50N
But the problem is that I can't really figure out the this fastest time for each level, because my game is a complex randomized 4d maze and I have no idea how fast a pro gamer can complete it to define the max score. And without that I have no idea how to calculate the score.
This question is all about: "Can we figure out the score without knowing the fastest time"
Any help appreciated.

sentences:
Shader Graph - Surface type change Is there any way to control what surface type is used in shader graph insted of changing it in PBR Master?
I'm creating dissolve effect for albedo/emission/transparent surfaces (https://www.youtube.com/watch?v=taMp1g1pBeE). Then I'm making 3 materials based on that one shader that I can control with variables. It works fine for Opaque but when I want to use it for glass I need to change Surface to Transparent in PBR Master and Opaque surfaces are getting bugged due to Two Sided setting.
Can I control what type of surface is used based on some variable or maybe take it out to inspector as in standard materials?

sentences:
Integer vs String for "type" data in data-driven games I've been developing a few mobile games, in which those games fetch their data from a server-database.

I'm used to storing "type" values as an integer identifier, and an enum in the client to identify the data coming from the server.

I'm under the impression that games like MMOs or PC games that get patches model their data to identify "types" as integers.

As an example: On the database table:

Monsters Table: MonsterId(int), Name(string), MonsterType(int)

On the client-sided code:

typedef enum {
    MonsterTypeGround = 1,
    MonsterTypeAquatic = 2,
    MonsterTypeAmphibious = 3,
    MonsterTypeAerial = 4
}MonsterType;

Is there an objectively correct answer on what to use (int vs string) for these types of data?

Do I have the correct impression that MMO's usually use integers for this, or it highly depends on the developers as well?

sentences:
Weird member of float4 structure in the HLSL I have encountered a weird x.wwww component of the float4 x vector in a HLSL code. I haven't seen such a member or member function of float4 structures in HLSL, so please tell me what is the meaning of that. It is in the code of this pixel shader:

float4 PSConstantColor( PS_PARTICLE_INPUT input ) : SV_TARGET
{
   // Sample particle texture
   float4 vColor = g_baseTexture.Sample( g_samLinear, input.Tex ).wwww;

   // Clip fully transparent pixels
   clip( vColor.a - 1.0/255.0 );

   // Return color
   return vColor;
}

At first I thought it should be the w component replicated to all the members of the float4 vColor vector, but it does not make sense for the color value, does it?

sentences: What language was used to write Starcraft II? Total newbie question , but what language was used by blizzard to crate the Starcraft II game play? I've been playing it for the last couple of days , and I'm constantly astonished by the complexity and the performance of the game. Is it an in-house language , or do they use some flavor of a know language?

sentences:
Meshes exported from blender as .obj does not map correctly I am having some problems with developing my game in OpenGL with java (Using LWJGL3). I have been following a guide for the more complex steps of the process, like loading meshes.

When using the basic mesh of a cube that was provided by the guide it works as it should, so it seems like it is not my software that is the problem? The problem comes when I attempted to create my own models using blender. I made sure to triangulate faces and include normals when exporting, but for some reason even when I created a simple cube it does not work correctly. The textures get smeared, only one face is intact. I have both tried the automatic UV projection, and making my own seams.

I have been stuck on this for a while and I have no idea where I am doing something wrong. I would greatly appreciate some help.

sentences:
Make an arrow to point at a direction from UI I want to have a guiding arrow on the left side of UI. The arrow is child of the player's camera and it's rendered from another camera into render texture. The render texture is displayed on the screen. The arrow is rotated via transform.LookAt(targetPosition) The problem I'm having is that although it does point in the right direction, form player's point of view it looks like the arrow is pointing somewhere else.

I want that arrow to point from the point where it's placed on the UI. It should look something like this:

I tried to do this:
  Vector3 direction = targetPosition - _arrowRawImage.rectTransform.position;
_transform.LookAt(direction);
but it didn't work.

sentences:
Weird issue with Member Initializers C++ I'm making a game with C++ and SDL2. I have a class called "text" and a class called "buttonObj"

The constructor of "text" is a void function that takes an SDL_Color variable.

The first part of buttonObj looks like this:

string textContent;
text buttonText;
text highlighted_buttonText;

//Constructor
buttonObj(string tex, SDL_Color notHighlighted, SDL_Color highlighted) :
  textContent( tex ),
  buttonBase( img ),
  buttonText( notHighlighted ),
  highlighted_buttonBase( hI ),
  highlighted_buttonText( highlighted )
{}

Currently, this works, but I don't exactly know WHY it works. With a constructor initializer, the value outside the parenthesis gets assigned to the value within the parenthesis. So, how come an SDL_Color (i.e "notHighlighted") can get assigned to a text variable? (i.e buttonText)

I assume this is because with a class, the variable inside the parenthesis is a parameter of the constructor of that class. So, since the constructor of text takes an SDL_Color variable, the program treats "notHighlighted" as a parameter, rather than the regular one-line initializer. Right?

Speculation Aside, this works. From my console, I can see two "text" instances are constructed, one for "highlighted" and one for "notHighlighted". Once the texts are constructed, they remain as they should and render as they should later on in the code.

However, this isn't what I want... Instead of passing an SDL_Color into the constructor and having buttonObj turn the color into text, (via constructing it)  I want to load some text beforehand (elsewhere during runtime) and pass the text into buttonObj directly. Like so:

string textContent;
text buttonText;
text highlighted_buttonText;

//Constructor
buttonObj(string tex, text notHighlighted, text highlighted) :
  textContent( tex ),
  buttonBase( img ),
  buttonText( notHighlighted ),
  highlighted_buttonBase( hI ),
  highlighted_buttonText( highlighted )
{}

According to my knowledge of what one line initializers are SUPPOSED to do, "highlighted_buttonText" should become equal to the parameter "highlighted." So "highlighted_buttonText" is set to whatever the parameter "highlighted" is, since they're both of type "text"

However, this doesn't work. In my console, I see that the texts are constructed and then destructed! As if something is calling the destructor... this means that the variables don't work fine later on in the code. (And then I get a bunch of exceptions in the library I'm using for text rendering. It's a text chaching library based on SDL_TTF called SDL_FontCache)

I know this is a hard issue to explain and I might not be describing it well. But please, any advice would be awesome! Weird problems like this irk me...

sentences:
How can I implement versioning into a save system? I currently have a crude save system in my game.

When my game is first launched after download, it checks for three directories in a certain location on the client computer, user://save1, user://save2, and users://save3.

If these directories don't exist, they are created with some empty files player_data.save, level_data.save, persistence_data.save and meta_data.save.

Then, at periodic points in my game, these files are updated. (Which base directory is used depends on which save slot the player chose when they selected a new game, or loaded.)

I have read a lot  about  the importance of versioning to protect compatibility with saves (for example, here and here).

So,  how I can implement versioning into this save system to protect myself from incompatibilities when I inevitably release updates and patches to the game?

For example, is it advisable to create different save directories per game version, so that on boot you check if you have a save directory corresponding to your current game version? Or is it advisable to just have a single save directory and merely save a text file with the version number in the sub directories?

A structure like:

version_1_saves
    save1
    save2
    save3

version_2_saves
    save1
    save2
    save3

Or a structure like:

saves
    save1
        version.txt
    save2
        version.txt
    save3
        version.txt

And what do the checks look like when you do release an update and need to check for compatibility when a player boots the game or tries to load an old save?

sentences:
Would seam carving/liquid rescale make changing aspect ratios easier? Seam carving is an algorithm which allows for resizing images without major distortions. I think it might help to make games which would adapt to different aspect ratios/resolutions much easier. But am I right?

You can watch this presentation to see how seam carving works for videos.

sentences:
Taking cube from camera space to clip space, error in my math? watching Ken Joy's Computer Graphics lectures on youtube. One thing I'm confused about is after he gets the cube from the camera space to clip space, from my calculations the cube doesn't look like that. I expected the cube to look like that pink parallelogram in my picture, if we assume the Z of the front-face of the cube to be -4/3 and the back-face to be -2 then the Ws come out to be 4/3 and 2 respectively. So can someone explain how after multiplying by the viewing matrix, the cube comes out to look like how Ken has it.

Ken's view matrix:

After view matrix has been applied:

What I think the side of the cube should look like(the pink parallelogram) after view matrix has been applied:

my reasoning is, after the perspective divide by W, the blue and green vectors should get truncated to create that pink parallelogram. So I'm struggling to understand this. Thanks in advance.

sentences:
Showing the steps of a level generation process over multiple frames I seem to be misunderstanding part of Unity.  I'm generating a maze similar to the one here:  http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/

I put the whole of the generation in Update() and used a bool to ensure it only runs once.  However, right now the whole thing runs before the editor becomes available - it behaves exactly as if I had the whole thing in a Start() section.  Do I need to use coroutines to watch it build out?  In the link above, if you click the first demo box, you can watch the maze place itself and build.  I'd like to be able to see that in the scene view in Unity.  Thoughts?

Edit:

This is my Update() method currently:

void Update()
{
    while (_continue)
    {
      _continue = false;
      Dictionary<String, Tile> _dict = FetchTileList();

      Tile _wall = _dict["Wall"];

      for (int x = 0; x < width; x++)
      {
        for (int y = 0; y < height; y++)
        {
            var _go = Instantiate(_wall.gameObject, new Vector3(x, y, 0), Quaternion.identity);
        }
      }

      _addRooms();

      for (var y = 1; y < height; y += 2) {
        for (var x = 1; x < width; x += 2) {
            Vector2 pos = new Vector2(x, y);
            Rect _rect = new Rect(x, y, 1, 1);
            bool _add = true;

            foreach (var other in _rooms)
            {
                if (_rect.Overlaps(other))
                {
                    _add = false;
                }
            }

            if (_add)
            {
                _growMaze(pos);
            }
        }
      }
   }
}

sentences:
Networking with UDP, should I keep sockets open on the server I am working on making a 2D platforming game that will have multiplayer functionality. Over the last few days, I have done a lot of reading regarding how to deal with the networking, and believe that I am on the way to implementing some of the concepts I have read about.

I have decided to go with an Authoritative server/client model, where multiple clients will send actions made by the user to the server, client will predict the players next steps before comparing against the Authoritative reply from the server, etc. This seems to have been suggested in numerous corners of the web regarding games networking, and seems reasonable.

Before jumping straight into trying to get snapshots sent from the server, I wanted to make sure that I had an idea of some of the technical nuances of a language, as conceptual knowledge can only get me so far. I have set up a simple Echo Server that has worked rather well for a single client, but now my next step is to have multiple clients connected to the server at a single moment, and have each message that is sent from a client echoed to all clients connected to the server.

I feel that the answer might be language dependent, so I will mention now that currently I am using Java for the networking (a little bit of preliminary testing may suggest that Java has significant overhead in its network implementation, so I am open to change upon suggestion). I am using UDP for speed sake (and this seems to be what is predominantly suggested).

My question is with the server, should I be keeping each DatagramSocket that represents a connected client open and send DatagramPackets directly out without ever closing them (until the program terminates, client disconnects, etc.), and have them stored in some form of Collection, or should I close them after each message is sent and create a new outgoing socket whenever I need to send a packet? There are obvious performance disadvantages of creating a  socket whenever I need to send a message, but is there some fundamental reason that I have not come across that suggests leaving sockets open is not a good idea?

sentences:
How can I output multiple sprite sheets from a single .fla? I have to produce out three sprite sheets of differing sizes. To do so, I have three different .fla source files.

Obviously maintaining three files takes more time than maintaining one; is there some way that I can use one .fla and produce three differently-sized sprite sheets?

sentences: Minimalistic JavaScript sprite manipulation libraries Are there (or can someone recommend) any minimalistic JavaScript based libraries for sprite(s) manipulation? Preferably DOM oriented.

sentences:
Subdivision of a triangle in HLSL How can I subdivide a triangle more than once. I can not use recursion as directx 11 hlsl will not allow it. Are there any links to a HLSL code. This has to be done in the geometry shader as my book says.

my code that will subdivide once is:

  void Subdivide(VertexOut inVerts[3], out VertexOut outVerts[6])
{
    //          1
    //          *
    //         / \
    //        /   \
    //     m0*-----*m1
    //      / \   / \
    //     /   \ /   \
    //    *-----*-----*
    //   0     m2     2

    VertexOut m[3];

inVerts[0].PosL = normalize(inVerts[0].PosL);
inVerts[1].PosL = normalize(inVerts[1].PosL);
inVerts[2].PosL = normalize(inVerts[2].PosL);
// compute edge midpoints
m[0].PosL = 0.5f * (inVerts[0].PosL + inVerts[1].PosL);
m[1].PosL = 0.5f * (inVerts[1].PosL + inVerts[2].PosL);
m[2].PosL = 0.5f * (inVerts[2].PosL + inVerts[0].PosL);
m[0].PosL = normalize(m[0].PosL);
m[1].PosL = normalize(m[1].PosL);
m[2].PosL = normalize(m[2].PosL);

    // derive normals
    m[0].NormalL = m[0].PosL;
    m[1].NormalL = m[1].PosL;
    m[2].NormalL = m[2].PosL;

    // interpolate texture coordinates
    m[0].Tex = 0.5f * (inVerts[0].Tex + inVerts[1].Tex);
    m[1].Tex = 0.5f * (inVerts[1].Tex + inVerts[2].Tex);
    m[2].Tex = 0.5f * (inVerts[2].Tex + inVerts[0].Tex);

    outVerts[0] = inVerts[0];
    outVerts[1] = m[0];
    outVerts[2] = m[2];
    outVerts[3] = m[1];
    outVerts[4] = inVerts[2];
    outVerts[5] = inVerts[1];
}

void OutputSubdivision(VertexOut v[6], inout TriangleStream<GeoOut> stream)
{
    GeoOut gout[6];

    [unroll]
    for(int i = 0; i < 6; ++i)
    {
        // Transform to World Space
        gout[i].PosW = mul(float4(v[i].PosL, 1.0f), gWorld).xyz;
        gout[i].NormalW = mul(v[i].NormalL, (float3x3)gWorldInvTranspose);

        // Transform to homogeneous clip space
        gout[i].PosH = mul(float4(v[i].PosL, 1.0f), gWorldViewProj);

        gout[i].Tex = v[i].Tex;
    }

    //          1
    //          *
    //         / \
    //        /   \
    //     m0*-----*m1
    //      / \   / \
    //     /   \ /   \
    //    *-----*-----*
    //   0     m2     2

    // We can draw the subdivision in two strips:
    // strip 1: bottom three triangles
    // strip 2: top triangle

    [unroll]
    for(int j = 0; j < 5; ++j)
    {
        stream.Append(gout[j]);
    }
    stream.RestartStrip();

    stream.Append(gout[1]);
    stream.Append(gout[5]);
    stream.Append(gout[3]);

    }

[maxvertexcount(8)]
void GS(triangle VertexOut gin[3], inout TriangleStream<GeoOut> stream)
{
    VertexOut v[6];

    Subdivide(gin, v);

    OutputSubdivision(v, stream);
}

How can I subdivide twice or even three or four times.
thx

sentences:
Where should I put the SDL_Renderer* using the ECS with SDL2 and C++? So I'm still learning about ECS (Entity Component System) and whenever I'm thinking about the architecture and actual implementation, I just can't figure out where should I put the SDL_Renderer*.

So far what I've learned is that the Entity class should have its own unique ID, there should be a Component and System class and things like RenderComponent and RenderSystem should be derived from them. RenderComponent should contain all the data and the RenderSystem should contain the actual algorithms (correct me if I'm wrong so far).

I'm using C++ and SDL2 and I don't know how about you guys but I never really used more than one SDL_Renderer and I'm not intending to do so either. I always just create a renderer for the window and copy everything to that one renderer and than I present that renderer to the screen.
So my questions are:

In an ECS design like I explained above, where should I put my
SDL_Renderer?
What should the RenderComponent, and RenderSystem,    contain?

sentences:
Is there an HLSL equivalent to GLSL's "map" function? Google has not helped me in this area.

Here is the GLSL shader:

vec3 globalIllumination(vec3 p, vec3 n) {
vec3 g = vec3(0.0);
float dist;
for (float i = 1.0; i <= samples; i++) {
    dist = stepDistance * i;
float d =  vec3(dist - map(p + n * dist, returnColor));
    g += returnColor*d/ i;
}
return g;
}

I know how to convert this to HLSL, except for that map function. I could use some help.

sentences: Unity Rotations Not Following Local Nor Global Axis? In the gif below, you can see that rotating on X moves all 3 axis including the X axis. It's possible it's rotating on the global X rather than local X (hard to tell). But Y looks more like it's rotating on global Z and Z is quite clearly rotating on local Z. What is going on? Why is there no consistency?

sentences:
EXC_BAD_ACCESS error when box2d joint is destroyed When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line

world->DestroyJoint(weldJoint);

in the update method below:

    -(void) update: (ccTime) dt
{

int32 velocityIterations = 8;
int32 positionIterations = 1;

// Instruct the world to perform a single step of simulation. It is
// generally best to keep the time step and iterations fixed.
world->Step(dt, velocityIterations, positionIterations);

// using the iterator pos over the set
std::set<BodyPair *>::iterator pos;

for(pos = bodiesForJoints.begin(); pos != bodiesForJoints.end(); ++pos)
{

    b2WeldJointDef weldJointDef;

    BodyPair *bodyPair = *pos;
    b2Body *bodyA = bodyPair->bodyA;
    b2Body *bodyB = bodyPair->bodyB;

    weldJointDef.Initialize(bodyA, bodyB, bodyA->GetWorldCenter());

    weldJointDef.collideConnected = false;
    weldJoint = (b2WeldJoint*) world->CreateJoint(&weldJointDef);

    // Free the structure we allocated earlier.
    free(bodyPair);

    // Remove the entry from the set.
    bodiesForJoints.erase(pos);
}

for(b2Body *b = world->GetBodyList(); b; b=b->GetNext())    {
    if (b->GetUserData() != NULL)
    {
        CCSprite *mainSprite = (CCSprite*)b->GetUserData();
        if (mainSprite.tag == 1) {
            mainSprite.position = CGPointMake( b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO);
            CGPoint mainSpritePosition = mainSprite.position;
            if (mainSprite.isMoved) {

                        world->DestroyJoint(weldJoint);

                    }
            }
        }
    }

}

In the HelloWorldLayer.h I set the weldJoint with the assign property. Am I destroying the joint in the wrong way? I would really appreciate any help. Thanks

sentences:
How can I use OpenGL and D3D to render to the same window at the same time? I have main render loop in which initial drawing is done via OpenGL to an SDL window, and after that the same window handle is passed to a Direct3D device, which does subsequent rendering.

Once I execute the program it will initially draw the OpenGL scene, and then do Direct3D drawing but that latter drawing overwrites the OpenGL work.

What I want to see is both drawings in parallel. How can I accomplish that?

sentences:
How to read monogame log files on android device I am working on a monogame android project where I want to log some data. First try was something like this:

Log.Info(tag, message);

This works great when debugging in Visual Studio via the Android Device Logging-Window. But when I run the app on my mobile android device I have no idea how to view the log entries. As far as I know the logging happens in the so called CatLog, which can be viewed with some Apps. But unfortunately these apps need root access, which I think cannot be given to them on a "normal" android device.

Is there any way to either view the Logfile on my Android device or is there a better way of adding logging to my project?

Thanks in advance
Nick

sentences:
Loading and storing content efficiently So for example I have a class called TypingKeyboard. It allows you to display a string while it's being typed by the computer with sounds. I need one in the menu, for the title. And one for the credits, and some in-game.
So loading every sound and storing it to the RAM for every instance of TypingKeyboard is not very efficient.

So, I want to make a class that already holds these sounds, then call it when I need it, so I don't have to load everything.

How do I design this? I mean, how do you get these sounds loading and then make them accessible without initializing a class for it?

sentences:
parametric 3D sphere unwrapping math for perfect 3D-textures After some time looking or it on the internet I can't find the proper answer to my concern.

I'm currently generating 3D textures on a shader for my planets to avoid sphere mapping issues (pole, distortion, ...).

It works great however I'm limited due to algorithm complexity so I'd like to generate my 3D textures on the CPU side. However a fully furnished 3D texture is heavy like crazy (3 dimension remember) so I'd want to store a 3D result in a 2D texture.

I need to find the correct transformation from 3D coordinates to 2D storage. Anyone have a clever thought ?

Edit : not looking for Sphere cube Map, Octohedron or similar, several texture (like in EveOnline).

I'm looking for something that you have in 3D modelers where you can unwrap a sphere on a flat surface (not regularly).

Typically the picture on the bottom:

With a function vec2 map(vec3) which can map a 3D texture and retrieve the correct value on the sphere surface.

sentences:
Terrain Generation - Only draws first sprite and last row on the X axis So, I have a problem where I'm trying to loop trough columns of sprites, that later will be drawn to fill a specific area.

But it only renders the first sprite and the last row of sprites on the X axis.

Like this :

As you see it doesn't fill the entire "screen".

This is how I try to loop trough all the sprites and draw them :

void EntityManager::GenerateMap(float xSize, float ySize, int texture)
{
    // Generates a series of rooms connected so eachother with random positions and size.
    Random randomGen;

    roomTextures.push_back(sf::Texture());

    if (!roomTextures[texture].loadFromFile("Resource/Images/Test.png"))
        std::cout << "Failed to load texture from file." << std::endl;
    else
    {

        for (int y = 0; y < ySize; y++)
        {
            std::cout << "y : " << y << std::endl;
            for (int x = 0; x < xSize; x++)
            {
                std::cout << "x : " << x << std::endl;
                roomSprites.push_back(new sf::Sprite());
                roomSprites[x]->setPosition(sf::Vector2f(x * 32, y * 32));
            }
        }

        std::cout << roomSprites.size() << std::endl;

        for (int i = 0; i < roomSprites.size(); i++)
        {
            roomSprites[i]->setTexture(roomTextures[texture]);
            //std::cout << "x : " << roomSprites[i]->getPosition().x << " y : " << roomSprites[i]->getPosition().y << std::endl;
        }
    }

}

Where xSize = 10, and xSize = 10 and texture = 0.

And here's the "definitions" of the array list things :

std::vector<sf::Sprite*> roomSprites;
std::vector<sf::Texture> roomTextures;

Update :

So, I tried looping trough the sprite positions which resulted in this :

There were more positions below those, all of them being x: 0 y: 0

sentences:
SetActive doesn't work for GameObject I'm using Unity 2D for my game and I'm facing a weird problem. I have a GameObject (an image) in my scene with a button attached to it. When the player is out of the screen, the image that works as a GameOver panel appears and in case of enough coins, you can resume the game. Everything works fine but when the image appears and I click on button to resume, the image doesn't disappear while the function for decreasing number of coins still works.

Here is my script in which di() is for die and but() for button:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CodeStage.AntiCheat.ObscuredTypes;
using CodeStage.AntiCheat.Detectors;

public class UIManager2 : MonoBehaviour {

    public static ObscuredInt coin_score = 0;

    public Text coin_text;
    public Slider slider;
    public Slider slider1;
    public Slider slider2;
    public GameObject bul;
    public bool reverse;
    public float timer;
    public int delay = 1;
    public float speed=0.5f;
    public GameObject pause;
    public AudioSource[] aud=new AudioSource[3];

    void Start () {
        coin_score = ObscuredPrefs.GetInt ("Score");
        StartCoroutine (elapsed ());
        slider1.minValue = 0;
        slider1.maxValue = 20;
        bul = GameObject.FindGameObjectWithTag ("Player").GetComponent<Plane19> ().bullet;

   }

    void Update () {
        timer += Time.deltaTime;
        if (timer >= delay && reverse == false) {
            timer = 0f;
            slider2.value++;
        }

        if (timer >= delay && reverse == true) {
            timer = 0f;
            slider2.value -= speed;
      }

        coin_text.text = coin_score.ToString ();
        ObscuredPrefs.SetInt ("Score", coin_score);

        if (slider2.value == 10) {
            bul.SetActive (false);
            reverse = true;
        }

     if (slider2.value == 0) {
            bul.SetActive (true);
            reverse = false;
        }

    }

    public void di(){
        pause.SetActive(true);
        GetComponent<AudioSource>().Pause();
        Time.timeScale = 0;
        aud[0].Play();
        aud[1].Pause();
        aud[2].Pause();

}

    public void but(){
        pause.SetActive(false);
        Time.timeScale=1;
        aud[0].Pause();
        aud[1].UnPause();
        aud[2].UnPause();
        GetComponent<AudioSource>().UnPause();
        UIManager2.coin_score-=2;

    }

IEnumerator elapsed () {
        yield return new WaitForSeconds (2f);
        slider.value++;
        StartCoroutine (elapsed ());
    }
}

sentences:
How to implement stress/strain mechanics in voxel terrain? I am in the process of developing a Minecraft-like world where the terrain is divided into voxels. However, I would also like for unstable configurations of landscapes to collapse predictably. For example, an overhang that is too heavy would fracture and break off at 'high stress' voxels, as would a pillar formation with an asymmetrically eroded base. I was thinking about adding a 'stress vector' field to each voxel in the terrain, and doing the following (pseudocode):

foreach voxel in terrain
    foreach neighbor in voxel.neighbor_voxels()
        if magnitude(voxel.stress - neighbor.stress) > stressThreshold
            detach_voxels(voxel, neighbor)

But the problem is that I don't know how I would go about calculating these individual stresses. Is there some kind of FEA-based algorithm specialized for voxel discretizations that I can use to calculate the stresses on a per-voxel basis? Or am I approaching this all wrong and there's some other way to do this?

sentences:
Need help choosing the right networking approach/platform for an RTS I have been thinking for a while about making an online 2D RTS-like game. (2-6 players in a match, up to 50-60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice.

I really liked lock-step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code - that may as well cut the development time in half.

But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right - at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock-step simulation seems so much more straightforward, as there is no "adjusting" part.

So are my assumptions correct? What would you suggest?

sentences:
Is it acceptable to have a global singleton engine class, in an entity component model? I am in the process of writing an entity component model game engine, and I wanted to ask about the best way to lay out the code. I have run into an issue that I know will quickly cause me to run into more problems, down the road. In short, I currently have a render component, that I attach to the entity class. The problem is, I need the render component to signal the render engine, and add itself to it.

I thought about creating a singleton for the render system, but I quickly realized that was a bad road, and sooner or later, I would be creating singletons for just about everything (Ex, physics for the physics component). What I am currently thinking of doing is creating the base engine class as my only singleton. The engine class is responsible for initializing all of the systems available, such as the graphics and file systems, storing references to them, calling the game loops update method, and keeping track of all the entities in the game. If I did that, then my components or any other part of the code could easily reference the important systems they need to deal with via a simple Engine.MySystem. In the case of my render component, Engine.Graphics3D.addModel().

I am wondering is if this is an acceptable way of doing things, or not. If not, what would be better? I could, in theory, pass a reference to the GFX system to the render component, but that seems like a really bad idea. I feel like this is a nice middle ground between the two options.

sentences:
How to update Unity? I have clicked on check for updates but it says I have latest Unity.

But latest is 5.6.

How to update it to 5.6?

sentences:
How can I easily implement swinging in a platformer game? I'm developing a game in which player can use ropes to swing (just like what Spiderman or Bionic Commando did) and I'm having problem implementing this behavior. Can anyone help me how to do this, I mean physics formulas and etc. Till now I've come up with 3 ideas. One is using spring, but it consumes a lot of time and sometimes it is jumpy. The other two are trying to calculate next step (one via calculating potential energy and one via calculating torque) and both of them almost crash whenever the actor is trying to swing.

Here is the code I wrote to calculate torque:

float dx = Runner->getPosition().x - ancher.x;
float dy = Runner->getPosition().y - ancher.y;
float t0 = atan2(dy,dx); //my current angle
float k = ((dy) *vx - (dx) * vy) / (dx * dx+dy * dy); //previus angular velocity
k -= gravity * cos(t0) *dt; // new angular velocity (gravity is positive)
t0 += k * dt - acc * cos(t0) *dt * dt / 2; // rotate the rope
float dx1 = r0 * cos(t0); // new position (r0 is rope length)
float dy1 = r0 * sin(t0);
vx = (dx1 - dx) / dt; //calculate velocity
vy = (dy1 - dy) / dt;

sentences:
How can I use another script from a script? The first script is very long, and I need to use only the top of it:

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

public class mBitmap2MeshV30a : MonoBehaviour
{
    public Texture2D SourceTexture;
    private float Pixel_vs_Unit_Scale = 1;
    public float extrudeDepth = 1;
    private Vector2 scanpoint;
    private bool gotStart = false;
    private int maxsteps = 512;
    public bool invertFaces = false;
    private Mesh srcMesh;
    private mMeshExtrusion2.Edge[] precomputedEdges;
    private List<ExtrudedTrailSectionBM3> sections;

    public class ExtrudedTrailSectionBM3
    {
        public Vector3 point;
        public Matrix4x4 matrix;
        public float time;
    }

I need to assign a value to SourceTexture from another script. This is the other script:

void Start ()
{
    text2d = new Texture2D(10, 10, TextureFormat.ARGB32, false);
    System.Drawing.Font myf = new System.Drawing.Font(FontFamily.GenericSerif, 12);
    Image myimage =  DrawText("Hello", myf, System.Drawing.Color.Red, System.Drawing.Color.Black);
    Bitmap mybitmap = new Bitmap(myimage);

    MemoryStream msFinger = new MemoryStream();
    mybitmap.Save(msFinger, mybitmap.RawFormat);

    text2d.LoadImage(msFinger.ToArray());
    filter.GetComponent<Renderer>().material.mainTexture = text2d;

    mBitmap2MeshV30a bb = new mBitmap2MeshV30a();
    bb.SourceTexture = text2d;
}

The problem is I can't make a new mBitmap2MeshV30a bb = new mBitmap2MeshV30a();. Both scripts are attached to the same GameObject, in the hierarchy.

sentences:
how to organize rendering I use a deferred rendering. During g-buffer stage my rendering loop for a sponza model (obj format) looks like this:

int i = 0;
int sum  = 0;
map<string, mtlItem *>::const_iterator itrEnd = mtl.getIteratorEnd();
for(map<string, mtlItem *>::const_iterator itr = mtl.getIteratorBegin(); itr != itrEnd; ++itr)
{
   glActiveTexture(GL_TEXTURE0 + 0);
   glBindTexture(GL_TEXTURE_2D, itr->second->map_KdId);
   glDrawElements(GL_TRIANGLES, indicesCount[i], GL_UNSIGNED_INT, (GLvoid*)(sum * 4));
   sum += indicesCount[i];
   ++i;
   glBindTexture(GL_TEXTURE_2D, 0);
}

I sorted faces based on materials. I switch only a diffuse texture but I can place there more material properties. Is it a good approach ? I also wonder how to handle a different kind of materials, for example: some material use a normal map, other doesn't use. Should I have a different shaders for them ?

sentences:
Problem about underground block generation for voxels I've been working at a voxel sandbox game and have already implemented chunk generation and stuff.
But I just found that generating underground blocks with the surface ones is impossible, since that causes lag.
My game only generates surface blocks for now.
Are there any available chunk generation algorithms that covers the solution for my problem?
Please give a link or clearly state the method.
Thanks

sentences:
Blending Two different animations I'm sure there are articles around on this but I'm not really sure what they are called.

animation blending tends to give me the blend between two different complete animation such as walk and run.

what I'm after is having a player with that has a walk/jump animation and a firing gun animation. Is this still animation blending?

Can anybody enlighten me to how this process could be achieved?

sentences:
SFML - Completely Unlimit Framerate I am trying to completely unlimit the SFML framerate, so that as many frames will be displayed as possible. The reason for this is I want to loop through one section of code which calculates positions of objects in a physics simulation, and update the screen after perhaps 100 iterations.

I have done:

window.SetFramerateLimit(0);
window.UseVerticalSync(false);

The SFML documentation says this should set the frame rate to "infinity", but I still think it's stuck at about 60-ish...

Does anyone know how I can get more performance out of this?

Also once unlimited, I need to be able to do the equivalent of this in SFML, from SDL:

SDL.Delay(1000);

Is there a way of doing this? The SDL Delay is good because it frees CPU time for other processes. Any help would be greatly appreciated, especially as it's Christmas and you probably have better things to do! (I don't I'm a student.)

sentences:
Pygame freezing on QUIT I'm having problems with quitting a Pygame application (6502 based computer emulator).

The part regarding exit looks like this:

while True:
  do_something_200_times()

  for event in pygame.event.get()
    if event.type == pygame.QUIT:
      pygame.quit()
      sys.exit()

I'm also using pygame.mixer to play sounds as they appear, but I'm not sure that's related. I'm also using pygame.time.set_timer to update screen in regular intervals and play sound if buffer has filled enough. Is it possible the event queue overfills? How would I determine if this is the case?

It simply freezes in 40-50% cases, and attaching strace -p to the python interpreter gives:

Process 21326 attached
futex(0x7f5a32f839d0, FUTEX_WAIT, 21329, NULL

Also, I'm getting occasional pulseaudio related crashes, is this combination known to be buggy?

Any ideas and suggestions are more than welcome! Thanks!

EDIT: it freezes when I click the window's close button (x)

sentences:
Why is my screen black? I'm developing an android game, and my screen is not displaying what I want it to. I've read various tutorials but they are either outdated or hard to follow. I have followed this tutorial and most of the code is identical. However, when running the game, the screen is black.

Game logic loop:

public void run(){
    while(running){
        long beforeTime = System.nanoTime();
        gameEngine.update();
        Canvas c = null;
        try{
            c = holder.lockCanvas(null);
            //synchronized (holder){
                c.drawRect(0,0,c.getWidth(),c.getHeight(),blackPaint);
                gameEngine.draw(c);
            //}
        }finally{
            if(c!=null){
                holder.unlockCanvasAndPost(c);
            }
        }

        this.sleepTime = delay-((System.nanoTime()-beforeTime)/1000000L);
        try{
            if(sleepTime>0){
                this.sleep(sleepTime);
            }
        }catch(InterruptedException e){
            Logger.getLogger(GameThread.class.getName()).log(Level.SEVERE,null,e);
        }
    }
}

Main activity:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.activity_main);
}

engine.draw(Canvas c):

public void draw(Canvas canvas){
    Paint bluepaint = new Paint(Color.BLUE);
    canvas.drawRect(50,50,100,100, bluepaint);
}

EDIT:

@wondra I did test the break point, and the thread does actually get started, or so I think. The app runs and there are no errors thrown to the log console. Someone also suggested it was the emulator not running properly.

@fadden I have implemented what you suggested, still nothing... does starting the view from the xml and not from the Java have to do anything to do with it? Does the instance still exists if I don't declare it in Java?

sentences:
Making a cube slowly rotate 180 degress one time on a mouseclick I am new to C# and new to Unity. I made a script that can turn a cube slowly one time after a mouse click but I feel like its probably wrong for using FixedUpdate. Is this OK or is there a better way? What is wrong with this way?

using UnityEngine;
using System.Collections;

public class MouseClick : MonoBehaviour {

    public float myRotationSpeed = 1.0f;
    bool flipped = false;

    //when User clicks it with mouse
    void OnMouseDown ()
    {

        if (flipped == false)
        {
        flipped = true;
        }
    }
    void FixedUpdate ()
    {

        if(flipped == true && gameObject.transform.rotation.y >=0.01)
        {

            transform.Rotate(0, myRotationSpeed * Time.deltaTime, 0);
        }
    }
}

sentences:
Alternative to 2D array in a tiled-map structure After searching for a long time, I'm surprised this question was not asked yet. In a 2D, tiled-map game, how do you handle the map ? I'd be glad to have your point of view in any languages, though I'm more interested in C++ implementations.

A 2D array, a 2D vector, a class handling a linked-list with ad hoc computing to handle coordinates, a boost::matrix... ? What solution do you use and why ?

sentences:
How can I draw filled triangles with the illusion of color? So I have used the code of this website for drawing filled triangles. But I would like to improve my game by adding the illusion of color. Well sadly I made my game for the monochrome Nokia 5110 screen which can't draw just one pixel but needs to draw lines. So I though about a concept like that: I could enter a float into my fill triangle function (0-1 = 0-100%) and if I for example enter 0.5 then it will only draw 50% of all the pixels. This would be possible by always leaving a small gap when drawing lines. (I don't care if it starts glitching at for example 1 - 10 percent)

So it turns out that I am just way to dumb to create such an complicated filling method. Is this even possible? Thanks in advance!

Epilogue : You don't really need to create this whole function. Just a little tip or link to an already existing method will help. But thanks if you decide to create it anyway :3

sentences:
XNA Multiple Key Input I'm using the KeyboardState state way (if there are any others) of handling key presses for a PC game. It has been working fine for single key presses but now I am trying to handle multiple key presses at once.

I have it grab the newState at the top and then save it to the oldState at the bottom. I've tried it this way:

if (newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D2) && newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt))
{
    if (equipment_accessory2 != null)
        UseItem(equipment_accessory2, "Accessory 2");
}

And I've also tried:

Microsoft.Xna.Framework.Input.Keys[] currentPressedKeys = newState.GetPressedKeys();
bool altPressed = false, twoPressed = false;
for (int i = 0; i < currentPressedKeys.Length; i++)
{
    if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.LeftAlt)
                altPressed = true;
    else if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.D2)
                twoPressed = true;
}

...

if (altPressed)
{
    if (equipment_accessory2 != null && twoPressed)
        UseItem(equipment_accessory2, "Accessory 2");
}

Both ways work to a certain degree. The end result is that you're able to press alt and then a key between 1 and 5 to quick use a consumable. Normally you have skills in those slots so holding down alt makes the skills you have bound disappear and instead shows your quick use items.

The problem I'm having is that no matter what I have tried, the only way it works is that you have to hold 2 then hold alt. If you hold alt first and press/hold 2 it does nothing and doesn't work. I have spent 4 or 5 hours trying to figure out why it only works when you hold down 2 and then press alt. The problem with having it only work this way is if they have a skill bound to 2 then they're going to use the skill so the system is supposed to be to hold down left alt to swap the skill bar to the quick use bar.

I can't figure out why both ways I've tried doing multi key input aren't working when I press alt first.

EDIT: ok it must be something with my keyboard because alt+1 works but 2, 3, 4, and 5 don't work.
EDIT2: restarted and 2-5 work now too, was something with my keyboard apparently.

sentences:
Should I use animated objects or use the physics engine on iOS scenes with lots of rigidbodies? I have a scene with lots of houses and other objects. These objects will be bombarded from the sky. How to handle these kind of settings having in mind that you want the physics to be as realistic as possible.

In Unity3D, if I set all the objects with isKinematic=true and on collision I set it to false, then the physics isn't as realistic as I want it to be... Can you have these kind of scenes on iPhone? Should I have animated objects? I really don't know what is the best practice in this kind of scenes....

sentences:
How can I get the width and height of a picture? I'm trying to make a script on RPG Maker XP that needs the width and height of an image to do some calculations. I tried @picture.bitmap.widthand @picture.bitmap.height but it returned the width and height of the image that is being shown in the screen.

For instance, if the image is 800 pixels height, and the image takes 400 pixels in the screen, @picture.bitmap.height will only return 400.
This is the code I'm using:

@picture = Sprite.new
@picture.bitmap = RPG::Cache.picture("picture")
@pictureWidth = @picture.bitmap.width
@pictureHeight = @picture.bitmap.height

sentences:
Data structure to store map layers in each Tile while keeping the order of terrain, items and monsters intact My game represents its map as a 2D array of tiles, each of which stores a stack of layers. I'm looking for a data structure to efficiently represent this .

I want to be able to add layers dynamically, so fixed arrays won't do.

Additionally, the layers are applied in zones, to make sure that terrain is always drawn before items and monsters, and that items/monsters are drawn before the player. This is the order:

terrainlayer
terraineffectlayers
itemlayers
monsterlayers
playerlayers
specialeffectslayers

I want to store all those zones in the same data structure, so I can traverse it from end to end in either direction. I also need to be able to add a monster layer that would automatically go at the end of monsterlayers data structure while still having a global object that would let me traverse from the all the layers. I also need the ability to access the data structure with index, so I can get the 3rd monster in the tile easily or remove the 3rd monster. Add will always be sequential, but remove are at random indexes.

Does a data structure like this already exist or do I need to make some sort of vector/doubly linked list/deque hybrid?

I have already seen this question but it doesn't help me.

sentences:
Unity: How can I control a Shadergraph effect on multiple enemies with the same prefab? So I made a simple White Flash -> Dissolve effect with shader graph 2D, it's my 1st time using shaders.
I'm controlling the effect using a float inside the shader, with:

Material.SetFloat("FLOAT_NAME", 0-1f);

And I'm wandering how can a control only a single instance of my Shader without affecting all my enemies.

Example:
I have 20 enemies, all from the same prefab with the same material.
I want to be able to make 1 enemy dissolve whenever I shoot at him.

sentences:
How do collision meshes work in games like Zelda on the N64? I was recently reading about the technology of Ocarina of Time/Majoras Mask and discovered that world collision is done using a single triangle mesh (vertices, normals, etc) for an entire area. There are also no signs of preprocessed spatial partitioning methods in that data structure.

What algorithms exist for performing character collision on a similar arbitrary triangle mesh fast enough to run on a platform like the N64?

Quake is a contemporary game with a similar feature that came to mind. I understand Quake brush collision works by subdividing an AABB with planes. If a point is in the AABB and behind all the planes there is a collision. However, this method only works using a bunch of individual convex objects to make up a collision scene.

Zelda data structure details Here:

http://wiki.spinout182.com/w/Zelda_64:_Collision_Format
http://zeldaspeedruns.com/oot/generalknowledge/zelda-64-engine

EDIT - I don't need to know the real method used by the real game, Zelda is an example. I am looking for a method of achieving a similar effect under similar hardware constraints.

sentences:
How do you compute the tangent space vectors with normals given in the mesh? Suppose you are given a mesh with normals for each vertex. These normals might not correspond to the face normals, as the artist could have tweaked them. In this case, how would you go about computing the tangent and binormal vectors for the vertex?

The best algorithm I can think of, and the one that looks to be used by assimp, is to take all the faces in a given smoothing group and compute the tangent and binormal per face. Once that is done, project them into the plane determined by the normal and average over all the faces in the smoothing group.

I am uncertain as to whether this algorithm works exactly as needed. For example, does the projection operator preserve the angle between the tangent and binormal?

Another issue I have is that the assimp implementation of the algorithm does not seem to use the smoothing groups specified in the mesh. They instead seem to calculate the smoothing groups manually using nearby vertices. What is the advantage of doing this?

Finally, is this the ideal algorithm? Some other things I have found (such as this) seem to suggest that it is not, but they do not go into any more details.

EDIT:

So I checked out the MikkTSpace algorithm that was suggested in the comments, and while it answers my question of what the industry standard method for generating tangent spaces is, I do not fully understand why the algorithm works.

As described in the paper, the algorithm works by collecting triangles into groups and then averaging the tangent spaces for each individual triangle in the group. I ran into two problems understanding this: first and once again, why discard the smoothing groups specified in the mesh? It seems wasteful to discard information that is already given to you about how the mesh is supposed to appear.

Secondly, how do the groups even work? The paper specifies that two triangles are considered to be in a group if the share two vertices, two texture coordinates, and two normals. The first two requirements make sense to me, but the third does not. Suppose you are approximating a sphere by something like an icosahedron. In this case there will be no vertex normals shared by any two vertices, so each individual triangle is going to have its own tangent space. This seems counterintuitive.

sentences:
Where should I place input/output console for server? I'm developing a simple 2d online game and now I'm designing my server. The server will be run on linux vps and I need a way to communicate with it (for example to close it, and as it will be run on vps, simply closing terminal won't work). So I think there are 2 options:

1) Write 2 apllications - server which doesn't say anything and doesn't accept console input and the second application is console which sends commands to server (like exit, get online players etc).

2) Have 2 threads on the server appplication - one is the real server, the second thread will be used for cin and cout. However I'm not sure if this will work on vps...

Or maybe there is better aproach? What is the usual way of doing this?

sentences:
Voice Recorder in Unity I am using Unity for a user study and I am trying to integrate audio interview questions in the game itself. I need to record the user's input to an audio file. The closest thing I found was in this thread.

https://forum.unity.com/threads/save-microphone-recording-to-disk.378038/

It works but it tries to save a 5 minutes clip at once. So, it takes a few seconds and the whole game is stuck for a few seconds. I want to create a thread that will continuously write the shorter clips to the file. I tried using a coroutine but I am having a hard time managing the header as it is dependent on the whole clip.

Any suggestions or links to any threads I might have missed will be appreciated. Thanks!

sentences:
Algorithm for dynamically calculating a level based on experience points? One of the struggles I've always had in game development is deciding how to implement experience points attributed to gaining a level.  There doesn't seem to be a pattern to gaining a level in many of the games I've played, so I assume they have a static dictionary table which contains experience points vs. the level.  e.g.

Experience   Level
0            1
100          2
175          3
280          4
800          5

...There isn't a rhyme or reason why 280 points is equal to level 4, it just is.

I'm not sure how those levels are decided, but it certainly wouldn't be dynamic.  I've also thought about the possibility of exponential levels, as not to have to keep a separate lookup table, e.g.

Experience   Level
0            1
100          2
200          3
400          4
800          5
1600         6
3200         7
6400         8

...but that seems like it would grow out of control rather quickly, as towards the upper levels, the enemies in the game would have to provide a whopping amount of experience to level -- and that would be to difficult to control.  Leveling would become an impossible task.

Does anyone have any pointers, or methods they use to decide how to level a character based on experience?  I want to be fair in leveling and I want to stay ahead of the players as not to worry about constantly adding new experience/level lookups.

sentences:
Should I use procedural animation? I have started to make a fantasy 3d fps swordplay game and I want to add animations. I don't want to animate everything by hand because it would take a lot of time, so I decided to use procedural animation.

I would certainly use IK (starting with simple reaching an object with hand ...).
I also assume procedural generation of animations will make less animations to do by hand (I can blend animations ...).
I want also to have a planner for animation which would simplify complex animations; those which can be split to a sequence - run and then jump, jump and then roll - or which are separable - legs running and torso swinging with sword -.

I want for example a character to chop a head of a big troll. If troll crouches character would just chop his head off, if it is standing he would climb on a troll. I know that I would have to describe the state ("troll is low", "troll is high", "chop troll head" ..) which would imply what regions animation will be in (if there is a gap between them character would jump), which would imply what places character can have some of legs and hands or would choose an predefined animation.

My main goal is simplicity of coding, but I want my game to be looking cool also. Is it worthy to use procedural animation or does it make more troubles that it solves? (there can be lot of twiddling ...)

I am using Blender Game Engine (therefore Python for scripting, and Bullet Physics).

sentences:
Rotating a gameobject in the Inspector doesn't change direction When I add a Cube to a scene, the blue axis (=forward) of the cube points into a certain direction.

When I now change the Y rotation of the cube to 90 in the inspector, the blue arrow doesn't rotate.

I would have expected it to rotate with the rotation that I have defined for the cube.

What is happening here?

To explain more in detail why this is bothering / confusing me:

I want to rebuild the RE4 inventory (which is actual 3D). The items in this inventory can be moved within the "grid":

To do that I have created a suitcase and then I added a gun to it:

As one can see, I have assigned the facing direction properly: The blue axis (=forward) points into the direction of the gun.

Now I wanted to rotate the gun in such a way that it is shown like in the original RE4 inventory.

To do that, I apply a rotation of Y = -90.

The gun looks correctly now:

However, the blue axis now faces the wrong direction in my opinion. Why does it not rotate along with the rotation of the gameobject?

This really confuses me because now when I want to move the gun left or right, I have to change its X position value instead of changing the Z position value.

This just seems wrong to me.

Can somebody tell me what I'm missing here?

Thank you.

sentences:
How can a system similar to Dwarf Fortress' legends mode be implemented? In Dwarf Fortress, nearly everything that happens during world generation is logged and viewable in legends mode. An XML file containing that information can be exported and loaded into a utility such as Legends Viewer which can show specific events, relationships between two recorded people, what kingdoms people belonged to, etc.

My naive approach would be to add each event associated with a person to a database with a unique ID then filtering using the ID in order to view the correct events. However, this approach seems to be inflexible and adds more dependencies and complexity to my project.

My second approach would be to store these events in a JSON file in order to be able to treat each individual as an object, although this approach will probably be either be too memory intensive and not scale well since I would have to load a large file into memory or be too slow since I would have to open and modify many files at a time.

Assume the game has a simple system where each individual is tracked by a name and a UUID, belongs to a kingdom, and has some type of relationship to other individuals. Events are tracked by recording the location, date, and individuals involved. What type of file, data structure, library, etc. is generally used for something like this that is efficient enough to store up to a million or so of these simple entries?

sentences:
AI algorithm for avoiding bullets in a shoot-em-up game I am working on a shoot-up-game in XNA, it is going to be my final project in school. I was thinking of utilizing the minimax algorithm for AI agents for making tactics. However, I realized that the most important issue in such a game is to avoid bullets(fired by the player). An AI agent making tactics but no good at avoiding bullets would be useless in a shoot-em-up game I guess.

So, I need your help about what algorithm to utilize. It's not going to be a bullet storm like game, but it's fast(thanks to XNA). I have read about using threat maps and also pathfinding algorithms but couldn't figure out which one is ideal in such a game. I mean it needs to be simple enough for a fast paced gameplay, but it should also help AI agents act intelligently.

sentences:
Pan camera within bounds of large image I have a camera that I pan around a large image which works fine, however when I reach the end of the image I can keep panning on and on, forver. I have looked everywhere for an answer on how to prevent this but the only one I found did not use panning and I could not get it to work.

My code atm is very simple:

map.setPosition(-map.getWidth()/2, -map.getHeight()/2);

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
        return true;
    }

My Image is very large, 4096x4096, and my camera is 480x800. My problem is I have no idea how to get the distance I have panned, and even if I did I dont know how to stop a pan from moving past a certain point, just setting camera position won't work because then there will be a "bounce" back.

Basically I have a rectangle inside another rectangle, and the inner rectangle should not be allowed to move outside the larger. But as I said I don't really know where to start since I can't get the panning distance.

Ex of something I've tried:

@Override
public boolean touchDown(float x, float y, int pointer, int button) {
    startX = x * PAN_SPEED;
    return false;
}

@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
    if(-totalX > map.getX() + cam.viewportWidth/2){
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
    }
    return true;
}

@Override
public boolean panStop(float x, float y, int pointer, int button) {
    endX = x* PAN_SPEED;
    totalX += endX - startX;
    System.out.println("pan: " + totalX + ", map: " + map.getX());
    return true;
}

This is just a test, basically I can't move anymore after I hit the left border of the image, but totalX still keeps adding up so this will not work.

EDIT: Got it to work, code below:

@Override

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX, deltaY);
        keepCameraInBounds();
        cam.update();
    return true;
}

private void keepCameraInBounds () {
    OrthographicCamera c = this.cam;
    Vector3 camPos = c.position;
    float HW = c.viewportWidth / 2, HH = c.viewportHeight / 2;
    camPos.x = MathUtils.clamp(camPos.x, map.getWidth()/2 - map.getWidth() + HW, map.getWidth() - map.getWidth()/2 - HW);
    camPos.y = MathUtils.clamp(camPos.y, map.getHeight()/2 - map.getWidth() + HH, map.getHeight() - map.getHeight()/2 - HH);
}

sentences:
Implementing a score cheating prevention system in an offline game with an online score board: How to protect game fairness? This is hopefully a very simple question. It isn't about loading assets (which is all I found while searching)

Basically I have a template, say Object_Monster that has stats, abilities, etc. But I don't want to abstract it and create Object_Monster_Witch, Object_Monster_Ghoul and so on.

I want to know the best way to store data for loading many "different" monsters for one monster class. But I don't want the data to be editable by players.

For example. Lets say a Ghoul has 50 max health, the name "Ghoul" and the Consume ability. I would want all those variables listed somewhere to then be loaded into Object_Monster so he can act as a Ghoul.

I hear people use XML for this sort of thing, but that is of course, edited on the fly. Should I be using just an in-code list of #defines? An array of monster data?

sentences:
Is continuous loop best idea for Android OpenGL game? I've done some small OpenGL games for computer. I've used continuous loop (with VSync) for game life cycle, input - update - render. Now i'm going to write simple game for Android, but i'm wondering if it is the right way to go.

What matters? Battery usage, i've played some simple games that used so much battery compared to their complexity and graphics and i don't wanna to create that battery hungry game.

sentences:
Stop Lerp at relative location? In my Unity 2D platformer, I'm trying to move the camera down a bit when the character is crouching but not moving. I've done this with the following:

cameraPosition = mainCamera.transform.position.y;
cameraPosition = Mathf.Lerp(cameraPosition, cameraPosition - 0.8f, 3 * Time.deltaTime);
mainCamera.transform.position = new Vector3(mainCamera.transform.position.x, cameraPosition, mainCamera.transform.position.z);

This works, but it's causing the camera's y value to decrease continuously rather than just 0.8f, because cameraPosition is assigned a new value every frame. But cameraPosition has to be relative because its location depends on the player's location, so I can't figure out how else to write it.

sentences:
How do I save a screenshot and load it as a texture for use in game? I have a Unity level that takes a screenshot taken in the previous level and applies it as a material to a Plane, the problem is that it will get stuck and not apply the most recent version of the screenshot.

I figure that the best way would be to handle it with a C# script instead of just simply dragging and dropping the image file from the assets folder like I have been doing.

sentences:
Vectors and corners of squares I am having some problems with some vector math.

Imagine a square and coming from each corner of the square is an invisible vector, which starts at the square's centre and ends at the edge of the screen.

   \          /
    \   a    /
     \______/
     |      |
  d  |      | b
     |______|
    /        \
   /    c     \
  /            \
THIS IS A VERY CRUDE IMAGE AND THE ANGLES OF THE VECTORS ARE NOT EQUAL

There are 4 areas: a, b, c and d

I would like to say that if you touch within one of the areas then something happens.

Is there a simple way to do this?

sentences:
What elements of D3DPRESENT_PARAMETERS MUST be set? DIRECTX9...
For ages, I've shipped games that only half-fill out the D3DPRESENT_PARAMETERS structure, and now I'm wondering if this is buggy. The items I'm worried about, and never set are:

hDeviceWindow
Windowed
EnableAutoDepthStencil
FullScreen_RefreshRateInHz

I zero out the whole structure initially, so they should all be zero, even if my game is running (happily) in a window. As ever, there are a tiny %tage of users who have issues, and I am looking for possible causes. Could not setting one of these cause problems? The documentation doesn't say either way, and 99% of users certainly are fine with these settings. Does anyone have a definitive answer as to what should be set?

sentences:
Sprite and Physics components or sub-components? I'm taking my first dive into creating a very simple entity framework. The key concepts (classes) are:

Entity (has 0+ components, can return components by type)
SpriteEntity (everything you need to draw on screen, including lighting info)
PhysicsEntity (velocity, acceleration, collision detection)

I started out with physics notions in my sprite component, and then later removed them to a sub-component. The separation of concerns makes sense; a sprite is enough information to draw anything (X, Y, width, height, lighting, etc.) and physics piggybacks (uses the parent sprite to get X/Y/W/H) while adding physics notions of velocity and collisions.

The problem is that I would like collisions to be on an entity level -- meaning "no matter what your representation is (be it sprites, text, or something else), collide against this entity." So I refactored and redirected collision handling from entities to sprite.physics, while mapping and returning the right entity on physics collisions.

The problem is that writing code like this.GetComponent<SpriteComponent>().physics is a violation of abstraction. Which made me think (this is the TLDR): should I keep physics as a separate component from sprites, or a sub-component, or something else? How should I share data and separate concerns?

sentences:
Rotate bone on 1 axis to look at another object - Unity 3D I'm new to game development and I'm trying to create a basic 3D Tower Defence game as my first project. I've created a basic turret in Blender and I'm now trying to rotate 2 different bones to make the turret follow the enemy. The first bone (which I have working) rotates the turret to face the direction of the enemy. The second which I can't get right needs to rotate the gun at the top of the turret to look down at the enemy. I need it to keep facing the same direction as the rest of the turret and don't want it to tilt to either side. So it needs to move on 1 axis only.

I have tried various things, including examples from the Internet but I can't figure it out. So far I've managed to get it to look down at its base, up at the sky and spin like a wheel. Basically everything except where it's supposed to be looking.

Here is the code I have at the moment:

if (enemiesInRange.Count > 0)
    {
        //Rotate Platform //#### This section works fine
        Transform platform = transform.root.Find("Armature/BaseBone/PlatformBone");

        Quaternion targetRotation; //Final rotation (I.e. facing the enemy)

        Vector3 turretPosition = platform.position; //Store the turrets current position
        turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

        Vector3 targetPosition = enemyManager.activeEnemies[enemiesInRange[0]].transform.position;

        targetRotation = Quaternion.LookRotation(targetPosition - turretPosition);

        float rotateSpeed = 2.0f * Time.deltaTime;
        platform.transform.rotation = Quaternion.Lerp(platform.transform.rotation, targetRotation, rotateSpeed);

        //Rotate GunBox //####TO DO: This part is not working
        Transform gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");
        Vector3 gunBoxPosition = gunBox.position;

        float angle = Vector3.Angle(gunBoxPosition, targetPosition);

        gunBox.RotateAround(gunBox.position, Vector3.left, angle);

        Debug.Log(angle);

    }

Here's a picture of the turret to give you an idea what I'm working with. You can see in the screenshot that the bone's default X rotation is roughly -50.

Enemies walk through the trench around the turret. The PlatformBone rotates everything from the silver platform upwards.

I also don't understand why the line below makes the turret rotate instead of tilting it. I would expect to rotate the turret around the Y axis to keep it flat on the floor and face another direction. Yet I seem to have to do the opposite (If I select the PlatformBone its Y axis is facing up as expected):

turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

sentences:
Should a socket server and game server be separate processes? Assume a simple standard client/server game.  For the server, is it worthwhile to have a separate process that listens for connections and messages from clients and sends the data via local sockets or stdin to another process that runs the actual game server?

The other option would be to have both things be done in a single process. Queueing incoming messages and executing them in the right order there shouldn't be a halting issue.

I am wondering if the extra resources to separate the two "activities" is actually worth it. How should I decide? I'd like to hear any pros/cons.

sentences:
Specular reflections shine at the wrong angle when using a normal map I'm using Unity with URP and I'm trying to include a normal map in my shader graph.
Here is a basic graph that just display a normal map, with properties to control tiling and smoothness.

When I render the scene, the sun reflection highlights the wrong parts of the surface.
In this example, we can see the shadow direction of the cube, and the light itself. The sun reflection is clearly at the wrong place.

I tried with several normal maps from the web, all maps behave exactly like this one, so I think I'm missing something.
Ah, and strangely, when I rotate the object, the light reflection origin seems to change!
Of course, without the normal map, the light reflects gracefully.

What am I missing?

sentences:
LOVE Physics - Breaking Joint Chains (LUA / Box2D) Wasn't sure whether to post here or on SO so please move if needed.

I've been having a look into the box2D physics API provided by LOVE to try and create a swinging flail or weighted rope but I'm having some trouble keeping the jointed elements close together.

So far I've made a series of circular bodies and linked them together using revolute joints with the first element being static and the final element being slightly larger/heavier to act as a weight.

The code to generate each link is as follows:

    for i = 1, segments, 1 do

        link = {}

        if (i == 1) then
            link.body = love.physics.newBody(world, xpos, ypos, "static") --Starting link
        else
            link.body = love.physics.newBody(world, xpos, ypos, "dynamic")
        end

        if (i == segments) then
            link.shape = love.physics.newCircleShape(endlink_radius) --Ending link
        else
            link.shape = love.physics.newCircleShape(link_radius)
        end

        link.fixture = love.physics.newFixture(link.body, link.shape) --Fix bodies to shapes

        table.insert(chain,link)

        ypos = ypos + link_distance --Place next link further down, keeping x position

    end

And the code to join each link:

    for i = 2, #chain, 1 do

        x1,y1 = chain[i-1].body:getPosition() --First link position
        x2,y2 = chain[i].body:getPosition() --Second link position
        chain[i-1].join = love.physics.newRevoluteJoint(chain[i-1].body, chain[i].body, x1, y1, x2, y2, false ) --Join the two with a revolute joint

    end

And this works quite well, producing a chain like this:

The next step is to move the chain, I'm currently moving the first static element and having it "drag" the rest of the links along with it using the following code:

    position = vo.add(position, velocity) --Vector addition add velocity to current position to get new position
    chain[1].body:setPosition(position.x, position.y) --Update the first link position

This works fine for slow speeds (chain currently moves towards mouse cursor) but any rapid movement causes everything to fall apart.

Is there anyway to easily keep the elements close together?

I've tried adjusting the weights and world gravity but couldn't see any difference, I've also thought about applying a force to each element when the first one moves but that doesn't seem quite right.

Thanks

Solution (Thanks to NauticalMile)

Change the previous position update:

    position = vo.add(position, velocity) --Vector addition add velocity to current position to get new position
    chain[1].body:setPosition(position.x, position.y) --Update the first link position

To a velocity update and have Box2D handle the movement:

    chain[1].body:setLinearVelocity(velocity.x, velocity.y)

sentences:
How to map interaction events to game actions When I port between Desktop games and Mobile games, I find I always make a kludge out of the interaction events.

I typically end up hard-coding event handling for mobile, and event handling for the desktop in completely separate systems.

On mobile, I need to track multiple touches.

On desktop, I only have a single mouse pointer.

But on desktop, there is a concept of "hovering" above something with a mouse.
There is no such thing on mobile.
Or pressing a modifier key like SHIFT or CTRL while clicking a button or pressing a key.

I want to design an API that I can use on both mobile and desktop that is able to translate an interaction (by user) to an action in my game world.

Are there any design patterns that I can follow, or some abstract model I can use for this? How do people successfully marry the desktop and mobile port of a game?

So in the same code-base, maybe assign Alt+Left-Click to a certain game function, but on mobile have that done via a gesture.

On Desktop, I currently use SDL2's SDL_Event. On Apple, is use UIEvent, and on Android I use NDK's AInputEvent.

sentences:
XNA slowly stops sprite movement on key released I'm making a game where player moves around a spaceship pressing W,S,A,D. What I would like to achieve is that I would like to make the ship stop slightly when a key is released before it went to full stop. How can I achieve that?

Here's the moving code :

 kbs = Keyboard.GetState();

            if (kbs.IsKeyDown(Keys.W))
            {
                this.pos.Y -= speed;
                this.animation = "up";

                if (kbs.IsKeyDown(Keys.D))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X += speed;
                    this.animation = "upright";
                }
                else if (kbs.IsKeyDown(Keys.A))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X -= speed;
                    this.animation = "upleft";
                }

                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;

                CheckStop();
            }
            else if (kbs.IsKeyDown(Keys.S))
            {
                this.pos.Y += speed;
                this.animation = "down";

                if (kbs.IsKeyDown(Keys.D))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X += speed;
                    this.animation = "downright";
                }
                else if (kbs.IsKeyDown(Keys.A))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X -= speed;
                    this.animation = "downleft";
                }

                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else if (kbs.IsKeyDown(Keys.A))
            {
                this.pos.X -= speed;
                this.animation = "left";
                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else if (kbs.IsKeyDown(Keys.D))
            {
                this.pos.X += speed;
                this.animation = "right";
                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else
            {
                this.isAnimating = false;
                this.isDirectional = false;
                frameIndex = 0;
            }

I have been trying to check for the ship to slowly stop with CheckStop() function, here it is (for the sake of trying, on the above code I only apply CheckStop() on the 'W' key):

private void CheckStop()
        {
            KeyboardState nkbs = Keyboard.GetState();

            if (!kbs.IsKeyDown(Keys.W) && nkbs.IsKeyDown(Keys.W))
            {
                speed -= fraction;
                if (speed <= 0) speed = 0;
                this.pos.Y -= speed;
            }
        }

Any help is appreciated, thanks.

sentences:
Setup golf ball physics I am developing a simple Golf game as shown in the below image.

I am facing below issues:

Even if I apply small amount of force, the ball continuous move along the grass? Grass friction is not stopping the ball.
Sometimes, the ball speed is increased after colliding with the walls instead the ball speed should decreased after collision with the walls. The walls are having box collider.
Sometimes, the ball reverses its direction after colliding with walls.

Code:

Physics properties of the ball:

 ball.physicsBody.affectedByGravity = true;
 ball.physicsBody.mass = 0.0450;
 ball.physicsBody.restitution = 0.8;
 ball.physicsBody.friction = 0.3;
 ball.physicsBody.allowsResting = true;

Physics properties of the grass:

golf.physicsBody.friction = 0.8;

Physics properties of the walls:

 leftWall.physicsBody.friction = 0;
 leftWall.physicsBody.restitution = 0.8;

I have set the physics world gravity value to -9.8.

I am looking for suggestions to fix the above listed issue. Thank you.

sentences:
Objects rendering only on editor, but not on build (they get invisible) Everything works fine in the editor, but when I build the game, none of the objects in the scene are rendered, and only the skybox and UI text is visible. But although they aren't appearing, they are working as normally (i.e. these objects' triggers work normally when the determined event occurs, like for example, colliding to a specified object, or in other words, they are invisible).

I searched for this issue but didn't found any answer.  Could it be my cheap computer's fault (Intel Celeron without an external graphics card)?

In editor game mode:

In buit game:

I ran both the editor and the built game in the same quality, and also tried to run it in Fastest quality, but no, it made no difference in the built game.

Also, there is no object tagged with "Editor only", only one have a custom tag and all the others are "Untagged". And the camera's culling mask is set to "Everything".

The result is the same either for web or Windows.

Edit:

OK, I built for Android and the objects render normally. So, I'm not completely sure, but probably it's my PC that can't render the objects, because both building for web plugin and desktop have this disappointing result, but for Android it works perfectly (even the shadows, which wasn't being cast in the editor), so...

sentences:
Approaches to timed puzzle elements I'm working on a side scrolling game that has a number of timed puzzle elements. As a simple example: I have a number of moving platforms that have been setup to transition in a pattern. Ideally I'd like to ensure that as the player first approaches them, they are in an ideal state -- whereby the player can witness the full transition and more experienced players (i.e: speedrunners) can complete the puzzle immediately without having to wait for the current transition to complete.

The issue here, in a nutshell, is that because these platforms begin transitioning at the start of the level, it's impossible to correctly calculate when the player is likely to stumble upon them.

I've done a fair bit of Googling but haven't managed to turn up any decent resources with regards to solving a problem like this. The obvious solution is to only begin updating the objects when the player (or more likely: the camera) first encounters them. But this becomes difficult when you consider more complicated situations.

It seems like potentially the easiest way of handling this is to have an invisible trigger volume that will tell any puzzle elements located inside of it that the player has 'arrived' upon first colliding with the player. But this would mean I'd have to logically group puzzle elements, which could become fairly messy in a hurry. Take, for instance, a puzzle that appears to the right of the screen. It may take the player a number of seconds to reach it. It would look strange if the elements involved were to remain stationary. But by the time the player arrives, it's likely things will be 'out of sync'.

I wanted to post here in the hopes that others know of, or have implemented, a decent solution to this problem?

sentences:
Realistic Camera/Screen Shake from Explosion I'd like to shake the camera around a bit during an explosion, and I've tried a few different functions for rocking it around, and nothing seems to really give that 'wow, what a bang!' type feeling that I'm looking for. I've tried some arbitrary relatively high frequency sine wave patterns with a bit of linear attenuation, as well as a square wave-type pattern. I've tried moving just one axis, two, and all three (although the dolly effect was barely noticeable in that case).

Does anyone know of a good camera shaking pattern?

sentences: What exactly is the difference between Unreal Development Kit and Uunreal Engine 4? I want to start learning game development and I would obviously come across this tool. So every where I went people mentioned Unreal Engine 4 to be a viable choice, I've tried a bit of Unity and now I want to try Unreal. Only issue I came across UDK and UE4, I downloaded UDK which turns out to be different from tutorials and I can't seem to find any info on that and besides I could only run the software once because after the first time it starts a game, I re-installed UDK I still get the issue, but anyways that's a different topic, what I want to know is whether UDK and UE4 are different and if they are, where do i get UE4, becauuse when I down UE4 (from - https://www.unrealengine.com/dashboard), it downloads a game launcher and no development tool. In case they are same, why is my version of UDK different fr

sentences:
Using LibGDX within Android Fragment I want to use LibGDX with Android, but instead of modifying my Activity to extend

  AndroidApplication

I want my to render my graphics inside Android Fragment

The problem is that my class already extends Fragment, so I can't make it extend LibGDX AndroidApplication (Multiple Inheritance)

is there any workaround for this ?

Thanks

sentences:
Tech Tree layouts for games? I'm trying to do a tech tree GUI for my game, but i have limited width and the tree has alot of branches, the problem is if I make them small to fit the width, the tech tree is too small to read.

For example the AOE one is very large (in width):

I could allow scroll bar but as its web based, scrolls are quite ugly. So i was wondering how to deal with branches which slowly cause the tech tree to get wider as you go down the tech tree and how you would fit such a design in a limited space.

Are there different known designs for tech trees that any one knows of so i can look at their types. I don't know the names given to the types of tech tree layouts. But am hoping to find one that is not overly complex for the user aswell.

sentences:
How do I stop gyroscope-controlled camera from jittering when holding phone still? I have here a simplified version of my gyro-controlled camera with a sensitivity modification (a side effect of increasing sensitivity is that the jitteriness is exacerbated).
public class GyroControl : MonoBehaviour{

private Transform _rawGyroRotation;
Vector3 gyroAdjust;
[SerializeField] private float _smoothing = 0.1f;

void Start()
{
    Input.gyro.enabled = true;
    Application.targetFrameRate = 60;

    _rawGyroRotation = new GameObject("GyroRaw").transform;
    _rawGyroRotation.position = transform.position;
    _rawGyroRotation.rotation = transform.rotation;

}

private void Update()
{
    _rawGyroRotation.rotation = Input.gyro.attitude;

    gyroAdjust = _rawGyroRotation.rotation.eulerAngles * 2; //increase rotation sensitivity
    transform.rotation = Quaternion.Euler(gyroAdjust);

    transform.rotation = Quaternion.Slerp(transform.rotation, _rawGyroRotation.rotation, _smoothing);

}}

When in motion, the jittering isn't noticeable. But when you hold the phone still, there's what I assume to be just analogue noise that causes jittering. I would really appreciate any help or advice on how to add a filter or something to reduce the jittering for this kind of controller.
Thanks.

sentences:
Should Draw method calculate the element's screen location? Should Update take care of calculating the drawing position of element or should it be done exlusively in Draw method?

If I calculate the drawing position of element in Update and then store it as element property then I can reuse it in Draw method. I can only run the update if the element (or camera) moved so it seems it would be good for performance. Is this good approach? Or should I never store the draw position of an element and always calculate it in Draw method?

EDIT:

It seems my question wasn't clear enough. I'm not talking about elements Draw method but the Draw method of manager/renderer that draws them on the screen. The elements themselves do not have Draw method.

sentences:
How to make a simple escape the room game? I want to make a very simple "escape the room" game.  I was hoping for something that looks something like this.  You would see images of some room and you click around to move or to add things to inventory.  Then, you can select something in your inventory to use that item with something on the screen.  During the whole game there would be a text box describing what is happening (probably in really broken English instead of Japanese).

I am looking for something that can be quite simple.  I would prefer to have the ability to play sound (probably mp3's) when something happens.  It can be web-based or a downloaded executable or .jar file.  It doesn't have to be perfect, just a proof-of-concept really.

What is the best approach to get this game working with minimal effort?  Are there some libraries that can help?  I have plenty of Java experience and some C++, PHP, and others.  I'd rather avoid Windows-based technology as I primarily run Linux.  I am willing to learn other languages if they have a huge advantage.

Ideally, if someone could point me to an example program that I can modify.  I'm not expecting to sell or distribute this game.

sentences:
Help understanding camera/scene Unity I'm a brand new unity developer and I watched a few tutorials and then found a game on the Asset Store to provide a nice base for my game. However the setup, especially with multiple scenes is quite different than the tutorials I watched and I can't figure out what is happening. Here is my Scene view from the main menu:

When I click on Main Camera the tiny little thing with the green outline in the corner is highlighted.

Now if I click play, that whole menu fits in the screen, even though the Main Camera is apparently tiny? Then, while playing, I click back to scene view I see this:

It shows the camera as being empty, even though in Game View I can see/interact with the menu.

When I swap to my Scene 1, which is the game view, it is the exact opposite. This is what I see in Scene View while the game is playing:

Note the game running in the preview in the corner. Those tiny circles are the same circles on the main menu, how does the same asset fit in what appears to be two wildly different sizes?

So I ask, what is the different between the two scenes. One appears in the preview while one doesn't. One fills in the huge canvas while the other apparently fits in the tiny camera. What am I missing?

sentences:
How to know if a game concept is "different enough"? For the past year or so, I've been designing a top-down zombie shooter game. However, after playing a 2d top-down battle royale game, it's given me inspiration to build a similar game. The graphics would be very similar, though there would be new things like building.

I'm trying to decide if this concept is different enough; there's another similar game, though it has different graphics and some other key differences.

I'm wondering at what point two games become too similar, and how to avoid taking too many ideas from one game (a common problem for me).

sentences:
How to store unique keys for an infinitely generated, chunked world? My game is made up of chunks which are identified in world space with and X and Y coordinate. Each chunk contains 16 tiles by 16 tiles by 4 layers. So that I don't have to loop over every single tile every time I want to access things such as hitboxes or animation frames I store that tile's value as keys in various dictionaries such as "Animations" or "Collidables". Until now I have been doing it like this:

        public string GetTileKey(int layer)
    {
        string XString = X.ToString();
        if (XString.Length < 4)
        {
            XString = XString.PadLeft(4, '0');
        }
        string YString = Y.ToString();
        if (YString.Length < 4)
        {
            YString = YString.PadLeft(4, '0');
        }
        return layer.ToString() + XString + YString;

    }

which as you can imagine, slows things down considerably!

After chatting with a few awesome people in discord I was suggested a bitwise method which would store the first few bits as the X coordinate, the second few as the Y, and the last 2 as the layer like so:

public int GetTileKeyAsInt(int layer, IInformationContainer container)
    {
        return (X << 16) | (Y << 9) | layer;
    }

(The container parameter is not currently used, I was trying things out with its X and Y coordinates. It's really just the chunk)

which works fantastic when used with X and Y values which are between 0 and 128 and which are not negative. In addition it guaranteed no duplicate keys.

I quickly realized this wouldn't work with my world, which requires both positive and negative coordinates and an "infinitely" expanding number of chunks.

What is a better way to do this? I was planning on using a float or a double and using the first bit as the sign value, and the next eight (4 and 4) to store the X and Y coordinates of local tiles within chunks and then allocating the rest of the bits to allow for a massive number of allowable chunks. I'll admit I'm not super familiar with bitwise operations or even really the specifics between int, float and double :( but from what I've gathered it doesn't actually make sense to do bitwise operations with anything larger than an Int 32!

sentences: XML serialization error on XBOX 360 When try to save game on an xbox with xml serialization i get a code 4 error. I made sure t oadd all the xml referances and there is no errors until i run the game. Any suggestions?

sentences:
Unpausing a game when a TouchScreenButton node is released I'm making a mobile game in the Godot game engine.
I made a spike scene where the spikes will respawn at a random time in a particular position moving upwards.
Then I instanced the scene in the main scene, it worked perfectly, the spikes moving up and appearing in a particular position.
Then I created a TouchScreenButton node in the main scene and changed it pause property to process and then added a _OnPressed and _OnReleased signal to the main scene script then added this code to the _OnPressed function
get_tree().paused = true
And added this code to the _OnReleased function
get_tree().paused = false
But when ever I press and release the button it only pauses the scene
What should I do?

sentences:
Where is ID3D10EffectShaderResourceVariable::SetResourceArray in SlimDX? I don't know if I'm just not looking in the right place, but I can't find ID3D10EffectShaderResourceVariable::SetResourceArray anywhere in SlimDX.

Anyone have any idea how I should be calling this?

sentences: Ignore specific key press in textbox there is a text box on GUI in my application created using Unity3D. in the textbox user can input only the keys of "A-Z", "0-9" , "enter key" , "." and "," other key press should be ignored (not should print in textbox when typing). how to do this in Unity3D C#

sentences:
Should I use a database to store ~10 000 names in a sports game? I'm working on a single player sports game for a year or so and this doubt came up: how should I treat/store big amounts of data, like player names.
Let's take an arbitrary number as example: 10000 names, 5000 first names and 5000 surnames. These names would be equally divided between 100 countries, which give us 50 first names and 50 surnames per country.
Should I have a local database with these names (or even these countries) considering this data will be needed to generate new players names during the course of the game? Would that introduce limitations, considering I want to make my game moddable by players, as much as possible?
These doubts can be extended to other, more complex game entities, such as:

Players - each one with their own face, attributes, team etc...
Teams - each one with its own crest, kit, squad etc...

In my previous research about that, the SQLite popped up as a seemingly viable solution. It happens that I have almost no experience with DB's (specially in games) and would like to know if this is a good direction before start to study and try to implement it.

sentences:
Relative and absolute position with sprites in libgdx In libgdx, can i add a sprite as children of another an set it with the relative coordinates of the father and not the stage?

Like in HTML when you add controls they are relative to its parent, but here i want it with sprites, i add the children in a Group class but the coordinates are absolute (relative to the stage)

sentences:
Efficiently drawing large numbers of small, moving squares to screen in libgdx I'm trying to make a game which behaves somewhat like The Powder Toy. The world is square and can be filled with particles. Particles are drawn as small squares, constrained to integer positions, and stored in a 2D array, similar to the GOL. Here's what the world looks like:

I've tried a few different approaches of drawing particles to the screen:

Using a ShapeRenderer by calling setColor and rect for each particle. Seems to have been the slowest of the approaches.
Using a SpriteBatch to draw a Pixmap for each particle.
Writing asynchronously to a Pixmap, storing the Pixmap in a Texture, then drawing the Pixmap with a SpriteBatch.

Although these approaches work, I'd be interested in hearing about other, possibly more efficient ways to render the particles. Could VBO be used here? Or is it not accessible from within gdx?

sentences:
Sphere intersection Stuck I have two spheres that are bounded by spheres for collision detection. I do not want them to intersect. My intersection works. But it gets stuck. Once the function returns true, I cannot get it out. I tried

collideBool = ObjectOne.Intersect(ObjectTwo);

if(collide == true)
{
    leftright = leftright;
    updown = updown;
}
else
{
if(GetAsyncKeyState(VK_RIGHT))
leftright -= dt;
if(GetAsyncKeyState(VK_LEFT))
leftright += dt;
if(GetAsyncKeyState(VK_DOWN))
updown += dt;
if(GetAsyncKeyState(VK_UP))
updown -= dt;
}

collide = false;

My sphere gets stuck. What is a way around this?

sentences:
How much slower is it to draw on "half pixels"? I've noticed that games like Diep.io are using floating decimal points for thin stroke lines on the grid. I have even tried this myself, by adding 0.5 to all of the positions for the grid lines to make the lines more thin.

I heard it from a friend that drawing on half pixels causes the GPU to do more work to smooth it out, like anti-aliasing. I am really trying to make my game look nice, by making the most smoothest lines as I can. How much slower is it really, and should I use it in an online competitive 2D game using Canvas?

sentences:
How can I apply a Camera Shader to UI? I am trying to make a shader that applies a black image with 50% transparency to the entire screen, with the exception of a designated area.  I am starting by just trying to apply a shader to the entire screen.  So I am using the default ImageEffect Shader.

This is my before and after when applying my shader, which should invert everything.  It inverts everything except for the Balmer's Peak, which is a Unity Image:

Before:

After:

Example of what I am going for:

I attached a script using OnRenderImage to the Camera, and the attached material is being applied to everything in sight, except the UI.  What can I do to make my material applied to everything on the screen, including the UI?

I am new to shaders, so this may seem like a bit of a dumb question.  But I am not sure what direction I should be headed.  Here are my scripts, although I did not really change anything from what Unity provided me:

Script attached to camera:

using UnityEngine;

public class ButtonHighlight : MonoBehaviour
{
    [Tooltip("Material which is to be applied")]
    [SerializeField]
    private Material material;

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Graphics.Blit(source, material);
    }
}

Shader attached to material above:

Shader "Magic/Magic Shader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                // just invert the colors
                col = 1 - col;
                return col;
            }
            ENDCG
        }
    }
}

What is the correct approach to apply a shader to the entire screen?  (Keeping in mind, that the purpose is to add a filter to most, but not all, of the screen.)

sentences:
What happenes if you leave out buffers for the inputassembler that the vertex shader expects? I'm working through my first attempt at a "graphics engine" (I use the term loosely as I'm not aiming for much more than something that will display a few meshes).  I want to leave my classes as extensible as possible and am currently working on my mesh class.

I want my mesh class to be able to have optional UVs and optional normals, although I generally expect to use these.  As I'm new to Direct3d I'm curious if I still have to define matching "zeroed" buffers for the missing normals and UV data if the vertex shader and input assembler is otherwise expecting this data?  Should I have my mesh class assemble the missing data zeroed out and declare empty buffers or does Direct3d know to pass null arguments for missing data?

EDIT: I guess zeroed normals wouldn't work as any shader expecting normals would produce bad/bizarre results, but the question regarding texture coords still stands.

sentences:
Rotating a vector by a quaternion I am trying to rotate a direction vector (0,0,1,0) by a rotation quaternion in DirectX.

From what understanding, to rotate the vector you must do

NewVector = rotQuaternion * Vector * inverse(rotQuaternion)

In directX11, I am testing out the algorithm above using an identity quaternion.

XMVECTOR qIdentity = XMQuaternionIdentity();
XMVECTOR inverse = XMQuaternionInverse(qIdentity);
XMVECTOR test = qIdentity * XMVectorSet(0.0f,0.0f,1.0f,0.0f) * inverse;

My new test vector should just be (0,0,1,0), however it is completely zeroed out, and I am not exactly sure why or if I multiplied it correctly.

sentences:
Is game localization by external files protected by a patent? http://www.google.ch/patents/US7930167

This patent explains loading game languages from external files. I'm pretty sure that has already been implemented in many games. I'm not sure if they violate the patent or not. What kind of localization would be allowed then?

sentences:
How can I raycast between two moving objects in Unity? How can I raycast between two moving objects?

I want to raycast from a moving enemy to a moving player.  I dont know how to actually code to make the direction work.

using UnityEngine;
using System.Collections;

public class Enemy_Manage_Two : MonoBehaviour {

    public GameObject player;

    // Use this for initialization
    void Start () { }

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

        player = GameObject.FindGameObjectWithTag ("Player");
        //Debug.Log (player.transform.position + " " + transform.position);

        Ray ray = new Ray (transform.position, player.transform.position);
        RaycastHit hit;

        Debug.DrawRay (transform.position, player.transform.position,
            Color.red);

        if(Physics.Raycast(ray, out hit)) {
            gameObject.renderer.material.color = Color.blue;
        } else {
            gameObject.renderer.material.color = Color.white;
        }
    }
}

sentences:
How can I keep the clicked point under the mouse when rotating? (GLM) I have a spherical mesh of radius 1, centered at (0,0,0) in world coordinates. I want to rotate the sphere so that the clicked point remains under the mouse at all times. However, I cannot find an algorithm that does this. The clicked point always drifts away from the mouse. My current algorithm does the following:

Cast a ray to a sphere of radius 1. Find intersection point in world coordinates (Pa).

After the mouse is moved, cast another ray and find a new intersection point. (Pb) since both those 3D points are on a sphere of radius one, centered at the origin, they should have length = 1 but just in case I normalize them both.

Find the rotation axis by doing Pa x Pb. Normalize the resulting axis

axis = glm::cross(Pa,Pb);
axis = glm::normalize(axis);

Find the angle by doing arccosine on the dot product

float angle = glm::acos(glm::dot(Pa,Pb));

Build a rotation matrix from the axis and angle

mat4 rotation = glm::rotate(glm::degrees(angle),axis); <-- This was the mistake glm::degrees is not needed

Multiply the existing model matrix by that calculated matrix:

modelMatrix = rotation*modelMatrix;

The rotations are correct but the clicked point does not stay under the mouse (I am checking by drawing a black square point on the sphere texture when the drag starts). If I click and drag to the right, the initially clicked point drifts to the left (lags).

sentences:
How can you run events after a set amount of time in SFML 2.0? I've been using SFML 1.6 for a while and recently upgraded to 2.0, apparently there's a new sf::Time type however I'm clueless as to how I can achieve running of a certain function after a set amount of time.

How would you go about doing this? Say you want something to execute after 5 seconds, how would you do it in SFML?

sentences:
Why Inverse Transform the Ray when doing Transformation? I am adding 3D affine transformations to my ray tracer, and it seems all the literature on the web recommend inverse transforming the ray instead of transforming the 3D objects.

Why is that? There are a lot more rays than objects in a typical ray tracing scene, so wouldn't it be more efficient to transform the objects themselves?

sentences:
How do I resize a game object, when it has extended past a boundary? I have some white blocks, and within the white blocks, I have some cyan-bordered boxes. Whenever the white boxes are extended outside of the cyan bordered boxes, I want to resize them so they are back inside the cyan bordered boxes.

As per my image, they need to remain in their borders, like the fifth one from the top.

How do I resize a game object, when it has extended past a boundary?

Here is my current code:

void Update()
{
    if(numOfGeneratedGuideline < numOfGuidelineToGenerate)
    {
        Generate_Guideline_Positons(numOfGeneratedGuideline);
        Generate_Platform_Positions_And_Scale(numOfGeneratedGuideline);
        Generate_Platforms(numOfGeneratedGuideline);
        numOfGeneratedGuideline++;
    }
}

void Generate_Guideline_Positons(int i)
{
    float tempGuidelineOffset = groundHeight + (guidelineOffset * (i + 1));

    guidelinePosX[i] = worldWidth / 2;
    guidelinePosY[i] = tempGuidelineOffset;
    guidelinePosZ[i] = 0;
}

void Generate_Platform_Positions_And_Scale(int i)
{
    randomGuidelineNumber = Random.Range(1, numOfGuidelineToGenerate + 1);

    float tempPlatformPosXMin = (worldWidth - guidelineWidth) / 2;
    Debug.Log(tempPlatformPosXMin);
    float tempPlatformPosXMax = worldWidth - tempPlatformPosXMin;
    Debug.Log(tempPlatformPosXMax);
    float tempPlatformPosY = groundHeight + (guidelineOffset * (i + 1));

    platformPosX[i] = Random.Range(tempPlatformPosXMin, tempPlatformPosXMax);
    platformPosY[i] = tempPlatformPosY;
    platformPosZ[i] = 0;

    platformScaleX[i] = Random.Range(minPlatformScaleRange, maxPlatformScaleRange);
    platformScaleY[i] = 1;
    platformScaleZ[i] = 1;

    //22 29 36 43 50
}

void Generate_Platforms(int i)
{
    GameObject newplatform = Instantiate(platformPrefab,
        new Vector3(platformPosX[i], platformPosY[i], platformPosZ[i]),
        Quaternion.identity) as GameObject;

    newplatform.transform.localScale = new Vector3(platformScaleX[i], platformScaleY[i],
        platformScaleZ[i]);
}

sentences:
Simple 3D particle gravity in javascript? I'm trying to do some simple gravity handling in my 3D environment (I'm using three.js). I've got some code, but it doesn't work. I'm hoping it's just a silly bug somewhere. Note: This is a cross-question from stack overflow since I've got no responses

function handleGravity() {
    for(var j = 0; j < spheres.length; j++) {

        for(var i = 0; i < spheres.length; i++) {

            var r1 = new Array( spheres[j].position.x, spheres[j].position.y, spheres[j].position.z);
            var r2 = new Array( spheres[i].position.x, spheres[i].position.y, spheres[i].position.z);
            var r12 = new Array(r2[0]-r1[0], r2[1]-r1[1], r2[2]-r1[2]);
            var r12UnitVector = new Array( r12[0]/Math.abs(r12[0]), r12[1]/Math.abs(r12[1]),r12[2]/Math.abs(r12[2]) );

            var m1 = masses[j];
            var m2 = masses[i];
            var r12Squared = r12[0]*r12[0] + r12[1]*r12[1] + r12[2]*r12[2];
            var a12 = new Array( -(gravConst*m2/r12Squared)*r12UnitVector[0], -(gravConst*m2/r12Squared)*r12UnitVector[1], -(gravConst*m2/r12Squared)*r12UnitVector[2]);

            velocities[j][0] += a12[0]*timePassed;
            velocities[j][1] += a12[1]*timePassed;
            velocities[j][2] += a12[2]*timePassed;
        }

    }
}

If you can see anything wrong with it, or give me any tips on using JavaScript to simulate many particles in a 3D environment most efficiently (I'm very new to physics + simulation), that would be awesome!

sentences:
Synchronisation on a non authoritative networked peer to peer scene I currently have a piece of coursework that requires 3 or more 3d simulations connected via p2p to maintain a simulation that is visually consistent amoung all peers. A big issue is that I'm not allowed to use any form of authoritative server/peer logic and I'm struggling with potential designs.

The coursework has the following relavant constraints

each peer must be connected at the start and will have the same initial empty simulation
The network will be LAN only
Hardware is consistent in all computers in the network

I'm thinking about implementing it along the lines of

Each peer will regularly create a snapshot of all objects that have moved since the last snapshot
Each peer will maitain a local copy of the snapshot in addition to broadcasting it to all other peers
Each peer will combine the other snapshots possibly via averaging and and adding it to the current local state. I'm thinking I could also possibly use timestamps of each snapshot to weight the combination.
each peer runs their local simulation briefly
then repeat the process

Can anybody see any potential problems with this or recommend anything?

sentences:
How to create an illusion of movement in space? I am currently making a space game. The player's ship is stationary at world origin while things come towards it. However, the player is supposed to move towards the next destination.

To create the illusion of movement, I have particles moving backwards while my ship remains stationary. However, the particles seems to get lost visually during complex battle scenes.

Is there any other way to give the illusion of movement where there is an absence of stationary reference points?

Here are some screenshots of the game

The referenced question that has been identified as a duplicate does not answer my question. It is somewhat unclear what some of the implementations are. I seek a tried example that is used in other games if possible.

Most of the implementations suggested is more relevant to a first person perspective. I am looking for 3rd person effect where the player cannot "Visually Feel" the effect through a jolt.

sentences:
How to make one material on object with many parts inside? I have a weapon witch have many parts, it also have many materials. Do I really need to make it like that?
It's like about 8 mats! :(

sentences:
LWJGL 3 HelloWorld example crashing I'm trying to start LWJGL 3 development and I am having an issue with getting things working. I have created a new Gradle project and successfully built the HelloWorld example from https://www.lwjgl.org/guide but when I run I get an error. However the error seems to be different each time. Here is one example:
Hello LWJGL 3.2.3 build 13!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff6d4fe829, pid=4595, tid=5891
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libobjc.A.dylib+0x6829]  objc_msgSend+0x29
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4595.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Another:
Hello LWJGL 3.2.3 build 13!
[thread 9731 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff34cc1027, pid=4579, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [CoreGraphics+0x73027]  CGClipRelease+0xe
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4579.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

What should I start looking at to resolve this?

sentences:
How to obtain touch events from a GL Viewport, not the whole screen? Background

I'm implementing viewport resizing in order for my game to maintain the same display ratio on all devices.

However, I've found an issue with getting touch events.

Basically, if my viewport, for example, uses the whole of the physical screen's width and height then there is no issue.  However, if it is resized say in the vertical, then my touch events are thrown off, because touch events are registered from the top of the physical screen.  Hence if I put a sprite at say position 50 in the Y direction then it put's the sprite 50 pixels down from the top of the viewport, not the top of the actual screen.

Do I have to manage this myself by adding my viewport's offset to my touch events or is there a way to tell Android to register 0, as the top of the viewport as opposed to the actual screen.

Here is a graphic to illistrate what I mean, any help would be appreciated

sentences:
How do I resolve a sphere-triangle collision in a given direction? I am trying my hand at game physics.

I understand that the basic way to pull back a sphere when it collided is to negate the penetration distance:

// If collided...
// `distance`: distance form triangle face; a negative number
// `normal`  : triangle face, in vec3
// `position`: sphere center, in vec3
position.x -= normal.x * distance;
position.y -= normal.y * distance;
position.z -= normal.z * distance;

But I don't want to change y coordinate, while the player is on the ground like this (side view):

How can I calculate the expected translation?

I have these values:

penetration distance, as a negative number (shown in blue)
triangle face normal, as a vec3 (shown in red)
triangle vertices, as 3 vec3s

and

sphere radius, as a number
sphere center, as a vec3

Answers in any programing language are welcome!

updated Jul 17, 2014

I found a hint. It's difficult to explain, I will attach 2 more figures.
It seems, dashed lines in following figures are the translation value what I need, I guess.

and in another case

sentences:
Keep running CGRectIntersect Method - Objective C I have two UIImageViews. mainSprite, and enemy1. And I have a method that makes enemy1 start moving towards mainSprite. So here's that method.

-(void)enemy1Aggro{
if (CGRectIntersectsRect(mainSprite.frame, enemy1Aggro.frame)) {
    if (mainSprite.center.x > enemy1.center.x) {
        enemy1.center = CGPointMake(enemy1.center.x+2, enemy1.center.y);
    }
    if (mainSprite.center.x < enemy1.center.x) {
        enemy1.center = CGPointMake(enemy1.center.x-2, enemy1.center.y);
    }
    if (mainSprite.center.y > enemy1.center.y) {
        enemy1.center = CGPointMake(enemy1.center.x, enemy1.center.y+2);
    }
    if (mainSprite.center.y < enemy1.center.y) {
        enemy1.center = CGPointMake(enemy1.center.x, enemy1.center.y-2);
    }
}

}
This works because I'm calling it on an IBAction that is a button that gets held down. But the problem is that when that button stops being pressed, this method stops running. So what I need is a way to have this method keep on running. Maybe a for loop? I'm not using anything like cocos2d, and I'm not using CoreGraphics. If you need to see any more of my code just ask.

Thanks :)

sentences:
Implementing a camera on HTML5 canvas? I am trying to work out the best way of implementing a camera in my simple 2d game.

The way it is structured at the moment is my game objects all have draw functions, which are passed a canvas instance to draw themselves to (at whatever position they are currently at).

I now need to add a camera to the mix, so that i can have a bigger world, but i'm not sure of the best way to implement it.

The way I see it, I can either translate the whole canvas and let the objects carry on drawing themselves at whatever position they are at, eg:

canvas.translate(camera.position);
player.draw(canvas);

This seems easy enough, but doesn't seem right somehow. Alternatively, I could pass the camera in to the objects with the canvas, and let the objects calculate a relative screen position before drawing, eg:

player.draw(canvas, camera);
// inside the draw function:
var position = this.position.subtract(camera.position);
canvas.drawStuff(stuff, position);

But that seems wrong too. How do other 2d engines handle this? Is there an established best way of doing it, or any pitfalls I should avoid?

sentences:
How can I find the collision response between a moving sphere and cube? I'm implementing my own algorithm for sphere and cube collision response. So far I'm able to only test if both of them overlap.

My problem is: A cube is rotating around its axes i.e x and z axes. And the sphere is moving at a velocity that being Vx,Vy and Vz in all the 3 axes. How do I find the collision response between them without considering angular velocity of cube i.e when the cube and sphere collide cube is not having an velocity but angles with 2 axes. After collision I don't want the sphere to have angular velocity.

sentences: Do I need to create an HLSL in XNA to display textures without content pipeline I currently have a jpeg texture stored as a Color array in XNA as RGBA. I also have the vertices of a cube in OBJ format mapped to VertexPositionColor vertex buffer using the VertexBuffer and Indices of the GraphicsDevice class. The OBJ has my jpeg mapped as a UV texture. I think I have all the Texture Coordinates as well(not sure, the array has 24 Vector3D values). I'm not sure where to go from here. I'm not using the Content Pipeline for my cube model or its texture though I'm wiling to add a custom .fx file if i need to. I realize I will have to add info about texture coords and color to my VertexDeclaration but do i need to write a custom effects file in HLSL to display my textured cube model or is there another way?

sentences: Displaying normals of a geometry I have a rectangle which is created by 2 triangles and it is in x-z plane, and i have object on it. Now, the normals of two triangles (face normals) are y axis i.e. (0,1,0). I want to display normals of two triangles for which i need two points to draw a line to show normal. Intuitively if i take center of a triangle as one and (0,1,0) as second point of a normal then both of the normals will converge to single point. I dont think it is correct as the normal should be exactly perpendicular to the surface. We can do a trick and take one point as a center and other by increasing y coordinate keeping x and z same, but what if we have curved surface and not a plane board? What about the cylinder made of triangles? How could we display normals as a lines of cylinder? I guess i am missing very basic concept here, please help me to understand it and tell me how to calculate the two points of normal.

sentences:
How can I animate a recursive algorithm? Say I have a recursive algorithm, for example one that generates a random tree:

// Pseudocode, just a simple algorithm: it isn't perfect.
function generate_branch(angle, length, current_depth, max_depth) {
  var branch = Branch(angle, length); // creates a new branch
  if (current_depth == max_depth) {
    return branch;
  }
  current_depth++;
  // random_int(min, max)
  branch.subbranches[] = generate_branch(random_int(0, angle + random_int(-30, 30)),
                                         random_int(0, 20)
                                         current_depth,
                                         max_depth);
  // ^^^^ recursion
  return branch;
}

var trunk = generate_branch(0, random_int(10), 0, 5);
RenderTree(trunk);

The problem is that this will render the entire tree in one frame. If I want to animate this (i.e. grow the tree over time), how would I do that? What is the best way to do this?

The game uses a game loop.

sentences:
Importing audiofile into Unity3d gets shown after ending playmode I am working on a game where the user has the possibility to import custom audio tracks that can be listened to during the game.

For this I am making use of System.IO.File.Copy method. This works, there are no issues or flaws here. When I inspect the target and destination folder the file(s) get copied properly and show up in the folder.

The issue however is that the Unity Editor doesn't show the file despite it actually being there. During play mode in the Unity editor the new file isn't shown in the resources folder (which I use as destination for now). When I use windows file explorer I can clearly see the file in the corresponding folder. Using debugs (in Unity) also state that the folder is empty, however when I use debugs outside of Unity it shows that the folder contains the copied item. Keep in mind that these both debugs are called roughly at the same time. I have tested this in many ways to be 100% certain that Unity doesn't see the file, while it is there.

So once I stop playmode it starts loading/importing/processing the new file and then it shows up in the folder in unity as well. When I launch playmode after this the file is indeed loaded and included in the game as well.

I however need this to happen without having to stop playmode. So there is probably some type of processing that I haven't called for Unity to process the addition of the new file and for it to be visible.

So in a nutshell basically copying a file from folder to folder isn't enough for Unity to directly utilized in the same play session (and all after). How can I make the audio-file directly showable and accessable?

There aren't any errors or warnings. The file plays correctly after it has been processed. I am at a loss with this issue/bug.

sentences:
Unity - Static Camera Perspective, Walls Obscure Player Pretty simple and common problem here.
The world I'm designing is fully explorable, no invisible walls or tricks. It's presented as a single seamless area, a School complex with 9 buildings, some of which have 2 or 3 floors and contain many rooms.

The perspective I've chosen is simple, inspired by topdown RPGs:

A problem arises with walls. They obscure the player.

I've tried some shaders which draw a silhouette of the player ontop but I don't like this approach, other objects and decoration remains obscured behind the wall.
Some kind of dissolve effect allowing you to see through the walls would be preferable, but writing my own shaders is not my forté...

Another problem is with large buildings outside. The camera is at a fixed distance, about 14 metre's away. If the player walks behind a large building (over ~10 metres tall) then the camera cuts off the top of it as it is now within the building.

The only way I can think of fixing this is to adjust the distance between player and camera, but some of the buildings are so tall the zoom-out looks very unusual and impractical.

I suppose this is why you don't see this simplistic camera setup in large explorable games...

While I've been developing games for some years now, I've only come to 3D and Unity fairly recently, so there might be a jaw-droppingly simple solution which I'm not seeing.

Anyway, I'd like to hear some interesting or novel approaches towards fixing these problems, besides the simple ones I've suggested.

I hope that's not asking too much.

sentences:
How do I find the largest circle possible in a square of pixels using Unity? As I am using Unity, I can easily grab a square of pixels of any length. However, I want to find the largest circle possible within that square of pixels.

So for instance, if I had a 40 x 40 square of pixels, how would I get an array of pixels that form a circle inside of the square?

sentences:
Unity Particle System How to rotate particle effect? My Particle System creates a "puff" of smoke.
When I rotate the particle system it doesn't rotate the effect, just the way the particle is shot.

What I want to do is when I shoot a wall have it "puff" horizontal not vertical. And vertical when hitting floor. I want it to follow the normals of the surface I am raycasting to.

My problem is that the texture doesn't turn with it's parent rotation.

Do I need to write my own Custom Simulation Space to be able to rotate the effect?
Assigning the transform of the parent does nothing.

Prefab structure:

Particle Settings:

sentences:
Time limit on puzzle games: yea or nay? Of course, it goes without saying that this can only work when the puzzle is randomly generated (say, something like minesweeper/bejeweled) and not hand-designed levels (such as trainyard, theseus & the minotaur etc).

I am currently thinking that this can instill a sense of urgency to the player and make them feel more challenged. Along with increasing the actual puzzle difficulty, a time restriction could be another way to increase difficulty, and the combination of both can be used as a way to give a sense of progress.

Also possibly, incremental time increases when solving parts of the puzzle (like time extensions in racing games) could be used for these games.

What I'm wondering about is, what's the accepted thought about using time limits? Would they work as I'm currently thinking or am I missing anything?

sentences:
Improve bloom quality I'm trying to understang how can I improve bloom effect quality using all known to me optimizations.

Currently I'm making it as follows:

Create new texture using some threshold to extracts areas which should glow
Downsample that texture 4 times (using bilinear filtering - GL_LINEAR)
Blur each texture horizontally using 5x5 gaussian blur.
Blur each texture vertically using 5x5 gaussian blur.
Composite each blurred texture with final image.

I've implemented gaussian blur using Incremental Gaussian Algorithm and set radius to 5. However because of size of last texture after composition bloom has very low quality especially when moving camera:

It doesn't look clear here but you can see it near bunny tail.

Simple workaround to that issue was increasing the radius for smaller textures but then image was more blurred.

Similar effect is when I use solution presented by Philip Rideout.

I get better results when I use blur shader presented here. However I still see some kind of vertical stripes.

I also tried to improve the algorithm by blurring the image and then downsampling it. Then I repeated whole process for the rest of images. But I haven't spotted any difference.

I'm also wonder how it is done in Unreal Engine. I mean how effective blur radius is computed. Documentation claims that each Bloom Size value is "the size in percent of the screen width" and each texture is smaller from previous one 2 times.

sentences:
convert clock input into 24 hour format I have stuck in a logical problem I have a third party package of DayNight. It takes hours input(24-hour-format) to show dayNight effects in scene

My code is to transform 12 hours clock cycle into 24 hours is

if (todsky.Cycle.Hour >= 0 && todsky.Cycle.Hour < 11.97)
            {
                Debug.LogError("1st");
                var degree = 360 - hourniddle.transform.eulerAngles.z;
                var degreeToMintues = degree * 2;       //multiply each degree with 2 to get correct minutes
                ConvertMinutesToHours(degreeToMintues); //
            }
            else if (todsky.Cycle.Hour > 11.97 && todsky.Cycle.Hour < 23.97)
            {
                Debug.LogError("2ndt");

                var degree = 360 - hourniddle.transform.eulerAngles.z; // as rotation is anti-clock getting rever degree
                var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
                var MintuestTo24HoursMintueCoverstion = 720 + degreeToMintues; //add 720 mintues into current minute in order to get 24-hour-format
                ConvertMinutesToHours(MintuestTo24HoursMintueCoverstion);

            }
 void ConvertMinutesToHours(float mintues) {
        result = TimeSpan.FromMinutes(mintues);
        Debug.LogWarning(result.Hours + ":" + result.TotalHours + ":" + result.Minutes + ":" + result.TotalMinutes);
        todsky.Cycle.Hour = (float) result.TotalHours;
        Debug.LogWarning("setted hours : " + todsky.Cycle.Hour);
    }

But it is not working correctly .
 have made a clock GUI(360-degree) and as you know it only show 12 digits-format not 24. I am getting clock needle movement which can be change through mouse drag. Needle z position up to 320 degree which means one degree is equal to 2 minutes and i am taking it as input from GUI. I write below code to integrate my clock needle with my DayNight package in order to integrate GUI with package and passing hour parameter into the package but it not working correctly. Problem is that else condition is skipping.

sentences:
In Unity3D, try to load a png into a Texture2D in an Editor script and then run PackTextures, but they need Readable flag to be set I am trying to automatically create a texture atlas from a set of generated png files in an Editor script. The problem is that I can't seem to be able to load a png into a Texture3D without it being inaccessible by the PackTextures method. I have tried a few different ways to load the PNGs, such as Resources.LoadAssetAtPath(...), AssetDatabase.LoadAssetAtPath(...) and a few more.

Since all of this is done in OnPostprocessAllAssets, I don't want to have to do any manual editing of the textures. I just want to be able to drop a PNG into a certain folder and get an updated atlas. Answers such as this seem to suggest manual editing.

The actual error message is

  "Texture atlas needs textures to have Readable flag set!".

So the question is, is it possible to do this kind of post processing in Unity3D? Is there any way to import a PNG into a Texture2D with the Readable flag set, without having to manually change it?

sentences:
How is this particular HLSL condition treated with respect to compile- or run-time evaluation? Let's say I have this very simple pixel shader (cbuffers and other stuff omitted)

float4 PS(VertexOut pin, uniform bool useLighting) : SV_Target {
    float4 retColor = gDiffuseMap.Sample( sampler0, pin.Tex );
if (useLighting) {
    retColor = retColor * float4(gAmbientLight, 1.0f);
}
    return retColor;
}

and two techniques such as

technique11 TexTech {
    pass P0 {
        SetVertexShader( CompileShader( vs_4_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(CompileShader( ps_4_0, PS(false)));
    }
}

technique11 TexLitTech {
    pass P0 {
        SetVertexShader( CompileShader(vs_4_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(CompileShader(ps_4_0, PS(true)));
    }
}

The way I understand it, the useLighting condition is evaluated during compile-time and each technique will have its own version of the pixel shader function without any branching. That means the useLighting condition wouldn't have any runtime penalties. Is that correct? So it's kind of like C preprocessing?

Why can the pin variable just be left out like that in the CompileShader call? It makes sense, of course, I'm just wondering if this is some special HLSL or Effect Framework syntax?

sentences:
Spawning prefab when other prefab appears Im trying to make a bottle spawn when it is broken.

This is the code that makes that:

public class romperobjetos : MonoBehaviour {

public GameObject BrokenBottle;
public float breakVelocity = 5f;
public GameObject NoBrokenBottle;
public bool rompible = false;
public Vector3 oldPosition;
public Quaternion oldRotation;
public bool botellarota = false;

public void Start()
{

}

// Use this for initialization
public  void Update()
{
    Debug.Log(NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude);
    if (NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude > breakVelocity)
    {
        rompible = true;
    }
    else
    {
        rompible = false;
    }

}
public void OnTriggerEnter(Collider other)
{
    if ((other.gameObject.name == "Plane") && (rompible))
    {
        oldPosition = NoBrokenBottle.transform.position;
        oldRotation = NoBrokenBottle.transform.rotation;
        Debug.Log("vamos bien");
        BreakBox();
    }
}
public void BreakBox()
{
    Instantiate(BrokenBottle, oldPosition, oldRotation);
    Debug.Log("se rompe");

        NoBrokenBottle.SetActive(false);
        botellarota = !botellarota;
}

}

The broken bottle prefab has a boolean variable that is true when it appears, but the unbroken bottle doesn't instantiate. This is the script for the spawn:

public class SpawnBotellas : MonoBehaviour {

public Transform[] spawnPoints;
public GameObject[] whatToSpawnPrefab;
public GameObject[] whatToSpawnClone;
public bool botella1rota = false;
// Use this for initialization
void SpawnAlgo()
{
    whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(0, 0, 0));
}
 void Update()
{
    //botella1
    if (GameObject.Find("alidobas blanco roto").GetComponent<alidobasrota>().alidobasblanco)
    {
        Debug.Log("asdkj");
      //  whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(90, 0, 0)) as GameObject;
    }

Sorry for my bad English and thanks.

sentences:
How to rotate a direction I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at (0,0,0), it has a height of 1 and a radius of 1. The direction of this cone is (0,-1,0) when the rotation is (0,0,0).

The relevant GLSL code:

float spot_alpha = dot(-l,normalize(vec3(0,-1,0) )); // <------
float inner_alpha = cos(light.falloff);
float outer_alpha = cos(light.radius);
float spot = clamp((spot_alpha - outer_alpha) / (inner_alpha - outer_alpha),0.,1.);

As you can see, the GLSL code uses a direction to define the area to be lit, so I could get this direction as a uniform, but I would need to find a rotation from that for the mesh to follow, or I can get the rotation and find a direction, but I don't know how to do either of these things.

Can I rotate a direction? How do I do it? If I can't, is there another solution for this problem?

sentences:
Is there any documentation comparing/contrasting C++ standard library implementations? (This is not game programming per se, but I'm certain if I asked this on SO I'd get told not to prematurely optimize, even though history tells us every large game ends up worrying about these things.)

Is there a document anywhere that summarizes the differences in performance, and particularly memory usage, between different C++ standard library implementations? The details of some implementations are protected by NDA, but a comparison between even STLport vs. libstdc++ vs. libc++ vs. MSVC/Dinkumware (vs. EASTL?) seems like it would be immensely useful.

In particular I'm looking for answers to questions like:

How much memory overhead is associated with the standard containers?
What containers, if any, do dynamic allocations merely by being declared?
Does std::string do copy-on-write? Short string optimization? Ropes?
Does std::deque use a ring buffer or is it crap?

sentences:
Libgdx, TweenEngine - continous rotation animation without stopping/delay I have a probably dumb question.

I'm trying to create a LoadingCircle so I just picked one image (you can see in the attachment) and made some sequences to rotate it:

 Tween.to(loadingCircle, SpriteAccessor.ANGLE, 1f).targetRelative(25).repeatYoyo(Tween.INFINITY,0).start(tweenManager);

And SpriteAccessor:

case ANGLE:
   returnValues[0] = target.getRotation();

case ANGLE:
    target.setRotation(newValues[0]);

It rotates of course, but 'to()' method gets the 'time' parameter. Now, the animation rotates the image, but slows down and stops rotating after the given time and starts from the beginning - speeds up and again - slows down.

Is it possible somehow to set the rotation to be continous, that it won't slow down and repeat the action? It's caused by the interpolation I think.

If you could point me the way I would be grateful!

sentences:
How to prevent images from being resized in game maker? This warning appeared in the compilation menu of my game.

The images were rescaled in half. I understand that this happened because they had very large dimensions.

It turns out that the images, although they have a large size (pixels), are very light, because they are composed for the most part by simple traces in addition to having the transparent background.

Below, one of the images:

You see, it is very light.

It turns out that in the game it stops being clear.

How do I solve my problem? Using smaller images is out of the question.

sentences:
Path finding algorithms? I posted this question on stack overflow first, but I guess no one is very interested in video games there...

What are some path finding algorithms used in games of all types? (Of all types where characters move, anyway) Is Dijkstra's used a whole lot? I would think not, as it doesn't actually trace out the steps to take to get somewhere, right? If I'm understanding it right, it only determines which object is the closest. I'm not really looking to code anything; just doing some research, though if you paste pseudocode or something, that would be fine (I can understand Java and C++). I'm basically looking for a quick overview of path finding in general.

I know A* is like THE algorithm to use in 2D games. That's great and all, but what about 2D games that are not grid-based? Things like Age of Empires, or Link's Awakening. There aren't distinct square spaces to navigate to, so what do they do?

What do 3D games do? I've read this thingy http://www.ai-blog.net/archives/000152.html, which I hear is a great authority on the subject, but it doesn't really explain HOW, once the meshes are set, the path finding is done. IF A* is what they use, then how is something like that done in a 3D environment? And how exactly do the splines work for rounding corners?

sentences:
Game Maker picking the wrong network adapter for broadcast In my game I need to get the local network IP of the computer that is running the game, and for that purpose I have the following code:

// Create event
randomize();
var random_port = irandom_range(49152,65535);
host = network_create_server(network_socket_udp, random_port, 5);

if ( host < 0 ) {
    show_message("Failed to create a broadcast server");
    game_end();
} else {
    var tsock = network_create_socket(network_socket_udp);
    var tbuff = buffer_create(32, buffer_fixed, 1);
    buffer_fill(tbuff, 0, buffer_bool, 0, 32);
    network_send_broadcast(tsock, random_port, tbuff, buffer_get_size(tbuff));
    network_destroy(tsock);
    buffer_delete(tbuff);
}

/// Async network event
global.game_ip = string(async_load[? "ip"]);
instance_destroy();

I've manually set up my local network IP to be 192.168.1.150, but when I run the code above, I get the IP 169.254.51.115.

Because I wasn't expecting such IP, I ran the ipconfig/all command (on Windows) and I got the following output (I've translated the output because my computer is in another language, and I've deleted the information that isn't relevant to this):

Ethernet adapter:

   Specific dns for this connection. . : Home
   Description . . . . . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   [...]
   IPv4 address. . . . . . . . . . . . . . : **192.168.1.150(Preferred)**
   Subnet Mask . . . . . . . . . . . . : 255.255.255.0
   Default gateway . . . . . : 192.168.1.1
   DHCP server . . . . . . . . . . . . . . : 192.168.1.1
   DNS Servers. . . . . . . . . . . . . . : fe80::1%13
                                       1.1.1.1
                                       1.0.0.1

Ethernet Npcap Loopback Adapter:

   Specific dns for this connection. . :
   Description . . . . . . . . . . . . . . . : Npcap Loopback Adapter
   IPv4 automatic configuration address: **169.254.51.115(Preferred)**
   Subnet mask . . . . . . . . . . . . : 255.255.0.0
   Default gateway . . . . . :
   DNS Servers. . . . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1

So, from my understanding point of view, Game Maker is getting the Ethernet Npcap Loopback Adapter instead of the regular ethernet adapter.

I could delete the Npcap Loopback adapter, but what if a user has wifi and ethernet connection?

Is there a way for Game Maker to choose one or another adapter?

In case the previous answer is no, is there a workaround for this  to avoid getting the Npcap loopback adatper?

sentences:
How do I stop my skeleton from playing the walking animation? I'm trying to get a Skeleton Model to go from its walking animation to its idle animation using a bool that checks for input. Currently, in-game, the skeleton doesn't leave its walking animation and stays in it even when not walking.
Here is the code I'm using:
public class SkeletonMove : MonoBehaviour
{
    private float velocity = 5f;
    public bool _isWalking = false;
    Vector2 input;

    void Update()
    {
        GetInput();

        if (Mathf.Abs(input.x) < 1 && Mathf.Abs(input.y) < 1)
            return;

        Rotate();
        Move();
    }

    void GetInput()
    {
        input.x = Input.GetAxisRaw("Horizontal");
        input.y = Input.GetAxisRaw("Vertical");
    }

    void Move()
    {
        _controller.Move(transform.forward * velocity * Time.deltaTime);
        _anim.SetBool("Walking", _isWalking);

        if (input.x != 0 || input.y != 0)
            _isWalking = true;

        if (input.x == 0 && input.y == 0)
            _isWalking = false;
    }

sentences:
Stacking Drawing Matrix for SpriteBatch in XNA I'm trying to make a 2D engine for XNA with SpriteBatch. My object unit is Entity, which can include other Entities as its children. However, when drawing them, the rotation and scaling stacking do not work well.

Here is my Entity code:

    protected virtual void PreDraw(Engine pEngine)
    {
        pEngine.PushMatrix();

        { // Transform Matrix
            // Translate
            pEngine.DrawingMatrix *= Matrix.CreateTranslation(this.X, this.Y, 0);

            { // Scale
                float translateX = this.ScaleCenterY + this.X;
                float translateY = this.ScaleCenterX + this.Y;

                pEngine.DrawingMatrix *= Matrix.CreateTranslation(-translateX, -translateY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateScale(this.ScaleX, this.ScaleY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateTranslation(translateX, translateY, 0);
            }

            { // Rotation
                float translateX = this.RotationCenterX + this.X;
                float translateY = this.RotationCenterY + this.Y;

                pEngine.DrawingMatrix *= Matrix.CreateTranslation(-translateX, -translateY, 0);
                pEngine.DrawingMatrix *= Matrix.CreateRotationZ(MathHelper.ToRadians(this.Rotation));
                pEngine.DrawingMatrix *= Matrix.CreateTranslation(translateX, translateY, 0);
            }
        }

    }

    protected virtual void Draw(Engine pEngine) { }

    protected virtual void PostDraw(Engine pEngine)
    {
        pEngine.PopMatrix();
    }

I will implement some primitive entities by overridding Draw method. Here is my Drawing call, and the Draw implementation for Rectangle, and the StartDrawing in the Engine:

Managed Draw call every drawing:

    public void ManagedDraw(Engine pEngine)
    {
        if (!this.Visible) return;

        { // Perform Drawing
            this.PreDraw(pEngine);

            int childIndex = 0;

            // Underlay Children
            while (childIndex < this.Children.Count && this.Children[childIndex].Z < 0)
            {
                this.Children[childIndex].ManagedDraw(pEngine);
                childIndex++;
            }

            // Draw Self
            this.Draw(pEngine);

            // Overlay Children
            for (; childIndex < this.Children.Count; childIndex++)
            {
                this.Children[childIndex].ManagedDraw(pEngine);
            }

            this.PostDraw(pEngine);
        }

    }

** Draw implementation of Rectable**:

    protected override void Draw(Engine pEngine)
    {
        pEngine.StartDrawing();
        pEngine.SpriteBatch.Draw(pEngine.RectangleTexture, new Rectangle(0, 0, (int)this.Width, (int)this.Height), new Rectangle(0, 0, 1, 1), this.Color);
        pEngine.StopDrawing();
    }

Start Drawing of Engine:

    public void StartDrawing()
    {
        this.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, null, null, this.DrawingMatrix);
    }

Here is one example of my failure, where the parent has Rotation of 30, while the children has none, but it should be in the center of the parent (red) rectangle:

Please give me the problem with above Drawing Matrix. What should I do to achieve the stacking?

sentences:
How do I fix this weird lighting problem? I'm making a small game in Unity, and some models are displaying very ugly shading.  The shading usually looks funky along the edges between triangles.  I'm pretty new to working in 3D; I bet this is an artifact of vertex lighting, but I'm not sure, and I'm not sure how to fix it.

Here you can see the worst example of this problem:

Low-quality lightmapping is visible in that shot, but I'm asking about the visible bands and weird shapes visible on the surface of the orange mesh in the foreground.  The mesh was built and UV-mapped in Blender, and is using a standard bumped diffuse shader.  There is a light behind and above the camera; all other lights in the scene are pretty far away.  What am I doing wrong, and how can I do better?

EDIT: Below is the wireframe for this model in Blender.

sentences:
Framerate is affecting speed of object I'm experimenting with building a game engine from scratch in Java, and I have a couple questions. My main game loop looks like this:

        int FPS = 60;
        while(isRunning){
            /* Current time, before frame update */
            long time = System.currentTimeMillis();
            update();
            draw();
            /* How long each frame should last - time it took for one frame */
            long delay = (1000 / FPS) - (System.currentTimeMillis() - time);
            if(delay > 0){
                try{
                    Thread.sleep(delay);
                }catch(Exception e){};
            }
        }

As you can see, I've set the framerate at 60FPS, which is used in the delay calculation. The delay makes sure that each frame takes the same amount of time before rendering the next. In my update() function I do x++ which increases the horizontal value of a graphics object I draw with the following:

bbg.drawOval(x,40,20,20);

What confuses me is the speed. when I set FPS to 150, the rendered circle goes across the speed really fast, while setting the FPS to 30 moves across the screen at half the speed. Doesn't framerate just affect the "smoothness" of the rendering and not the speed  of objects being rendered? I think I'm missing a big part, I'd love some clarification.

sentences:
Calculating the vector to catch a falling object I have two objects in a three dimensional world. One is a ballistic projectile: that is, it is free-falling with some known gravitational acceleration. The other is a catcher that travels with constant velocity and is not subject to gravity. I want to calculate the vector that the catcher must travel along in order to intercept and catch the falling projectile (or the position of intercept between the catcher and the projectile).

By my reckoning, the problem can be formulated into equations like this:

Intercept position = Catcher start position + Catcher velocity * Intercept time

Intercept position = Projectile start position + Projectile start velocity * time + 1/2 * Gravitational acceleration * Intercept time^2

...where all the named variables except intercept time are three-dimensional vectors. Within those equations, I know:

The catcher and projectile start positions
The projectile's current velocity
The projectile's gravitational acceleration
The magnitude of the catcher's velocity.

I don't know, and could solve the problem by finding out any one of:

The direction of the catcher's velocity
The intercept position
the intercept time

...but I have really struggled to make any headway finding a solution to these equations. Can anyone help me out? Is there something missing from/incorrect about my approach here?

sentences:
Do I need to create my own or use a commercial server for the features and matchmaking options I want my game to support? So I'm developing an indie turn-based game for iOS and, in coding up a Game Center matchmaking class, I'm starting to question whether Game Center is even the best choice for what I want this game to do.  I need to figure out whether I need to create my own server, invest in a preexisting client or server service, or if I even need to use a server at all.  If I do need to use a ready-made service other than Game Center, which server would accomodate my game's needs best?  I have limited resources and funds.  Here is the list of features I want my game to support, ideally:

Turn-based gameplay (a la "with Friends" and "with Buddies" games)
Smart matchmaking (matching users up with other players of comparable skill/achievements)
Random matchmaking
Facebook matchmaking
Specific username matchmaking
Contact list matchmaking
A way to select what "type" of match you want to challenge an opponent to.  (In random, smart, and Facebook matchmaking, there will be different "wagers" the player can make. [e.g. "I wanna play a random opponent for 1000 points.  Now, I wanna play my Facebook buddy for 1,000,000 points."]  There will be a predetermined range of amounts you can play for.  It won't be customizable.)
Buddies list capability (Game-buddies, as opposed to contacts and Facebook)
A higher concurrent game cap than Game Center offers (which I still can't really find a straight answer on)
Scalability (it should support 2 or 20,000,000 players)
Objective-C compatibility
Flexibility (for all the stuff I haven't thought of yet)

Am I dreaming, here?  Is there even a service that can handle all of these features?  Do I need to invest months in learning a networking language to build my own?  If so, how much would I need to spend on hardware?

I've been looking around all morning and, so far, the only seemingly viable option is SmartFox.  Under "Everything and the kitchen sink" section here, it says they support "virtual world with Zones, Rooms and RoomGroups, create complex game challenges, send invitations, manage buddy lists, create custom permission profiles, oversee the security aspects and tons more."

http://www.smartfoxserver.com/overview/platform

Is there an option that Im just overlooking?  Thanks for any help anyone can provide.  Sorry for the long poast.

One last question:  Does anyone know which server Dice with Buddies uses?  I was experimenting with how many concurrent games I could get going and my ADHD kicked in at about 80 games.  80 concurrent games would be great for my game, but again, I need the other features I mentioned too.  Thanks again.

sentences: What are these yellow lines between toggles, and how do I turn them off in Unity? I don't understand what these faint yellow lines are and how to turn them off (see screen shot). I have created toggles from a prefab and to save time have been duplicating them and moving them. Unity chugs everytime I move a group of them, and I imagine it is because it is recalculating how to draw these lines. All of the toggles have lines between them. Send help!

sentences:
What does "GL_CLAMP_TO_EDGE should be used in NPOT textures" mean? I have two sRGB PNG images I am using for textures. One is 64x64, and works fine. The other is 64x47, and when I attempt to use it I get an error:

reason: 'GL_CLAMP_TO_EDGE should be used in NPOT textures'

What does this mean, and how do I address it?

sentences:
How can I find out where a particular texture is being used in my Unity project? I have a texture in my assets, and I need to find out where it's being used so that I can change some textures in my project.

How can I find out where a specific texture is used in my project?

The case is that the game needs to be updated to have a Christmas look, so there are a few game textures should be replaced.

This resource checker does not work for me. It shows that there are no textures even though there are:

sentences:
Should I go with SpriteBatch or just 3D with Z component always zero? I'm designing a platformer and beginning to code the viewing engine of the game. Now, I have to make a key decision: Should I just use SpriteBatch to draw all the 2D stuff, as there is no 3D, or should I just go with making camera-facing polygons with Z set to zero? What are the good sides and drawbacks of both? Performance? Extensibility?

Performance is a key factor as I'll be having lots of texttures/objects/effects/animations etc, and I'll be targetting high resolutions like 1920x1200 (if available on client's computer), so I need things to go smooth. On the other hand, I also need some extensibility, as I want to have great control over the drawing methods. Seems like I'd be going with 3D/polygon method, but I was wondering if it has any side-effects?

sentences:
Checkerboard using Shadergraph In Unity Shadergraph, how can I create a checkerboard pattern that works independently of the size of the quad that it is applied to?
Here's what I got so far. Since I have set the Frequency to 10x6, this will work for a quad that has a scale of 20x12. However, if I increase the scale of the quad, the checkerboard will get stretched to fit. But instead, I would like it to "add more squares" to fit the new size.
Is there a way to get it to somehow use the size of the quad instead of manually specifying the frequency?

sentences:
Need to generate seamless gradient noise texture for water Shader I need to generate something like this

for my water Shader, because on fly calculations are to expensive for mobile (https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Gradient-Noise-Node.html). The texture needs to be seamless. I currently clueless where and how to make this happen (especially about the seamless thing). Any help appreciated!

sentences: Is there documentation on XNA other than at MSDN? MSDN documentation of XNA seems to be incomplete and/or bad. Is there another resource available? And by documentation I mean of the library/framework itself, similar to what UNITY, SFML, or SDL all have available.

sentences:
Unity 5 Virtual Reality Supported: Text shimmering / aliasing in GearVR I've spent the last 2 days trying to figure this out but have not come up with a conclusion. I'd appreciate if anyone has experienced the same and any thoughts.

Basically, I'm noticing that if I have a scene with text in it (world canvas and UI text component), when I build for GearVR with Unity's VR support, the text aliases like crazy. To be honest I'm not even sure 100% if it is plain old aliasing. The text just constantly shimmers.

I tried moving things around in case it was z fighting but it seems it is not.

I tried enabling anti aliasing from the quality settings and neither does it seem to make a difference.

I tried tweaking the Canvas Scaler Dynamic and Reference pixels/unit settings (which are not entirely clear to me from the docs btw). But at most, I was able to make the text slightly blurry as mentioned in the Unity VR guide and it barely helps.

I tried making the canvas and text huge and then scaling the canvas down to 0.05.

finally I tried making my text bold and bigger. And that seemed to mitigate the shimmering to a certain extent but not 100%.

But I've seen Unity apps for GearVR that don't exhibit this shimmering issue. So I am wondering what else might I be missing. I'm on 5.3.3.p3 if it makes any difference.

sentences:
Is my understanding of designing games in layers correct? I have started explaining how a game is designed in layers to a friend of mine. I want to make sure that I explained things, correctly, so I wanted to verify my thoughts.

Basically, the way I understand it, games are designed with the following layers, in the following order:

Rendering Engine
Physics Engine
Game Engine
Scripted Game

Is this correct?  Am I explaining this right?

sentences:
Layers with parallax in a game with zoom out by a transformation matrix I'm trying to implement a parallax rendering to my multi layered backgrounds. It's a classic 2d fighting game like The King of Fighters and Street Fighter.

It may have a stage composed by 5 layers.

Layers:

1 = Factor of 100% (the original, where generally the characters and the floor are present)

2 = Factor of 75%

3 = Factor of 50% (half of movement and scale of the first layer)

4 = Factor of 25%

5 = Factor of 0% (static, generally stuff very far away of the camera, like the sky, moon, stars etc.)

The camera with scale 1 shows 640 x 384 pixels, and with the max zoon out (scale 0.5) shows 1280 x 768 pixels.

Ie, all the stages of the game have a maximum size of 1280 x 768

These would be the sizes of the images of each layer aforementioned:

100% = 1280 x 768

75% = 1120 x 672

50% = 960 x 576

25% = 800 x 480

0% = 640 x 384

Every works fine when my transform matrix is with scale of 1, since it's only needed to multiply the actual camera position to the factor of the current layer being rendered.

The difficulty arises when the scale of the camera changes. It seems that I need to compensate the scale of the matrix in the parallax factor of the layers, but I can't figure out how.

Any sugestion?

--UPDATE--

Here some images of an example of a layer with 50% factor (960 x 576):

The first image the camera matrix is with scale 1 (no zoom) and is positioned in left edge of the screen. The second is the same but in the right edge and the last image is with the max zoom out (0.5).

I already correct the scale of the layer, the problem is correct the offset of its translation.

This layer is draw at the position (0, 0) relative to the stage size (1280 x 768) and with a origin Vector of (160 x 96).

--- UPDATE2 ---

I don't think my problem is in the camera matrix, because the sprites without the parallax processing are drawing correctly with any zoom, but here it is:

var gameResolution = new Vector2(640, 384);

var currentScale = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width / gameResolution.X * camera.Zoom,
                               GraphicsDevice.Viewport.TitleSafeArea.Height / gameResolution.Y * zoom);

var middleOfScreen = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width - 1) / 2f,
                                 GraphicsDevice.Viewport.TitleSafeArea.Height - 1) / 2f);

var currentTranslation = new Vector2(middleOfScreen.X - cameraPosition.X * currentScale.X,
                                     middleOfScreen.Y - cameraPosition.Y * currentScale.Y);

var cameraMatrix = Matrix.CreateTranslation(currentTranslation.X, currentTranslation.Y, 0);

cameraMatrix.M11 = currentScale.X;
cameraMatrix.M22 = currentScale.Y;

sentences:
p2.js body position is NaN when spawned inside of each other I'm working on a project for which I need a physics engine. At the moment I'm playing around with p2.js but I'm running into a problem:

When I try to create multiple bodies (circles and/or boxes) which overlap the positions are set to NaN as soon as world.step() is called. The bodies have a mass of 5 and are dynamic.

In very rare occasions it does actually work. How can I make sure it works every time? Do I have to wait for the bodies to be initialized?

4 circles before the simulation starts, once world.step is called the positions of these circles is NaN:

var world = new p2.World({
    gravity: [0, 9.82]
});
function PhysicsBody(type, x, y, widthOrRadius, height) {
    this.body = new p2.Body({
        mass: 5,
        position: [x, y],
    });
    this.type = type;
    if (this.type == 'rectangle') {
        this.shape = new p2.Box({ width: widthOrRadius, height: height });
    }
    else if (this.type == 'circle') {
        this.shape = new p2.Circle({ radius: widthOrRadius });
    }
    this.body.addShape(this.shape);
    world.addBody(this.body);
}
var bod1 = new PhysicsBody('circle', 0, 0, 32);
var bod2 = new PhysicsBody('circle', 10, 0, 32);

sentences:
Sprite Image in Canvas not displaying correctly (distorted) I have a problem with displaying images in my Canvas, as they're not displaying exactly like the imported image.

In the image below, the sprite on the left is how it looks when it's imported. The sprite on the right is how it looks in the canvas. Notice that some of the pixels have incorrect colours, like the lighter pink in the center of the staff's top is gone, the eyeball is a darker shade, some of the colouration under the hood is wrong, and other errors.

( The sprite is just a test I took from somewhere else, not what I intend to use as a final product. )

The project is 3D (going for a 2.5D look with billboard sprites) set to 384x224 resolution, orthographic camera size of 3.5, no anistropic textures, no anti-aliasing.

Is there some setting I missed somewhere to ensure that images display 100% exact like the source sprite when used in the Canvas?

EDIT
Sprite in the Inspector
(Seems to also not be correct)

EDIT
Added entire inspector

sentences:
Random lines drawn on screen while all vertexes are correct I'm writing a 2D program in which a monocycle follows a Catmull-Rom spline. My problem is when I write the circle, the drawing goes crazy. There is one line on the screenshot (which seems to be 3 when watching it), that rotates with the circle and blinks around it.

It doesn't happen always, comes randomly, sometimes it's fine then it will start this after a few seconds.

I have no clue what could cause it. My calculations are correct, there aren't fauly or nans/inf-s in the array, and if I put printf right before buffering the vbo, the lines don't appear, so I can't even debug it. And sometimes there's a small blinking in the green part too.

Here's some part of my code.

Creating the curve:

void Create() {
    // Curve
    glGenVertexArrays(1, &vaoCurve);
    glBindVertexArray(vaoCurve);

    glGenBuffers(1, &vboCurve); // Generate 1 vertex buffer object
    glBindBuffer(GL_ARRAY_BUFFER, vboCurve);
    // Enable the vertex attribute arrays
    glEnableVertexAttribArray(0);  // attribute array 0
    // Map attribute array 0 to the vertex data of the interleaved vbo
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), NULL); // attribute array, components/attribute, component type, normalize?, stride, offset
}

void Create() {
    glGenVertexArrays(1, &vaoCyclist);
    glBindVertexArray(vaoCyclist);
    // Curve
    glGenBuffers(1, &vboCyclist); // Generate 1 vertex buffer object
    glBindBuffer(GL_ARRAY_BUFFER, vboCyclist);
    glGenBuffers(1, &vboHuman); // Generate 1 vertex buffer object
    // Enable the vertex attribute arrays
    glEnableVertexAttribArray(0);  // attribute array 0
    // Map attribute array 0 to the vertex data of the interleaved vbo
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), NULL); // attribute array, components/attribute, component type, normalize?, stride, offset
}

Calculating:

humanData.clear();
        circleData.clear();

        for (int i = 0; i < 180; i++) {
            cordX = cosf((float)M_PI * i * 2 / 180.0f);
            cordY = sinf((float)M_PI * i * 2 / 180.0f);

            if (i == 0) {
                circleData.push_back(cordX);
                circleData.push_back(cordY);
            }

            else if (i == 179)
            {
                circleData.push_back(cosf((float)M_PI * i * 2 / 180.0f));
                circleData.push_back(sinf((float)M_PI * i * 2 / 180.0f));

                circleData.push_back(cosf((float)M_PI * i * 2 / 180.0f));
                circleData.push_back(sinf((float)M_PI * i * 2 / 180.0f));

                circleData.push_back(cosf((float)M_PI * 0 * 2 / 180.0f));
                circleData.push_back(sinf((float)M_PI * 0 * 2 / 180.0f));
            }

            else {
                circleData.push_back(cordX);
                circleData.push_back(cordY);
                circleData.push_back(cordX);
                circleData.push_back(cordY);
            }
        }

Draw:

mat4 MVPTransform = MrotateTranslate() * camera.V() * camera.P();

MVPTransform.SetUniform(gpuProgram.getId(), "MVP");

int colorLocation = glGetUniformLocation(gpuProgram.getId(), "color");

for (int i = 0; i < circleData.size() - 1; i++)
    printf("%f\n", circleData[i]);

glBindVertexArray(vaoCyclist);
glBindBuffer(GL_ARRAY_BUFFER, vboCyclist);
glBufferData(GL_ARRAY_BUFFER, circleData.size()* sizeof(float), &circleData[0], GL_DYNAMIC_DRAW);
if (colorLocation >= 0) glUniform4f(colorLocation, 0.72f, 0.16f, 0.0f, 1.0f);
glDrawArrays(GL_LINES, 0, circleData.size());

Cyclist attributes:

class Cyclist {
private:
    unsigned int vaoCyclist, vboCyclist;
    unsigned int vboHuman;
    float r= 1;
    float v = 0;
    vec2 wTranslate = vec2(-10.0f, 0.0f);
    vec2 position = vec2(0, 0);
    float sina, fi=0, ds;
    float cordX, cordY;
    vector<float> circleData;
    vector<float> humanData;
    float dir = 1.0f;

sentences:
Drawing Sprites with Artemis I am trying to trace the StarWarrior code (the Artemis tutorial). I cannot figure out how these sprites are being drawn.  This is the code where the player's ship is initialized:

/// The initialize player ship.
private void InitializePlayerShip()
{
    Entity entity = this.entityWorld.CreateEntity();
    entity.Group = "SHIPS";

    entity.AddComponentFromPool<TransformComponent>();
    entity.AddComponent(new SpatialFormComponent("PlayerShip"));
    entity.AddComponent(new HealthComponent(30));

    entity.GetComponent<TransformComponent>().X = this.GraphicsDevice.Viewport.Width * 0.5f;
    entity.GetComponent<TransformComponent>().Y = this.GraphicsDevice.Viewport.Height - 50;
    entity.Tag = "PLAYER";
}

Which line of code actually leads to the ship being drawn? The drawing takes place in PlayerShip.cs. Here is a commented version of the code with what I think is happening:

/// The initialize player ship.
private void InitializePlayerShip()
{
    Entity entity = this.entityWorld.CreateEntity(); //declare and initialize entity
    entity.Group = "SHIPS"; //Unused label

    entity.AddComponentFromPool<TransformComponent>(); //Add the component to store X and Y
    entity.AddComponent(new SpatialFormComponent("PlayerShip")); //Add a component which is just a String (perhaps this has something to do with PlayerShip.cs?)
    entity.AddComponent(new HealthComponent(30)); //Add a health component with 30 hp

    entity.GetComponent<TransformComponent>().X = this.GraphicsDevice.Viewport.Width * 0.5f; //Initialize the TransformComponent's X
    entity.GetComponent<TransformComponent>().Y = this.GraphicsDevice.Viewport.Height - 50; //Initialize the TransformComponent's Y
    entity.Tag = "PLAYER"; //Unused label
}

So how is the actual sprite being drawn?  Because, I am not seeing it. :(

If it is being drawn by entityWorld.Draw() in the Draw() method, then which line(s) of code put it in the world to be drawn? Or what is actually happening in entityWorld.Draw()?

I believe the RenderSystem is the one that is doing the drawing, but I don't get how it is being called.

I am sorry for the uninformed question, but I have made no progress after about 12 hours, and I desperately need some guidance!

sentences: LWJGL Collision Detection I cannot find LWJGL collision detection with a camera and walls. Like making it to where you can not walk through walls and other different shaped rectangular prisms and cubes. How do I set up LWJGL collision?

sentences:
Is there a way to set a pallet for colours in an SVG image and change them at runtime for one gameobject? in the latest beta build for unity they introduced the ability to import svg files. What I'd like to know is if there is a way to identify all svg shapes by colour, and then change those colours, as if you were changing a class in CSS.

I suspect that you can go into an svg file, find where the text for colour is found and then change it, but I'm worried it'll change it for any object that use that svg file instead of changing it by gameobject.

The thing I'd like to do here is have customizable characters in a fighting game, where you can go into the menu and change their colours on a slider. so if I can identify like 3 colours in an svg and list them, and then edit those values in runtime or load, I'll have what I need

sentences:
How to Enable NVIDIA Ambient Occlusion in my Game I have a DirectX11 based game, and I want to enable NVIDIA's built in Ambient Occlusion (that is shown in the NVIDIA control panel, but it grayed out for my application).  Is that possible?  Or do I need to be a big time developer and arrange something special with NVIDIA to get their ambient occlusion to work with my game?

Here is what happens when attempt to enable ambient occlusion in my application:

I've searched and found that sometimes you can override the "not supported" message through the use of an NVIDIA inpector tool, however it looks like the override is only for specific games as shown below:

So my conclusion is either NVIDIA has to enable it somehow, or my game must render in a very specific way, which NVIDIA can pick up on and insert its ambient occlusion calculations into my scene.  Is there any documentation of how this works online, or has anyone gotten NVIDIA's ambient occlusion to work for an application they wrote?

sentences:
Is there any way to convert .unr file? I'd like to examine a Harry Potter game for study purposes.
All of resources are fine except map file.
The maps are in a .unr file format. I know it is unreal map file.

Is there any way to convert .unr file to .fbx, .obj, or pskx formats?
I want to open map file to 3ds max or blender.

sentences:
IsoMetric Map draw: sort with Z-Buffer and anchor point I'm writing an IsoMetric renderer for my html5 isometric game. The isometric renderer should be able to render objects with floating point coordinates.

SOURCE: https://github.com/ilmattodel93/EaselJs-Isometric-with-Heightmaps

As now, the renderer works pretty well, but I have some questions and a problem to fix.
Note that little square is the anchor point, and lines are AABB (not correctly drawn I think).

THE PROBLEM

If you have a look at the demo, you should note that when the dragon is behind the tree on a higher level, it will be rendered over the tree instead of behind, as expected.

As you can see in js/mmo/renderer/IsoEntity.js#L91 and js/mmo/renderer/IsoLayer.js#L65, i have a "rough" implementation, and maybe it is'nt good.
I've googoled around and find something called "topological sort", i've attempted to implement it, but it does'nt seems to solve.

For each tile I have information about minX, minY, minZ, maxX, maxY, maxZ. An AABB as you can notice.

THE QUESTION

My question is, how can I solve this problem? Is it better (and will be faster) to maybe implement a depth-buffer? And how can I implement it? Will it ensure high performance? Maybe will a correct anchor point (represented with little square) solve the problem?

Thanks for any help! :D

sentences:
Client-side Prediction and Reconciliation for movement I've explored the concept of client-side prediction with reconciliation quite a bit and there's one thing that puzzles me a lot.

From what I've seen in most guides, the flow looks a bit like this:

T0. Client sends MOVE command and immediately simulates a predicted result.
T0. Server streams gamestate (server does not know about Client's MOVE command yet and thus the T0 gamestate does not contain results for it).
T3. Client receives gamestate T0 from the server. T0 does not contain any movement and thus Client is forced to reconcile with the Server gamestate.

This way, Client will have to reconcile with the Server every tick it receives because they will never agree. If Client would be delayed by ½RTT before predicting, Client and Server should agree most of the time, but that's an unwanted delay.

If the Client submits a tickstamp with each command sent, the server can apply those commands pasttime. But this would mean that the client is authorative because it can make the server reconcile with its commands. There's also an issue here where players with a high latency will be changing a relatively distant past on the server, potentially undoing/invalidating a lot of already streamed gamestates.

I suppose the Client could simply pretend that T3 is T0 (sync to a different server tick depending on how high the latency to Server is) but I don't know the effect of that when interacting with other non-predictable entities (such as other players). I guess the Client would take longer to reconcile with the correct Server gamestate because of the induced "tick latency".

Is there something I'm missing here? Which is the best way forward for a twitch gameplay competitive game? I.e. Air Hockey or similar.

sentences:
Farseer Player Movement and Collision I have added a video link for any one who whats to see what the problems are by watching the game.

I am trying to create a player movement system and there are small problems that I am running into.

I want to find the most accurate way of knowing if player is colliding with another object. I tried using if (Player.Body.LinearVelocity.Y == 0.0f) then player is not jumping and on ground. But if I add force to the X axis the y will fluctuate.   I also tried to use OnCollision but am confused on how to use it.

What is the best way to know if the player is colliding with the ground and can jump?
The player slides across the ground like it's ice how do i fix this problem? How would I make it into quick and sudden stops with little sliding.
Lets say I had a one color texture, and I wanted to use it on a rectangle and a circle but could not bother to make 2 textures and just want to do it in the coding. How could I make this texture go from a rectangle to any shape I want?
If OnCollision is the best way for me to detected where the player is hit (left, right, top, or bottom) and then use for the best and quickest collision test, were can I learn how to use this thing properly?
Here is the Video.
How do you delete an object, I got the texture to go but not the object itself. The objects are spawned in and then stored on a list. How do you remove them from the list?
How come the player on the top left is more clearer then the player being controlled?

sentences:
Java Game Optimizing I'm trying to optimize my game. I've got object Handler that goes trought all objects and then render and tick them. If I have lot of objects in game game lags or don't start. Could you please help me? public class Handler {

public LinkedList<GameObject> object = new LinkedList<GameObject>();

private GameObject tempObject;

private Camera cam;

public Handler(Camera cam) {
    this.cam = cam;
}

public void tick() {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.tick(object);

    }

}

public void render(Graphics g) {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.render(g);

    }

}

sentences:
Inconsistent CapsuleCast/Collision behavior when a GameObject is selected My gameobject has a CapsuleCollider and I use CapsuleCast to check for horizontal collisions when moving horizontally so the gameobject won't pass thru obstacles.
It works 100% of the time except when I select the gameobject in Hierarchy.

When I have the gameobject selected, whenever I try to bump a wall continuously, it shakes/jitters until it eventually goes thru the wall. But this only happens when I have the object selected in Hierarchy. If I click on the scene so that the object is not selected and do the exact same thing (bump a wall continuously), there is no shaking/jitter and it doesn't pass thru the wall no matter how long I bump it.

This passing in the wall when selected is also consistent. Hundred percent of the time it will pass thru when I have it selected (and does the shaking) and also hundred percent of the time it doesn't if I don't have the object selected. Shouldn't selecting an object don't have any effect on this? Please give me some ideas of why.

sentences:
Issues with 3dsmax and Unity3d scale I changed the units in Blender so they are identical to Unity 3d. If I make a 1m^3 box in Blender, it will import into unity as exactly the same size as the standard cube.

With 3ds max, I changed the unit setup to metric and made sure it was centimeters in the system unit setup tab. However, when I import an obj file made in Blender and used in Unity, it is absolutely tiny. I have to convert the model to meters on import and then, when exporting, I have to set the model scale to .01 otherwise it is enormous in the unity scene.

I've tried changing the max units to meters and nothing changed.

How do you change the max unit/grid setup so one grid unit is 1m^2 and exactly equivalent to unity's grid?

sentences:
How can I use a filter to scale down my sprites? I want the best visual result on my Windows Phone if I scale down my sprites from 1920x1080 pixel resolution to 800x480 pixel resolution.

How can I use a filter to scale down my sprites? Which filter is the best?

sentences:
How to avoid self-intersection when applying stroke to a curve? I have several Spline2D objects in my code, each of which has a Position, Velocity, and Acceleration method that returns a vector of the specified quantity at a particular time. I've been using these vectors in order to construct geometry to create gradient strokes for the curves, but I'm having problems with self-intersections at steep curves. As an example, here's one curve where I'm having this occur:

Wireframe: http://twitpic.com/2zplw1/full
Filled: http://twitpic.com/2zpmnt/full

As you can see, on the second bend, the inner portion intersects itself, which causes that ugly artifact. Is there a good algorithm/method to stroke curves without causing that self-intersection?

EDIT: More extreme examples, plus a mock-up of what I'd like to achieve:

Wireframe: http://twitpic.com/2ztwzi/full
Filled: http://twitpic.com/2ztwkt/full
Ideal Outcome (Mock-Up): http://twitpic.com/2ztxa8/full

sentences:
Approximately circular range of motion on a square tile grid I've been working on a grid based tactics style game to learn the ropes of Unity. I have an issue with movement range for a player unit. Let's say the units move range is 3 spaces..
If I set up each grid tile with 4 neighbours (up down left right), I get this movement range:

If I give each tile diagonal neighbours too- 8 in total, I get this;

What I'm actually looking for is what you'd see in these type of games traditionally, like this;

Here is the code that finds the unit move range list, starting at tile (5, 5). It adds the initial tile/node and its neighbours to the movelist, then works outward looping through all their neighbours. It's based off a youtube tutorial.
public HashSet<Node> getUnitMovementOptions() {

    float[,] cost = new float[mapSizeX, mapSizeY];
    HashSet<Node> moveList = new HashSet<Node>();
    HashSet<Node> tempMoveList = new HashSet<Node>();
    HashSet<Node> finalMoveList = new HashSet<Node>();

    int moveSpeed = 3;
    Node unitStartNode = graph[5, 5];
    finalMoveList.Add(unitStartNode);

    /// Initial costs for the neighbouring nodes
    foreach (Node n in unitStartNode.neighbours) {
        cost[n.x, n.y] = costToEnterTile(n.x, n.y, unitStartNode.x, unitStartNode.y);
        if (moveSpeed - cost[n.x, n.y] >= 0) {
            moveList.Add(n);
            }
        }

    finalMoveList.UnionWith(moveList);

    while (moveList.Count != 0) {
        foreach (Node n in moveList) {
            foreach (Node neighbour in n.neighbours) {
                if (!finalMoveList.Contains(neighbour)) {
                    cost[neighbour.x, neighbour.y] = costToEnterTile(neighbour.x, neighbour.y, n.x, n.y) + cost[n.x, n.y];

                    if (moveSpeed - cost[neighbour.x, neighbour.y] >= 0) { tempMoveList.Add(neighbour); }
                    }
                }
            }

        moveList = tempMoveList;
        finalMoveList.UnionWith(moveList);
        tempMoveList = new HashSet<Node>();
        }

    Debug.Log("Total move spaces for this unit is: " + finalMoveList.Count);
    return finalMoveList;
    }

Here is the costToEnterTile function:
public float costToEnterTile(int targetX, int targetY, int sourceX, int sourceY) {

    Tile t = tileTypes[tiles[targetX, targetY]]; // get current tile type
    float cost = t.movementCost;

    // diagonal
    if (sourceX != targetX && sourceY != targetY) {
        cost += 0.3f;
    }

    return cost;
}

If I tamper with the cost value in here, I can get different results in the movement range overall shape, but it's a bit hit and miss depending on the movement range.
Can anyone offer insights in to what path I need to head down to solve this?

sentences:
Node-Based pathfinding vs A* and others Whats the difference between node-based pathfinding algorithm and the A* among others?

A friend just told me about node-based, but I cannot find much tutorial or information on it.

sentences:
Generating Arrow Maze puzzles I have picked this puzzle shown here as training in programming games.

  In these mazes you follow the arrows. From each arrow you can move to
  any of the arrows it's pointing to, in the same row, column, or
  diagonal.

More explanation can be found here.

As you can see the Arrow on a yellow background in the top-left corner marks the beginning of the maze. Since this arrow is pointing to the right, the player can move from here to either of the two spaces to the right. The player then chooses which arrow to should move to. If they choose the Down arrow in the top-middle, then for their next move they can travel to any of the spaces in the column below it. If they choose the diagonal arrow, then they can move diagonally.

In short, the arrow direction indicates the path direction the player can move. The player continues making these moves until they arrive at the bulls-eye which marks the end of the maze. Here is a solution to this maze:

What I want is to generate a brand new puzzle each time the player starts the game, so they will have to find a different solution path. The player then makes their choices of moves to solve the puzzle. Then they can generate a new puzzle to solve.

Unfortunately, I'm stuck on this step. How can I generate this kind of puzzle? Do I need some path finding methods and which one will help me to achieve this goal?

I'm using the C# language.

Thanks!

sentences:
Get all supported resolutions for a monitor I've been receiving complaints from users that my game doesn't support the 16:10 aspect ratio.
Currently I list everything in Screen.resolutions in a dropdown and allow the user to pick from that. I have since come to the understanding that the first element is not necessarily the native resolution of the monitor.
I've found the Display class but this appears to only give the native resolution, not all scaled resolutions. E.g. if the monitor is 1920x1080 then I need a list of 1600x900, 1280x720, 640x360 etc.
I thought about just multiplying by some scale factor but then I'm afraid I'll get something obscure like 885x497.8. And if I have a pre determined list of resolutions for a specific aspect ratio, how do I support obscure aspect ratios like widescreen for example.

sentences:
Why the camera is not moving only up but also to the right? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMove : MonoBehaviour
{

    public float smoothSpeed = 3f;

    // Use this for initialization
    void Start()
    {

    }

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

    }

    private void FixedUpdate()
    {
        transform.localPosition = Vector3.MoveTowards(transform.localPosition, new Vector3(0, 500, 0), smoothSpeed * Time.deltaTime);
    }
}

The script is attached to the Main Camera.

I want the camera to move directly up and a little bit also to the back.
But the way it is now it's moving up but also to the right. Why it's moving also to the right ? I tried transform.localPosition and also only transform.position

sentences:
Make player to always move along the terrain I'm working on a 2D platformer side scroller game. I am giving high impulse to player, the player starts moving and if it hits a slope on terrain, it gets a vertical movement and starts to fly over (Box2D physics).

What I need is that the player should always be on the terrain and move along the ground.

I would like to know if it's possible using Box2D engine.

sentences:
How to mix textures in DirectX? I am new to DirectX development and I am wondering if I am taking the wrong route to achieve the following:

I would like to mix three textures which contain transparent areas and some solid areas (Red, Blue, Green). The three textures should blend like shown in this example:

How can I achieve that in DirectX (preferably in directx9)?

A link or example code would be nice.

Update:

My rendering method looks like this and I still think I am doing it wrong, because the sprite only shows the last texture (nothing is rendered transparent or blended):

void D3DTester::render()
{
d3ddevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
d3ddevice->BeginScene();

d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

LPD3DXSPRITE sprite=NULL;
HRESULT hres = D3DXCreateSprite(d3ddevice, &sprite);
if(hres != S_OK)
{
    throw std::exception();
}

sprite->Begin(D3DXSPRITE_ALPHABLEND);

std::vector<LPDIRECT3DTEXTURE9>::iterator it;
for ( it=textures.begin() ; it < textures.end(); it++ )
{
    sprite->Draw(*it, NULL, NULL, NULL, 0xFFFFFFFF);
}

sprite->End();

d3ddevice->EndScene();
d3ddevice->Present(NULL, NULL, NULL, NULL);
}

The resulting image looks like this:

But I need it to look like this instead:

Update2:
I figured out that I have to SetRenderState after I use sprite->Begin(D3DXSPRITE_ALPHABLEND); thanks to the hint by Josh Petrie. However, by using this:

    sprite->Begin(D3DXSPRITE_ALPHABLEND);

d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

std::vector<LPDIRECT3DTEXTURE9>::iterator it;
for ( it=textures.begin() ; it < textures.end(); it++ )
{
    sprite->Draw(*it, NULL, NULL, NULL, 0xFFFFFFFF);
}
sprite->End();

The sprites colors are becoming transparent towards the background scene e.g.:
if I use d3ddevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,100,21), 1.0f, 0); the result looks like:

Is there any way to avoid that?
I would like the sprites be transparent to each other but to be still solid to the background.

Update3:
After having sombody explained to me, how to do what @LaurentCouvidou and @JoshPetrie suggested, I have a working solution and therfore accept the answer:

d3ddevice->BeginScene();

D3DCOLOR white = D3DCOLOR_RGBA((UINT)255, (UINT)255, (UINT)255, 255);
D3DCOLOR black = D3DCOLOR_RGBA((UINT)0, (UINT)0, (UINT)0, 255);

sprite->Begin(D3DXSPRITE_ALPHABLEND);
sprite->Draw(pTextureRed, NULL, NULL, NULL, black);
sprite->Draw(pTextureGreen, NULL, NULL, NULL, black);
sprite->Draw(pTextureBlue, NULL, NULL, NULL, black);
sprite->End();

sprite->Begin(D3DXSPRITE_ALPHABLEND);
d3ddevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
d3ddevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
sprite->Draw(pTextureRed, NULL, NULL, NULL, white);
sprite->Draw(pTextureGreen, NULL, NULL, NULL, white);
sprite->Draw(pTextureBlue, NULL, NULL, NULL, white);
sprite->End();

d3ddevice->EndScene();
d3ddevice->Present(NULL, NULL, NULL, NULL);

Update:
since this question is rather popular, I'd like to point out a website where you can experiment with opengl blendmodes:

sentences:
Will the same Flash game business model work for HTML5 games? One of the best ways to earn money with Flash games is by making sponsorship deals. The developer puts the sponsor's logo and a link to their site in the game and lets the game spread around the web. The sponsor gains money from the ads and the extra traffic to their website. Alternatively, they site-lock their game to their website (usually for a short period of time) so that people who want to play the game go to their website. It's true that one can remove the site-lock with some effort by decompiling the swf, but it's usually not done as it's not worth the effort and not legitimate. Another significant part of the Flash business model is to put advertisements in-game. There are other ways of earning money with Flash games, but from what I know, these two are the most prevalent ones.

Since HTML5 is necessarily open source, it makes me wonder if this model would still work for HTML5. Even if you obfuscate your js, it's much easier than Flash to copy the game, so maybe it's worth the effort for someone to copy the game to their (illegitimate) site. If you add your sponsor's logo and link or advertisements, it might be worth the effort to remove them for their site, something that I think is much harder to do with Flash games. Perhaps even the illegitimate site could claim that their site is better because there are no in-game ads. There's still the legitimacy barrier, but I wonder if it's strong enough.

Let's put aside all game development technical restrictions regarding HTML5 for this question (suppose for a moment that HTML5 works just as well as Flash for games). I have two very similar (pair of) questions. The first is, would the Flash business model work with HTML5? What changes to it would be helpful for HTML5 games? The second question is, what about the big picture for HTML5 games? Is adapting the Flash model really the best solution, or is there a better model for the HTML5 games world to "turn"?

sentences:
Dynamic frame rate in Unity I'm developing a 3D visualization tool based on Unity, targeting WebGL. The user rarely interacts with the 3D scene and when he does it's only about adjusting the camera like rotating or zooming the view. I disabled vSync (QualitySettings.vSyncCount) and locked the frame rate to 30 (Application.targetFrameRate) to reduce the CPU usage at least a bit while still having an acceptable level of responsiveness when the user moves the camera around. With 30 fps I get a CPU usage of around 30%. Considering lower-end hardware this seems still too high.
In order to further decrease CPU usage, I introduced two 'modes':

Interactive: runs with 30 fps
Idle: runs with 10 fps

I wrote some lines of code to switch between those modes depending on user interaction. So when an input is detected, the application uses more fps and after a certain amount of time without any interaction, the application uses less fps again. It works pretty well so far: The app uses 30% in interactive mode and 8% to 10% of the CPU while in idle mode.
Setting the idle frame rate to 1, CPU usage is reduced to 1.5% while in idle mode. This is really great. But as expected there's a problem. Basically I locked all the Update() methods to be called only once per second. When the user interacts with the camera, the event will be processed with an expected delay of something around one second.
Now the question: How can I detect user input immediately while having the application run with a low frame rate and also immediately apply a new frame rate (say 30) without any  noticeable delay?
Originally I wanted to have some sort of on-demand rendering. I've read some posts about how people render to a texture to reduce rendering cost in less interactive scenes. But setting the frame rate dynamically seems like a cleaner solution in my opinion. I also tried to use the FixedUpdate() method to check for inputs and switch to interactive mode, but that didn't work either.
Note Also worth mentioning, this approach produces errors in the browser, indicating that the application frame rate should be 0 (not in terms of Unity's target frame rate but as in 'let the browser handle the frame rate'). While this might be a different question it's still related to this topic. Maybe someone has an answer for that as well!

Edit 1
As mentioned in the comments below, Unity provides the callbacks MonoBehaviour.OnApplicationPause and MonoBehaviour.OnApplicationFocus to detect whether the application is about to receive or lose focus.
However, the problem is this: My application nearly never loses focus. While this is a nice additional optimization it doesn't really help me too much. My problem is that the app is idle most of the time while also having focus. It's really just the user staring at the window most of the time.
Just to make some more sense: I'm targeting WebGL. Unity's sole purpose is to visualize some stuff while the user mainly interacts with some HTML controls. In the rare case he wants to interact with the 3D scene, I want to set the frame rate to say 30. The idea is "I don't re-render the scene too often as long as you don't interact".
To emphasize: In my most relevant use case the application never loses focus. This means, the only reliable indicator to determine when to switch between frame rate profiles is based on user input.
Sorry if I wasn't too clear about that :)

Edit 2
I posted this topic on the Unity Feedback Page. If you're interested, check it out and leave a vote. Maybe this request gets enough attention to get supported by the Unity developers.

sentences:
Creating an mouse-friendly GUI in a "sort of" Python console mode I'm developing a real-time rogue-like game during my spare time, using Python and libtcod, to learn programming (and have some fun). I would like to create some sort of mouse-friendly GUI, just like in Goblin Camp.

This game is 90% mouse-driven, with menus, scrollbars, buttons etc.
As a total noob with graphical interfaces, I just can't figure out how to do this. Example: How to display the name of a monster when the cursor is over it? I tried some ways, which more or less worked, but were always awful, impossible to maintain, hard to scale, and resource-consuming.

Is there a "simple" way to have something more like an object.OnClick() ?

sentences:
Collision box to slow I've made the collision box for my player (and other blocks) and I'm now testing gravity and collision on the player. What I saw was that my collisionbox is updating slower than my player is moving.

It's not visual if he's just moving, but you can clearly see it when he's falling at a certain speed. (and it causes problems with the collision because the box updates slower)

This is for updating my collision box (and player):

public override void Update(GameTime gameTime, Rectangle clientBounds)
{
    // collision box for player
    if (left)
    {
        collisionRect = new Rectangle((int)position.X + 10, (int)position.Y + 14, frameSize.X + 2, frameSize.Y + 20);
    }
    else
    {
        collisionRect = new Rectangle((int)position.X + 8, (int)position.Y + 14, frameSize.X + 2, frameSize.Y + 20);
    }
    // for player
    position += direction
}

This is for updating my player:

public override Vector2 direction
{
    get
    {
        Vector2 inputDirection = Vector2.Zero;
        keyboard = Keyboard.GetState();

        if ((keyboard.IsKeyDown(Keys.Left)) || (keyboard.IsKeyDown(Keys.A)))
        {
            moving = true;
            walking = true;
            inputDirection.X -= 1;
            running = false;
            left = true;

            if (keyboard.IsKeyDown(Keys.LeftShift))
            {
                speed = speedMultiplier;
                inputDirection.X -= 1;
                running = true;
            }
        }

        if ((keyboard.IsKeyDown(Keys.Right)) || (keyboard.IsKeyDown(Keys.D)))
        {
            moving = true;
            walking = true;
            inputDirection.X += 1;
            running = false;
            left = false;

            if (keyboard.IsKeyDown(Keys.LeftShift))
            {
                speed = speedMultiplier;
                inputDirection.X += 1;
                running = true;
            }
        }

        if (!(keyboard.IsKeyDown(Keys.Right)) && !(keyboard.IsKeyDown(Keys.D)) && !(keyboard.IsKeyDown(Keys.Left)) && !(keyboard.IsKeyDown(Keys.A)))
        {
            moving = false;
            walking = false;
        }

        if (stopping)
        {
            inputDirection.X = 0;
        }

        if (falling)
        {
            inputDirection.Y += 1f;

        } else
        {
            inputDirection.Y = 0;
        }

        return inputDirection * speed;

    }
}

Or do I also need to use a get; for my collisionbox instead of updating it in Update()?

sentences:
cocos2d-x Label Load Image like Sticker-Smile..(by html or …) hi and sorry for my english...

i am using cocos2d-x (c++)... can i load sticker (smile) in my Label(a text mixed by image)? i know that we can load bitmap fonts by:

Label::createWithBMFont

also i know many frameworks like flash can load html texts by textbox which can contains img tags... but what is the best way for adding smile image in the text of label in cocos2d-x?? can cocos2d Label load html text like :

"hello
How Are You"???

thanks...

sentences:
synchronise two coordinate planes So i have two coordinate planes. One is player and mouse click position relative to player. Other is the world map.

I need to find the point on the world map, where the mouse clicks.

The map is generated from a 64*64 heightmap, so for now i want to find the mouse click inside the 64*64 bounds.

Im having trouble determining the coordinates at the world map, where the mouse clicked.

The map has a multiplier of 10. Im not really sure how it is applied, but when it is 10, the world map is in bounds -10,-10 to 10, 10. When it is 20, it is in -20,-20 to 20, 20, when 50 then in -50,-50 to 50,50. Those are click coordinates in relation to player.

To get the world vertex i need to supply a coordinate (0-63, 0-63).

How do i transform the mouse click coordinates so that they are aproppriate to the world map?

sentences:
MiniMax not working properly(for checkers game) I am creating a checkers game but My miniMax is not functioning properly,it is always switching between two positions for its move(index 20 and 17).Here is my code:

 public double MiniMax(int[] board, int depth, int turn, int red_best, int black_best)
 {

  int source;
  int dest;
  double MAX_SCORE=-INFINITY,newScore;
  int MAX_DEPTH=3;
  int[] newBoard=new int[32];
  generateMoves(board,turn);
  System.arraycopy(board, 0, newBoard, 0, 32);
  if(depth==MAX_DEPTH)
  { return Evaluation(turn,board);}
  for(int z=0;z<possibleMoves.size();z+=2){
        source=Integer.parseInt(possibleMoves.elementAt(z).toString());
        System.out.println("SOURCE= "+source);

        dest=Integer.parseInt(possibleMoves.elementAt(z+1).toString());//(int[])possibleMoves.elementAt(z+1);
        System.out.println("DEST = "+dest);
        applyMove(newBoard,source,dest);
        newScore=MiniMax(newBoard,depth+1,opponent(turn),red_best, black_best);
        if(newScore>MAX_SCORE)
        {MAX_SCORE=newScore;maxSource=source; maxDest=dest;}//maxSource and maxDest will be used to perform the move.

        if (MAX_SCORE > black_best)
        {
            if (MAX_SCORE >= red_best)
                break;  /*  alpha_beta cutoff  */
            else
                black_best = (int) MAX_SCORE;  //the_score
        }
        if (MAX_SCORE < red_best)
        {
            if (MAX_SCORE<= black_best)
                break;  /*  alpha_beta cutoff  */
            else
                red_best = (int) MAX_SCORE;  //the_score
        }

  }//for ends

  return MAX_SCORE;
 } //end minimax

I am unable to find out the logical mistake. Any idea what's going wrong?

sentences:
How do I detect collision between an ellipse and a rhombus? I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base tile is 32x16px).

Most creatures in the game use ellipses as collision masks (similarly 2x1 sized, default size is 32x16), whereas static objects use rhombuses for masks (again, 2x1, 32x16 default). How do I detect the collision of these two distinct shapes? Also, how do I detect collisions between two ellipses and/or two rombuses?

I've looked at the Separating Axis Theorem, Voronoi diagrams, and all kinds of other things, but I am having trouble understanding them (which is a pretty essential step for C/C++). Can anyone help me to understand these techniques?

sentences:
Car movement in arcade racing game I am finishing a very basic 2D racing game with top-down perspective. I can't get the appropriate formulas to make the movement of the cars fun and addictive... Do you have tips on how to achieve that arcade feeling a lot of games have? Do you know of any guide/tutorial on this topic?

Right now, these are the formulas I am using:

// (speed changes linearly according to the user input)
direction += turnAmount.Value;
Vector3 pos = Position + new Vector3(speed.Value * (float)Math.Cos(direction), 0, -speed.Value * (float)Math.Sin(direction));

I have tested other, more complex options but this is the best I have got so far...

sentences: Analyzing movement data for a checkerboard For a psychology experiment - subject has to learn that the 2D grid is a checkerboard, and collect all the 1s (rewards). How do I test if subjects are actually doing it in the most optimal way -- making least effort for moving from one square to the next by taking smaller steps (or selecting closest reward neighbour). My guess is that if I could simulate a learning algorithm and approximate how long it takes to learn the reward distribution, and then explore it optimally (optimality is defined as a unit of time and exploring closest squares first), I could compare the behaviour.

sentences:
how to implement A Star path finding on 2D map with large tiles The map tiles I have im my game are 64x64 pixels, and the characters are 16x16 pixels. I was reading about A Star path finding and I was wondering if I need my tiles closer to the size of my characters so that the movement given by the path finding seems more natural, or should I set up a different node map of where the characters can move, and use that in the A Star algorithm.

Or if you have a better solution let me know

Thanks!

EDIT: this is the Map class I am using

public class Map extends JComponent{
MapTile[][] map;
Random random;

public Map(char[][] mapKey){
    map = createMap(mapKey);
}

public void update(){

}

@Override
public void paintComponent(Graphics g){
    for(int i = 0; i < map.length; i++){
        for(int j = 0; j < map[0].length; j++){
            drawTile(g, map[i][j].getType(), i * 64, j * 64);
        }
    }
}

private MapTile[][] createMap(char[][] mapKey){
    MapTile[][] temp = new MapTile[mapKey.length][mapKey[0].length];

    for(int i = 0; i < mapKey.length; i++){
        for(int j = 0; j < mapKey[i].length; j++){
            temp[i][j] = new MapTile(mapKey[i][j]);
        }
    }
    return temp;
}
}

really the only thing that the MapTiles hold at this point is a key to the Image they paint on the screen

sentences:
Best way to do discontinuous animation? Or: Best way to animate a character with a jerky center of mass? I am using Unity and need to know how to use it animation system properly for… well let me describe it below.

In this game I have this big 3D block-like character that moves in an unusual fashion compared to most game characters. In most games, the character moves along a straight line at a constant rate. However this character, and other characters in the game, does not move in a continuous fashion. Instead it is discontinuous and choppy in unique ways.

For example, here is how I want a big block character to move:

Basically the two corners in front of him are pivot points, and the character moves forward by alternating between these two points and rotating. How can I do this with Unity's animation system? For the most part the animations in Unity don't move the character but instead have an animation play, such as the "Run" animation, and then a script actually moves the character. Know I the animator has a “use root movement” or something that does exactly this, but I have heard that it can causes problems. I’ve been considering just programming all of the animations, since they are relatively simple. However that makes fine tuning them a nuisance, and have some animations programmed and others not is probably not a good practice. I kind of also fear that if I don’t end up programming it I will have troubles with detecting if a character can walk through a certain walkway, considering for example the above animation his “walk width” is greater than his actual width since he rotates side to side.

Also keep in mind that there are other animations that are discontinuous like this but work in different ways. For example, another block that hops but pauses between hops. Another might rock backwards and then slide forward on the forward rocking animation.

So I know there are multiple ways to tackle this, but my question is what is the best way to do this? How would you do it?

sentences:
XNA - Obtaining depth from the scene's render target? Possible Duplicate:
  Depth buffer and render target

I'm currently rendering my scene to a render target so it can be used for rendering methods such as post processing and order independent transparency.

rtScene = new RenderTarget2D(
            GraphicsDevice,
            GraphicsDevice.PresentationParameters.BackBufferWidth,
            GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,
            DepthFormat.Depth24Stencil8,        // Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model)
            0,
            RenderTargetUsage.PreserveContents
            );

I am required to use RenderTargetUsage.PreserveContents so that the same render target can be rendered to multiple times, once for each of the draw methods below.

DrawBackground
DrawDeferred
DrawForward
DrawTransparent

The problem is that DrawTransparent requires a copy of the scene's depth as a texture.

Is there any way to obtain this from the scene render target above (rtScene)?

I can't have more than one render target with RenderTargetUsage.PreserveContents as this causes problems on hardware such as the XBOX 360, so rendering the depth to a separate render target at the same time as I render the scene isn't possible as far as I can tell.

Would I be able to get around this problem by "Ping-Ponging" two render targets (using the more compatible RenderTargetUsage.DiscardContents) and using the result for the depth texture?

sentences:
Non-rectangular collision detection in Python and Pygame I am programming a ray tracer in python, and I have gotten as far as making a character that can move across a 2d plane and change direction of movement when needed. The problem is this: I want to be able to use an image with transparency as the maze that the player travels through, and use transparent parts as parts that aren't walls, where as every thing else is a wall. The way I am using collision detection is by using the "pygame.sprite.spritecollide" method, which takes in a Sprite, and a Sprite Group. So I first add the map sprite object to the group, and then in the main while loop, it checks for collision. Here is a small snippet of what that might look like:
map = Map("map1.png") # "Map" class is regular sprite class but with "image" and "rect"
group = pygame.sprite.Group()
group.add(map)
# inbetween stuff would be here
# while loop \/
running = True
while running:
    # event handling stuff would be here
    if pygame.sprite.spritecollide(player, group, False):
        print True
    # screen drawing routines would be here

As I mentioned, the image has transparency. But never the less, the image rect sticks to the non transparency position that it was, so i have to move the player off screen to get the console to stop saying "True".
So what I ask, is there a way that I can check for sprite collision but with transparency?

sentences:
Mesh with quads to triangle mesh I want to use Blender for making models yet realize some of the polygons are not triangles but contain quads or more (example: cylinder top and bottom).

I could export the the mesh as a basic mesh file and import it in to an openGL application and workout rendering the quads as tris, but anything with more than 4 vert indices is beyond me.

Is it typical to convert the mesh to a triangle-based mesh inside blender before exporting it? I actually tried this through the quads_convert_to_tris method within a blender py script and the top of the cylinder does not look symmetrical. What is typically done to render a loaded mesh as a tri?

sentences:
How can I create online leaderboards for iOS and Android? I'm developing a racing game for iOS and Android phones/tablets and I want to implement online leaderboards. My game has a singleplayer mode(no multiplayer features) but I want to implement online leaderboards to encourage people to beat other player's score and time.

I want to save the score and time(the time that you need to finish the race) in an online leaderboard. In addition, the name of the player and if possible his country are also saved in the leaderboard. The leaderboards don't need to be cross platform, I can create two leaderboards, one for iOS and one for Android.

Is it possible to create online leaderboards without MySQL and PHP knowledge? In addition, I don't have a server to save the data.

I use MonoGame to develop my game. Do you know a step by step tutorial for implementing online leaderboards because I don't know where to start.

sentences:
Generating objects randomly from prefabs in Unity2D I am developing an infinite runner using Unity. I have already figured out how to loop a set of backgrounds randomly but I am having problems doing the same for the objects.

So, I have a few objects or obstacles in my prefabs. I want them to generate randomly in the game, not everything at once though.

How do I do that? Can I please get a well-explained piece of code for the purpose?

EDIT : I want the objects to be destroyed as soon as they move out of camera's view (The cam which is following the player).

Thank you.

sentences:
Improve mouse movement in first person game In my current FPS game, I have the mouse setup in a way, that it always forces the position of the mouse to be centered at the screen. This gets the job done, but also gets very annoying, since the mouse is "fixed" at the center of the screen.

Here is what I am doing:

get mouse current position
find offset from center of the screen
set mouse current position to center of the screen
apply difference to m_pTransformation (transformation matrix of the player)

Is there a better way to deal with this ?

sentences:
Why is the equation \$S = ut + \frac 1 2 a t^2\$ not used directly to calculate final position of an object? Most articles I've read on physics integration in games say to do it like this:

first we calculate velocity after a certain elapsed time dt like this: velocity.x += acceleration.x * dt
then we calculate position as: x += velocity.x * dt

But this will definitely give an inaccurate result.

Therefore, what is the reason to not use the equation of motion \$S = ut + \frac 1 2 a t^2\$ to calculate an accurate displacement and add it to the position?

sentences:
What is "game state?" The terminology "game state" is a bit vague to me. Could anybody clarify what is included in the game state, please?

Is it a state of all the variables and objects within the game at particular moment?

sentences:
Order of rotation in Euler angles I'm want to control the direction my camera looks, so I'm using Euler angles, so rotating around an axis is relative to rotation around previous axis. Something like this.

I want to always rotate using the blue axes. So I'm using three separate matrices to track rotation along their respective axes.

...

glm::vec3 mulVec (glm::mat4 const&, glm::vec3&);

glm::vec3 camPos = glm::vec3(0.0f, 1.0f, 0.0f);
glm::vec3 target = glm::vec3(0.0f, 0.0f, -5.0f);
glm::vec3 camup  = glm::vec3(0.0f, 1.0f, 0.0f);

tulsi::ModelInput a1;

while (1) {

    ...

    a1.tick();  // Tracks user input.

    glm::mat4 lookat = glm::lookAt(
                    camPos,
                    mulVec(a1.yAxis * a1.xAxis, target),
                    mulVec(a1.yAxis * a1.xAxis, camup)
                    );
    ...
}

I get the desired output (rotate around x axis then y)

But when I switch the order of multiplication, I get different output (rotate around y then x axis)

glm::mat4 lookat = glm::lookAt(
                    camPos,
                    mulVec(a1.xAxis * a1.yAxis, target),
                    mulVec(a1.xAxis * a1.yAxis, camup)
                    );

So whats happening here. I'm assuming the order should not matter.

sentences:
Android TV game development Anybody develop games for Android TV? Especially with libGDX?

I would like to know what game controllers Android TV uses? And whether we can use libGDX to control the game controllers?

sentences:
Help for structuring classes I am creating a platformer game with some card base fighting. I was thinking  about how should I structure my classes? There are 2 types of cards i.e. Continuous effect and 1 time effect. Also, they can be divide into 3 other categories i.e. Environment cards, enemy cards and player cards. Please help me to get started with structuring it.

For more details, I want structure to be reusable as well as organized. Enemies and player both can interact with these cards and at some points.

Thank you

sentences:
Control Two agents separately with one script? I have two characters"agent" moving them on terrain by mouse. My script for both of them is...

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

void Update
{

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

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

public bool character1, character2;

void Start()
{
    character1 = true;

}

   void Update()
{

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

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

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

}

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

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

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

sentences:
Texture blends into one single color It looks like that it's being sampled from the least detailed MIP level, at least RenderDoc sees the texture as it should be, and what the actual texture looks like is the same as MIP 9th. I'm using DirectXTex, so I think the shader resource view should be correct.
    DirectX::ScratchImage* pImageData = new DirectX::ScratchImage();
    LoadFromDDSFile(path.c_str(), DirectX::DDS_FLAGS_NONE, nullptr, *pImageData);
    const DirectX::TexMetadata& textureMetaData = pImageData->GetMetadata();
    const DirectX::Image* image = pImageData->GetImage(0, 0, 0);
    DirectX::CreateShaderResourceView(
        GetDevice(gfx),
        image, textureMetaData.mipLevels,
        textureMetaData,
        &pShaderResourceView);

and the sampler is
    D3D11_SAMPLER_DESC samplerDesc;
    samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.MipLODBias = 0.0f;
    samplerDesc.MaxAnisotropy = 4;
    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    samplerDesc.MinLOD = 0;
    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

    DX::ThrowIfFailed(GetDevice(gfx)->CreateSamplerState(&samplerDesc, &pSamplerState));
    pImageData->Release();

then
    GetContext(gfx)->PSSetShaderResources(0u, 1u, &pShaderResourceView);
    GetContext(gfx)->PSSetSamplers(0u, 1u, &pSamplerState);

Input layout might be relevant
    const std::vector<D3D11_INPUT_ELEMENT_DESC> inputElemDesc =
    {
        {"Position", 0u, DXGI_FORMAT_R32G32B32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"TexCoordinate", 0u, DXGI_FORMAT_R32G32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"Normal", 0u, DXGI_FORMAT_R8G8B8A8_UNORM, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u}
    };

Vertex shader
struct VertexIn
{
    float3 position : Position;
    float2 texCoord : TexCoordinate;
    float3 normal : Normal;
};

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 Tex : TEXCOORD;
};
PSstruct main(VertexIn vin)
{
    PSstruct vout;

    vout.Tex = vin.texCoord;;
    return vout;
}

pixel shader. I removed light related code, I'm fairly sure that here it's not important. And I temporarily disabled it
Texture2D cubeTexture : register(t0);
SamplerState cubeSample : register(s0);

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 tex : TEXCOORD;
};
float4 main(PSstruct pin) : SV_TARGET
{
    float4 texColor = float4(1, 1, 1, 1);
    texColor = cubeTexture.Sample(cubeSample, pin.tex);
    float4 litColor = texColor;
    return litColor;
}

sentences:
The difference between shading and data interpolation Using methods like Phong you can make mesh look smooth and real. However you can do the same interpolation at the data level creating a surface (for example B-Spline surface).

What is the difference and when would you use shading over data interpolation?

sentences:
Data flow with PhysX on a dedicated GPU If  there are 2 GPUs in a PC, one processing only graphics and the other dedicated to PhysX, what is the flow of the physics-related data?

Let's say we're simulating an explosion and the PhysX calculates exploded elements (position, size, number, whatnot) while graphics GPU renders them. Does CPU send input to PhysX GPU, gets the results and sends (some of) them to graphics GPU? Or is something like this possible: CPU sends input data to PhysX GPU and, after performing calculations, data from PhysX GPU goes straight to graphics GPU (omitting CPU altogether) since they're just used to render stuff anyway and CPU doesn't need to do anything with them?

Edit: Actually, as a bonus question, I'd like to know the same in case of just one GPU (used for both PhysX and graphics). Does the data flow to GPU, gets calculated, returns to CPU and then goes back to GPU for rendering or can it "stay" on GPU?

sentences:
Unity: Car Rollover Protection I have a standart Unity car with Unity Car physics.
What would be the best approach to protect my car from a rollover?

I dont want to mess up and try and error 10 different approaches, so maybe here is an expert who really knows how to do it right?

I couldnt find anything decent on the internet.

sentences: Making a button that spawn objects in the world? I want to make a button that can spawn an object that I've already created. Though I have no clue how to actually do this / where to start. Has anyone ever done something similar?

sentences:
How are potentially visible sets (PVS) determined in state of the art games? As I understand it,  potentially visible sets (PVS) are used to determine 2 things;
1. which objects are inside the camera's view volume
2. which objects are not occluded (hidden) from the camera's point of view.

I understand that things like octtrees & BSP trees have been used for PVS calculation in the past, but how are PVSs calculated in today's AAA titles?

sentences:
Add a "fake" Loading Screen I'm working on a 2D game for WPF8 using XNA 4.0.

Everything goes great, but it's too fast. I was just wondering, what could I do between the end of the game and the score screen, and before the game starts? I'm looking for a sample of how to do that (black screen with "loading" write in windows phone style) or a way to implement it.

sentences:
Random map generation - strategies for scattering/clustering random nodes I am doing a simple 4X strategy game in space where each node is a point-of-interest (a planet, an asteroid and etc.).

To randomly generate a map, I would follow the steps below

Decide how many type of each nodes the map will have (perhaps, say, 5 Earth-like planets, 10 barren planets etc.)
Place each type of node on the map.

For step 2 I would like to have an even spread of each node type. So for example, I would start by placing all the earth-like planets. If I simply do a rand(map.width, map.height) to determine the position, I may end up all the earth-like planets clustering together, which will give advantage to the player who starts in that area.

Are there any methods, such as using different graph functions or noise function, which could generate a sequence of (x,y) coordinates which are spread out from each other. Likewise, are there any ways to generates coordinates which are close to each other?

sentences:
Unity - change sprites to something that uses less memory I have a game that uses only silhuette textures, but they take up waay too much memory (360 MB overall and this is a mobile game) so I plan to avoid using sprites with alpha punchouts (1 bit alphas). From what I gathered, I could use an asset from Unity store like SVG importer, but I have no financial means to do so. So I plan to make low poly 3D (in fact 2D) planes that somewhat cover my textures.
Now, I have a lot of sprites already. I saw that Unity can create a 2D mesh collider around my sprites. Can I use that to create my meshes and then apply a single colour unlit material to them? How would it roughly effect memory usage as opposed to my generally 500x600 sprites?
If I'm going in the wrong direction, is there a way to create Shapes, just like in Photoshop or GIMP?

sentences:
How to read rendered textures back without killing performance I have an application where I need to render some OpenGL based dlls, read the rendered textures back, and send them to another directx based application that will render them in directx.

Right now, I am rendering them using FBOs, reading them back, and then sending the data across the network.  However, the "reading them back" step is killing the performance.

My basic loop is as follows:

while(true)
   ... render 5 to 10 textures ...
   foreach( texture in renderedTextures )
      bind texture
      glGetTexImage( data )
      push data onto a queue to send asyncronously

Commenting out the glGetTextImage call causes performance to improve drastically.  What techniques can I use to read the data back faster?

sentences:
Why is my Tiled map distorted when rendered with LibGDX? I have a Tiled map that looks like this in the editor:

But when I load it using an AssetManager (full static source available on GitHub) it appears completely askew.

I believe the relevant portion of the code is below.
This is the entire method; the others are either empty or might as well be.

private OrthographicCamera camera;
private AssetManager assetManager;
private BitmapFont font;
private SpriteBatch batch;
private TiledMap map;
private TiledMapRenderer renderer;

@Override
public void create() {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    assetManager = new AssetManager();
    batch = new SpriteBatch();
    font = new BitmapFont();

    camera.setToOrtho(false, (w / h) * 10, 10);
    camera.update();

    assetManager.setLoader(TiledMap.class,
            new TmxMapLoader(
                    new InternalFileHandleResolver()));
    assetManager.load(AssetInfo.ICE_CAVE.assetPath, TiledMap.class);
    assetManager.finishLoading();

    map = assetManager.get(AssetInfo.ICE_CAVE.assetPath);

    renderer = new IsometricTiledMapRenderer(map, 1f/64f);
}

sentences:
Unity3d - Transform rotation(angle) help Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right.

Here's the part of the code which controls the rotation:

rotationDestination = new Vector3(60, 270, 0);
if (Vector3.Distance(transform.eulerAngles, rotationDestination) > 0.2f) {
  transform.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles,
                                       rotationDestination,
                                       rotationSpeed * Time.deltaTime);
}

If I try to make the Y axis -90 a.k.a (60, -90, 0) then it rotates constantly to the left.

How do I make it rotate straight to the left (90 degrees) ?

Thank you.

sentences: No assets in CryEngine V? I just downloaded and installed CryEngine 5.0.1. I am trying to follow the Island tutorial but I don't have the assets the tutor has. I have installing CryEngine Game SDK but I still don't see any assets or materials except the default ones. So my question is how do I install the assets I need to follow the tutorials?

sentences:
Maze algorithm with field counter I am new to algorithms but currently creating a little game with the need for some.

I have a 2d grid/board with a start and a finish field. Between those two fields are several platforms which can be entered. Each platform has a counter on it. When going on a platform the counter is decreased by one. If the counter reaches zero the platform is gone. The goal is to go to the finish field AND destroy every platform field. A little exmaple:

0 1 0
1 2 1
1 0 F
S 0 0

S being the Start field and F being the finish field the right path would be going UP, UP, RIGHT, UP, DOWN, RIGHT, DOWN.

All I could find so far were algorithms getting paths for mazes without counter. Do you have any tips for a algorithm that can decide, if the current maze if solvable or not and maybe even get the correct path?

Thanks in advance!

sentences:
How do I understand a big c++ gaming project in SFML? Currently I am doing SFML- c++ as a basement in game development before starting out Unreal

When I see a game project in  SFML,  the codebase is huge, like above 30 classes, 100 functions, how can I get an idea of the code project, any suggestions about the usual standard class names in SFML projects and their purpose would be helpful.

sentences:
DirectX D3DXVec3Normalize unresolved external symbol I have simple DirectX project:

#include <d3dx10.h>
#include <d3dx10math.h>

#pragma comment(lib, "d3d10.lib")
#pragma comment(lib, "d3dx10.lib")

int main()
{
    D3DXVECTOR3 u(1.0f, 2.0f, 3.0f);
    D3DXVECTOR3 v(2.0f, 1.0f, 3.0f);
    D3DXVECTOR3 a, b, c, d, e;

    float l = D3DXVec3Length(&u);
    float s = D3DXVec3Dot(&u, &v);

    D3DXVec3Normalize(&d, &u); // <- problem is here

    return 0;
 }

I added "include" and "lib" directories in my project properties and everything works fine, except D3DXVec3Normalize line. When I run the program it says: "error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function _main".

Can anyone explain why D3DXVec3Length and D3DXVec3Dot functions work OK (without Normalize line) and D3DXVec3Normalize produces error?

P.S. I use DirectX SDK June 2010 and Visual Studio 2012.

sentences:
Get mesh height at position Me and my friends are creating a simple 3D game in LibGDX and are currently trying to implement simple collision detection with the terrain (ground). For this I thought the best way would be to simply get the y-value (height) of the piece of terrain the player is currently standing on, and limit the player's y-position to that value.

For this I need some way to get the 3 vertices that make up the triangle the player is standing on and then use some type of interpolation (probably barycentric) to get the correct height. The problem is that LibGDX's Model, ModelInstance and ModelData classes only contains a raw vertex array(s) of floats with no built in way to acquire the information we need. So my question is fairly straight forward:

Is there a way to acquire the three vertices that we need to perform this interpolation or Is there another way to acquire the height of the terrain given the coordinates (x, z)?

PS. I know using a heightmap instead of a model could solve this problem, but we'd much rather use LibGDX's built-in systems unless absolutely necessary.

sentences:
Build a vbo once every second I have a VBO storing some data in my game. The thing is, the data can change at a rate of about a second. The data is not fixed size, meaning that some objects will sometimes be visible, sometimes invisible and could even have a different polygon count. I'm trying to figure out how I could do that efficiently using VBOs. In immediate mode, I would simply not call the render method of the single objet, and it would simply not appear! And if I needed more polygons, I would just... call glVertex2f more often! I understand why using immediate mode is really bad in performance, but I really can't think of any good way to "build" the VBO.

I thought about using a list, append the vertices to the list and then create the vbo, but this would have, I think, three drawbacks. More CPU intensive, requires more memory copying, and would require me to recreate (I could work this out) the VBO every time, since I don't know the size before building the lists!

Is there a common way of building a VBO for many small objects without using a list?

Some pseudo code:

void GlobalRender()
{
    foreach (chunk in chunks)
    {
        if (chunk.RequiresUpdate)
        {
            chunk.UpdateVBO(); //In there, that's where I don't know how large I'll need my VBO to be.
        }

        chunk.Render();
    }
}

void UpdateVBO() //The code called above
{
    foreach (node in nodes)
    {
        if (node.Visible)
        {
        //Emit vertices from here!
        }
        else
        {
            //There's nothing here really, just pointing out that there could be no vertices for a single node
        }
    }
}

sentences:
How to make an enemy spawner that selects from a list of potential enemies? (Unity) I'm just making a practice version of a basic 2D RPG, but I'm trying to build a spawner kind of object that could be scaleable across the entire game. That is, there would be multiple types of enemies, and each instance of such a spawner would have a specific set of enemies that it would spawn.

I'm sure the answer is very simple, but I'm at the beginning stages of all of this. I guess really I just want a simple list that I can attach to my object and add the enemy names to it so that it can draw from that to figure out what they would spawn.

sentences:
Would I need to delete unused assets from my Unity packaged build? I'm going to make a release for my Unity game.

Does Unity include unused assets in build output? Would removing unused assets from a project reduce build size/Time?

I want to know if Unity packages all the assets to my build (which I would need to delete), or if Unity packages only the assets that are actually used in the game.

sentences:
Can I 'emulate' a device by booting its BIOS on my PC? So for example let's take a SEGA Genesis (Mega Drive).

Let's say I have a usb Genesis cartridge loader with Sonic 1 plugged in. In that case, could I 'hardware emulate' a Genesis by booting a Genesis BIOS from USB (or any other way to boot a Genesis BIOS) and use that to play or mod Sonic 1, or develop & test home-brew games for the console?

sentences:
Strange GLSL performance problems I'm having weird performance problems with a GLSL shader I'm working on. This small example fragment shader:

#version 450
out vec4 fragColor;

struct ST { float a; float b; float c; float d; float e; };

void main() {
    ST s = ST (0.0,0.0,0.0,0.0,0.0);
    ST[1] stack;
    int ptr = 0;
    for (int i = 0; i < 32; i++) {
        if (i > -1) // Always true
            stack[ptr++] = s;
        s = stack[--ptr];
    }

    fragColor = vec4(1.0);
}

has horrible performance, but the same shader with almost anything taken out, for example, removing e from the struct, performs fine. I'm just using these on a fullscreen triangle.

I can't figure out what's going on, and how I could fix this problem in my actual shader. Any ideas?

sentences:
What are the differences between random encounters and permanent mobile enemies? Random Encounter:

A player has a 10% chance to encounter an enemy. while moving through a 5x5 grid.

Permanent Mobile Enemies:

There is one enemy that constantly moves through the 5x5 grid and only encounters the player when they land on the same grid. Also, both the enemy and the player cannot see each other until they meet.

Obviously, the random encounter will give better performance, but are there any benefits through implementing the second option?

sentences:
Problem animating in Unity/Orthello 2D. Can't move gameObject I have a enemy npc that moves left and right in a corridor.
It's animated with 2 sprites using Orthello 2D Framework.

If I untick the animation's play on start and looping, the npc moves correctly.
If I turn it on, the npc tries to move but is pulled back to his starting position again and again because of the animation loop.
If I turn looping off during runtime, the npc moves correctly again.

What did I do wrong?

Here's the npc code if needed.

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour
{
    private Vector2 movement;
    public float moveSpeed = 200;
    public bool started = true;
    public bool blockedRight = false;
    public bool blockedLeft = false;
    public GameObject BorderL;
    public GameObject BorderR;

    void Update ()
    {
        if (gameObject.transform.position.x < BorderL.transform.position.x)
        {
            started = false;
            blockedRight = false;
            blockedLeft = true;
        }
        if (gameObject.transform.position.x > BorderR.transform.position.x)
        {
            started = false;
            blockedLeft = false;
            blockedRight = true;
        }

        if(started)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedRight && !started && blockedLeft)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedLeft && !started && blockedRight)
        {
            movement = new Vector2(-1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
    }
}

sentences:
Simple Java 2D Game : Player Doesn't Move I'm a beginner at java and I'm trying to make a simple 2D game as a practice, and i have a problem here with the player, I've tried a lot to make it move but it didn't work. These are the classes that contain the player.

Game Class :

package game;

import game.input.Controller;
import game.input.KeyInput;
import game.objects.Player;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.Timer;

public class Game extends JPanel implements ActionListener{

  Timer loopTimer;
  //Objects
  Player p;
  Controller c;

  public Game(){
    addKeyListener(new KeyInput(p));
    setFocusable(true);

    loopTimer = new Timer(10, this);
    loopTimer.start();

    p = new Player(300,200);
    c = new Controller();
  }

  public void paint(Graphics g){
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.white);
    g2d.fillRect(0, 0, 640, 480);
    p.draw(g2d);
    c.draw(g2d);
  }

  public void actionPerformed(ActionEvent ee){
    p.update();
    c.update();
    repaint();
  }
}

Player Class :

package game.objects;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;

public class Player extends GlobalPosition {

  private String playerimage = "/images/marioR.png";

  int velX = 0;
  int velY = 0;

  public Player(int x, int y) {
    super(x, y);
  }

  public void draw(Graphics2D g2d){
    g2d.drawImage(getPlayerImage(), x, y, null);
  }

  public Image getPlayerImage(){
    ImageIcon i = new ImageIcon(getClass().getResource(playerimage));
    return i.getImage();
  }

  public void update(){
    x += velX;
    y += velY;

    // Collision with outside
    if(x < 0){
      x = 0;
    }
    if(y < 0){
      y = 0;
    }
    if(x > 640){
      x = 640;
    }
    if(y > 480){
      y = 480;
    }
  }

  public void keyPressed(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = -10;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 10;
    }
    if(c == KeyEvent.VK_UP){
      velY = -10;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 10;
    }
  }

  public void keyReleased(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = 0;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 0;
    }
    if(c == KeyEvent.VK_UP){
      velY = 0;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 0;
    }
  }

  public void keyTyped(KeyEvent e){
  }
}

KeyInput Class :

package game.input;

import game.objects.Player;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KeyInput extends KeyAdapter{

  private final Player p;

  public KeyInput(Player p){
    this.p = p;
  }

  public void keyPressed(KeyEvent e){
    p.keyPressed(e);
  }

  public void keyReleased(KeyEvent e){
    p.keyReleased(e);
  }
}

.

sentences:
Listen for asset modification in editor I would like to listen for an event that some asset (prefab, precisely) has been modified. To my surprise, there's no such event in AssetModificationProcessor.

Is there any way to do this in Unity?

sentences:
How can shears/reflections/enlargements be represented by 4x4 matrices? I understand that 4x4 matrices can represent transformations on a 3d point (represented as x, y, z, w)

Eg, a translation is

[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[x y z 1]

where x, y and z are the amount to move the point along each axis.

I know how to represent translations, scaling and rotations but how are other transformations such as shears (with any invariant plane and shear factor), reflections (in any plane) and enlargements (with any center and any scale factor) represented?

The end goal is to have c++ functions to create a translation matrix.
Eg:

Matrix4x4.generateReflection(Vector3d planeNormal);
Matrix4x4.generateEnlargment(float centerX, float centerY,
                             float centerZ, float scaleFactor);

These would return an instance of a Matrix4x4 class with the elements set such that multiplying it by a point returns the sheared/reflected/enlarged point.

sentences:
AI movement in a tile based game I've been tryin to make My AI follow my A* path in grid. the problem is that is goes off course and doesn't move along the path very well. currently got it to move only  left and up.

how I intended it to work is that the character goes to the centre of the Path cells and repeat until the end.

void AIEnemy::AutoMotion(  Gridspot& grid)
{
    std::pair<int, int> ecn = getNodePosition();

    std::reverse(grid.Path.begin(), grid.Path.end());
    for (auto path : grid.Path)
    {
            if (path.node.first == ecn.first)
            {
                if (rect.getPosition().y != path.rectCenter.y)
                    rect.move(0, -5);
                break;
            }

            if (path.node.first < ecn.first && path.node.second == ecn.second)
            {

                if  (right != path.rectCenter.x )
                    movetoThe(e_left);
                break;
            }

    }
}

Here's how it looks like right now:

here's how it follows the path:

my question is how do I make AI character move on its own and alter its direction toward a goal.

sentences:
Unity2D - collide with objects while moving to a position How do I get my character to collide with other objects while moving to a position?

All I've managed to do is change the position, it only collides if the character is not moving, it's like he is moving behind.

void Update () {

    foreach(Touch touch in Input.touches)
    {

        if (touch.phase == TouchPhase.Began)
        {
            worldCoordinates = Camera.main.ScreenToWorldPoint(touch.position);
            posi.x = worldCoordinates.x;
            posi.y = worldCoordinates.y;
            //transform.position = Vector3.MoveTowards(transform.position, posi, speed);
            //transform.Translate(0,32.4,0);
            //rb.MovePosition(posi);
        }
    }
}

sentences:
Passive skill for balanced race / faction I'm currently working on an RPG game project. I’m out of ideas on how to properly set race skills in the RPG. In the game, three different races exist:

Human – Balanced starting stats, active skills are focused on crowd control, debuffs, and average damage
Dwarf – starting stats has huge amount of HP but at the cost of damage and speed. Active skills are focused on defense.
Elf – starting stats has boost to damage and speed, but at the cost of low HP/MP. Active skills are focused on Damage

Currently I’m in the phase when I want to implement race skills. Race skills should be a passive skill which your character automatically earns after creation. This skill is another way of diversification, so if you compare a dwarf warrior with an elf warrior, there will be a difference in active skills, in starting stats, and also with a race skill.

I'm thinking about race skill for Dwarfs and Elves, but I'm out of ideas for a race skill for humans, which are characterized as a balanced race.

Dwarfs – 10% damage reduction on each hit by the enemy
Elfs –  +5% critical hit chance
Humans – ???

Any suggestions are welcome.

sentences:
How much detail should I provide in reference material to potential contract composers? I'm not very good with music, so when the time comes I'll need help from a composer for my game. I'm unsure of how to actually work with one.

Despite my lack of musical understanding, I know what I like. I might listen to some music and think "Hey, this kind of music would be awesome to have in the epic chase scene near the end of the game, where our heroes just barely manage to escape!"

When I go to hire a composer to make music for my game, how much detail and reference music should I provide? Should I provide lots of long descriptions of what I'm after, lots of links to music that I think fits the theme? Or should I just let the composer play the silent game and work it out themselves?

sentences: unity how to keep prefabs updated I have a number of prefabs in unity and I regulary update them, is there an easy way make sure unity updates these prefabs so that I don't have to update 20+ identical objects in identical ways acros 10  different scenes?

sentences:
Animator consecutive set parameter problem I'm having a little problem with my animations transitions.

I have this diagram: http://imgur.com/Se8Ix1L

My transitions is made by updating the parameter "stateparam".

My code, changing the parameter: http://imgur.com/HlypG2L

I change stateparam to 2 and right after to 0, then my animation don't restart every frame.

But when I play, the my parameter doesn't change the animation and only change the stateparam to 0. I already debugged and it's passing in the line that change to valid transition value. But i don't know why my animation doesn't changes. If I play and change stateparam manually, it works.

If I take off the SetInteger "0", let only the valid value, the code works, but my animation keep restarting before it can finish itself.

I don't know if the parameter change it's too fast to do the transition or it's any buggy. Any help ?

sentences:
Where/how should A Star tie breaking occur? I've recently written a path finding script that utilizes a basic implementation of the A Star algorithm.  It works fine but is not very fast.  This is due, at least in part, to the fact that it isn't optimized at all.  Through a bit of searching through this site and others I've realized that at least one thing I need is a tie breaking procedure that updates the heuristic values of nodes in the open list.  Currently, whenever the pathfinder function is initiated.  The pattern the finder takes pretty much expands outward in all directions from the point of origin until the target node is found.  I've seen several videos that show A Star almost immediately traveling towards the target node thus eliminating many checks and ultimately speeding up the process.  I believe this is due to a tie breaking procedure.

My question is...  At what point in the process should I be applying the tie breaking procedure and is there a better modifier to add to the heuristic aside from the below code?:

Node.heuristic += (Mathf.Abs((Node.x * endNodeVector.z) - (endNodeVector.x * Node.z)) * 0.001F);

This seems to be the most common that I have found.  However, for some reason, this doesn't seem to effect the algorithm at all.  It still searches in all directions from the origin position. What am I missing to make my A Star favor open list nodes that are closer to the target?

sentences:
Java Game How to change opacity of an image? Hello I have a game where you feed animals. A few minutes after you feed them they do a poo. I want the poo to fade away after a few seconds. I want to know how to change the opacity on the image. How can I do this?

here is my code:

package items;

import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;

public class poo {

    public int x, y;
    private Image img;

    public int time = 0;
    public int timer = 100;
    public boolean remove;

    public float alpha = 1f;

    public poo(int x, int y) {
        this.x = x;
        this.y = y;

        alpha = 1f;
    }

    public void tick() {
        if (time >= timer) {
            time = 0;
            // remove = true;
        } else {
            time++;
        }
        if (alpha > 2) {
            // alpha--;
        } else {
            // remove = true;
        }

    }

    public void render(Graphics g) {

        ImageIcon i2 = new ImageIcon("res/items/poo.png");
        img = i2.getImage();

        g.drawImage(img, x, y,6,8, null);

    }
}

sentences:
PlayerPrefs.SetInt Stops code below from running This is the code...

void storeStarData()
{
    // Code to store star data in PlayerPrefs...
    Debug.Log("Writing to PlayerPrefs");
    PlayerPrefs.SetInt("totStars", NumOfStars);
    int i = 0;
    Debug.Log("test");
    while (i < NumOfStars)
    {
        PlayerPrefs.SetString("starID" + i, StarIDID[(i)]);
        PlayerPrefs.SetString("starName" + i, StarName[(i)]);
        PlayerPrefs.SetString("starHIP" + i, StarIDHIP[(i)]);
        PlayerPrefs.SetString("starHD" + i, StarIDHD[(i)]);
        PlayerPrefs.SetString("starHR" + i, StarIDHR[(i)]);
        PlayerPrefs.SetString("starGL" + i, StarIDGL[(i)]);
        PlayerPrefs.SetString("starBF" + i, StarIDBF[(i)]);
        PlayerPrefs.SetString("starRA" + i, StarRA[(i)]);
        PlayerPrefs.SetString("starDec" + i, StarDec[(i)]);
        PlayerPrefs.SetString("starMag" + i, StarMag[(i)]);
        PlayerPrefs.SetString("starCI" + i, StarCI[(i)]);
        Debug.Log("star " + i + " complete");
        i++;
    }
    PlayerPrefs.Save();

    i = 0;
    int ok = 0;
    while (i < NumOfStars)
    {
        if (PlayerPrefs.GetString("starID" + i) != null)
        {
            ok++;
        }
        i++;
    }
    Debug.Log(ok);
}

And this is the Debug.Log output that I am getting...

As you can see, the program gets up to the First Debug Log Debug.Log("Writing to PlayerPrefs"); But then stops before the Debug.Log("test");.

After removing PlayerPrefs.SetInt("totStars", NumOfStars); The program gets to the Debug.Log("test");. So it is the PlayerPrefs.SetInt causing the issue.

How do I fix this?

sentences:
Monogame pipeline is throws exceptions when trying to build .tmx files I have correct referenced the monogame extended pipeline dll file to the monogame pipeline
the importers and processors of the .tmx file are not missing/unknown
but when I try to build the it it throws a System.notSupportedException
Here's a screenshot if that helps

sentences:
Why has my refractive water shader become reflective So I was making a water shader in unity and well it looked fine in the scene view but as soon as I went into the game view the refraction texture basically flipped up 180 degrees and made it look like the water was reflective. The problem with this is that it breaks the transparency of the shader.

Scene View (how it should look):

Game View (how it does look):

Shader: (I can't post more than 2 images)

Part of the shader:

float4 Lerp2=lerp(Tex2D2,float4( 0.0, 0.0, 0.0, 0.0 ),_Refraction.xxxx);
float4 Subtract0=Lerp2 - _RefractionCorrection.xxxx;
float4 Add2=((IN.screenPos.xy/IN.screenPos.w).xyxy) + Subtract0;
float4 Tex2D0=tex2D(_GrabTexture,Add2.xy);

sentences:
How to implement a Behavior Tree (preferably in Unity 3D) I have a state machine I want to implement as a behavior tree. I now have an understanding of how they work but I can't seem to find a full implementation of one. I have implemented a simple one using a plug-in called Behavior Machine but the problem I have with it is I feel like it limits me just as it did when I used it for making my FSM until I implemented my own FSM that is when I had the privilege of using my own functions to trigger my own state transitions and optimize it so that it doesn't use a lot of resources.

The other problem I have is it is difficult to implement my own nodes and control which part executes (optimization). Any idea where I can find a good tutorial on how I can do this, preferably with Unity and in C# or Java. Or where I can find a good library with proper documentation because the one I found on Git-hub or other sites are buggy or just some classes with no documentation. Your help will be greatly appreciated.

So basically, what I want to do is implement my own Behavior Tree. This way I think I can have better control on how it executes so that it can run on mobile devices smoothly.

sentences:
LibGDX with SoundPool I'm developing a game for Android using LibGDX in Android Studio.
I recently found out that some sounds in my game fail to play. I noticed that every time a sound fails to play, these are the logs:

04-12 10:49:51.784 24234-24283/com.gadarts.parashoot.android E/AudioTrack: AudioFlinger could not create track, status: -12
04-12 10:49:51.785 24234-24283/com.gadarts.parashoot.android E/SoundPool: Error creating AudioTrack
04-12 10:49:52.503 24234-24283/com.gadarts.parashoot.android W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz

This is the code I use to play the sounds:

public long playSound(SFX fileName, boolean loop, float volume, boolean randomPitch) {
        if (GameSettings.SOUND_TOGGLE) {
            try {
                Sound sound = prepareSound(fileName);
                if (randomPitch && GameSettings.SOUND_RANDOM_PITCH) {
                    return setRandomPitch(loop, sound, volume);
                }
                if (loop) {
                    return sound.loop(volume);
                } else {
                    return sound.play(volume);
                }
            } catch (GdxRuntimeException e) {
                e.printStackTrace();
            }
        }
        return -1;
    }
private Sound prepareSound(SFX soundFile) throws GdxRuntimeException {
        try {
            String soundPath = SFX.fileAttribute.SFX_FOLDER_NAME.getValue() + "/" + SFX.fileAttribute.SOUNDS_FOLDER_NAME.getValue() + "/" + soundFile.getParentDir().getValue() + "/" + soundFile.getValue() + "." + soundFile.getFormat().getValue();
            Sound sound;
            if (!sounds.containsKey(soundFile.getValue())) {
                sound = Main.getAssetsManager().get(soundPath, Sound.class);
                sounds.put(soundFile.getValue(), sound);
            } else {
                sound = sounds.get(soundFile.getValue());
            }
            if (sound == null) {
                throw new GdxRuntimeException("preparing sound failed - sound not found.");
            }
            return sound;
        } catch (GdxRuntimeException e) {
            throw e;
        }
    }

The sound files are in WAV format.
Any ideas how to fix it? Thanks in advance!

Update: I've found out that this problem appears only on my Nexus 5X. I tried it on Xiaomi Redmi Note 4X and it didn't happen.

sentences:
Parse/Write JSON with Unity iOS anybody know a tutorial or maybe can help me to develop a parser/reader for JSON compatible with Unity iOS pro? I've already tried different third part libraries but without luck (i've tried json.net, jsonfx, litjson).

Im pretty in hurry of doing a simple parser/writer that i can use also under iOS and not only in Desktop.

P.s. i can also use third part library, but please, first of suggest be sure that it will work under iOS!
Thank you all

sentences: Adjust the Camera Viewport Rect in Unreal Engine Am new to Unreal Engine. I want to adjust the Camera Viewport  Rect so that the camera will render to half of the screen. This is achieved in Unity by changing the Camera Viewport Rect property. How can we achieve similar stuff Using Unreal Blueprint?

sentences:
What's the best way to index my object? Obviously, lists automatically create their own index. So basically I wouldn't need this function at all. But I figured it was safer in case my list index ever changed (e.g. adding a new item at the beginning of the list, would shift the index numbers for all the other list items).

public EmpireAgentView ShowEmpireView(int eIndex)
{

    foreach (EmpireAgentView e in EmpireViews)
    {
        if (e.EmpireIndex == eIndex)
        {
            Debug.Log("Showing Empire for Agent: " + e.AgentName);
            return e;
        }
    }

    Debug.LogError("No EmpireAgentView Found for that empire: " + eIndex);
    return new EmpireAgentView(9999);
}

So in this case, I added the property "EmpireIndex" to the EmpireAgentView object. So now, whenever I need to access a specific EmpireAgentView from the EmpireViews list, I would use ShowEmpireView(1) instead of EmpireViews[1].

Each EmpireAgentView object has unique information about the same Agent object. For example, where the Agent is currently located. If we have 4 empires, than there will be 4 EmpireAgentView objects in the Agent class. Each empire has their own idea of where the Agent is currently located, so I need to be able to access the specific empires data on this agent. Right now, I assign a simple int called EmpireIndex to each EmpireAgentView, so that I can make sure I got the right view for the right empire. If i simply used EmpireViews[3], and that list rearranged itself somehow, (like adding an EmpireAgentView object to the beginning of the list, presumably) than all that information would be mixed up for the empires.

Is that the best way of doing that? is there a better way of finding it? Or am I being TOO careful, and just need to not add new EmpireView's to the beginning of the list? (I'm new to C#, is there anything else that would change the index of a list item?)

sentences:
Sprite Animation Toolkits for iPhone Does anyone know of any good (and preferably free) Sprite Animation Toolkits/Libraries for iOS development?

This library should be able to handle the collision detection and the movement of the sprites.  Back in the 90's there was a Pascal library called Sprite Animation Toolkit by Ingemar Ragnemalm that handled a lot of the heft to create animations and the such.  I am just wondering if there is anything like that in the iOS world?

sentences:
Using buttons on Smartphone shooter games Just a simple and probably stupid question.

I noticed that many iOS and Android shooter games tend to avoid using traditional buttons in favour to autofire.

The very first reason to do so is to have more space in the screen available for graphics. However this takes away some satisfaction to the user when "pressing the virtual button". I understand that the fact that smartphone buttons would be only "virtual" is a good design reason to remove them and add autofire, but I was wondering which sort of comments your users (if u are one of those developers) have given you about this choice.

In short:

Does autofire add to the gameplay?
Does a game without autofire (and
hence buttons) result inadequate for a smartphone and/or become less fun to play?

sentences:
What causes the difference between these boxes? I have recently started using Blender and I notice that the light (from my game) on default box is different from the one I downloaded. The below picture shows that.

They have the same normal direction in Blender.
Thanks in advance.

sentences:
Vector Math question Suppose I have two game object located at two Vector3s v1 and v2, respectively.
If I wanted to locate a position between v1 ad v2, but 3 units away from v2, how would I manage that in terms of calculating the target vector (vT)?  Basically, I want object 1 to translate toward object2, so that it can play an attack animation a reasonable distance away from the combat target without being on top of it.

I calculate a vector pointing from v2 to v1:

Vector3 heading = v1 - v2;
Vector3 headingNorm = heading.Normalize();

From there, how to I "add 3 units in the direction of v1 from v2" to get the target position?

Thanks in advance!

sentences:
What is wrong with my Respawn coroutine? I am creating a 2D Platformer game in which if the player falls off the base/ground then I want the player to respawn at the nearest checkpoint. However I want there to be a delay between the player falling off the ground and the respawn. This is the section of my code to achieve this goal:

private void OnTriggerEnter2D(Collider2D collision)
{
    Debug.Log(collision.tag);
    if (collision.tag.Equals("Kill"))
    {
        StartCoroutine("Respawn");
    }
    else if(collision.tag.Equals("Checkpoint"))
    {

        Animator flag = collision.GetComponent<Animator>();
        if (!flag.GetBool("hasCrossed"))
        {
            flagCounter++;
            flag.SetBool("hasCrossed", true);
            checkpoint = collision.gameObject.transform.position;
        }
    }
}

IEnumerator Respawn()
{
    yield return new WaitForSeconds(respawnDelay);
    transform.position = checkpoint;

}

This works fine for small respawn delays like 1 or 2 seconds. But on increasing the delay to 5 seconds, the player after appearing at the nearest checkpoint vanishes off in an instant and then after quite a few repetitions the player reappears.

This is for the 2 second time delay

This is for the 5 second time delay

How can I fix this?

sentences:
What functional abstraction to use for multi-agent simulation? this is quite a broad question, touching a few different fields, so let me know if there's a way to narrow it down.

What I would like to know is your opinions on what abstraction to use for my use case.

My game is a grid-based trading game (it's more complicated than that, but for now  think of a Patrician on a grid) and I want to do some heavy simulation in the settlements. Heavy here means that the decisional processes and actions of every individual is simulated. I already managed to do a stress test and I know I can handle about 1 milion individuals without any slow down for the game.

The game is written in Scala in a functional style. The problem is that I achieved those performances using a naive copy of immutable states. So for every entity and settlement I compute the next state, I aggregate it in a global state and in the next iteration, I replace the old state with the new one. The issue is with the garbage collector: if the state grows too much after a while it tries a full garbage collection to free up memory and considering that with this approach I may have two whole sized states (the old one and the just computed new state), this gargabe collection may happen at every step.

What I did to solve this was to break the global state in N parts, computing and replacing parts of the state in N iterations. This works because every settlement is assumed to be in isolation and so it won't conflict with the others. This  is a strong assumption though and in such an early state of development I don't want to be bound to it.

So what I need is a way to structure this simulation, settlement by settlement but that allows the agents on the map to interact with the settlements. The abstraction must be functional and match the requirements for the memory issue.

An obvious answer may be to use actors but I fear that using frameworks like Akka, the overhead may be too great for a game.

sentences:
Unity2D: Rendering multiple sprites as a single one I'm creating NPCs in Unity 2D using C#, and I have 16x16 sprites for body, helmet, clothes and weapon. All these have a tile set which has been split in unity. I'd like to be able to render one of each part together, so I can drag the sprite to the field, and then it will be rendered on the NPC. IE, I drag a helmet sprite into the helmet field and that is the rendered helmet.

I intend on having multiple NPCs, so I'd prefer to minimise the child objects. Multiple sprites will need rendering, however there's only one sprite renderer. Is it possible for me to combine the sprites (in code), and then render the final sprite? Or is there perhaps a better way?

Thanks in advance!

sentences:
SharpDX: Render to bitmap using Direct2D 1.1 I have a command line application that I am currently using SharpDX (Direct2D 1.0) to render to PNG files. This is a window-less application.

It's currently creating a SharpDX.WIC.WicBitmap, a WicRenderTarget, then rendering to that. I then save the WicBitmap to the PNG file.

For various reasons, I need to migrate to Direct2D 1.1 to take advantage of some of the effects available in 1.1.

I'm trying to get a SharpDX.Direct2D1.Bitmap that I can save as PNG.

I cannot use FromWicBitmap because that copies the bitmap, it does not share it.

I see CreateSharedBitmap in the Direct2D1 API that takes a IWICBitmapLock. However, I do not see this implemented as a constructor of SharpDX.Direct2D.Bitmap.

This is what I'm trying to do:

// Bunch of setup
var d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice);

var d2dDeviceContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice,
    SharpDX.Direct2D1.DeviceContextOptions.None);

using (var wicFactory = new SharpDX.WIC.ImagingFactory())
{
  using (SharpDX.WIC.Bitmap wicBitmap =
    new SharpDX.WIC.Bitmap(wicFactory, 500, 500,
      SharpDX.WIC.PixelFormat.Format32bppPBGRA,
      SharpDX.WIC.BitmapCreateCacheOption.CacheOnDemand))
    {
    var wicLock = wicBitmap.Lock(SharpDX.WIC.BitmapLockFlags.Write);

    var props = new SharpDX.Direct2D1.BitmapProperties1();
    props.BitmapOptions = SharpDX.Direct2D1.BitmapOptions.Target;

    var bitmap = new SharpDX.Direct2D1.Bitmap1(d2dDeviceContext, wicLock, props); // This is not available

    d2dDeviceContext.Target = bitmap;

    // Do the drawing
    // Save the PNG
  }
}

Is there a way to do what I'm trying to accomplish?

sentences:
How are trajectories calculated and transmitted to other players, in multiplayer? I play a lot of "Call of Duty", and can see tracers for gunfire, missiles, care packages falling from helicopters etc. There is a lot of activity. I am curious to know the algorithm one would use, at a high level, to manage all this action when you have 20 people on a map shooting each other to death.

This question touches on the subject, but doesn't ask for a more in-depth answer as to how you the developers go about calculating and transmitting movement and collision detection for projectiles, be it missles, bullets, or any other object that is flying through the air in real-time.

How are trajectories calculated and transmitted to other players, in multiplayer?

sentences:
Modelling the board in a Mastermind game Hey, I'm trying to make a Mastermind game. I'm having trouble figuring how to design the game board for the guesses. The board must consist of four columns and eight rows. I'm having trouble figuring out how to go about printing the game board on screen. I know I could use a two dimensional array to store the letters and guesses, but I need to print the game board on the screen as well as the guesses inside the game board.

I hope this was clear enough, if not i can explain more, I just need help with this game board situation.

sentences:
Why are triangle fans not supported in Direct3D 10 or later? As covered in the documentation, triangle fans not supported in Direct3D 10 or later.

Why?  Are there inherent drawbacks to working with triangle fans?

sentences: Changing Hitbox from a single spritesheet I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?

sentences:
Where should shaders and lights be in a component-based entity system? Where should I put the shader and the light / shadow calculation? Should that be a component too?

And should the rendering system know how to handle them or should there be a separate light system?

I'm specifically talking about about a 2D system, but it should be the same in for 3D I think.

sentences:
Why is my partially transparent image blitted fully opaque? I have a part in my program that should display the currently playing song's name for the first 4 seconds, then fade out. Even though Surface.get_alpha() returns expected results, the image still does not fade out.

Why is this? How can I make it work?

My code looks like this:

for event in settings.events:
    if pygame.mixer.music.get_pos() < 4000 and sounds.music.volume != 0:
        #This part creates the surface and determines the position
        show = 40 * 4
        font = pygame.font.SysFont(typeface, 15)
        songname = font.render(sounds.music.playlist[0], True, settings.color)
        font_pos = songname.get_rect()
        font_pos.right = screenx - 10
        font_pos.top = 10
        alpha = 255
    if event.type == USEREVENT + 1 and sounds.music.volume != 0:
        #The userevent is there to ensure it will fade out with the same speed
        #and not being related to fps
        #this decreases alpha
        show -= 1 if show > 0 else False
        if show < 40 * 4 and alpha > 0:
            alpha -= 1.6
        songname.set_alpha(int(alpha))

if pygame.mixer.music.get_volume() != 0.0 and show != 0:
    #This does actually return the correct results
    print songname.get_alpha(), alpha
    screen.blit(songname, font_pos)

sentences: Book on designing game architecture? I would like to make nice games with good architecture that are easy to support and extend. But when i write code it all gets messy and hardcoded, so when I want to add a feature it becomes a huge pain. Is there any book that teaches me how to design my game upfront, so I will know what classes I will want, how to do certain features etc.

sentences:
Prevent Unity optimizing local variables out Is there a way to instruct Unity compiler not optimize (best only for builds run from Unity editor)? More precisely, I would like it to stop removing local variables, because it complicates debugging. For example, inspecting node

void Generate() {
   var node = new Node();
   node = node; //breakpoint here, node cannot be inspected
   var x_nearest = Nearest(new_node);
   Debug.Log(new_node);//new_node still cannot be inspected, but x_nearest can
}
Node Nearest(Node node)
{
   //node is an argument here and can be inspected
}

in Visual Studio produces error rather than displaying its value.

  The identifier node is not in the scope

A solution would be make every local variable a private member instead:

private Node node;
void Generate() {
   node = new Node();
   node = node; //breakpoint here, node can be inspected
}

this would, however require frequent back and forth refactoring. I am using Unity 5.6.0f3 with C# 6.0 support and Visual Studio 2017.
note: provided code is for illustration only and the question is not about debugging said code because reproducing specific compiler behavior is not trivial

sentences:
Adding components to a GameObject referenced within code So in my project, I have a class called ComponentRegistry. The idea of this class is to store a dictionary of components and their names. For example:

    public Dictionary<string, MonoBehaviour> registry;
    public MonoBehaviour testComponent;

    void Start(){
        registry = new Dictionary<string, MonoBehaviour> ();
        registry.Add ("TestComponent", testComponent);
    }

    public MonoBehaviour GetScript(string name)
    {
        return registry[name];
    }

Then in a separate class, I will access this dictionary using a string in order to retrieve the associated component, subsequently adding the associated component to the gameObject.

    foreach (string comp in blockInfo.components) {

    //For each of the components that need to be added

        gameObject.AddComponent(ScriptMaster.compReg.GetScript(comp));

        //I know this is incorrect, but the idea is there
}

Just for understanding, compReg is an instance of the ComponentRegister class stored as a static variable within my ScriptMaster class.

But no matter what I try, I have not been able to get this to work. I have switched endlessly between different formatting of adding components to gameObjects, alternating between using Components and MonoBehaviours, adding by type.

Thank you for any insight.

sentences:
My character gets stuck when It's running on a straight level ground My project is an infinite runner that goes right in a straight line. Sometimes when it just runs without jumping the Player stops. Sometimes the Player doesn't stop. When you jump the Player usually stops a lot earlier. I've been trying to fix this, but I can't find the solution.

How I'm doing this is by making the character move to the right all the time with 1 point in the front for ground generating and 1 point in the back for deleting ground. The camera is following the player and the points are going forward at the same pace as the player. The ground is even, but the player always stops. Please help.

Code for generating the ground:

using UnityEngine;
using System.Collections;

public class PlatformGenerator : MonoBehaviour {

public GameObject thePlatform;
public Transform generationPoint;
public float distanceBetween;

private float platformWidth;

// Use this for initialization
void Start () {
    platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x;
}

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

    if (transform.position.x < generationPoint.position.x)
    {
        transform.position = new Vector3 (transform.position.x + platformWidth + distanceBetween, transform.position.y, transform.position.z);

        Instantiate (thePlatform, transform.position, transform.rotation);
    }

}

}

Code for controlling the Player:

using UnityEngine;
using System.Collections;

public class PlayerControl : MonoBehaviour {

public float moveSpeed;
public float jumpForce;

private Rigidbody2D myRigidbody;

public bool grounded;
public LayerMask whatIsGround;

private Collider2D myCollider;

private Animator myAnimator;

// Use this for initialization
void Start () {
    myRigidbody = GetComponent<Rigidbody2D>();
    myRigidbody.velocity = new Vector2(moveSpeed, 0);

    myCollider = GetComponent<Collider2D>();

    myAnimator = GetComponent<Animator> ();
}

// Update is called once per frame
//void Update () {
//  myRigidbody.velocity = new Vector2(moveSpeed, myRigidbody.velocity.y);
//
//  if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0));
//  {
//      myRigidbody.velocity=new Vector2(myRigidbody.velocity.x, jumpForce);
//  }
void Update () {

    grounded = Physics2D.IsTouchingLayers(myCollider, whatIsGround);

    if (Input.GetKeyDown(KeyCode.Space))
    {
        if(grounded)
        {
            Jump();
        }

    }

    myAnimator.SetFloat ("Speed", myRigidbody.velocity.x);
    myAnimator.SetBool ("Grounded", grounded);

}

void Jump () {
    myRigidbody.AddForce(new Vector2(0, jumpForce));
    }

}

sentences:
How do I control texture appearance based on game play events? In an FPS I am developing, I am procedurally altering the appearance of textures based on game play events, and would like to know if the way I have implemented this was a good idea.

Right now, on each frame, I am grabbing a pointer to the uncompressed image and writing to it using memset. It's pretty straightforward if I want to have game play events affect the texture's appearance, because all I have to do is tie whatever attribute I like from any game object into the function writing the image data. For example, using this I could get the player's x,y position and draw an x directly to a map texture as the player moves around.

Is there a better way to implement this functionality in general?

My first thought would be to use shaders instead, but I haven't been able to find anyone doing anything like this and I know almost nothing about shaders. I feel like I could be missing something obvious to someone.

I am trying to keep this question as engine-independent as possible, but if relevant, I am using Source Engine procedural materials.

sentences:
Getting a TileMap wrapping as a toroid on player movement [libgdx version 1.9.13 - Desktop Game]
This question seems to have been asked many times, but I have yet to find a decent solution. I want to display a map without edges, where the player moves in all directions on a 'world' which is toroidal.
I load my tiles into cells of an OrthogonalTiledMapRenderer, which I then render. This gives me a map which draws in the game window - works fine - but it has edges. The player can walk up to the edge of map.
So my questions:

How do I get a tiled map to draw without edges (I.E. no background color around edge of tile map, as per attached screen shot, which shows character about to walk off the map)

How do I then make the map toroidal - so the player moves off left map edge and is moved to right edge. Same for top/bottom. I can set the players coordinates to do this, but screen 'jumps' to the other edge.

So if the player continually presses a single up/down/left/right key, eventually they will come back to their starting position.

sentences:
Rotating an object while moving I have an object the is a perfect circle.  The object is moving left, right and jumping with collision detection.  What I am trying to do now is rotate the object while it is moving, so it looks like rolling.

This is the code that I have so far:

key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);

//1  right, -1 left
var move = key_right - key_left;
hsp = move * walkspd;
vsp = vsp + grv;

if(place_meeting(x, y + 1, oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collisions
if (place_meeting(x + hsp, y, oWall))
{
    while (!place_meeting(x + sign(hsp), y, oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collisions
if (place_meeting(x , y + vsp, oWall))
{
    while (!place_meeting(x, y+ sign(vsp), oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}

sentences:
Blender->Unity Import Animation Failing by Overlapping Mesh Objects I'm new to both Unity and Blender. I created this penguin 3d model, rigged it up and animated it in Blender and all looked good.
When I imported it into Unity, I noticed that this idle animation did not appear to be working correctly. As the body moves, the body mesh overlaps the belly mesh and covers a portion of it.

This is not the case when viewing the animation from blender 2.9.

The belly uses a shrinkwrap modifier with the body as a target.
Is this a problem with Unity import, or how I modeled this penguin in Blender? Can anyone see what I have done wrong here? Any help is much appreciated!

sentences:
How could you parallelise a 2D boids simulation How could you program a 2D boids simulation in such a way that it could use processing power from different sources (clusters, gpu).

In the above example, the non-coloured particles move around until they cluster (yellow) and stop moving.

The problem is that all the entities could potentially interact with each other although an entity in the top left is unlikely to interact with one in the bottom right. If the domain was split into different segments, it may speed the whole thing up, But if an entity wanted to cross into another segment there may be problems.

At the moment this simulation works with 5000 entities with a good frame rate, I would like to try this with millions if possible.

Would it be possible to use quad trees to further optimise this? Any other suggestions?

sentences:
2D: Scaling a character with multiple RigidBody2Ds? So, this example is in the Godot Engine, but other engines porbably have this kind of problem, too:

I have a character with multiple RigidBody2Ds, that also has a bone skeleton for animation over them. Now, the problem is, that Godot's physics engine handles the transforms of the bodies, so they won't scale properly. If you scale the children (CollisionShape2Ds and Sprites) the positions will be off. Is anybody aware of a proper way to work around this? Being able to scale these kind of characters would be awesome.

Thanks for all your answers.
Greetings, Footurist

sentences:
Black lines on sprites I am having the issue as seen below while using a textureAtlas with libgdx. I haven't found anyone else with the issue so I decided to ask here.

Here is an image of the textures in the game screen:

And to prove it's not a texture related issue, here is the spritesheet with the same background color as the game screen has applied:

Any suggestions? sorry for the sloppy write-up I am very preoccupied.

sentences:
Improving the efficiency of my bloom/glow shader I'm making a neon style game where everything is glowing but the glow I have is kinda small and I want to know if there's an efficient way to increase the size of it other than increasing the pixel sample iterations.

Right now I have something like this:

float4 glowColor = tex2D(glowSampler, uvPixel);

//Makes the inital lines brighter/closer to white
if (glowColor.r != 0 || glowColor.g != 0 || glowColor.b != 0)
{
    glowColor += 0.5;
}

//Loops over the weights and offsets and samples from the pixels based on those numbers
for (int i = 0; i < 20; i++)
{
    glowColor += tex2D(glowSampler, uvPixel + glowOffsets[i] + 0.0018) * glowWeights[i];
}

finalColor += glowColor;

for the offsets it moves up, down, left and right (5 times each so it loops over 20 times) and the weights just lower the glow amount the further away it gets.

The method I was using before to increase it was to increase the number of iterations from 20 to 40 and to increase the size of the offset/weight array but my computer started to have FPS drops when I was doing this so I was wondering how can I make the glow bigger/more vibrant without making it so CPU/Gcard intensive?

sentences:
Unity 3d auto-move player forward script Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's about as far as I get.

I'm assuming it's a Transform.translate function too, but not sure what parameters to use to move forward 1 m/s automatically (for example). Also, how do I block W and S keys moving forwards and backwards, and instead use the for up and down? (My character is 'floating' and I'm looking to incorporate space harrier style controls)

Thank you!

sentences:
How to Calculate Caridnal Direction from Unit Vector I have unit Vector of acceleration in local space of object.
Now I want to calculate Cardinal Direction from (North, East, South, West).

So Far I tried to:

FQuat QRot = LocalAcceleration.ToOrientationQuat();
    FRotator Rot = FRotator(QRot);
    float Angle = Rot.Yaw;
    float Angle2 = (FMath::RoundToInt(Angle) + 360) % 360;

(Another version was calulcating atan2).

Then:

if (FMath::IsWithin(IntAngle, 0, 46)
    && FMath::IsWithin(IntAngle, 314, 0))
{
    NewDir = EFourCardinalDirection::N;
}
if (FMath::IsWithin(IntAngle, 134, 228))
{
    NewDir = EFourCardinalDirection::S;
}
if (FMath::IsWithin(IntAngle, 46, 136))
{
    NewDir = EFourCardinalDirection::E;
}
if (FMath::IsWithin(IntAngle, 229, 313))
{
    NewDir = EFourCardinalDirection::W;
}

I also tried to calculate eighth directions and then just assign the four based on the previous eight.

Neither way provided stable results. There are some jumps between directions depending on object movement.

sentences:
Creating Compute Shaders throws E_INVALIDARG exception in SharpDX I've recently been working on a small helper for creating and using compute shaders in C# along with Monogame/XNA. My end goal is simply to have compute shaders working in C#.
My main issue is as such:
   var result = SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile(filepath, "CSMain", "cs_5_0", ShaderFlags.Debug);
   if (result.ResultCode.Failure)
      throw new Exception($"HLSL Compilation failed with the code: [{result.ResultCode.Code}] and message: [{result.Message}]");
   shader = new SharpDX.Direct3D11.ComputeShader(device, result.Bytecode);

Calling the constructor on the ComputeShader class throws the error: "HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect." (Of type SharpDXException). The device is obtained via Microsoft.Xna.Framework.Graphics.GraphicsDevice.Handle casted to a D3D11 Device.
Call Stack:

Anyone know how to fix this? Or is this just something I'll have to find some new way of doing?
NOTE:
The fact that I went down the Monogame-DirectX + SharpDX route is largely incidental, but I don't seem to have many options - something like Vortice.Windows, which aims to replace the now abandoned SharpDX, doesn't appear to have compute shader support. While I wouldn't mind using OpenGL, and would be happy with being recommended working .Net Core OpenGL binding libraries (Vulkan would probably be way over my head), that type of question isn't accepted here, but I'm aware it may be the better option.

sentences:
How to stop a jump midair and remove y velocity in the process What I want to do is to cut a jump midair by turning off the y velocity when the player releases the jump button (like in Hollow Knight). I managed to do that with:
rb.velocity = new Vector2(rb.velocity.x, 0f);

My problem is when I cut the jump and I am midair, if I repeat the release jump button process, the whole thing happens again, the character staggers as long as I am releasing the jump button continously.
I would like to be able to do that only once when I am off the ground. I am a noob when it comes to coding so I don't really know what to do.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Events;

 public class PlayerController : MonoBehaviour {

     public Animator animator;

     private Rigidbody2D rb;
     public float speed;
     private float moveInput;
     public float jumpForce;

     private bool isGrounded;
     public Transform feetPos;
     public float checkRadius;
     public LayerMask whatIsGround;

     private float jumpTimeCounter;
     public float jumpTime;
     private bool isJumping;
     private bool facingRight = true;
     public float jumpDownForceY = 0;

     void Start()
     {
         rb = GetComponent<Rigidbody2D>();

     }

     void Update()
     {

         isGrounded = Physics2D.OverlapCircle(feetPos.position, checkRadius, whatIsGround);

         if (Input.GetButtonDown("Jump") && rb.velocity.y == 0)
             rb.AddForce(Vector2.up * 700f);

         if (Mathf.Abs(moveInput) > 0 && rb.velocity.y == 0)
             animator.SetBool("Running", true);
         else
             animator.SetBool("Running", false);

         if (rb.velocity.y == 0)
         {
             animator.SetBool("Jumping", false);
             animator.SetBool("Falling", false);
         }

         if (rb.velocity.y > 0.2)
         {
             animator.SetBool("Jumping", true);
         }

         if (rb.velocity.y < 0)
         {
             animator.SetBool("Jumping", false);
             animator.SetBool("Falling", true);
         }

         if (isGrounded == true && Input.GetButtonDown("Jump"))
         {
             isJumping = true;

             jumpTimeCounter = jumpTime;
             rb.velocity = Vector2.up * jumpForce;
         }

         if (Input.GetButton("Jump") && isJumping == true)
         {

             if (jumpTimeCounter > 0){
                 rb.velocity = Vector2.up * jumpForce;
                 jumpTimeCounter -= Time.deltaTime;
             } else {
                 isJumping = false;
             }

         }

         if (Input.GetButtonUp("Jump"))
         {
             isJumping = false;
             rb.velocity = new Vector2(rb.velocity.x, 0f);

         }

     }

     void FixedUpdate()
     {
         moveInput = Input.GetAxisRaw("Horizontal");
         rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
         Flip(moveInput);

     }

     private void Flip(float moveInput)
     {
         if (moveInput > 0 && !facingRight || moveInput < 0 && facingRight)
         {
             facingRight = !facingRight;
             Vector3 theScale = transform.localScale;
             theScale.x *= -1;
             transform.localScale = theScale;
         }

     }
 }

sentences:
Cellbased maps explanation? I've been trying to understand cellbased maps and how they work, i have googled alot but can't seem to find any explanation for it.

With cell based maps i mean the ones where you do height and everything like walls roof floor in each cell.
If possible i would appreciate an explanation from a Javascript perspective, but only a theoretical explanation can do.

So why do we use them? how do they work?
Is it just like a normal array with more information?

sentences:
(Unity) Shortest way to instantiate an object and obtain it script Normally I use

ScriptName script = ((GameObject)Instantiate(
        Resources.Load("Prefab"),
        new Vector3(x, y, z),
        Quaternion.identity
    )).GetComponent<ScriptName>();

It is a little too long and too much of brackets, so I wondering if there is any other way to get instantiated object's script without break it in two statements.

sentences:
What makes game sound effects "good"? I'm making a small game, and I've found some free sound effects that I'd like to use.

The issue is that I can't get the sound effects to sound like they "belong" in my game. I don't know what to look for that can make sound effects match the rest of my game style.

I have some ideas on what affects the meshing of audio with graphics. For example, I have a feeling that the current SFX I may be too "realistic" for my graphical style, which is pretty cartoon-like. Also, is there a golden standard for what volume various SFX should be at? (for example, I am thinking that footsteps or other common sounds should be at barely audible volumes, while enemy deaths or something that is a "big deal" should be louder).

I found a similar question about graphics, I'm looking for a similar response with sound effects.

sentences:
Is this paint method okay? I dont know why i need to call super.paintComponent() and super.repaint() to make the player's movements update, if i just put paintComponent the game seems like to always be stopped. However I think that my mistake is the render() method, if a remove it, it doesn't make any difference, so it is useless, I've been looking for the error but I still can not see it. I would appreciate some help

Here is the paint method of the drawing class

public void paint(Graphics g) {
    super.paintComponent(g);

    setFocusable(true);
    requestFocusInWindow();
    setBackground(Color.BLACK);
    player.drawPlayer(g, getPosX(), getPosY());
    enemy.drawEnemy(g);
    //I know this should not be here
    super.repaint();
}

Pricipal GameLoop and render method

public void run() {
    long lastLoop = System.nanoTime();
    final int TARGET_FPS = 60;
    final long OPTIM_TIME = 1000000000 / TARGET_FPS;
    long lastFPSTime = 0;
    int fps = 0;
    double delta = 0;

    while (running) {
        long now = System.nanoTime();
        lastLoop = now;
        delta += (now - lastLoop) / ((double) TIEMPO_OPTIMO);

        lastFPSTime += (now - lastLoop);
        fps++;

        if (lastFPSTime >= 1000000000) {
            System.out.println("[FPS : " + fps + " ]");
            lastFPSTime = 0;
            fps = 0;
        }

        while (delta >= 1) {
            render();
            delta--;
        }

        try {
            Thread.sleep((System.nanoTime() - lastLoop + OPTIM_TIME) / 1000000);
        } catch (InterruptedException ex) {
            Logger.getLogger(mainGameLoop.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

public void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if (bs == null) {
        createBufferStrategy(2);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    drawing.paint(g);
    g.dispose();
    bs.show();
}

And as last and least probable, I thought that maybe there is something that is not adding correctly to my window

A normal window class

Drawing drawing = new Drawing();

public Window(String title,int width, int hight, mainGameLoop mainGame){
    JFrame frame = new JFrame(title);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, hight);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.add(mainGame);
    frame.add(drawing);

    mainGame.start();
    mainGame.run();

sentences:
How to instantiate GameObject on client without network? When I NetworkServer.Spawn(ob) a gameobject and make it a child of a transform.parent after it spawns on both the server and client it usually lags, meaning it takes some secs to align with the transform.parent which is the player

Example : Instantiating a GameObject containing a ParticleSystem which gives the parent somewhat an effect, smoke or something in that direction, in the host client every object usually has a smooth movement where as in the connected client it goes very rough and slow, like every gameobject having a low fps except the main client player prefab

So i was thinking spawning the same effect on both clients so it wouldn't have to sync from the server to the client which uses it instead it only would have to sync inside the clients game, it might not have the same particle movements but it wouldn't make a difference

Here's the child's prefab network identity and transform :

sentences:
sf::RectangleShape's position is not same as I set it to When I try to print my box.getSfShape()'s position it does not print out the position I set it to have.

( The box.getSfShape()'s position is by default set to 0 )

Wrong output : ( printing the position of the box.getSfShape() )

( prints out : X : 0 Y : 0 ((These are the default assigned positions)) )

box.getSfShape().setPosition(box.getBody()->GetPosition().x / b2Meter, box.getBody()->GetPosition().y / b2Meter);

But when I print out the calculation only :

std::cout << "X : " << box.getSfShape().getPosition().x << " Y : " << box.getSfShape().getPosition().y << std::endl;

It prints out a increasing Y value and a X value on 0 like it should do.

So, I'm guessing the call to set the box.getSfShape() position somehow fails.

If you need something more, please tell me what to add :)

sentences:
Get points on a line between two points I'm making a simple space game in JavaScript, but now I've hit a wall regarding vectors.

The game view is top-down on a 2d grid.  When the user clicks on the grid, the space ship will fly to that spot.

So, if I have two sets of points:

{ x : 100.2, y : 100.6 }; // the ship
{ x : 20.5,  y : 55.95 }; // the clicked coordinates

If the game loop ticks at 60 iterations per second, and the desired ship velocity is 0.05 points per tick (3 points per second), how do I calculate the new set of coordinates for the ship for each tick of the game loop?

p.s. I do not want to account for inertia, or multiple vectors affecting the ship, I just want the ship to stop whatever it is doing (i.e. flying one way) and move to the clicked coordinates at a static speed.

sentences:
Rotate an object smoothly by 90 degrees on key press in unity3D [I saw few similar question on stackexchange but none is solving the purpose.]

I want to rotate a 3D object by 90 degrees on different axis on respective inputs. For example if 'a' is pressed, the object should rotate left by 90 degrees. transform.Rotate(0,90,0); is working but it is not rotating the object smoothly.

I am new to C# and js so cannot manually code but I tried the codes given in this answer at Rotate an object smoothly on the Y axis in Unity. The below code works but it it has two problems -
code:

void Update () {
SwingOpen();
}

void SwingOpen()
{
    Quaternion newRotation = Quaternion.AngleAxis(90, Vector3.up);
    transform.rotation= Quaternion.Slerp(transform.rotation, newRotation, .05f);
}

Problem 1: The above code rotates object without any keyboard inputs.
I added the condition if (Input.GetKeyDown (KeyCode.RightArrow)) but now the object rotates partially on every keyboard input. I want to rotate it by 90 degrees on a single key press.

Problem 2: It will never actually rotate the object by 90 deg. It will always be tending towards 90 deg. I want exact 90 deg rotation to allow multiple 90 deg rotations for 'n' number if inputs.

How can I solve this? Please help. Please let me know if the question isn't clear enough.

[EDIT]

I applied the below script but it is giving me some totally unexpected output

Code:

public float speed = 1;
private int xtimesHit = 0;
private int ytimesHit = 0;
private int ztimesHit = 0;

void Update () {
    if( Input.GetKeyDown( KeyCode.RightArrow ) ){
        ztimesHit--;
    }
    if( Input.GetKeyDown( KeyCode.LeftArrow ) ){
        ztimesHit++;
    }

    if( Input.GetKeyDown( "a" ) ){
        ytimesHit++;
    }
    if( Input.GetKeyDown( "d" ) ){
        ytimesHit--;
    }

    if( Input.GetKeyDown( "w" ) ){
        xtimesHit++;
    }
    if( Input.GetKeyDown( "s") ){
        xtimesHit--;
    }

    this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Quaternion.Euler(xtimesHit*90,ytimesHit*90,ztimesHit*90), Time.deltaTime*speed);

}

On running this script
If I press rightarrow once followed by 's' the object rotates on 'z' axis and 'x' axis  correctly but there after if I press arrowkeys or 'a/s' in both the cases the object rotates on y axis. I dont understand why this is happening.

I want it to rotate w.r.t. the world axis always.

sentences:
Is there a concept of "pasted on theme" in video games? I've prototyped an idea and so far it's quite fun to play. However, it's still abstract and uses placeholder art. I've been thinking about a theme/story to add to the game, but I don't want to make it too obvious it was added almost as an afterthought.
There's a concept of "pasted on theme" within the board game community which basically refers to a game which is easy to reskin without redesigning some of the mechanics. I was wondering how big of an issue this is with video games (indie games in particular of course) and anything else I could do about a story for my game.

sentences:
How to handle multiple clipping rectangles in a CanvasItem? Let's say I have a CanvasItem that needs to draw the background first, occupying the entire item rect, and then draw all its content within a smaller rect leaving a margin.

How should this be done in the NOTIFICATION_DRAW within _notofication?

This is what I've tried:

void MyCustomItem::_notification(int p_what) {

    case NOTIFICATION_DRAW: {
        // Enable clipping
        VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);

        draw_background();

        // Clip to margins
        VisualServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), true, Rect2(
            Point2(
             MARGIN_LEFT,
             MARGIN_TOP
            ),
            Size2(
             width - MARGIN_LEFT - MARGIN_RIGHT,
             height - MARGIN_TOP - MARGIN_BOTTOM
            )
        ));

        draw_stuff();
    }

The problem with this is that it will clip everything to the margins including the background.

sentences:
Unity - Moving RigidBody to a point in a spherical world I have a planet ( a spherical planet) that have units on the surface , that units are attracted by the planet  with this

  public void Attract(Transform body,Rigidbody rigidBody)
    {
        Vector3 gravityUp =  (body.position - transform.position).normalized;
        Vector3 bodyup = body.up;
        Quaternion targetRotation = Quaternion.FromToRotation(bodyup, gravityUp) * body.rotation;

        body.rotation = Quaternion.Slerp(body.rotation, targetRotation, 50*Time.deltaTime);
        rigidBody.AddForce(gravityUp*gravity);
    }

I want them to also move to a specific point in the planet but I can't make it work, I tryed lot of things, the most "near" to the solution was this code on the Update method, but his make unit to "bounce",

Vector3 dir = (positionToAchieve - transform.position).normalized * speed;
rigidBody.velocity = rigidBody.velocity + dir;

Any idea /suggestion will be welcome, I am new in Unity and I am learning it

sentences: How can I switch between texture atlases based on the iOS version? How can I switch between atlases (with different resolutions) in Unity based on the runtime iOS version?

sentences:
How signals work when Node2D is queue_freed? Consider this setup:
* KinematicBody2D (Player)
|- Sprite (icon.png)
|- VisibilityNotifier2D

With Player.gd:
class_name Player extends KinematicBody2D
signal unvisible

onready var visibility_notifier :VisibilityNotifier2D = $VisibilityNotifier2D

func _ready() -> void:
    visibility_notifier.connect("screen_exited", self, "__on_screen_exited")

func __on_screen_exited() -> void:
    emit_signal("unvisible")

Now I have a template Level.gd:
* Node2D (Level)
|- Player

extends Node2D

onready var player :Player = $Player

export var debug_no_enemy  = false
export var debug_no_player = true

func _ready() -> void:
    player.connect("unvisible", self, "_reset_level")
    if debug_no_player:
        player.queue_free()

func _reset_level() -> void:
    print("reset")
    get_tree().reload_current_scene()

The print statement proves that this setup make a kind of infinite loop of reset because the signal screen_exited is still emited when the player is queue_free.
Is it expected?

I am even more surprised with this modified version which produces the same thing:
func _ready() -> void:
    if debug_no_player:
        player.queue_free()
    player.connect("unvisible", self, "_reset_level")

sentences:
Separating Axis Theorem fails at certain angles I'm currently attempting to add an overlap tester for an axis aligned and orientated bounding box but the solution only seems to work accurately when the OBB's angle is between -10 and +10. As the angle approaches +90 degrees the collision area seems to at first move to the right half of the OBB and then become non existent. Between 90 and 270 I couldn't get an overlap and then when it comes round a full 360 the area registers accurately again.

Any light on this subject would be great. I'm using positive X for 0 degrees increasing CCW.

EDIT: Did a little more research and realized that projecting a vector onto another requires more than just a dot product. Could any one give me a correct version of one of the check axis methods below?

EDIT 2: Actually just a dot product should do I think since the vectors being  projected onto are unit length.

public static bool overlapAABB_OBB(AABB a, OBB o)
    {
        float rads = MathHelper.ToRadians(-o.angle);
        T = Vector2.Subtract(o.position, a.position);
        Ax.X = 1;
        Ax.Y = 0;
        Ay.X = 0;
        Ay.Y = 1;
        Ox.X = (float)Math.Cos(rads);
        Ox.Y = (float)Math.Sin(rads);
        Oy.X = -Ox.Y;
        Oy.Y = Ox.X;
        if (checkAX(a, o) &&
           checkAY(a, o) &&
           checkOX(a, o) &&
           checkOY(a, o))
            return true;
        else
            return false;
    }

    private static bool checkAX(AABB a, OBB o)
    {
        float TAx = Vector2.Dot(T, Ax);
        float WoOxAx = Vector2.Dot(Vector2.Multiply(Ox, o.halfWidth), Ax);
        float HoOyAx = Vector2.Dot(Vector2.Multiply(Oy, o.halfHeight), Ax);
        if (TAx > a.halfWidth + WoOxAx + HoOyAx)
            return false;
        else
            return true;
    }

    private static bool checkAY(AABB a, OBB o)
    {
        float TAy = Vector2.Dot(T, Ay);
        float WoOxAy = Vector2.Dot(Vector2.Multiply(Ox, o.halfWidth), Ay);
        float HoOyAy = Vector2.Dot(Vector2.Multiply(Oy, o.halfHeight), Ay);
        if (TAy > a.halfHeight + WoOxAy + HoOyAy)
            return false;
        else
            return true;
    }

    private static bool checkOX(AABB a, OBB o)
    {
        float TOx = Vector2.Dot(T, Ox);
        float WaAxOx = Vector2.Dot(Vector2.Multiply(Ax, a.halfWidth), Ox);
        float HaAyOx = Vector2.Dot(Vector2.Multiply(Ay, a.halfHeight), Ox);
        if (TOx > o.halfWidth + WaAxOx + HaAyOx)
            return false;
        else
            return true;
    }

    private static bool checkOY(AABB a, OBB o)
    {
        float TOy = Vector2.Dot(T, Oy);
        float WaAxOy = Vector2.Dot(Vector2.Multiply(Ax, a.halfWidth), Oy);
        float HaAyOy = Vector2.Dot(Vector2.Multiply(Ay, a.halfHeight), Oy);
        if (TOy > o.halfHeight + WaAxOy + HaAyOy)
            return false;
        else
            return true;
    }

sentences:
update image properties Is there a way to update the location of an image?

I'm currently calling my image dynamically using:

itemImage = display.newImage(inventory[t.ID][1])

t. being my target ID.

But in order for Storyboard to properly work, I need to change its location in my code to above my function, rendering its dynamic properties useless. Is there a way to update it like you can do with .text?

something along the lines of:

itemImage.image(inventory[t.ID][1])
itemImage.imageUpdate(inventory[t.ID][1])

etc...

sentences:
How to create characters randomly with a given skill and weighted abilites I am trying to create random characters in my game.
Each character has 33 abilities and one of 6 jobs. For each job you need to skill/increase other
abilities. I am calculating an overall skill (from 1 to 99) by using only the important abilities for this job. For example one of the jobs is a healer. Here you need to skill ability1 to ability6, which have also different weights.

Example:

 - Healer
 - Ability1 has weight 10 (skill 70)
 - Ability2 has weight 5 (skill 60)
 - Ability3 has weight 4 (skill 50)
 - Ability4 has weight 10 (skill 80)
 - Ability5 has weight 5 (skill 40)
 - Ability6 has weight 8 (skill 50)

 Example calculation:
(70 * 10) + (60 * 5) + (50 * 4) + (80 * 10) + (40 * 5) + (50 * 8) = 2600 /  (10 + 5 +  4+10+ 5+ 8) = 62

Problem:

I want to create random characters with random skills WITH a specific overall skill in HIS job. Example: CreateHealer(skill: 70).
It doesn’t matter which values all the other abilities have. For example if ability7 is 1 or 99 the overall skill of the healer is always 70, but I want them to be random because the user has the opportunity to change the job, if he can see that this char would be a better warrior.

My idea:

Create all 33 abilities randomly and calculate the overall skill in this job.

If skill is on the right level —> stop.
If skill is too low increase one of the weighted abilities and calculate again.
If skill is too high decrease one of the weighted abilities and calculate again.

Is there a better way/algorithm to do this?

sentences:
How should I model exact 90-degree rotations in 3D? I'm familiar with quaternions... have used them in the past to model arbitrary rotations in 3D, as for a plane flying around with full pitch/yaw/roll freedom. Works great.

Now I'm working on a 3D puzzle where the rotation is "quantized": all rotations are whole multiples of 90 degrees. I could use quaternions, but it seems like complexity overkill for this situation. And more importantly, I need to be able to test different orientations according to their quantized values, aligned to the three main axes. Quaternions (usually) use floating point values rather than integers, so if we compose several rotations and then compare the resulting orientation to a known orientation, it may not be straightforward to test whether a certain face is pointing a given direction, due to rounding.

Anyway, there may be an easier way to model this.

The puzzle is like "netwalk", but in 3D. So the requirements are:

Be able to rotate a given piece +/-90 degrees, around a specified axis, updating its orientation state (which is modeled how?)
Be able to query whether a particular piece, in its current orientation, is connected in a particular direction (e.g. has a tube touching the face that is in the positive X direction)
For the latter we probably have an array of booleans that say whether the piece is connected in each direction in its "initial" orientation. But in order to make use of this, we need a way to rotate this initial state to the current orientation.
Oh, we also need to be able to display each piece graphically in its updated orientation. But that could use a separate orientation state if necessary... it's a pretty standard feature of scene graph libraries.

Maybe I just need to implement an integer version of quaternions?

Thanks for any thoughts...

sentences: With an iPhone game, can I allow music from other apps to play while my game is being played? My game doesn't have any music but it does have sound effects. Right now if I power up Pandora and then start a song and then switch to my game it will stop the Pandora song. Is there a special way I need to play my sound fx so that the music from Pandora will keep playing while my game is running?

sentences:
object array positioning-LibGdx In my game,if I touch a particular object,coin objects will come out of them at random speeds and occupy random positions.

public void update(delta){
if(isTouched()&& getY()<Constants.WORLD_HEIGHT/2){
         setY(getY()+(randomSpeed * delta));
         setX(getX()-(randomSpeed/4 * delta));
         }
  }

Now I want to make this coins occupy positions in some patterns.Like if 3 coins come out,a triangle pattern or if 4 coins, rectangular pattern like that.

I tried to make it work,but coins are coming out and moved,but overlapping each other.Not able to create any patterns.
patterns like:

This is what I tried

int a = Math.abs(rndNo.nextInt() % 3)+1;//no of coins
        int no =0;

        float coinxPos = player.getX()-coins[0].getWidth()/2;
        float coinyPos = player.getY();
        int minCoinGap=20;
        switch (a) {
        case 1:
            for (int i = 0; i < coins.length; i++) {
                if (!coins[i].isCoinVisible() && no < a) {
                    coins[i].setCoinVisible(true);

                    coinxPos = coinxPos+rndNo.nextInt()%70;
                    coinyPos = coinyPos+rndNo.nextInt()%70;
                    coins[i].setPosition(coinxPos, coinyPos);
                    no++;
                }
            }
            break;
        case 2:
            for (int i = 0; i < coins.length; i++) {
                if (!coins[i].isCoinVisible() && no < a) {
                    coins[i].setCoinVisible(true);
                    coinxPos = coinxPos+minCoinGap+rndNo.nextInt()%70;
                    coinyPos = coinyPos+rndNo.nextInt()%150;
                    coins[i].setPosition(coinxPos, coinyPos);
                    no++;
                }
            }
           break:
          ......
          ......
          default:
            break;

may be this is a simple logic to implement,but I wasted a lot of time on it and got confused of how to make it work.
Any help would be appreciated.

sentences:
Unity LWRP alternatives for camera stacking I am working on upgrading a project in unity from a 2018 version to the latest 2019. One of the mechanics of the game is an AR (augmented reality) system. Some of the UI elements appear in the 3D world, but clearly as part of the hud. They need to be transformed as the camera moves, but should always be drawn on top of the 3d scene.

The old project achieved this via camera stacking. All the AR elements were drawn on a different camera which rendered on top of the 3D camera. The clear flags were set to "depth only" and it removed all other elements from that camera.

In the 2019 version of Unity with the Lightweight Render Pipeline (LWRP), the clear flags feature on the camera is missing. To the best of my research, camera stacking has been removed from LWRP.

What are my alternatives? How can I now achieve this effect? I would like to stick to LWRP as I am using Shader Graph for many of the effects in the game.

sentences:
How to correct mouse position to world position in xna/monogame I'm making a small game where the player shoots projectiles by clicking the mouse.  Everything worked fine before adding in a camera.  Now the position of the new projectiles is always off.
shoot code:
    if (mouseState.LeftButton == ButtonState.Pressed)
        {
            Vector2 mousePos = new Vector2(mx, my);
            Vector2 worldPosition = Vector2.Transform(mousePos,
            Matrix.Invert(game.camera.transform));

            Shoot(new Vector2(mx, my), new Vector2(pos.X + 8 * scale.X, pos.Y + 8 * scale.Y),
            gameTime);
            buttonTimer--;
        }

Camera code:
    public class Camera
    {
    Handler handler;

    public Matrix transform { get; private set; }

    public Camera (Handler handler)
    {
        this.handler = handler;
    }

    public void Update (GameTime gameTime)
    {
        foreach (Player p in handler.players)
            Follow(p);
    }

    public void Follow(Player target)
    {
        var offset = Matrix.CreateTranslation(1200 / 2, 800 / 2, 0);

        var position = transform = Matrix.CreateTranslation(
            -target.pos.X - ((16 * target.scale.X) / 2),
            -target.pos.Y - ((16 * target.scale.Y) / 2),
            0);

        transform = position * offset;
    }
}

Bullet code:
    public class Projectile
{
    public bool isActive = true;

    Game1 game;
    Handler handler;
    Spritesheet ss;

    public Vector2 pos;
    public Vector2 scale;

    int type;

    public Vector2 vel;
    public Vector2 direction;
    public Vector2 origin;

    long startTime = 0;

    float speed = 14;

    int particleTimer = 0;

    Rectangle Bounds;

    public Projectile(Vector2 pos, Vector2 scale, int type, Game1 game, Handler handler)
    {
        this.pos = pos;
        this.scale = scale;
        this.type = type;
        this.game = game;
        this.handler = handler;

        this.ss = game.bullet_ss;

        origin = pos;
    }

    public void LoadContent(ContentManager content)
    {

    }

    public void Update(GameTime gameTime)
    {
        pos += direction * speed;
        CreateParticles();

        Collision();

        Bounds = new Rectangle((int)pos.X, (int)pos.Y, (int)(8 * scale.X), (int)(8 * scale.Y));
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(ss.frames[type, 0], pos, null, null, null, 0, scale);
    }

    private void Collision()
    {
        if (type == 0)
        {
            foreach (Platform p in handler.platforms)
            {
                if (this.Bounds.Intersects(p.Bounds)) isActive = false;
            }
        }
    }

    private void CreateParticles()
    {
        if (particleTimer > 2)
        {
            for (int i = 0; i < 3; i++)
            {
                Vector2 position = new Vector2(handler.rand.Next(8) * scale.X, handler.rand.Next(8) *
                scale.Y);
                Vector2 v = new Vector2(handler.rand.Next(8), handler.rand.Next(8));
                Particle p = new Particle(position + pos, v, new Vector2(4, 4), 0, game, handler);
                handler.particles.Add(p);
            }

            particleTimer = 0;
        }
        particleTimer++;
    }

What fixes can I implement so that the projectiles are created in the correct positon?

sentences:
import text strings into Unity editor 3D text objects so that Scene View displays them I am having trouble finding a solution to this problem.  I want to generate the text for TextMesh.text in a custom application and import into the Unity editor so that I can then scale the text to fit.  If anyone could point me in the right direction to simply edit a 3D Text game objects' text mesh.text property from a script so that it is reflected in the scene view in Unity's editor, I would greatly appreciate it!

Best Regards,
Ben

sentences: How do I recruit beta testers? We're a small company without enough employees to run a large scale beta in house.  The app is geo-location based so we're trying to recruits some beta testers from all over that aren't "friends and family".  Are there any sites or communities dedicated to something like this?

sentences:
LOD culled gameobject still interacts with raycast The camera is sort of top down and the player can move objects around, rotate them, delete them etc. I use a raycast to check what was hit when the player clicks. But some objects are culled by the LOD group when far away, but the LOD group only disables the renderer, not the colliders, so it still interacts with the raycast. This means a player can move or delete an object that they can't even see.

I've tried looping through all the renderers in the lod group and using renderer.isVisible but it doesn't solve the problem of collision and raycasts. I'd really rather not poll isCulled every frame in update either because there are thousands of gameobjects, that would be horrible for performance.

LODGroup lodGroup = GetComponent<LODGroup>();
LOD[] LODs = lodGroup.GetLODs();
for (int i = 0; i < LODs.Length; i++)
{
    LODRenderers = LODs[i].renderers;
}

bool isCulled = true;

for (int i = 0; i < LODRenderers.Length; i++)
{
    if (LODRenderers[i].isVisible)
    {
        isCulled = false;
    }
}

sentences: Deferred lighting and projective texturing? Is posible to use this technique with deferred lighting?

sentences:
My player sprite get stuck to walls while moving along Hello,

My player sprite is moving along the wall (not even diagonal, just straight down) and get randomly blocked in the corner of some walls. By blocked, I mean that the Y movement is stopped.
If I move him away from the wall, he might not be blocked again by the same wall and get blocked at some other walls, always at a corner.

The walls are all the same sprite and are of the same size.

I use 2D Box Colliders for the walls. The player sprite has a Box Collider 2D and a RigidBody 2D. I am not using any physics codes, I would just like to make it work with the built-in Unity physics.

I move the player by adjusting the velocity of the rigidbody according to Input:

RigidBody2D rb = GetComponent<Rigidbody2D>();
float horizontal = Input.GetAxisRaw ("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector2 movement = new Vector2(horizontal, vertical).normalized *speed * Time.deltaTime;
this.rb.velocity = movement;

The player is set like this:

Do you have any idea why it behaves like this and how I could fix it?

Thanks for your help.

sentences:
Delay for seconds when key is held down? Hello I am very new to Unity and am trying to make a shooting game in which when the space key is pressed down the gun charges then shoots. I want it to wait for 0.3 seconds before the gun fires off because I want an effect to happen with a particle system(I confused animation with effect in the first post). Also the problem the script has is that the bullet would not fire at all when the space is pressed. Here is the scripts I wrote:

 void Start()
 {
     StartCoroutine("Shoot",0.3f);
 }

 IEnumerator Shoot()
 {
     yield return new WaitForSeconds (0.3f);
     Bam ();
 }

 void Bam()
 {
     transform.Translate (0, 0, 12);
 }

 void Update ()
 {
     if (Input.GetKey (KeyCode.Space))
         Shoot();
 }

sentences:
Collision detection with entities/AI I'm making my first game in Java, a top down 2D RPG.
I've handled basic collision detection, rendering and have added an NPC, but I'm stuck on how to handle interaction between the player and the NPC.

Currently I'm drawing out my level and then drawing characters, NPCs and animated tiles on top of this. The problem is keeping track of the NPCs so that my Character class can interact with methods in the NPC classes on collision.

I'm not sure my method of drawing the level and drawing everything else on top is a good one - can anyone shed any light on this topic?

sentences:
XNA: Camera's Rotation and Translation matrices seem to interfere with each other I've been following the guide here for how to create a custom 2D camera in XNA. It works great, I've implemented it before, but for some reason, the matrix math is throwing me off.

public sealed class Camera2D
{
    public Vector2 Origin { get; set; }
    public Vector2 Position { get; set; }
    public float Scale { get; set; }
    public float Rotation { get; set; }
}

It might be easier to just show you a picture of my problem: http://i.imgur.com/H1l6LEx.png

What  I want to do is allow the camera to pivot around any given point. Right now, I have the rotations mapped to my shoulder buttons on a gamepad, and if I press them, it should rotate around the point the camera is currently looking at. Then, I use the left stick to move the camera around. The problem is that after it's been rotated, pressing "up" results in it being used relative to the rotation, creating the image above.

I understand that matrices have to be applied in a certain order, and that I have to offset the thing to be rotated around the world origin and move it back, but it just won't work!

public Matrix GetTransformationMatrix()
    {
        Matrix mRotate = Matrix.Identity *
            Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0.00f) *  // Move origin to world center
            Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)) * // Apply rotation
            Matrix.CreateTranslation(+Origin.X, +Origin.Y, 0.00f);   // Undo the move operation

        Matrix mTranslate = Matrix.Identity *
            Matrix.CreateTranslation(-Position.X, Position.Y, 0.00f); // Apply the actual translation

        return mRotate * mTranslate;
    }

So to recap, it seems I can have it rotate around an arbitrary point and lose the ability to have "up" move the camera straight up, or I can rotate it around the world origin and have the camera move properly, but not both.

sentences:
Squashing screen resolution in XNA I've made a game in 1920x1080 res in XNA, and I can't seem to find a way for the graphics device to squash the screen images to other resolutions like 1600x900 when played on different computers.

How can I get my game to be in proportion, and fit on smaller screens with the same aspect ratio?

sentences:
Wall collision and sweep and prune algorithm I am documenting myself on collision detection algorithms.

If I understand well, "sweep and prune" algorithm using frame coherence is powerful to detect object vs object collisions (almost as 0(n)).

I am wondering if this algo is good for object vs wall collision ?

Suppose you have a big plane wall that is tilted regarding the axes of the "sweep and prune" algorithm (in a 3D game), because it is tilted the bounding box is quite big, and the wall bounding box will be detected as colliding a lot of objects. Similarly if a room is tilted regarding the axes of the algo (and the room is not a cube, but a complex geometry), then all walls collides almost all objects in the room, and the "sweep and prune" algo is useless for this problem.

A turnaround could be to split the wall in many little faces before the algo ?
Or are there other fast specific algos to detect object vs (big)wall collisions ?

sentences:
How can I append geometrical objects over a circle LibGDX I want to draw geometric shapes over circle with using the graphics library in LibGDX like that;

As you see from image, I want to append blue shapes to black circle. Any advice ?

sentences:
Set multiple render targets with OMSetRenderTargets using ComPtr I've recently decided to get rid of pretty much all of the raw pointers from my Direct3D code, and I ran into a problem with using ComPtr<T> template with multiple render targets.

Microsoft suggests using ComPtr<T> for D3D instead of unique_ptr<T> or shared_ptr<T>. However even their example shows how to use it with OMSetRenderTargets, but I couldn't really find anything how to use it when you have to bind an array of managed objects.

Here's some code of my current solution:

class Texture{
public:
    void Initialize(const Bitmap &bitmap){ /* ... */}

    ID3D11ShaderResourceView* GetShaderResourceView() const { return this->m_pResourceView; }
    ID3D11RenderTargetView* GetRenderTargetView() const { return this->m_pTargetView; }
    ID3D11Resource* GetTextureResource() const { return this->m_pTexture; }

    ID3D11Texture2D* GetTexture2D() const { return static_cast<ID3D11Texture2D*>(this->m_pTexture); }

private:
    ID3D11ShaderResourceView * m_pResourceView;
    ID3D11RenderTargetView * m_pTargetView;
    ID3D11Resource * m_pTexture;
}

class Renderer{
public:
    void Initialize(const Window & targetWindow){ /* ... */ }

    void SetDepthStencilView(ID3D11DepthStencilView* pDepthStencilView = nullptr){
        n = n < RENDER_TARGET_MAX ? n : RENDER_TARGET_MAX;
        if (!n && pRenderTargetView == nullptr) {
            m_renderTargetViews[0] = m_myRenderTargetView;
        } else {
            m_renderTargetViews[n] = pRenderTargetView;
        }
    }

    void SetRenderTargetView(ID3D11RenderTargetView* pRenderTargetView = nullptr, size_t n = 0){
        if (pDepthStencilview == nullptr) {
            m_depthStencilView = m_myDepthStencilView;
        }
        else {
            m_depthStencilView = pDepthStencilview;
        }
    }

    void ApplyRenderTargetView(size_t count = 1){
        m_renderTargetViewCount = count < RENDER_TARGET_MAX ? count : RENDER_TARGET_MAX;
        m_deviceContext->OMSetRenderTargets(m_renderTargetViewCount, m_renderTargetViews, m_depthStencilView);
    }

private:
    ID3D11Device* m_device; // device context, swap chain, raster state, etc ...
    ID3D11RenderTargetView* m_renderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT], *m_myRenderTargetView; // This is the screen as a default
    size_t m_renderTargetViewCount;
    // depth stencil buffer, etc ...
}

void some_use_case(Renderer & render){
    Texture colorMap;
    Texture normalMap;
    Texture positionMap;

    render.SetRenderTargetView(colorMap.GetRenderTargetView(), 0);
    render.SetRenderTargetView(normalMap.GetRenderTargetView(), 1);
    render.SetRenderTargetView(positionMap.GetRenderTargetView(), 2);

    // ... Render geometry
    // ... Render posteffects
}

Keep tracking and releasing all of the resources are way too tedious, and It's reasonable to introduce some smart pointer solution here. How could I replace the pointer definition, and how could I bind it m_renderTargetViews to OMSetRenderTargets?

sentences:
Open GL Android frame-by-frame animation tutorial/example code My first question was asked wrong, so I need to ask again :)

I found out, that I will have to do an OpenGL animation for my Android game. The closest (known) example is Talking Tom (but I don't know how they did the animations).

I have large PNGs which I would like to put into a animation. For example - 30 PNGs 427×240px at 8 FPS.

I know some things already about Open GL, but I am used to learn from example code. And it is quicker that way (so I don't need to invent hot water all over again :)). Does anybody has any points to direct me?

sentences:
Default Game Window Size To Take While Making Games I am planning to make a game for mobiles and tablets, I wanted to know what would be the default resolution that I should set for my game so that it covers all or most of the devices out there.
I read an article someplace that says we should design the game for lowest resolution like 480 x 360 and then scale it according to devicePixelRatio for the target device, Is this the right approach because according to me it will be good only for devices that have 3:2 resolution but what about other 16:9, 16:10 etc
So What should be the base resolution I design my game so that it gets scaled to all mobiles and tablets?

sentences:
pygame KEYUP KEYDOWN events only once per frame? I've been playing around with pygame, and I ran into a bit of an odd issue with input on the pygame event queue. Consider the following test code:

import pygame as pg

def main():
    pg.init()
    pg.display.set_mode([640,480])
    clock = pg.time.Clock()
    while True:
        clock.tick(1)
        events = pg.event.get()
        print("There are %d events in the queue." % len(events))
        for event in events:
            print(event)
        print()

if __name__ == "__main__":
    main()

Here I'm intentionally running the game loop just once per second. What I observe is that the pygame event queue can easily receive dozens of mouse-related events per frame, but only ever a single KEYDOWN or KEYUP event at a time.

This is the output after pressing four keys simultaneously and quickly pressing the left mouse button a few times at the same time:

There are 0 events in the queue.

There are 1 events in the queue.
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>

There are 8 events in the queue.
<Event(2-KeyDown {'unicode': 'f', 'key': 102, 'mod': 0, 'scancode': 41})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>

There are 3 events in the queue.
<Event(2-KeyDown {'unicode': 'q', 'key': 113, 'mod': 0, 'scancode': 24})>
<Event(5-MouseButtonDown {'pos': (494, 392), 'button': 1})>
<Event(6-MouseButtonUp {'pos': (494, 392), 'button': 1})>

There are 1 events in the queue.
<Event(2-KeyDown {'unicode': 'e', 'key': 101, 'mod': 0, 'scancode': 26})>

There are 1 events in the queue.
<Event(2-KeyDown {'unicode': 'w', 'key': 119, 'mod': 0, 'scancode': 25})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 119, 'mod': 0, 'scancode': 25})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 113, 'mod': 0, 'scancode': 24})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 101, 'mod': 0, 'scancode': 26})>

There are 1 events in the queue.
<Event(3-KeyUp {'key': 102, 'mod': 0, 'scancode': 41})>

There are 0 events in the queue.

At 1 FPS, it takes pygame 8 seconds to process just 4 keypresses, one for each KEYUP and KEYDOWN signal. Is this intended behavior? Am I missing something here? It seems odd to me that pygame cannot register multiple keypresses per frame. I'm a bit of a newbie when it comes to gamedev, so I'm not sure where this is coming from.

sentences:
2D Websocket WebGL game Inspired by BrowserQuest, I want to try my hand at making my own kind of game like this but I don't really know anything about game development other than the basics, like how the game loop works. Although, I feel more than confident with server-side/client-side JS so it's mostly just about learning concepts for me.

Some questions I've had so far when thinking about how I'll go about implementing it:

I understand there'll be unsynced client-side code and synced server-side code. If a player presses an arrow key on their keyboard, should it send that information to the server, then the server says it's ok, then the client does it? Or should the client just do it anyway then the server validate it after-the-fact and correct the client if they perform an invalid action?
The data going between server and client will initially be very simple. Currently I just have x and y positions for players. But how often is it ok for clients to send this data back to the server and the server to broadcast the data to all clients? I could do these things every 1ms which would make everything as smooth as possible, but wouldn't this kill the client/server or at least use a truck-load of bandwidth? I only have a very small VPS and wouldn't want to overload it by sending 1000 JSON objects to a bunch of clients every second when I don't have to. What's the sweet-spot here?
I want to include some PvP style combat in my game but am not sure if the websocket protocol is suitable for this. With UDP, data is sent back and forth super fast partly in thanks to its unreliable nature, right? With websockets, will the communication between clients/server be fast enough to process something like a player attacking another player?

Any other advice about this sort of thing would be great, even if it's just links to existing documentation/examples. Cheers.

sentences: Is it reasonable to write a game engine in C? Even though C++ appears to be king, from what I've been told C is still widely used in games, especially on the consoles. However, would writing an entire game engine in C be unreasonable today? What are, if any, some advantages that C has over C++? Why would someone possibly want to use C over C++?

sentences:
Cocos2D - Fill a Sprite with a pattern I have a CCSprite with a certain shape in Cocos2D and I would like to fill it with a pattern, as seen here:

I've seen a lot of examples where they fill a rectangle with a pattern, or even a dynamically-created polygon, but not another CCSprite. Is it possible to do so?
Thanks!

sentences:
Lerp velocity in specific time How to lerp velocity to 0 in specific time? For example in two seconds? I need this for jumping.

velocity.Y = MathHelper.Lerp(velocity.Y, 0, [time]);

sentences:
Can world depth be achieved in a side scroller? I tend to build games with strong stories, which usually involves quite an indepth world environment. Typically I develope typical 2.5 over head view JRPG style (think Zelda, Final Fantasy 3, etc) because I have it stuck in my head that you can only achieve world depth using this style.

This question is limited to the 2D environment. Can this be achieved in a 2D side scroller? Can a user experience the world when only seeing it from the side? Can he/she explore villages in this manner? Any examples would be great.

The closest thing that comes to my mind at the moment is Castle Crashers.

sentences:
What determines the hit detection ordering for graphic elements in Unity (2d game)? I have a bunch of overlapping buttons spread across several UI Canvases. The default mouse behaviour only registers hover/click events with one of the overlapping buttons, which is ideal for my project. The problem is the order of which button gets activated, is not tied to the Layer it is on or the Sorting Layer the item is on. I cannot seem to control which button is the top button that gets activated.

Using a RaycastAll() function returns the name of all buttons on any given point, and reflects the problem that for some reason, the buttons are arbitrarily ordered.

How do you control the order in which buttons are registered by the mouse?

sentences:
C# Item system design approach, should I use abstract classes, interfaces or virutals? I'm working on a Resident Evil 1/2/3/0/Remake type of game. Currently I've done a big part of the inventory system (here's a link if you wanna see my inventory, pretty outdated, added a lot of features and made a lot of enhancements)

Now I'm thinking about how to approach the items system, If you've played any Resident Evil game or any of its likes you should be familiar with what I'm trying to achieve. Here's a very simple category I made for the items:

So you have different items, with different operations you could perform on them, there are usable items that you could use, like for example herbs and first aid kits that 'using' them would affect your health, keys to unlock doors, and equipable items that you could 'equip' like weapons. Also, you can 'combine' two items together to get new one, like for example mixing a green and red herb would give you a new type of herb, or combining a lighter with a paper, would give you a burnt paper, or ammo with a gun, would reload the gun or something. etc. You know the usual RE drill.

Not all items are 'transformable', in that, for example: lighter + paper = burnt paper (it's the paper that 'transforms' to burnt paper and not the lighter, the lighter is not transformable it will remain as it is) green herb + red herb = newHerb1 (both herbs will vanish and transform to this new type of herb) ammo + gun = reload gun (ammo state will remain as it is, it won't change but it will just decrease, nothing will happen to the gun it just gets reloaded)

Also a key note to remember is that you can't just combine items randomly, each item has a 'mating' item(s).

So to sum up, different items, and different operations on them. The question is, how to approach this, design-wise?

I've been learning about interfaces, but it just doesn't quite get into my head, I mean, why not just use classes with the good old inheritance?
I know the technical details of interfaces and that the cool thing about them is that they don't require an inheritance chain, but I just can't see how to use them properly, that is, if they were the right thing to use here.

So should I go with just classes and inheritance? just like in the tree I showed you? or should I think more about how to use interfaces? (IUsable, IEquipable, ITransformable) - why not just use classes UsableItem, Equipable item, TransformableItem?

I want something that won't give me headaches in the long run, something resilient/flexible to future changes. I'm OK using classes, but I smell something better here.

The way I'm thinking is to possibly use both inheritance and interfaces, so that you have a branch like this: item -> equipable -> weapon. but then again, the weapon has methods like 'reload' 'examine' 'equip' some of them 'combine' so I'm thinking to make weapon implement ICombinable?... not all items get used the same way, using herbs will increase your health, using a key will open a door, so IUsable maybe?

Should I use a big database (XML for example) for all the items, items names, mates, nRowsReq, nColsReq, etc?

Thanks so much for your answers in advanced, note that demo 3 is coming after I'm done with items :D

sentences: How do I fill a shape with a texture in Libgdx? I am making a 2D racing game. I want to fill the area of the ground object with a texture. I have the shapes of the ground (a Box2D shape). If I make images of the ground with textures, it uses a lot of RAM, so I instead want to fill the shapes with copies of a small texture.

sentences:
How do I create a manual object with colors for each vertex? How do I create a shaded manual object with colours for each vertex?
Eg if ogreObj is the Ogre::ManualObject :

ogreObj->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);

will allow me to select each vertex's colour with ogreObj->colour(r, g, b)
after each ogreObj->position(x, y, z) and ogreObj->normal(x, y, z) call.

However, if I change the material to BaseWhite, color() instructions are ignored.
I read that you must disable lighting int the .material script, but I need it active...
Any advice?

ANSWER: This Ogre forum's thread has a simple .material script that works for this purpose:

material Voxel/Default
{
   technique
   {
      pass
      {
         diffuse vertexcolour
         specular vertexcolour
         ambient vertexcolour
         lighting on

      }
   }
}

sentences:
Creating a Custom Map Editor using XNA and Windows Forms I'm looking to create my own level editor for a game I'm making, and I came across the following post:

Tutorial or Example of creating custom sprite tool/map editor for XNA?

In the example posted by Blau, I am unsure what needs to be replaced in this line, and with what:

XnaControlGame.CreateAndShow<MainDialog, VoxelEditorGame>( );

If anyone could help at all, that would be great!

sentences:
Normal Matrix in plain English I'm into shader language with Webgl and GLSL.
I've seen some tutorial about normal matrix and I don't really understand it.
I mean, I think I'm ok with the math such as:

modelViewMatrix = mat4.multiply(camera.view, modelMatrix);
inverseModelViewMatrix = mat4.invert(this.modelViewMatrix);
normalMatrix = mat3.fromMat4(inverseModelViewMatrix);
normalMatrix = mat3.transpose(this.normalMatrix);

But why do I need it? Where can I find a case where I can see the difference between using it and not using it? Ot when do I don't need it?

sentences:
Unity 3d Forge Networking: Transfer object ownership I have a simple chess game setup to play around with the Forge Networking asset.  I am having an issue where only the server is able to click and drag pieces around the board.  If a client attempts to move a piece, it gets snapped back to its original position.

I assume this issue is because the server is the actual owner of the NetworkedMonoBehaviour components on my chess pieces.  Is it possible to transfer ownership of a NetworkedMonoBehaviour in code?  It seems that all of the owner properties have protected set methods so I am unable to access any of them.

sentences:
Unity RigidBody not rebounding as expected on low-impact collisions I have a Rigidbody2D with a CircleCollider2D, on which I display a sprite of a circle. This Rigidbody can be "shot" in my game.

I also have 4 rectangular BoxCollider2Ds on the edges of the game screen.

When I shoot the circle, it rebounds fine from the rectangular colliders, except for cases when the impact velocity normal to the rectangular collider's surface is very small. In that case, the rebound velocity in that direction is somehow zero.

Here is the circle's RigidBody2D and CircleCollider2D setup:

Here is the BoxCollider2D of the rectangular collider:

The material "New Physics Material 2D" attached to the ball and the BoxColliders has Friction set to 0 and bounciness set to 1:

Here are two gifs, the first one demonstrating how it works (correctly) in most cases, and the second one demonstrating what happens on a low velocity impact. The "choppiness" of these gifs is due their "giffy" nature. In my game, the movement is smooth.

I'm wondering why, on the low-velocity impacts, the ball doesn't rebound in the same way as on the high-velocity impacts (i.e, by the outbound angle = inbound angle rule)?

----------------------------

Edit:

----------------------------

I stepped into the circle's void OnCollisionEnter2D(Collision2D collision) method, and, sure enough, on the very slow collisions, the collision.otherRigidbody.velocity had a zero-component for the slow velocity of the incoming collision (so depending on whether the impact's x- or y-velocity was slow, the respective component of the resulting velocity was, for whatever reason, set to 0).

Oddly enough (at least for me - I am still not completely familiar with all of Unity's in's and out's), the collision.relativeVelocity had been updated to hold the correct resulting velocity of the impact. Thus, by adding following code to the OnCollisionEnter2D method, I am able to handle the collision correctly, even on low-impact collisions:

if (collision.otherRigidbody.velocity.x == 0)
{
    collision.otherRigidbody.velocity = new Vector2(collision.relativeVelocity.x, collision.otherRigidbody.velocity.y);
}
if (collision.otherRigidbody.velocity.y == 0)
{
   collision.otherRigidbody.velocity = new Vector2(collision.otherRigidbody.velocity.x, collision.relativeVelocity.y);
}

While this seems to solve the issue I am experiencing, it doesn't seem to me that I should need to be doing this...

sentences:
Unity: How to resize a game object for a certain amount of time? I've tried to make a coroutine like this

private IEnumerator applyPowerUp(string type, GameObject player)
{
    GameObject originPlayer = new GameObject();
    originPlayer = player;

    if (type == "Bigger")
    {
        Debug.Log("make it big");
        player.transform.localScale = new Vector3(1.25f, 2.9f, 0);
        player.transform.position = new Vector2(player.transform.position.x + 0.4f, player.transform.position.y);
        yield return new WaitForSeconds(5);
        player = originPlayer;
    }
}

The game object are getting bigger but after 5 secs it didn't turn back to its origin size.

sentences:
A* Path Finding Loops Forever For, hours, I've been following these instructions.

public PathFinder(IntegralLocation loc, final int dest_x, final int dest_y) {
    boolean found = false;
    final List<Node> open = new ArrayList<>();
    final List<Node> closed = new ArrayList<>();

    // 1. Add starting node to open list
    open.add(new Node(loc.getX(), loc.getY(), Math.sqrt(Math.pow(dest_x - loc.getX(), 2) + Math.pow(dest_y - loc.getY(), 2))));
    Node current = null;

    final int[] axs = new int[] { -1, 1 };
    final int[] ays = new int[] { -1, 1 };

    while(!open.isEmpty() && !found) {
        // 2a. Select current node
        for(Node n : open) {
            if(current == null) {
                current = n;
            } else {
                if(n.g < current.g) {
                    current = n;
                }
            }
        }

        // 2b. Switch it to the closed list
        open.remove(current);
        closed.add(current);

        // If this is the destination, we've found it
        if(current.x == dest_x && current.y == dest_y) {
            found = true;
        }

        // 2c. Handle surrounding squares
        for(final int ax : axs) {
            for(final int ay : ays) {
                final int x = current.x + ax;
                final int y = current.y + ay;
                if(!isNodeInList(x, y, closed)) {
                    Node n = getNodeFromList(x, y, open);
                    if(n == null) {
                        open.add(new Node(x, y, Math.sqrt(Math.pow(dest_x - x, 2) + Math.pow(dest_y - x, 2))));
                    } else {
                        if(n.g < current.g) {
                            n.setParent(current);
                        }
                    }
                }
            }
        }
    }

    canAccessDestination = found;
    System.out.println("This won't get printed.");

    // Save the actual path
    while (current != null) {
        nodes.add(new Point(current.x, current.y));
        current = current.getParent();
    }
    System.out.println(nodes.size());
    inverse_stage = nodes.size() - 1;
}

The code above is supposed to be an implementation of the A* path finding algorithm but it's an infinite loop.

The loop always ends up stuck at n.setParent(current).

It is assumed, in this implementation that all nodes can be walked over.

I am sure that there is a tiny error somewhere but I can't quite find it.

sentences:
Is it possible to make windows games using Havok's Project Anarchy? I'm interrested in Havok's Project Anarchy as I plan to learn how to make 3D Games, so I've done some research and it seems focused on mobile platforms.

So before I engage myself I would like to know if it is possible to make PC Windows games with It since it is not explicitly mentionned.

sentences:
Pong Collision Help in C# w/ XNA Edit: My goal is to have it function like this:

Ball hits 1st Quarter = rebounds higher (aka Y++)
Ball hits 2nd Quarter = rebounds higher (using random value)
Ball hits 3rd Quarter = rebounds lower (using random value)
Ball hits 4th Quarter = rebounds lower (aka Y--)

I'm currently using Rectangle Collision for my collision detection, and it's worked. Now I wish to expand it.

Instead of it simply detecting whether or not the paddle/ball intersect, I want to make it so that it can determine what section of the paddle gets hit. I wanted it in 4 parts, with each having a different reaction to impact.

My first thought is to base it on the Ball's Y position compared to the Paddle's Y position. But since I want it in 4 parts, I don't know how to do that.

So it's essentially be

if (ball.Y > Paddle.Y)
{
PaddleSection1 == true;
}

Except modified so that instead of being top half/bottom half, it's 1st Quarter, etc.

sentences:
Unity: Edge of quad is dark. How do I avoid this? I have four quads together like this

These are just the default Unity quad from create\3d object\quad

the texture is white with grey borders on two sides and a black border on other two sides..

Lets zoom in..

How do I get rid of these black lines?

I am generating these bigger shapes out of quads and applying the texture using code...
I noticed that If I didnt change the material in code then there were no black lines.
So I made prefabs for each material, and am now spawning those in instead of changing a material on a quad. But I still get the same lines.
Also, if I drag the prefabs into the scene when the game is running they appear perfect.
I have no idea whats going on.

sentences:
Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it? I have added some basic movement and some manual interpolation to a cube that is a kinematic body in Godot.
extends KinematicBody

var speed : int = 10
var slowdown_buffer = 0.2
var movement = Vector3(0,0,0)
func _ready():
    pass

func interpolate():
    if movement.x > 0:
            movement.x -= slowdown_buffer
    elif movement.x < 0:
        movement.x += slowdown_buffer
    else:
        movement.x = 0.0
func _physics_process(delta):
    if Input.is_action_pressed("left"):
        movement.x = -speed
    elif Input.is_action_pressed("right"):
        movement.x = speed
    else:
        interpolate()

    move_and_slide(movement)

The problem is that when I move the cube using A and D, after the cube stops after the interpolation, it starts moving in the opposite direction with a non-increasing speed.
How can I fix this?

sentences:
how to keep display tick rate steady when using continuous collision detection? (I've just found about this forum). I hope it is ok to repost my question again here. I posted this question at stackoverflow, but it looks like I might get better help here.

Here is the question:

I've implemented basic particles motion simulation with continuous collision detection.

But there is small issue in display.

Assume simple case of circles moving inside square. All elastic collisions. no firction. All motion is constant speed. No forces are involved, no gravity. So when a particle is moving, it is always moving at constant speed (in between collisions)

What I do now is this:

Let the simulation time step be 1 second (for example). This is the time step simulation is advanced before displaying the new state (unless there is a collision sooner than this).

At start of each time step, time for the next collision between any particles or a particle with a wall is determined. Call this the TOC time; let’s say TOC was .5 seconds in this case.

Since TOC is smaller than the standard time step, then the system is moved by TOC and the new system is displayed so that the new display shows any collisions as just taking place (say 2 circles just touched each other’s, or a circle just touched a wall)

Next, the collision(s) are resolved (i.e. speeds updated, changed directions etc..).

A new step is started. The same thing happens. Now assume there is no collision detected within the next 1 second (those 2 circles above will not be in collision any more, even though they are still touching, due to their speeds showing they are moving apart now), Hence, simulation time is advanced now by the full one second, the standard time step, and particles are moved on the screen using 1 second simulation time and new display is shown.

You see what has just happened: One frame ran for .5 seconds, but the next frame runs for 1 second, may be the 3rd frame is displayed after 2 seconds, may be the 4th frame is displayed after 2.8 seconds (because TOC was .8 seconds then) and so on.

What happens is that the motion of a particle on the screen appears to speed up or slow down, even though it is moving at constant speed and was not even involved in a collision.

i.e. Looking at one particle on its own, I see it suddenly speeding up or slowing down, becuase another particle had hit a wall.

This is because the display tick is not uniform. i.e. the frame rate update is changing, giving the false illusion that a particle is moving at non-constant speed while in fact it is moving at constant speed. The motion on the screen is not smooth, since the screen is not updating at constant rate.

I am not able to figure how to fix this. If I want to show 2 particles at the moment of the collision, I must draw the screen at different times. Drawing the screen always at the same tick interval, results in seeing 2 particles before the collision, and then after the collision, and not just when they colliding, which looked bad when I tried it.

So, how do real games handle this issue? How to display things in order to show collisions when it happen, yet keep the display tick constant? These 2 requirements seem to contradict each other’s.

sentences:
How do I use Content.Load() with raw XML files? I'm using the Content.Load() mechanism to load core game definitions from XML files. It works fine, though some definitions should be editable/moddable by the players. Since the content pipeline compiles everything into xnb files, that doesn't work for now.

I've seen that the inbuild XNA Song content processor does create 2 files. 1 xnb file which contains meta data for the song and 1 wma file which contains the actual data. I've tried to rebuild that mechanism (so that the second file is the actual xml file), but for some reason I can't use the namespace which contains the IntermediateSerializer class to load the xml (obviously the namespace is only available in a content project?).

How can I deploy raw, editable xml files and load them with Content.Load()?

sentences:
Show 3D elements on 2D background I'll make a navigation menu in my game and had the good idee to this the enemies to start games or go to the gun store. The problem is when I look in game mode, the enemy named ZomBear in hierarchy and gun are away.

The ZomBear and the gun are 3D elements that I will show on a canvas named StartScreen in hierarchy. How Can I do that?

(Click on image to see full size)

Notes by the hierarchy:

Everything that begin whit Btn are button elements.
StartScreen, PlayButtons and LevelButtons is a panel
Gun and ZomBear are 3D elements form the Prefab folder.

Here you have also a screen from aside:

sentences:
What's the best way to handle numerous recurring log entries in game loop? I have a custom logging system, use of which is scattered all over the engine and game. The system is linked to a "LogStore" that has an std::vector<string> logs[NUM_LOG_TYPES] - each vector corresponds with it's log type (info, error, debug, etc.). There's one extra std::vector that has "coordinates" to all log entries in the order they were received.

Now, all the logging output is also displayed inside my development console in the game. The game console is handled by HTML-type GUI and therefore requires a new <p> element being added for each log output.

My problem is that the log entries that are generated in the main loop each frame freeze the engine, because they continue to add elements to the in-game console, and if the console or guy generates a warning - that creates an infinite logging loop.

I want to solve it by handling the recurring log entries in an elegant way that lets you know that something is critically wrong, but won't freeze the engine - like displaying the count of errors in the last 60 frames instead of displaying errors themselves. But how do you guys handle this? Does anyone know any nifty tricks to do this?

I understand the question may sound vague, but if someone came across this type of issue I'm sure they would know exactly what's happening.

Example problematic log entries:

OpenGL warnings (I actually do check for errors every frame in many
places)
Really any prints anywhere in the main loop (may be debugging, may
be warnings)

sentences:
render trajectory of particle in forcefield using GLSL shader I want to visualize flow of particles in some forcefield e.g. electromagetic, gravitional or potential flow in fluid (streamlines);

I was thinking to use Geometry Shader which would look like this (not tested, just sketch):

#version 330 core
layout (points) in;
layout (line_strip, max_vertices = 64) out;

uniform float dt;

vec3 getForce(in vec3 pos){ /* ... don't care now ... */ }

void main() {
    vec3 pos = gl_in[0].gl_Position;
    for( int i=0; i<64; i++ ){
        pos += getForce(pos) * dt; // it's actually velocity field but who cares
        gl_Position = pos;
        EmitVertex();
    }
    EndPrimitive();
}

However, I read that Geometry shaders are very slow (I did not yet tested). So I wonder if it would be helpful in this situation?

Or would Tesselation shaders or Compute shaders be suitable for this job and achieving better performance?.

background: I have experience with vertex-shaders, fragment-shaders, OpenCL ... but I have never tried geometry-,tesselation- nor compute-shaders.

EDIT: there is my simple example implementation using geometry shader in 2D
https://github.com/ProkopHapala/SimpleSimulationEngine/blob/ca16b6f8d72864a8a572ed2a21ded99c5c2cc3e4/cpp/sketches_SDL/OGL3/test_GeometryShader.cpp

which plots this (for velocity field defined by dipole):

sentences:
Good recent examples of educational games? I'm looking to make an educational game. I know they have a horrible reputation, but I still think there's a future for them. Unfortunately, it seems to me like most educational games were in the 90s. Does anyone know of any recent, semi-decent educational games?
I'm specifically interested in teaching a subject (ie, Chemistry) rather than a skill (ie, typing).
I know there was this question: How do I make educational games engaging not boring?
But it was over 5 years ago.

sentences:
Server Side : How to manage "delay" action/event like attacking? at the moment I'm writing a game server, so I made an event "handler". I mean, if a player send to the server "I move" it fire a function, so I think I'm doing well at the moment.

But there's a problem and I don't know how to handle it. Lets take an example.

When a player want to attack he need to press a key one time, and it will attack automaticly every second, that means the server receive one packet with "I attack" and the server handle it, But I don't know how to make the player attacking every second correctly. It's kinda hard to explain I'm sorry ! So what I'm doing at the moment is, if the server receive from the player "I attack" I start a timer for the player which call a function every second. And I do that for every player but, I think that is not a nice idea. Should it be better to make one big timer ? If yes, which interval should I use ? 100ms or more ?

Well I hope you understood me, I know I didn't explain it well and sorry for that ! Thanks in advance for your help.

sentences:
Populating NPC's Outside Of Loop This was my original question:
Populating Sprites
I used the following code to spawn Enemy Sprites in my game. I have 2 types that I was using and it would display one then remove it and display the other. It did this repeatedly(Imagine someone playing with a light switch and you have what is happening with the NPCs. EnemyType1 is Off and EnemyType2 is On.).Also It does not apply the current level number meaning, it does not spawn the number of enemies for the level. The number of enemies I want to spawn is the exact number of the level.  I used other types of random methods( nextBoolean(), nextInt(), nextFloat() ). I showed the code to my friend and he told me that I would need to spawn them outside of my loop, but he did not know how to. So now I am trying to see if anyone on stack could help me. What I am trying to do is this:

NPC's = Enemies

I have 2 types of NPC's that I want to use. The number of Enemies that are spawned are equal to the the current level number. I want to be able to spawn how ever many is needed for that level and have it to where which Enemy that will spawn is random, so you don't know if you will get EnemyType1 or EnemyType2 or a Mix. Ex: Level 1, only 1 Enemy spawns, the type is random. Level 2, only 2 Enemies spawn, the type is random. Level 3, only 3 enemies spawn, the type is random. etc.

Thanks In Advance.

sentences:
Get blocky look on textures some textures If I do this:

GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;

All textures I draw are blocky.

GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

All of my textures are blurred a bit.

What do I have to do so that only some of my textures are blocky and some are blurred?

sentences:
Using heavyweight ORM implementation for light based games I'm just about to engulf myself in an MVC-based/Component architecture in C#, using MySQL's connector/Net for the data storage, and probably some NHibernate/FluentNHibernate Object-relational-mapping to map out the data structure. The goal is to build a scalable 2D RPG.

Then I think about it...and I can't help but think this seems a little "heavy weight" for a 2D RPG, especially one which, while I plan to incorporate a lot of functionality and entertaining gameplay, may be ported to something like Windows Phone or Android in the future.

Yet, on the other hand even a 2-Dimensional RPG can become very complicated, and therefore must incorporate a lot of functionality. While this can be accomplished with text/XML/JSON for data storage, is there a better way? Is something such as Object-Relational-Mapping useful in such an application?

So, what do you think? Would you say that there is a place for such technologies? I don't know what to think...

sentences:
How can I draw a texture line by line I wish to draw a texture to the screen line by line (horizontal lines).
Can I do this in xna?

At first I wish to just start at the top of the texture, draw one single horizontal line of pixels and x no of milliseconds later draw the next line and so on until the texture is fully drawn.
In the future I may want to draw these horizontal lines in any order.

Any ideas how best to achieve this?

sentences:
Box2d bodies that are really close together, are getting “stuck” I'm using a tiled tmx map, and I created a class that adds bodies to each tile within a certain layer. This has been working great so far except for when a character or an enemy moves around on the screen, its body gets stuck on an edge between two tiles.

This seems to happen "sometimes" and in certain spots. Jumping makes you unstuck but it's annoying when it happens, and I tried increasing the position iterations, but the problem keeps reoccurring.

Here's what my game looks like:

sentences:
Matrix loading problems with jbullet and lwjgl The following code does not load the matrix correctly from jbullet.

//box is a RigidBody
Transform trans = new Transform();
trans = box.getMotionState().getWorldTransform(trans);
float[] matrix = new float[16];
trans.getOpenGLMatrix(matrix);
// pass that matrix to OpenGL and render the cube
FloatBuffer buffer = ByteBuffer.allocateDirect(4*16).asFloatBuffer().put(matrix);
buffer.rewind();
glPushMatrix();
glMultMatrix(buffer);
glBegin(GL_POINTS);
glVertex3f(0,0,0);
glEnd();
glPopMatrix();

the jbullet is configured as so:

CollisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldAabbMin = new Vector3f(-10000,-10000,-10000);
Vector3f worldAabbMax = new Vector3f(10000,10000,10000);
AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();

dynamicWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, solver, collisionConfiguration);
dynamicWorld.setGravity(new Vector3f(0,-10,0));
dynamicWorld.getDispatchInfo().allowedCcdPenetration = 0f;
CollisionShape groundShape = new BoxShape(new Vector3f(1000.f, 50.f, 1000.f));
Transform groundTransform = new Transform();
groundTransform.setIdentity();
groundTransform.origin.set(new Vector3f(0.f, -60.f, 0.f));
float mass = 0f;
Vector3f localInertia = new Vector3f(0, 0, 0);
DefaultMotionState myMotionState = new DefaultMotionState(groundTransform);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass, myMotionState, groundShape, localInertia);
RigidBody body = new RigidBody(rbInfo);
dynamicWorld.addRigidBody(body);
dynamicWorld.clearForces();

Nothing is rendered on the screen. What am I doing wrong?

sentences:
Unity aircraft physics I want to make a simple aircraft controller, what looks like little realistic in unity. I watch some video from airplane physics. and make a simple script in unity, but if I start, my plane cant move or if I change drag to zero, it cant lift. I tried to use real data and get it from wiki(F22 Raptor). To my game object, I gave the rigidbody component mass = 19670 kg.
Engine thrust = 2 * 116000.0f Newton.

    private void calculateEnginePower()
    {
        EnginePower = engineThrust * ThrottleInput;
    }

    private void calculateForces()
    {
        angleOfAttack = Vector3.Angle(Vector3.forward, rb.velocity);
        angleOfAttack = Mathf.Clamp(angleOfAttack, 0, 90);

        coefficient = Mathf.Pow(1225.04f * rb.velocity.magnitude, 2) - 1; //M^2-2 where: M is mach.

        if (coefficient > 0.0f)
            coefficientLift = (4 * angleOfAttack) / Mathf.Sqrt(coefficient);
        lift = 1.2754f * 0.5f * Mathf.Pow(rb.velocity.magnitude, 2) * coefficientLift * 78.04f; // densy1.2754 kg/m3, speed m/s , (F22)Wing area: 840 ft² (78.04 m²)

        coefficientDrag = 0.021f;
        rb.drag = coefficientDrag * 0.5f * Mathf.Pow(rb.velocity.magnitude,2) * 1.2754f * 78.04f;

        rb.AddForce(transform.up * lift);
        rb.AddForce(transform.forward * EnginePower);
    }

roll, pitch... inputs from keyboard and mouse, EnginePower, RollInput... are simple properties and I call the Move function in a controller inside void Update.

Move(float roll, float pitch, float yaw, float throttle)
{
// transfer input parameters into properties.s
RollInput = roll;
PitchInput = pitch;
YawInput = yaw;
ThrottleInput = throttle;
AirBrakes = false;
calculateEnginePower();
calculateForces();
calculateRotation();
}

used these formulas:

for Lift force:
Lift formula
for Lift coefficient:
Cl formula
for Drag:
Drag formula
and for Drag coefficient: I used data from wiki too (0.021f).

sentences:
Get world position of random point inside bounds I am trying to get a random world position inside my targets collider, so that I can fire an arrow at it.
I have tried a bunch of different solution but can't seem to get it right, for example (this code is on my target):
//Inside Awake
colliders = GetComponentsInChildren<Collider>(); //I want this to work on a unit with a single capsule collider and a building with 8 different box colliders

public Vector3 GetRandomPoint()
{
    Bounds b = new Bounds();

    for (int i = 0; i < colliders.Length; i++)
    {
        b.Encapsulate(colliders[i].bounds);
    }

    float minX = gameObject.transform.position.x - gameObject.transform.localScale.x * bounds.size.x * 0.5f;
    float minZ = gameObject.transform.position.z - gameObject.transform.localScale.z * bounds.size.z * 0.5f;

    return new Vector3(Random.Range (minX, -minX),
                           gameObject.transform.position.y,
                           Random.Range (minZ, -minZ));
    }

In the scenario I'm having issues with right now, the trageet simply has a single capsule collider.
This return a point quite far away from my target, but I cant find the issue.
EDIT:
Here is another one I tried without success:
public Vector3 GetRandomPoint()
    {
        Bounds b = new Bounds();

        for (int i = 0; i < colliders.Length; i++)
        {
            b.Encapsulate(colliders[i].bounds);
        }

        var target = new Vector3(
            UnityEngine.Random.Range(b.min.x, b.max.x),
            UnityEngine.Random.Range(b.min.y, b.max.y),
            UnityEngine.Random.Range(b.min.z, b.max.z)
        );

        return b.ClosestPoint(target);
    }

sentences:
Unwanted jump when landing I managed to make my 3D player character jump (hurrah!) but I get an unwanted jump upon landing.
It's not a mid-air double-jump. If I press space mid air, then after it get backs to ground it immediately jumps again.
How can I prevent this?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    bool jumpKeyIsPressed;
    float horizontalMovement;
    bool isGrounded ;
    Rigidbody rb;
    [SerializeField] float playerJumpForce;
    [SerializeField] float movementSpeed;

    void Start()
    {   //sustituye GetComponent<Rigidbody>() por rb!!!
         rb = GetComponent<Rigidbody>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            jumpKeyIsPressed = true;
        }

        horizontalMovement = Input.GetAxis("Horizontal");
    }

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isGrounded = true;
        }
    }

    private void FixedUpdate()
    {
        rb.velocity = new Vector3(horizontalMovement * movementSpeed, rb.velocity.y, 0);

        if (jumpKeyIsPressed && isGrounded)
        {
            rb.AddForce(Vector3.up * playerJumpForce, ForceMode.VelocityChange);
            isGrounded = false;
            jumpKeyIsPressed = false;
        }
    }
}

sentences:
How to prepare a sprite for a game? For example, I created my character drawing on Paint.NET using the Pencil tool and now it's a sprite like asset.

If I want him to move do I need to create many different poses for him and render them according a timer? Or do I need to have each pose side by side in a single image, then render the rectangle I need, thus loading the picture only once?

Thanks.

sentences:
drawing line using angle code below make enemy move towards player.

    //Calculate Distance formula
    double xDiff = player.x - enemy.x;
    double yDiff = player.y - enemy.y;
    double dist = Math.sqrt(xDiff * xDiff + yDiff * yDiff);

    //find angle
    angle = (int) Math.toDegrees(Math.atan2(yDiff, xDiff));
    if (angle < 0)
        angle += 360;

    xDiff = xDiff / dist;
    yDiff = yDiff / dist;
    x += xDiff * speed;
    y += yDiff * speed;

how to draw line with length 20, same direction as enemy is moving?

enemy.x2 = angle?
enemy.y2 = angle?
draw(enemy.x1, enemy.y1, enemy.x2, enemy.y2);

sentences:
Howto apply alpha value (Color) to a sprite in libgdx Howto apply alpha to a sprite so it will work.

With the following code, the sprite still is completely visible.

Can someone help me ?

batch.enableBlending();
if (sprite != null) {
    Color c = sprite.getColor();
        c.a = 0;
        sprite.setColor(c);
}
batch.draw(sprite, x, y);
sprite.setAlpha(0f);

sentences:
Load nextLevel with a button click Can anyone help me someone with this code?

I'd like to go to the next level by clicking a button: example my level name is L1,L2,L3,L4,L5,L6,L7 and when I finish level L1, I want to go to level L2 with the click of a button, and from L5 go to L6 like this.

public class GameLevels : MonoBehaviour {

 public Button Play;
 private int idLevel;
 // Use this for initialization
 void Start ()
 {
     idLevel = PlayerPrefs.GetInt("idLevel");
     Play.interactable = false;
 }
 public void SelectLevel(int i){
     idLevel = i;
     PlayerPrefs.SetInt ("idLevel", idLevel);
     Play.interactable = true;
 }

 public void LoadLevel(string Levels)
 {
     SceneManager.LoadScene (Levels);
 }
 public void Replay()
 {
     SceneManager.LoadScene ("L" + idLevel.ToString ());
 }
 public void loadNextLevel()
 {

 }
}

sentences: Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator? I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?

sentences: What is "streamlined" user interface? I have come across this term "streamlined" user interface, and I wonder how is it different from other user interface type? What is the different between "streamlined" and "non-streamlined" user interface?

sentences:
What category would this asynchronous production economy game fall under? I'm thinking of getting into game development and my friend and I have this idea for a game. We want to do some research on similar games, and I have noticed that games seem to fall under certain categories like "platformer", "shooter", "racing games" or similar.

Our idea is a multiplayer, mobile game where you and around 4-5 other players are placed in a session.

Every player is given a different role in a market (like a farmer to grow crops, miller to make flour out of crops, baker to bake bread, etc.). The players are supposed to sell goods to each other in order to earn money (or similar). The resources are produced/generated over time, so it's like Travian and other city building games when it comes to stuff happening over time.

You own a production facility (like a farm, mill, etc.) and if you have enough resources/money it produces some good every 10 min (arbitrary time for the example).

This happens even when the user is not playing. Then once in a while, you can check in, put some of your goods up for sale that others can purchase.

So it's a passive loop that simply generates resources every x minutes, and in addition, the players can put up their goods for sale when they feel like it.

But the game is not "infinite". When one of the players reaches a certain goal, the game session ends and the players are ranked (or something, it's still a rough idea).

So in this regard, it's more like Wordfeud or Chess where your next move depends on what the other players do and there is a way to win the game (be it a winning condition or time running out).

So the question is, does this kind of game fall under a specific category that we can research?

sentences:
What is the difference between a sprite sheet and a texture atlas? I wondering what the difference is between a sprite sheet and a texture atlas?

Aren't both the same? In a sprite sheet you have some Sprites and in a texture atlas you also have some sprites, so what's the difference?

sentences:
How do you rotate all the objects around the camera? If I'm correct, the way that you can "look around" in an environment is that you rotate all the objects around the camera. This is the code that I've created using JavaFX 3D. So what's the algorithm?

package com.rtek.main;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;

public class Walk extends Application {
    private Group root = new Group();
    private PerspectiveCamera camera = new PerspectiveCamera();
    private CameraGroup cameraX = new CameraGroup();
    private CameraGroup cameraY = new CameraGroup();
    private CameraGroup cameraZ = new CameraGroup();
    private static final double CAMERA_INITIAL_DISTANCE = -450;
    private static final double CAMERA_NEAR_CLIP = 0.1;
    private static final double CAMERA_FAR_CLIP = 10000.0;

    public void start(Stage primaryStage) throws Exception {

        Scene scene = new Scene(root, 800, 600, true);

        buildScene();
        buildMouse();

        loadMouse(scene);

        primaryStage.setTitle("Walk Around");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    private void loadMouse(Scene scene) {
        scene.setOnMouseMoved(event -> {
           ???
        });
    }

    private void buildMouse() {
        root.getChildren().add(cameraX);
        cameraX.getChildren().add(cameraY);
        cameraY.getChildren().add(cameraZ);
        cameraZ.getChildren().add(camera);

        camera.setNearClip(CAMERA_NEAR_CLIP);
        camera.setFarClip(CAMERA_FAR_CLIP);
        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
    }

    private void buildScene() {
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.RED);
        material.setDiffuseColor(Color.GREEN);

        Box cube = new Box(100, 100, 100);
        cube.setMaterial(material);

        root.getChildren().add(cube);
    }

    private class CameraGroup extends Group {
        private Rotate x = new Rotate();
        private Rotate y = new Rotate();
        private Rotate z = new Rotate();

        public CameraGroup(){
            x.setAxis(Rotate.X_AXIS);
            y.setAxis(Rotate.Y_AXIS);
            z.setAxis(Rotate.Z_AXIS);

            getTransforms().addAll(x, y, z);
        }
    }
}

sentences:
What are these odd distortions on far away textures? I'm currently writing a simple voxel engine just to get some practice in, and I'm coming across some odd issues. In order to generate terrain, I create a mesh and then assign UV coordinates on a texture atlas to each vertex. Whenever I run the game, I get strange distortions, like these:

I've tried doing a few things so far:

Generating mip maps for the texture atlas.
Play around with the max size of the texture atlas.
Play around with the format of the texture atlas.

Unfortunately, none of these have worked so far. As of right now, the import settings on the texture atlas itself look like this:

Is there any way I can get rid of these obnoxious distortions?

sentences:
No-duplicate collection without iterator allocation Problem

I need a collection with non-duplicate values minimising memory allocation during access operations. I am prepared to compromise with a slight decrease of performance to make up for the improved "garbage generation".

Solutions Considered (including discarded ones for reference)

Extend ArrayList to include a check on add(E e) for duplicates and do nothing if value exists. (this may include other methods too)
Use HashSet (discarded) - iteration of elements causes instantiation of a new Iterator which defeats the requirement of minimal memory allocation during access.
Convert HashSet to ArrayList (discarded) - creates more memory allocaiton than HashSet iteration.

Question

Is the extention of ArrayList to reject duplicate values a sensible way to achieve non-duplicate collection with minimal memory allocation? Are there alternative methods I should consider?

Notes

Most advised solutions to eliminate duplicates in ArrayList I have seen refer to using HashSet or other object instantiation which defeat my minimal memory allocation requirement. The only implementation I can think of is a basic "for iteration" of the ArrayList checking equality of the added value against each existing element.

Class NonDuplicateList extends ArrayList{
    @Override
    boolean add(E e){
        for(int i = 0; i < this.size(); i++){
            if(this.get(i).equals(e)
                return false;
        }
        return super.add(e);
    }
}

For completion this question is being posted on gamedev stackexchange as the game dev community is more sensitive to the subjects of memory allocation and garbage collection impact, so hopefully I won't get comments along the lines of iterator allocation memory allocation is insignificant :-)

sentences:
Splitting Pygame functionality between classes or modules? I am attempting to make my pygame application more modular so that different functionalities are split up into different classes and modules.
I am having some trouble getting pygame to allow me to draw or load images in secondary classes when the display has been set and pygame.init() has been done in my main class.

I have typically used C# and XNA to accomplish this sort of behavior, but this time I need to use python.

How do I init Pygame in class1, then create an instance of class2 which loads and converts() images.

I have tried pygame.init() in class 2 but then it tells me no display mode has been set, when it has been set in class1. I am under the impression I do not want to create multiple Pygame displays as that gets problematic.

I am probably missing something pythonic and simple but I am not sure what. How do I create a Display class, init Python and then have other modules do my work like loading images, fonts etc.?

Here is the simplest version of what I am doing:

class1:
    def __init__(self):
        self.screen = pygame.display.set_mode((600,400))
        self.imageLoader = class2()

class2:
    def __init__(self):
        self.images = ['list of images']

    def load_images():
        self.images = os.listdir('./images/') #get all images in the images directory
        for img in self.images:
            #read all images in the directory and load them into pygame
            new_img = pygame.image.load(os.path.join('images', img)).convert()
            scale_img = pygame.transform.scale(new_img, (pygame.display.Info().current_w, pygame.display.Info().current_h))
            self.images.append(scale_img)

if __name__ == "__main__":
    c1 = class1()
    c1.imageLoader.load_images()

Of course when it tries to load an convert the images it tells me Pygame has not been initialized, so I throw in a pygame.init() in class2 (I have heard it is safe to init multiple times) and then the error goes to:

  pygame.error: No video mode has been set

sentences:
Why do I get these errors in VS when I use OGRE_NEW? I am trying to get more experienced with Ogre 3D and I am following the basic tutorials on the website. All the code samples compile just fine.

The first time I encountered an "error" was in Basic Tutorial 3.

The code line where Visual Studio says something is not right is

mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mSceneMgr, Ogre::Terrain::ALIGN_X_Z, 513, 12000.0f);

Visual Studio compiles this line but it shows an ugly red line beneath it and on mouse hover it says

  #define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__) Error: no instance of overloaded 'operator new' matches the argument list" or if I mouse hover over Ogre::TerrainGlobalOptions() it says "Error: expected a type specifier

I searched on Google but couldn't find my answer. I got about a year C++ experience but that was mainly with the WinSock libary.

Thanks in advance.

sentences:
How to export 3ds Max wsm to Unity? I have made a cylinder in 3DS MAX. I then added a wave WSM. I then made the animation so it waves a bit. Then exported it to unity.

The animation works perfectly in 3ds max. When I import it to unity the animation does nothing. The cylinder looks fine.

Things I have tried.
Game export,bake animations,embedded files.
Collapse all and collapse alone and nothing happened.
Collapsing to only deforms the cylinder, But the animation still does nothing.

Any idea how to do this?

sentences:
How do I show an interviewer that I have past experience? While researching some of the development companies I'd like to work for in the future, one thing kept catching my eye; they all wanted previous AAA experience I will have an enormous struggle obtaining. I currently live in an area with no AAA developers nearby, so an internship is next to impossible. Is this requirement a killer, or can this be looked past if I have an 8-year degree? (I am planning on getting a Masters in Computer Science or a similar field anyway for permanent job security.)

If this requirement is that important, I have also heard that you can compensate by having a homemade demo of a game you created on your own. If this is true, how complex must it be? As involved as an indie game? Deeper? Must it be in 3D?

I know this is a few questions too many for one post, but I'd appreciate any advice (preferably for people who have hired other developers in the past or have bypassed a similar issue.)

sentences: is ECS a kind of (or vs) OOP? Is Entity Component System (ECS) considered a part of OOP or is it a completely different concept?

sentences: Started work on a time based business game- one similar already exists... What should i do? Yeah so like i said, i started to work on a time based game that involves business investments, and as it turns out, there is a game called adventure capitalist that has pretty much the same idea about it. I planned to greenlight my game on steam and i found that adventure capitalist is on steam. Im not sure what i should do. Should i continue but make changes to the game (and if so, what sort of changes) or should i give up and work on something else. I should have mentioned this earlier but in the game, you make investments in the electronic industry, and each type of investment will have a different payout per second and a different base investment price to other types. For example, investing in computers will cost you £500 and have a payout of £5/second but investing in smartphones will cost only £100 and have a payout of £1/second. When you can afford it, you can level up your investment. I havent really added any more to the game than that so any advice would be appreciated, thanks.

sentences:
How can I draw a "vision cone" (targetting element) into the game world? I'm wanting to indicate various things using a "pie slice" sort of shape as below.  Similar to vision cones in stealth game minimaps, or targetting indicators in RTS type games for frontal area attacks.  Something generic enough to be used for both would be ideal.

I need to be able to procedurally (and efficiently) change things like the slice width and length, color, transparency, position in the world, etc.  For my particular situation, there's no concern with elevation, funky terrain, or really any third axis at all as far as this element is concerned.

I have two first inclinations on how to accomplish this:
1) Manually generate the vertices for a main triangle, (possibly two, superimposed to get the border effect), a handful more to approximate the arc at the end, and roll it into a mesh.

2) Use some sort of 2D drawing library to create a circle and mask it off at the right angles, render to texture, and use that.

For reference, I have some experience with Ogre3D, but I'm not attached to it as this is a mostly academic pursuit at the moment.  Other technologies that might be better at accomplishing this are more than welcome.

Finally, I'm kind of curious about how to do a "flashlight" or similar 3D effect that could produce the same result, but on all surfaces in the lit area.

sentences:
Color sprite tint with opacity in MonoGame/XNA In MonoGame I am using SpriteBatch to draw sprites. I want to create a semi transparent overlay that would 'tint' the sprite with a given color. SpriteBatch.Draw accepts Color parameter that allows to specify the tint, however the alpha channel seems to make the whole sprite transparent (not the tint only).

To address the problem i am overlaying my sprites with another white, semitransparent sprite tinted to a given color. It works as expected, but I am not sure if that is the correct (and most optimal) approach.

Can you suggest better/faster technique?

sentences:
How would I detect if two 2D arrays of any shape collided? Say there's two or more moveable objects of any shape in 2D plane, each object has its own 2D boolean array to act as a bounds box which can range from 10 to 100 pixels, the program then reads each pixel from a image that represents it, and appropriatly changes the array to true(pixel has a alpha more then 1) or false(pixel has a alpha less than one).

Each time one of these objects moves, what would be the best accurate way to test if they hit another object in Java using as few APIs/libraries as possible?

sentences: Load Meshes with Bullet Physics I just started implementing some physics in my game with Bullet Physics and I was just wondering how would i use bullet physics to load in meshes. For my for DirectX I load in x files into a ID3DXMesh. I'd like to know how do I create a mesh in bullet physics instead of using boxes and spheres. I can't seem to find a way to do this. It would be great if someone could help me out. Thank you.

sentences:
PlaySoundAtLocation plays sound after some delay I’m developing the Pong game to learn Unreal Engine 4.26 using C++.
I use this code in the class’ constructor to load the sound:
static ConstructorHelpers::FObjectFinder<USoundWave> HitSoundAsset(TEXT("/Game/Effects/pong-paddle.pong-paddle"));
    if (HitSoundAsset.Succeeded())
        HitSound = HitSoundAsset.Object;

And in OnHit event this code:
void APaddle::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
    if ((OtherActor != nullptr) && (OtherActor != this) && (OtherComp != nullptr))
    {
        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Paddle has been hit by: %s"), *OtherActor->GetName()));

        if (ABall* Ball = Cast<ABall>(OtherActor))
        {
            PlayHitSound();
        }
    }
}

And finally:
void APaddle::PlayHitSound()
{
    if (HitSound != nullptr)
    {
        UGameplayStatics::PlaySoundAtLocation(this, HitSound, GetActorLocation());
    }
}

But it sounds after the ball has bounced.
The sound starts at 0 and it hasn’t any silent.

Is there any way to play it immediately?

sentences:
How do I get the proper swapchain enumeration for getting the backbuffer? I have code that I'm trying to update from DirectX 8, and so far I have been doing just fine until I reached this line of code:

r = g_pDevice->GetBackBuffer(/*,*/ 0, D3DBACKBUFFER_TYPE_MONO, &pBackSurf);

Because of this I decided to look up the changes that were made between DirectX 8 and DirectX 9 regarding GetBackBuffer, and found that it needed a parameter called iSwapChain. What it's asking for is the swap chain ordinal value, and referred me to D3DCAPS9's code - more specifically the Number of Adapters in Group variable.

Of course I want to have the correct value to correspond with whatever ordinal would give me the proper backsurface to write stuff to (i.e. the last-to-render backsurface in the chain) but that information is elusive and when I was guided to DCAP.NoAiG it doesn't lead me anywhere else.

How do I get the proper swapchain enumeration for getting the backbuffer?

sentences:
load textures using assimp I've got .obj model with .mtl materials.I load like this: When I get aiTextureType_DIFFUSE I create new texture object and then call glGenTextures, glBindTexture and etc.

for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
    const aiMaterial* pMaterial = pScene->mMaterials[i];

    m_Textures[i] = NULL;
    if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
        aiString Path;

        if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
            m_Textures[i] = new Texture();
            if (!LoadTGA(m_Textures[i], const_cast<char*>(FullPath.c_str())))
            {
               ....
            }
            else {
        glGenTextures(1, &m_Textures[i]->texID);
        glBindTexture(GL_TEXTURE_2D, m_Textures[i]->texID);
        ....

How to load texture with diffuse, specular, ambient, shininess properties when they are all together in material file?

sentences:
Using world coordinates instead of pixels I've been told that having a set pixels-per-world unit number is bad practice because it will not look the same at different resolutions. Because of this, I am trying to learn about using abstract world-space coordinates instead, however I am having some trouble understanding.

I've setup a quick test project for learning this: http://pastebin.com/GiUiR2NS
As I understand it, CAM_WIDTH and CAM_HEIGHT should be the dimensions of the world in world units. However, I must be missing something because the end result seems to have made the world 50 pixels by 30 pixels. (My "wall" texture drawn at (0,0) in the bottom left is 16x16 pixels)

I am trying to achieve a view with which I can see 50 walls on the x-axis and 30 on the y-axis. I was able to do this when using direct pixel coordinates and multiplying by 16 (the pixels-per-world-unit number), however as stated before, I don't think I want to use this method anymore because of negative affects at different resolutions.

sentences:
How can I get my Android camera system working more like Google Earth's? I'm implementing a touch screen interface whereby the user dragging their finger on the screen will rotate the camera in a sphere around the central point.

My code works well for the horizontal swipe (rotation around the y axis), but only covers a smaller angle from the vertical swipe (rotation around the x axis) instead of the full 360. I used the article - Spherical coordinate system form Wikipedia (http://en.wikipedia.org/wiki/Spherical_coordinate_system), specifically the Cartesian Coordinates section, to do this. I've posted my code below. Can anyone help get this working through the full 360 degrees on both axis? See how Google Earth works when you swipe the globe for what I want.

This must have been done a billion times, but Google searches confuse with the phone built in camera, gps and the like. Thanks!

//Get current position
oldX = getPosition().x;
oldY = getPosition().y;
oldZ = getPosition().z;

//convert to inclination/azimuth
camRadius = Math.sqrt((oldX * oldX) + (oldY * oldY) + (oldZ * oldZ));
inclinationTheta = Math.acos(oldZ / camRadius);
azimuthPhi = Math.atan2(oldY,oldX);

.
.
.

//use touch screen changes (deltaTouchX and Y)
inclinationTheta = (inclinationTheta + deltaTouchScreenX) % (2 * pi);
azimuthPhi = (azimuthPhi + deltaTouchScreenY) % (2 * pi);

//get new co-ordinates
newX = camRadius * Math.sin(inclinationTheta) * Math.cos(azimuthPhi);
newY = camRadius * Math.sin(inclinationTheta) * Math.sin(azimuthPhi);
newZ = camRadius * Math.cos(inclinationTheta);

//set new position
setPosition(newX, newY, newZ);

sentences:
Setting a jump counter in my 2d platformer built with phaser I have a platforming game, written in javascript with the Phaser.js framework, where my character collects objects. I thought trying to collect all objects in the least amount of jumps would be interesting, so I tried to implement a jump counter. Relevant pieces of code:

var jumpCount = 0;
var jumpText;

function create (){
    jumpText = this.add.text(16, 48, 'Jumps Used: 0', {fontsize: '32px', fill: '#000'});
}

function update (jumpCount){
    if (cursors.space.isDown && player.body.touching.down){
        player.setVelocityY(-630);
        jumpCount++;
        jumpText.setText('Jumps Used: ' + jumpCount);
    }
}

This is displaying the counter and incrementing it sort of correctly, but it seems to count the amount of time that the spacebar is held down and is leading to jump counts that are floats well into the thousands.

Is there a more reasonable way to handle counting the number of times a player has manually jumped?

Thanks!

sentences:
Box2D random crash when adding joints I'm currently working on a project which uses Box2D, when the player uses a certain key it should anchor to the ground. For that I use a weld joint, but when I add the joint the game will sometimes crash, it has a 1/10 change to crash.

The error I recieve:

Showing the controller
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 11
at org.jbox2d.dynamics.Island.add(Island.java:577)
at org.jbox2d.dynamics.World.solve(World.java:1073)
at org.jbox2d.dynamics.World.step(World.java:598)

The code for adding the joints:

WeldJointDef def = new WeldJointDef();
def.initialize(body, anchoredObject.body, body.getWorldCenter());
weldJoint = (WeldJoint) world.createJoint(def);

I still get the error if I synchronize it

sentences:
Improve opengl drawing with less calls as possible I'm looking to render rectangle primitives as performant as possible, here's what I did so far:

int main() {
    Window window("OpenGL", 800, 600);

    Shader shader("./file.shader");

    float vertices[8];
    glGenVertices(vertices, 200, 150, 400, 300); // return coords for a square
    const GLshort indices[6] = { 0, 1, 2, 2, 3, 0 };

    GLuint vao, vbo, ebo;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);

    glGenBuffers(1, &ebo);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    while(window.isOpen()) {
        window.clear();

        shader.use();
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
        shader.setUniforms(..);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);

        window.update();
    }

    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &ebo);
    glDeleteVertexArrays(1, &vao);

    return 0;
}

So far what I'm doing to fix my problem and seems to work:

Created vao, vbo and ebo to make a basic indexed rectangle.
Made a function that will returns vertices coordinates based position and sizes(x, y, w, h)
Create one single shader and set uniforms like position offsets, sizes and eventualy colors/textures after every draw call to be able to render shapes in different places ( that makes the coordinates function useless)

I'm pretty sure that's not the way to do it, but can't find something else, so this is what I'm thinking.

Heard that switching shaders is expensive, but I'll require shapes that won't share the same shader..
Also heard that setting uniforms is slower than switching shaders, so probalby switching shaders will be better here, need to profile the code to see.
Currently drawing one by one with glDrawElements seems hardcoded and inefficient to me, need something like a vao that could store multiple rectangular like indexedvbo all preloaded before drawing and when it goes to drawing, draw all the data with one call.
Not sure if I can load shaders between drawing, some of them will require changing while drawing like a hover or click effect, maybe there's better practices here too.

At the end, if you've been through this issue or having some tips/docs/source codes to read, it'll be excellent, thanks!

BIG NOTE: Mostly looking for 2d support, no 3d needed in case this could make it harder.

sentences:
Unity - Issue with Camera follow script I have a camera follow script which is attached to the main camera and it follows the players position and rotation. The player needs to be near the top of the screen. However when I hit play, the player  is shown at the center of the screen. This is how it looks in the scene view and this is how it should reflect when I hit play. Here the "y" position is -2 and "x" rotation is 0.

But when I press play, the "y" position is still -2 but "x" rotation changes to -14.9. And the player is shown at the center of the screen and not near the top.

Here is the camera follow script:
[SerializeField] Transform target;
public Vector3 defaultDist;
[SerializeField] float distDamp = .1f;

public Vector3 velocity = Vector3.one;

Transform myT;

void Awake()
{
    myT = transform;
}

void LateUpdate()
{
    SmoothFollow();
}

void SmoothFollow()
 {
    Vector3 toPos = target.position + (target.rotation * defaultDist);

    Vector3 curPos = Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp);
    myT.position = curPos ;

    myT.LookAt(target, target.up);
 }
}

After I hit play, I want the x rotation to stay at 0 and the player to be shown near the top of the screen. Can someone please help?

sentences:
Syncing items between server and client I'm doing this game of mine, and I want to add the items to it.
I'm already familiar with the basic concept of syncing data between server and client,
Usually using sync state, that's what i've done with my friends in our previous game.
This game is sort of a recreating of the previous one, but written better.

The problem we had with items is that every item we created in the server was basically a Subclass of a class that is a subclass of Item, for example:

EmeraldStaffOfTheExiledMonk : Weapon : Item

When we wanted to have the item in the client side, what we had to do is to create an item class, which would hold the necessary information we need to have of an item, and have some sort of an initialization of an ItemPool.
Now, to sync that, we obviously have to sync the IDs of each item, assuming we have them.
My question to you guys is, is there any good way to actually sync items across client and server, without having any hard-code of those items in the client side?

What I eventually want is to have an ItemPool that would be generated in the client when you connect to the server, and the only thing the client would really need to have is the assets of that item(textures, and so on)

sentences:
Android Java rectangle collision detection not working I had been hard coding a collision detection system which was buggy. Then I came across using rectangles for collision detection. So I put it all in and it does not work, I put a log in and it never logged.

Note to Java programmers who are not Android programers: Android uses the word Rect instead of Rectangle.

Code for Block.java:

public Rect getBounds(){
    return new Rect (this.x, this.y, 10, 20);
}

Code for Sprite.java:

public Rect getBounds(){
    return new Rect (this.x, this.y, 20, 20);
}

Code for MainGame.java:

for(Block block : BLOCKS) {
    block.draw(canvas);
    block.rigidbody();

    Rect spriter = sprite.getBounds();
    Rect blockr = block.getBounds();

    if(spriter.intersect(blockr)){
        showgameover = 1;
        Log.d(TAG, "Game Over");
    }

}

Is anyone able to help?

sentences:
How to instantiate seamless scrolling tiles I'm trying to create in Unity an "Endless Runner" game, where the player remains stationary on the 0 of the axes while the tiles underneath him scroll with a fixed speed on the Z-Axis.
The script attached spawns 5 tiles at the start while already scrolling at the speed set in the GameManager and then keeps on spawning tiles based on a timer.
The issue I'm facing is the following:
The tiles that are spawned with the timer are too much distant from the starting set of tiles.
How can I calculate the correct distance between the set of the already scrolling tiles and those the script start to spawn after 5 seconds in order to have seamless scrolling?
I'm attaching the script with what I've written so far in the hope that someone knows how to proceed, or perhaps knows a different method. Thanks!
public class TileManager : MonoBehaviour
{
    [SerializeField] private Transform player;
    [SerializeField] private GameObject[] tilesArray;
    [SerializeField] private int tilesToSpawn = 5;
    [SerializeField] private float zPosSpawn = 0f;
    [SerializeField] private float tileLength = 20f;

    public List<GameObject> tilesList;
    private float spawnRate;
    private float timeSinceLastSpawned;

    void Start()
    {
        //scrollingSpeed is -5
        spawnRate = GameManager.Instance.scrollingObjectsSpeed * -1;
        StartSpawnLogic();
    }

    void Update()
    {
        timeSinceLastSpawned += Time.deltaTime;
        SpawnTimer();
        DestroyAfterSpawn();

    }

    private void StartSpawnLogic()
        {
            for (int i = 0; i < tilesToSpawn; i++)
            {
                if (i == 0)
                {
                    SpawnTiles(0);
                }
                else
                {
                    SpawnTiles(Random.Range(0, tilesArray.Length));
                }
            }
        }

    //SPAWN FUNCTION
    private void SpawnTiles(int tileIndex)
    {
        //On Instantiation a list is filled to later dispose of the tiles after they reached a certain point
        tilesList.Add((GameObject)Instantiate(tilesArray[tileIndex], transform.forward * zPosSpawn, Quaternion.identity));
        zPosSpawn += tileLength;
    }

    //TIMER
    private void SpawnTimer()
    {
        if (timeSinceLastSpawned >= spawnRate)
        {
            timeSinceLastSpawned = 0;
            SpawnTiles(Random.Range(1, tilesArray.Length));
        }
    }

    void RemoveObjFromList(GameObject tile)
    {
        Destroy(tile);
        tilesList.Remove(tile);
    }

    private void DestroyAfterSpawn()
    {
        for (int i = 0; i < tilesList.Count; i++)
        {
            if (tilesList[i].transform.position.z <= -20f)
            {
                RemoveObjFromList(tilesList[i]);
            }
        }
    }
}

sentences:
(unity) move the world or the character I'm making a game like this:
https://www.youtube.com/watch?v=hO7573lphqI

wherein a 3D ship is flying around on a 2D plane.  From the player's perspective, the ship will stay stationary in the center of the screen.

The question I have is whether it's better to have to ship stay stationary and the world move around the ship? Or should I have the camera follow the ship as it moves around?

Notes:

assume the ship can go infinitely in any direction
this is in Unity, though I'm curious if that differs from other tools like Unreal
I will be culling items that are offscreen either way

Obviously, having the camera follow the ship is easier from the programming side of things, but I'm wondering if there's a good reason not to do that (if the player moves far enough in one direction does it hit an internal limit that would break the game)?

Thanks!

sentences: How to simulate a liquid like "The Cook" or "Bake it"? I want to make a simple liquid something like these gifs:

sentences:
Unity or MonoTouch with XNATouch/MonoGame? same price After figuring out the pricing of monoTouch and Unity, I've found that the pricing will be the same ($800). With XnaTouch/MonoGame for monoTouch I am able to port my games to droid/apple. I am just curious if anyone has tried both XnaTouch and Unity and which one they prefer.

I do mostly 2D games (if Unity had a 2d Engine I would be all over that) so xnaTouch seems that it might be better, but Unity seems better for more advance/professional (more companies are using it, so if I ever wanted to do this for more than just myself I have more options, which I've thought about)

(I also read somewhere that monoTouch is against the new apple term of agreement?)

sentences:
What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR) I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object in the intended direction (with a doctored Y value) at a speed dependent on other factors.

The language of the code doesn't matter too much, but I'm using Godot, so something that wouldn't require me to import a bunch of different math libraries (by converting them to Godot's Python-style GDScript) would be ideal. It doesn't need to be robust.

To give you an idea of what I was thinking, my original plan was to save the position of the grabbing controller every frame while an object is being held, removing old positions if the controller is moving backwards, then averaging out the movement deltas over the last 10 or 15 frames or so before letting go (it should be consistent since Godot has a fixed-timestep "update" function available) and normalizing the vector to get the direction the object should travel in.

However, this blog post got me thinking that spending the time learning how to do the linear regression in a more robust way, then applying that to 3D/VR, might be worthwhile. I just wonder if, since I don't need the actual linear or angular velocity, it might be overkill in terms of time spent on the feature.

sentences:
Can I post to Facebook with my own text from Unity on behalf of the user? I'm using Facebook SDK for Unity 6.0 with FB.Feed.

I'm trying to post a link to the user's feed, text and link on his behalf.

So far I've managed to publish only a link and its details, the part where the user can write the post is left empty for him to fill.

sentences:
What is the necessary know-how to write an animation library (IK & FK)? I can't find any good library for animation, the ones that I found are just really old and discontinued, but I have noticed that the libraries are relatively small, so I'm thinking about coding one on my own: where should I start? What are the basics for this? There is a book about this?

Some further notes about a good file format for animation are also highly appreciated.

I'm using C++.

sentences:
What is a fast way to darken the vertices I'm rendering? To make a lighting system for a voxel game, I need to specify a darkness value per vertex. I'm using GL_COLOR_MATERIAL and specifying a color per vertex, like this:

glEnable(GL_COLOR_MATERIAL);

glBegin(GL_QUADS);

glColor3f(0.6f, 0.6f, 0.6f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.3f, 0.3f, 0.3f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.7f, 0.7f, 0.7f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.9f, 0.9f, 0.9f);
glTexCoord2f(...);
glVertex3f(...);

glEnd();

This is working, but with many quads it is very slow.. I'm using display lists too. Any good ideas in how to make vertices darker?

sentences:
Material is flickering in Unity I'm trying to make a grid like, light up floor using Unity's Shader Graph. However, I am having an issue where the lines are flicking after a really short distance when the camera is moving.

The shader graph is below.

How can this issue be prevented and what is causing it?

sentences:
How to handle circle penetration I've been working on circle to circle collision and have gotten the intersection method working correctly, but I'm having problems using the returned values to actually separate the circles from one another.

This is the method which calculates the depth of the circle collision

public static Vector2 GetIntersectionDepth(Circle a, Circle b)
{
    float xValue = a.Center.X - b.Center.X;
    float yValue = a.Center.Y - b.Center.Y;

    Vector2 depth = Vector2.Zero;

    float distance = Vector2.Distance(a.Center, b.Center);

    if (a.Radius + b.Radius > distance)
    {
        float result = (a.Radius + b.Radius) - distance;
        depth.X = (float)Math.Cos(result);
        depth.Y = (float)Math.Sin(result);
    }

    return depth;
}

This is where I'm trying to apply the values to actually seperate the circles.

Vector2 depth = Vector2.Zero;
for (int i = 0; i < circlePositions.Count; i++)
{
    for (int j = 0; j < circlePositions.Count; j++)
    {
        Circle bounds1 = new Circle(circlePositions[i], circle.Width / 2);
        Circle bounds2 = new Circle(circlePositions[j], circle.Width / 2);

        if(i != j)
            depth = CircleToCircleIntersection.GetIntersectionDepth(bounds1, bounds2);

        if (depth != Vector2.Zero)
        {
            circlePositions[i] = new Vector2(circlePositions[i].X + depth.X, circlePositions[i].Y + depth.Y);
        }
    }
}

sentences:
Do UDP game clients/servers block for receive calls? One way to implement a client/server relationship is to have the server simulate the whole game based on the clients input and send updates back to each client, while the client is is simulating the game for the player and sending back input and game state messages that the server can use to process the whole state of the game.

My question is, since a ReceiveFrom() call blocks till it receives data and a Select() call blocks for a set period of time, does that mean all clients and servers block for a certain amount of time each frame?  I am aware that a call to Select() can be set to zero which would be an effective poll to the read write states of the current sockets, but wouldn't you miss out on new data if it comes in just microseconds later?  How is this problem solved now a days?  Pro select() method handling? Asynchronously? Separate thread completely? Other?

I may be over thinking this, but I would like to know more information so I can write an effective client/sever relationship.
-Haywire

sentences:
How to adapt UV code to use a tilesheet that is "uneven"? The tutorial has code that takes a tilesheet and builds a UV mapping:

 const float tileSize = 0.25f;

 public virtual Vector2[] FaceUVs(Direction direction)
 {
     Vector2[] UVs = new Vector2[4];
     Tile tilePos = TexturePosition(direction);

     UVs[0] = new Vector2(tileSize * tilePos.x + tileSize,
         tileSize * tilePos.y);
     UVs[1] = new Vector2(tileSize * tilePos.x + tileSize,
         tileSize * tilePos.y + tileSize);
     UVs[2] = new Vector2(tileSize * tilePos.x,
         tileSize * tilePos.y + tileSize);
     UVs[3] = new Vector2(tileSize * tilePos.x,
         tileSize * tilePos.y);

     return UVs;
 }

He explains why he uses tileSize = 0.25f:

  The variable tileSize is equal to 1 divided by the number of tiles per
  side, in the case of our example texture 1/4 (0.25). The function
  creates an array of vector2 and gets the tile position with the
  direction and populates the array based on the tile position. Every UV
  coordinate corresponds to a vertex and the triangle made of those
  vertices uses the corresponding texture coordinates.

This is the tilesheet he is using, which is a 4x4:

I have a tilesheet which is not a 4x4:

I have tried tileSize = 0.0667f (1/15 if I assume the tilesheet is 15x15), but this is not correct. For example, a grass block is (5, 14) for the side, and (5, 8) for the top. But the game renders really weird textures.

What should the tileSize be since this tilesheet is not a perfect square (it looks like 6x15 tiles, but it also has a lot of empty space which might cause problems)?

Reference:

Tutorial:
http://alexstv.com/index.php/posts/unity-voxel-block-tutorial-pt-2

Source tilesheet (CC0 license):
http://kenney.nl/assets/voxel-pack

sentences:
Client side prediction in 2D rigid-body physics I'm currently working on 2D rigid-body physics multiplayer game using Matter.js for physics (both the client and server side) and Phaser3 for rendering. Both the server and the client run the simulation and the server is authoritative.

The whole game consists of multiplayer players (who can collide with each other) and objects (boxes, balls, etc).

For now, I'm working on the client side prediction and while I understand the main concept, I just can't get it right.

Every game tick I gather the client inputs, store them locally, timestamp them and send to the server, while at the same time I start moving the player forward (by applying force). When the server receives the inputs, it processes them (by applying the same forces to the player). The server then sends the current state (coordinates, velocity, rotation, last processed input timestamp, etc) to all players at 20hz.

This is the part where it gets tricky. What I currently do, is I force the player to the coordinates sent from the server and apply the same velocity (both X and Y). After that, I remove all locally stored inputs which are older than the last processed input and apply them instantly in a single frame, by doing multiple physics steps.

With low latency (20-30ms) it works out quite well, with some jittering when rapidly changing the player direction or when I'm colliding with other players/objects, but with higher latencies 70-110ms, the prediction goes completely off. I can see the player constantly being pulled back and forth and the whole game becomes unplayable.

I can't wrap my head around, what exactly am I doing wrong? Is client side prediction even the correct way of handling this sort of thing in a rigid-body physics-based game?

Also, I turned off state updating from the server and noticed that the position in the server and locally sometimes goes completely off, for example when I'm jumping, running and quickly changing direction. I believe that means that the physics engine is not deterministic?

sentences: Should the bullet trajectory calculated by server or by client? In a FPS game like Battlefield or Arma, when playing online, should the bullet trajectory be calculated by the server or by the client?

sentences:
Will an optional bad words censoring system affects the age rating as well? My game project is a 2D top down RPG with dating simulator & visual novel elements in it, and I have a few parts of dialogue in my game that have bad words and used often by a character.

However, I'm afraid those bad words will affect the age rating up to 17+, so I decided to censor bad words optionally. This means player can enable bad words after confirming legal disclaimers.

Will this feature results more friendly age rating? I'm targeting for 15+ age rating.

sentences:
Dividing up spritesheet in Javascript I would like to implement an object for my spritesheets in Javascript.

I'm very new to this language and game-developement so I dont really know how to do it.

My guess is I set spritesize to 16, use that to divide as many times as it fits on the spritesheet and store this value as "spritesheet". Then a for(i=0;i<spritesheet.length;i++) loop running saving the number of sprites.

Then tile = new Image(); and tile.src = spritesheet[i] to store the individual sprites based on their coordinates on the spritesheet.

My problem is how could I loop trough the spritesheet and make an array of that? The result should be similar to:

sprite.sprites = Array(
"0",
"1"
);

If possible this would be done with one single object that i only access once, and the tile array would be stored for later reference.

I couldn't find anything similar searching for "javascript spritesheet".

Edit 2: I've come a long bit since I first posted this question and this is what I've come up with so far:

function Sprite(){
    this.size = 16;
    this.spritesheet = new Image();
    this.spritesheet.src = 'spritesheet.png';
    this.spriteCount = this.spritesheet.height / this.spritesheet.width;
    this.spriteIndex = 0;
    var sprites = new Array();

    for(i=0;i<this.spriteCount;i++){
    sprites.push(this.spriteIndex); // Could insert pretty much whatever I want
    this.spriteIndex++;
    alert('spriteIndex # ' + sprites[i] + ' pushed');
    }
}
var sprite = new Sprite();

The alert method is only for testing, it alerts from 0 and up giving me usable X and Y values for the drawing (when multiplyed by size).
If anyone has improvements please let me know.

Edit 3: I still have some trouble with the array. How would i access the index of it?
For example the first sprite should give me sprite.sprites[0] second sprite sprite.sprites[1].

sentences:
Why should I use getcomponent? I have already referred the animator by using the statement,

       Animator anim;

But,What is the use of getcomponent in awake() function.What happens without it.

sentences:
SFML Trying to shoot bullets but it moves with the gun I'm pretty new to SFML and C++ and I'm trying to figure out how to shoot bullets. I've done the shooting part and it's origin is from a moving shape controlled by the user called Player.

The problem is when I move, the origin moves as well which is why the bullets move with the origin. I feel like it's something really basic but I cannot for the life of me figure this out. Can anyone help?

This is the part of the code that creates and moves the shapes:

        //creates a new bullet when pressed
            else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) {
            rects.push_back(sf::RectangleShape(sf::Vector2f(40, 10)));

        }
    }

    // clear the window with black color
    window.clear(sf::Color::Black);

    sf::Vector2f pl = player.getPosition();

    //draw active shapes in the vector and move them to the right
    for (int x = 0; x < rects.size(); x++)
    {
        rects[x].setOrigin(-pl.x,-(pl.y + 10));
        window.draw(rects[x]);
        rects[x].move(10, 0);
    }

sentences:
How to make a class diagram and data model of a Unity3D game? I'm developing a 3D platformer video game on Unity3D and I've been asked to present its UML class diagram and data model. If I'm not mistaken Unity uses an entity-component-system, which necessarily doesn't use heritage. How would a class diagram from a Unity game look like, in that case?

Also, I've been taught that usually data model refers to entity-relationship-models that represent a database. In the case my game doesn't use a database, how could I diagram the way the player's data is store on the game? I'm storing the player progress on a file in the user's computer.

sentences:
Will function-local objects affect my performance over time? This is a very simple question.

Let's say my render loop runs at 60Hz, in each call to render(), I draw all my game's buildings, characters and scenery to make the current frame ready. Each of these entities are drawn using its own instance of a RectangleShape, which is a class able to render a texture to the screen. (I am using OpenGL but it shouldn't be relevant)

RectangleShape is a class that once allocated, generates geometry for the "sprite" to be drawn, has some properties to configure and then renders itself using OpenGL.

The problem is, for each entity, I am allocating the RectangleShape object, configuring and rendering it inside render(). So, in practice, there are dozens if not hundreds of blocks like this inside render():

// pseudocode
RectangleShape entitySprite;
entitySprite.setSize();
entitySprite.setTexture();
entitySprite.render();

I am aware I have a performance decrease by not using a pre allocated RectangleShape, already configured, which I only call render() on. I know that is the optimal path to go, but my question is:

Will so many allocations/deallocations of RectangleShape (hundreds, 60 times a second) fragment memory over time, decreasing the performance of the whole program? Or can I be safe that despite the performance hit by on-demand allocation is constant and will not degenerate as time passes?

I am not using any kind of custom allocator for anything. Also, please have in mind that the RectangleShape constructor internally resizes a std::vector, which I think implies a heap allocation.

Thanks

sentences:
Forward Compatibility of Save Files My game is driven by a scripting language, and the user can save at almost anytime in the middle of the script, so the instruction number of the script engine must be saved. The problem is that the game state breaks when the script is changed. If the script is A B C D E and the player saved at C (the 3rd), and then the script is changed into X Y Z A B C D E, then the player will load at Z. I think my game will be updated infrequently even after release.

I think breaking the script into sections and autosaving in each new section. (in case of incompatibility: restart at autosave) However, are there any other ways to make save files forward-compatible?  I want to hear some examples of especially RPGs with DLCs and patches.

sentences:
Generated 3d tree meshes I did not find a question on these lines yet, correct me if I'm wrong.

Trees (and fauna in general) are common in games. Due to their nature, they are a good candidate for procedural generation.

There's SpeedTree, of course, if you can afford it; as far as I can tell, it doesn't provide the possibility of generating your tree meshes at runtime. Then there's SnappyTree, an online webgl based tree generator based on the proctree.js which is some ~500 lines of javascript.

One could use either of above (or some other tree generator I haven't stumbled upon) to create a few dozen tree meshes beforehand - or model them from scratch in a 3d modeller - and then randomly mirror/scale them for a few more variants..

But I'd rather have a free, linkable tree mesh generator.

Possible solutions:

Port proctree.js to c++ and deal with the open source license (doesn't seem to be gpl, so could be doable; the author may also be willing to co-operate to make the license even more free).
Roll my own based on L-systems.
Don't bother, just use offline generated trees.
Use some other method I haven't found yet.

Update 2015: ended up porting proctree.js to c++ https://github.com/jarikomppa/proctree

sentences:
Neural Net Controlled Car I'm trying to make an AI car controlled by a neural net.

I saw this two videos: Neural Network Demo and Q Learning and neural network in 2D car driving and I want to replicate that.

I already have the neural net code made, with a back propagation algorithm.

The thing is, I don't know how to reinforce the learning of the net. What kind of value should I use to calculate the error?

My car currently have 5 inputs (similar to the first video), and outputs 2 numbers, 1 which is plugged in the rotation torque of the car, if it's positive it will rotate clock-wise, if it's negative counter-clock-wise, and how much it will turn is based on it's magnitude, it ranges from -1~1, and I mapped it to a desired min-max rotation. The second output number is acceleration, it's from 0~1, but mapped to -10~100 (so it can reverse).

sentences:
Memory usage increasing ~10kb every frame I am currently developing a game for Android (using the SDK) and have been trying to reduce the memory usage. I have discovered that during each frame, the memory usage increases by about 10kb. The game runs at 60fps so adds over half a megabyte every second which, over time, significantly increases the total memory usage of the game.

This is not a huge problem as, after a short while, the memory is released by the garbage collector and it returns to a normal level. Despite this, I would like to know if such per-frame memory increases are normal for games developed in Java. If not, are there any tips or solutions to reducing the framely memory increase (other than not instantiating objects in every update/draw call - I have made sure I'm not doing this).

This is the draw method for my game:

public void draw(Canvas canvas){
    if(screenScaleX > 1f || screenScaleY > 1f)
        canvas.scale(screenScaleX, screenScaleY);

    canvas.drawColor(Color.BLACK);
    if(skipFrames > 0){
        skipFrames--;
        return;
    }

    pp.preDraw(this, canvas);

    scrollX = (player == null ? 0 : player.getBounds().getX()) * SCALE_FACTOR - 1280f / 2f;
    scrollY = (player == null ? 0 : player.getBounds().getY()) * SCALE_FACTOR - 720f / 2f;

    if(battle != null)
        battle.draw(this, canvas);

    popTranslate(canvas);

    canvas.scale(SCALE_FACTOR, SCALE_FACTOR);

    synchronized(objects){
        if(objectModCount > 0){
            Collections.sort(objects, GameObject.RenderLayer.RENDER_COMPARATOR);
            objectModCount = 0;
        }

        uCopy.clear();
        uCopy.addAll(objects);
        for(GameObject obj : uCopy){
            if(battle != null)
                if(!(obj instanceof Dialog))
                    continue;
            if(!obj.shouldScale())
                canvas.scale(SCALE_FACTOR_1, SCALE_FACTOR_1);

            obj.draw(this, canvas);

            if(!obj.shouldScale())
                canvas.scale(SCALE_FACTOR, SCALE_FACTOR);
        }
    }

    pp.draw(this, canvas);

    canvas.scale(SCALE_FACTOR_1, SCALE_FACTOR_1);

    pushTranslate(canvas);

    windows.draw(this, canvas);
    guis.draw(canvas, this);
    pp.postDraw(this, canvas);

    if(FRAME_SYNC){
        if(delta > 17L && delta < 33L){
            dSyncDiff = 33 - delta;
            try{
                Thread.sleep(dSyncDiff);
            }catch(InterruptedException e){
                e.printStackTrace();
            }
        }
    }

    frameCounter++;

    if(screenScaleX > 1f || screenScaleY > 1f)
        canvas.scale(1f / screenScaleX, 1f / screenScaleY);
}

As can be seen in the code above, I do not instantiate any objects, even primitives so the memory should not increase. All of my rendering and update code follows this sort of style so should be the same. Unless Androids SDK is memory inefficient (which I don't imagine it is), I really cannot see why or how the memory increase so much every frame. I have moved all primitives that are used to members of the class that owns this draw method and done the same for all others.

Update: Could it possibly be due to unavoidable creation of strings. For example, because strings are immutable, I would have to create a new string every time I want to update the contents of some text being drawn to the screen (and this does happen framely).

sentences:
Efficient communication between entities using ECS via entt To avoid confusion about the ECS terms I'll use, I explain them here quickly. I use entt terminology and set-up my architecture like this:

Entity: is only an id (entt::entity)
Component: is a struct holding plain data (int, floats, etc.)
System: is a function looping over a family of components (using entt::registry.view)

In my game, I model a space ship that can have multiple engines. The engines apply a force on the ship each frame so the ship accelerates. I implemented it like the following:
Ship is an entity, Engine is an entity. Ship has the components AppliedForces, Mass and Velocity. Engine has the components Parent and Thrust. Parent is a component containing the parent's id of the engine (in this case a ship entity).
I have two systems: ThrustSystem goes through all entities that have the components Thrust and Parent. It looks up the AppliedForces component of the parent and adds the thrust vector to it. Then the AccelerationSystem runs through all entities with the components AppliedForces, Mass and Velocity. It adds the applied forces to entity's velocity. In code, it looks like this:

void ThrustSystem::update(entt::registry& entities)
{
  auto view = entities.view<Thrust, Parent>();
  for (auto [thrust, parent]: view)
  {
    auto& applied_forces = entities.get<AppliedForces>(parent.id);
    applied_forces.vector += thrust.vector;
  }
}

void AccelerationSystem::update(entt::registry& entities, dt)
{
  auto view = entities.view<AppliedForces, Mass, Velocity>();
  for (auto [applied_forces, mass, velocity]: view)
  {
    velocity.vector += applied_forces.vector * mass * dt;
  }
}

This works perfectly for me, the systems are decoupled and work independently from each other and I don't experience any performance issues (I model max. 1000 ships with an average number of 4 engines each). So I will stick to this implementation in my current game.
But I am actually curious and I would like to learn more about the "correct" usage of ECS in game code: is this a recommended approach to gain high performances and avoid cache misses? This is my first project with ECS and I am not an expert in CPU stuff at all but naively-thinking I would say there are two "bottlenecks" in my code:

Look-up time for the AppliedForces component of the parent entity in ThrustSystem
The AppliedForces is probably further away from Thrust and Parent in memory. So I introduced a cache miss.

At first, are my assumptions correct? And if yes, how would one avoid these bottlenecks?

sentences:
Is there a 3D animation tool that meets these requirements? I'm searching a 3D physics / transforms animation editor. It should be able to import 3D meshes from OBJ or FBX, then it should be able to animate transforms. I need such a tool for my 3D games, where many dynamic and inorganic elements appear, like doors, traps, robots, lifts, and so on.

Where I can find such a tool?

sentences:
How do I stop stretching during window re-size in XNA? In my windowed mode XNA game when the user resizes the window the game stops updating the window and the last frame drawn is stretched and distorted until the user releases the mouse and the resize completes.

Is there any way to have the game continue to run "normally", updating frames and redrawing the screen, during the resize event?

I realize that keeping the render loop going while resizing may not be possible or recommended due do hardware managed resources getting continually created and destroyed, but is there any way to stop the ugly stretching?  Ideally by leaving the existing frame unscaled in the top left, or with a black screen if that isn't possible.

sentences:
How to convert this shader from Worldspace into Localspace? Based on this question (LINK)

Shader "Unlit/WorldspaceTiling"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

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

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);

                // Gets the xy position of the vertex in worldspace.
                float2 worldXY = mul(_Object2World, v.vertex).xy;
                // Use the worldspace coords instead of the mesh's UVs.
                o.uv = TRANSFORM_TEX(worldXY, _MainTex);

                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                return col;
            }
            ENDCG
        }
    }
}

So this has these two issues:

a) If the object moves through worldspace (eg. a moving platform), the texture will appear to crawl along it.
b) Rotating the object won't rotate the texture, so it will tile across it diagonally.

How is this code supposed to be to fix these two problems?
EDIT:
This is what I'm trying to achieve over all:

I have no idea if my current method is good or bad, but its basically:

Use a flat mesh created in blender with UVs unwrapped. They're all basically a bunch of quads with UVs having literally the shape same as the mesh itself.
Attach a material to each mesh in Unity with a particular texture.
Resize, rotate and align mesh into correct size and position.
Use as physics object in a 2D sideview game. May have additional meshes attached to it as non-interactive decorations, but otherwise using the same method to build them.

sentences:
Unity - protect MonoBehaviour-derived classes from instantiating via new in C# When the class hierarchy grows and you deal with a lot of custom types in your project, it sometimes becomes hard to remember which types are allowed to be created via new and which types are derived from MonoBehaviour and therefore can't be created via new but must instead be attached to the GameObject as a Component.

Is it possible to have some safety-mechanism for this? The goal would be to have two base classes to control the ability to use new on a certain type. Ideally resulting in a compile-time error instead of an easy to miss warning in the console ("You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. Blah blah.").

My attempt to make the constructor protected, like this

public class UnCreatableBase : MonoBehaviour {
    protected UnCreatableBase() {
        // using new should be not allowed
    }

    public static T Create<T>() {
        // instead this method allows object creation
        return GameObject.Instantiate (Resources.Load ("Prefabs/" + typeof(T).Name) as GameObject).GetComponent<T>();
    }
}

public class CreatableBase {
    public CreatableBase() {
        // new is ok here
    }
}

still allows me to write:

var whyDoesThisWork = new UnCreatableBase();

I can access the protected constructor even from an outside scope.

Now, the obvious solution would be to make constructors of MonoBehaviour-derived classes private. Manually. All of them. Manually. I was wondering if there's a way of achieving the same in a more generic way.

sentences:
Storing non-binary, but non-mergable files in Git LFS Is it acceptable to store files that aren’t binary and diffs between versions are not important in Git LFS? Examples of these files include:

.obj
.stl
.mtl
large .csv data dumps
etc

I know that I can, but would there be any advantages to storing them in LFS instead of the regular repo? I've done a bit of googling but couldn't find any information on the subject.

sentences:
3D pathing finding with flying Does anyone know of a (free or paid) solution that enables 3D path finding?  Basically something like:

CalculateRoute(input_geometry, start_pos, end_pos, variance)

I found a good paper on the topic, but I haven't found any solutions via Google or even searching sites like odesk, etc...

I know recast/detour is great for ground navigation, but I can't find anything that involves flying/3D space.

Any suggestions would be great to existing solutions.

sentences:
2D fighting bounding boxes I'm prototyping a 2D platformer/brawler game for uni and I'm having some trouble with creating collision/bounding boxes. This is most likely going to end up on a Vita so I do have some library constraints as well as performance implications.

None of this has yet been implemented but is all theory.

My idea was to have the artist create a sprite sheet for the character animation and then a second identical sprite sheet with the corresponding  collisions in a solid colour (e.g green for where the character can be hit and red for dealing damage, near the foot if kicking etc.)

With this, I would then parse the collision sheet and generate the various collisions required storing them in the character model. This is the point I feel would be most inefficient.

While I think this is a possible solution, I was wondering if there was a more standard way of doing this or a more efficient way as I feel this would have severe performance problems.

sentences:
TLS Allocator ALLOC_TEMP_THREAD error using "Fireworks" and "Explosion" particle systems in Unity 5.5 I receive a TLS Allocator ALLOC_TEMP_THREAD error whenever I add certain prefab particle system assets, such as "Fireworks" and "Explosion", to my scene.

It also generates a huge amount of log messages, such as

  Allocation of 752 bytes at 0524a60f
  Allocation of 22960 bytes at 0542a6f0
  ...

It also creates a huge amount of lag and, severely drops the frame rate.

Particle systems like "Flare", "Dust Storm" and "AfterBurner" work as expected. The individual simulation of the child particle systems in the "Explosion" and "Fire" prefabs worked perfectly in the scene view, but the same prefabs simulate weirdly in the game.

I am using Unity 5.5, and this error should have been fixed in 5.4.0 b23, but apparently it has not. How do I fix these issues?

sentences:
Frustum culling only working at certain angles So how I'm doing this is a little sketchy but I plan on changing it to either AABBs or spheres once I get it working. So the problem I'm having right now is that the frustum culling I've implemented is only working at certain angles and is not even close to accurate, personally I believe that the problem is at a calculation level. I am fairly new to 3D game development so I just whipped up this class fairly quickly based on some thread I read. My ViewFrustum class can be found here: https://www.dropbox.com/s/3b97bgcwoyh2oq8/ViewFrustum.java?dl=0

So all I'm doing outside this class is calling the update method from my renderer class and I have an ungodly amount of if statements checking if an entity's xyz is within the min and max xyz of the frustum (This is temporary).

So my main question is, am I calculating the frustum right or did I make any mistakes?

Values (when game starts, rotation matrix is a identity matrix) :

centerNear: [134.49167, 7.3502045, -271.4365]
centerFar : [134.49167, 7.3502045, -1170.7365]
points[0-7] :

[0] 2607.2214 1714.3507 -621.8992 1.0
[1] -2338.238 1714.3507 -621.8992 1.0
[2] 2607.2214 -899.70605 -1573.3379 1.0
[3] -2338.238 -899.70605 -1573.3379 1.0
[4] 136.4149 100.760254 -252.18294 1.0
[5] 132.56844 100.760254 -252.18294 1.0
[6] 136.4149 98.727104 -252.92294 1.0
[7] 132.56844 98.727104 -252.92294 1.0

sentences:
Comparing a saved movement with other movement with Kinect I need to develop an application where a user (physiotherapist) will perform a movement in front of the Kinect, I'll write the data for the movement in the database and then the patient will try to imitate this motion. The system will calculate the similarity between the movement recorded and executed.

My first idea is to store the position of the recorded points and then compare them in the execution time to the patient's movement. I know that this approach is too simple, however, because I imagine that in people of different sizes the skeleton is recognized differently, so the comparison is not reliable.

My question is about the best way to compare a saved motion with a movement executed (on the fly).

sentences: How to make sure that all the UI elements were the same size on all screens in new Unity 4.6 UI system I have made a HUD for my 2d mobile game with the help of the new UI system, that was introduced in Unity 4.6. But when I am trying to play game in Unity editor, the UI elements have normal size, but when I am playing this game on mobile devices, they have more small size than in editor. Why this is happening? May be I missed something while watching Unity tutorials about new UI system. Can anyone help me please.

sentences:
Sending an object from one point to another I am working on a simple game in Java and am stuck for now with getting an object to be directed from its current position to a certain point, all at a fixed speed. My problem is that whenever I activate the movement, the object seems to shoot off into a random direction, sometimes towards my target, sometimes away, really any direction it seems, but nothing consistent.

This is what I'm working with:

    else if (key == KeyEvent.VK_SPACE)
    {
        double deltaY = 100 - p.getY();
        double deltaX = 100 - p.getX();
        double angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
        System.out.println(angle);
        double dx = (double) (Math.cos(angle) * 3);
        double dy = (double) (Math.sin(angle) * 3);
        p.setVelX(dx);
        p.setVelY(dy);
    }

Here is my SetVel functions as well as the tick method.

public void tick()
{
    x+=velX;
    y+=velY;

    if(x <= 0)
        x = 0;
    if(x >= 640)
        x = 640;
    if(y < 0)
        y = 0;
    if(y >= 480)
        y = 480;
}

public void setVelX(double velX)
{
    this.velX = velX;
}

public void setVelY(double velY)
{
    this.velY = velY;
}

Using the system outs, and positioning my object at 90 degree angles relative to my target I am getting 90 and 180 degrees, so I don't think its a problem with that.

sentences:
Does Game Maker use use intrinsic or extrinsic rotations? I have a pretty difficult problem on my hands. My 3D character moves through space and rotates. I do not know the angle of rotation at any given time, but I do have three X, Y, Z unit vectors serving as basis vectors for the character's coordinate system.

I see that in the Euler angle page on Wikipedia there are three formula for extrinsic rotation. My problem is that they do not seem to work in any manner whatsoever. Either my reading of that page misled me, or game maker does not use extrinsic rotation.

Do Game Maker's rotation transformations always rotate globally in 3D space, or does it use the current set of transformations and rotate around the current X, Y, or Z axis?

sentences:
Help on TileMapRenderer In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.

sentences:
Algorithm to make an entity follow tile edges in a tilemap I'm implementing something like the electric balls seen in this video https://www.youtube.com/watch?v=MWyB56AlAWw (skip to 1:55 and you will see this electrical balls follow tile edges in the tilemap).

I have an algorithm working but I feel like it is a bit of a mess. I could summarize it as:

1) Setup

The ball starts always falling
I have an enum holding what side the ball is engaged to (side of tile it is traveling. It could be Top,Bottom,Left, Right and None). This var is inited to "None" at start.

2) While the ball is falling, as soon as it touches a tile we set the engaged var to bottom (the ball is engaged to a tile that is at the bottom) and we make it move to the left.

3) Now we have 2 cases

the ball collides with another tile while moving to the left. In this case we set the engaged var to Left and start moving it upwards.
the ball gets into a situation where there's no tile at the bottom to continue going to the left. In this situation we use the engaged var to know what edge of the tile we were moving along. In this particular case as we where engaged to a bottom tile we fix the ball position to be right at the left of the last valid tile and start moving it down.

This applied to all possibilities makes the ball run across all the tilemap.

I would like to know if there's a more clean way to do this without all this "mini cases" or a better way to accomplish this.

Cheers

sentences:
MonoGame creates a copy of song files in XNBs location I'm having a problem. I've been adding .wma files to the Content Pipeline app to be used as my game's background music. But today when I opened the solution/project/content/bin/music folder I spotted the following:

So am I forced to ship the .wma files with the actual XNBs when I distribute my game? No other asset gets copied like this so how do I prevent songs from being copied as well?

If I delete the .wma files manually then the next time I build the project they get automatically added again :/

sentences:
Move an object up while touch is active I'm trying to move an object towards the top of the screen while the touch is active.
This is my current code. When I am touching the screen, the object I'm trying to move just keeps it's place (and the gravity seems to be disabled from this point). I'd be glad if someone could help me in this case. Thanks in advance!

public class PlayerScript : MonoBehaviour
{

public Vector2 jumpForce = new Vector2(0, 12);
public int speed = 3;

void Update()
{
    for (int i = 0; i < Input.touchCount; i++) {
                    Touch touch = Input.GetTouch (i);
                    while(touch.phase == TouchPhase.Began) {
                            // Touch are screens location. Convert to world
                                rigidbody2D.velocity = new Vector2(0, speed);
                                rigidbody2D.AddForce(jumpForce);
                    }

            }
     }
 }

sentences:
Is it possible to mod a GameMaker game? I been google searching on how to mod Game Maker games (Hyper-Light-Drifter to be more specific) but so far everyone says it's impossible to mod the files. The reason I want to do this is I want to learn to program by modding first and seeing examples that is already made, I also really like this game.

If there is a more better place/website to ask this question please tell me.

sentences:
How to implement a property with a base value and a changed value? I have a number of stats and effects in game that are subject to change, they have some kind of base value and the current value. For stats, I implemented this in a dynamic way, but for less important things, like buffs that is too much work. For buffs I have 2 properties - current and base value. For example, the shield buff action takes the base value and copies it into the current value at the start of each turn.

What is a good way to implement having the current value and base value for effects?

Right now I have a base property defined along with the modified value.

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    buff.intensity = intensity;
    buff.baseIntensity = intensity;

    return buff;
}

Should I refactor such code early on and replace it with some kind of tuple, like EffectValue(current,Base) where x is current and y is base?

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    buff.intensityTuple = EffectValue(intensity, intensity);
    return buff;
}

Or should I start with a dictionary/map right from the start? This seems to be the easiest to expand later on, although I have to remember string keys:

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
    [dictionary setObject:@(intensity) forKey:@"base"];
    [dictionary setObject:@(intensity) forKey:@"current"];

    //optional parameters for potential future expansion
    [dictionary setObject:@(1) forKey:@"decay"];
    [dictionary setObject:@(4) forKey:@"maxHitsBlocked"];
    buff.valueDictionary = dictionary;

    return buff;
}

sentences:
Is it possible (from the vertex shader) to always draw at specific pixels? I am wondering if I can (if possible) make a vertex shader that will always make the pixel shader draw everything in 1 pixel, at position 0,0.

I know this sounds crazy, but it's needed in the situation I'm in right now.

Let's say that I am drawing a line with 2 vertices that each have the color blue. For every vertex, I tried attaching a TEXCOORD that specifies what pixel I want this vertex to be drawn in. However, I can't get this to work.

The reason I am doing this is that I am making experiments where the physics of my game (which is very intensive) is drawn onto a texture, and handled by the GPU.

sentences:
Chunked QuadTree creation & handling I am new to LOD-based techniques so please be lenient with your comments about my naive questions.

Preface:

My aim is a simple terrain renderer (preferred C++ and OGL) that is to load a height-map (say 990 x 990 x 8bit) organized into 33x33 vertex chunks. No on-demand paging, just the sampling vertices from the height-map data directly into the vertex-buffers of the chunks. The rendering should be done via a quadtree whereas the leafs would render a whole chunk (33x33 vertices).

After reading Thatcher Ulrich's "Adaptive Quadtree" article, as well as chunked LOD and quite many other articles and questions on stack-exchange, I still seem to be too stupid to wrap my head around on how to actually proceed. Ulrich rendered leafs as triangle-fans directly (in his demo-code) which was appropriate at that time (I guess) but my prerequisite is a batch of triangles at once, hence the chunked approach.

1) Using a quad-tree (which is easy enough to understand, at least conceptually, and will -presumably- not lead to patent-wars later as with e.g. 'geo-mipmaps'), at some point the tree will have to be created. My guess was to load (or generate) a height-map first and then PRECALCULATE a quad-tree based on this map. Would that be a viable approach?
Various articles seem to expect the reader to know this fact a priori, so it is nowhere clearly stated. If pre-calculated, then all possible child-nodes would be pre-allocated in the RAM and walked top-down with some distance-to-node-by-width LOD criteria that would force the child-nodes to take over.

2) If pre-allocated, HOW would one render the chunks if lower LOD is required. I.e, the chunk being 32x32 quats => 33x33 vertices, an index buffer holding 33x33 indices would render the whole chunk as is. Now, a neighbor-node with one lower LOD-level is not a leave anymore, and its index buffer would not only need to span the four chunks of it children, it would also have to have an index buffer that indexes every second vertex as well to maintain only a single level of difference (or so my understanding). So I guessed (again) that EVERY node (leaf or not) would have to have (at least) one index buffer, and this index buffer would also have to be created/calculated during creation of the entire tree. (Which I would place in the engine's loading section, not anywhere close to the rendering-loop).
What I really don't understand is, how to do the rendering with the above approach (if it were the way to go, that is)... When nodes way above (in terms of lower LOD-level, i.e. coarser resolution) must draw their content, would that mean that the vertex-buffers of ALL chunks (in the leaf nodes way down) must be bound? And how would the index buffer of this node address the vertices in all the chunks?...
Or, would one have an empty 33x33 patch standing to the ready to collect vertices from various chunks as indexed by this lower-level node? (Sounds cheesy already whilst writing this...)

I would love to see an answer to this. I would accept a NO-CAN-DO with quadtrees and alternative suggestions, but a quad-tree solution is what I hope for.

My own alternative solution (which is a whack-job on my mind though) is a kinda 'Infinite Snapshot Quadtree' that starts with a root and creates nodes on-the-fly, but does only store as many nodes as required to render the visible world. A node however must carry all information to recreate its parent as well as to be able to create a chunck-geometry. The subdivision depth with this approach is (virtually) infinite (not considering issues with precision here), but the neighbor-linking mayhem is beyond good and evil...

Best Regards.
Edward

sentences:
How can I limit the movement angle of a Farseer joint? How can I create rectangles in Farseer that behave like the two red rectangles in this video:

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

I created an angle joint, but it behaves weird. Should I use an angle joint or is it better to use another joint?

In addition, I don't know how to adjust the angle of the joint so that the rectangle only moves in a predefined angle. How can I limit the movement angle of a joint?

I tried it like this, but the rectangle moves not as it should:

       RectangleA1 = BodyFactory.CreateRectangle(world, 3.50f, 0.50f, 1.0f);
       RectangleA1.BodyType = BodyType.Dynamic;
       RectangleA1.Position = new Vector2(10.4f, 5.40f);
       RectangleA1.Rotation = 0f;
       RectangleA1.CollisionCategories = Category.Cat5;

       RectangleA2 = BodyFactory.CreateRectangle(world, 0.10f, 1.00f, 1.0f);
       RectangleA2.BodyType = BodyType.Static;
       RectangleA2.Position = new Vector2(8.6f, 6.2f);
       RectangleA2.Rotation = 0f;
       RectangleA2.CollisionCategories = Category.Cat5;

       AngleJoint1 = JointFactory.CreateAngleJoint(world, RectangleA1, RectangleA2);

       spriteBatch.Draw(RectangleA1Sprite, ConvertUnits.ToDisplayUnits(RectangleA1.Position), null, Color.White, RectangleA1.Rotation, new Vector2(RectangleA1Sprite.Width / 2.0f, RectangleA1Sprite.Height / 2.0f), 1f, SpriteEffects.None, 0f);

       spriteBatch.Draw(RectangleA2Sprite, ConvertUnits.ToDisplayUnits(RectangleA2.Position), null, Color.White, RectangleA2.Rotation, new Vector2(RectangleA2Sprite.Width / 2.0f, RectangleA2Sprite.Height / 2.0f), 1f, SpriteEffects.None, 0f);

sentences: Why are games locked at a certain frame per second? A lot of PC games are locked at 60 frames per second. I know that this is because a high frame rate can cause glitches/bug in a game and mess up the physics but is there another reason? Should anyone who makes games lock their games at 30-120fps? Thanks in advance!

sentences:
Texture mapping issue in my Wavefront *.obj parser I wrote a simple *.obj parser reading read vertices, texcoords and normals. But when I draw a model the texture isn't mapped correctly.

I have already tried uv.y = 1.0f - uv.y to get inverted Y axis coordinates as suggested by a few people but my textures are still displayed skewed.

I know that both texture file and rendering code are correct. Because when I render a plane and use hand written and hard coded texture coordinates and vertices it renders fine. I can render a textured cube by hand fine, too.

I use an index buffer to store vertex elements and I use the face elements provided by the *.obj file to fill texture coordinate buffer and normal buffer.

Model::Model(const string &givenName, const string &filePath){
    name = givenName;

    std::ifstream in(MODEL_PATH+filePath, std::ios::in);
    if(!in){
        error("Model \"" + filePath + "\" does not exist");
        return;
    }

    ModelMeshIndex tempindex;

    vector<vec3> normals;
    vector<vec2> uvs;

    string line;
    while(getline(in, line)){
        if(line.substr(0,2) == "v "){
                    std::istringstream s(line.substr(2));
                    vec3 v(0.0f);
                    s >> v.x >> v.y >> v.z;
                    data.vertices.push_back(v);
        }
        else if(line.substr(0,2) == "vt"){
                    std::istringstream s(line.substr(2));
                    vec2 v(0.0f);
                    s >> v.x >> v.y;
                    //v.y = 1.0f-v.y;
                    uvs.push_back(v);
        }
        else if(line.substr(0,2) == "vn"){
                    std::istringstream s(line.substr(2));
                    vec3 v(0.0f);
                    s >> v.x >> v.y >> v.z;
                    normals.push_back(v);
        }
        else if(line.substr(0,2) == "f "){
                    std::istringstream s(line.substr(1));
                    char tmp; // For the slashes between elements
                    unsigned short a,b,c, d,e,f, g,h,i;
                    s >> a >> tmp >> d >> tmp >>g;
                    s >> b >> tmp >> e >> tmp >>h;
                    s >> c >> tmp >> f >> tmp >>i;
                    a--; b--; c--; d--; e--; f--; g--; h--; i--;
                    data.index.vertexElements.push_back(a);
                    data.index.vertexElements.push_back(b);
                    data.index.vertexElements.push_back(c);

                    data.index.uvElements.push_back(d);
                    data.index.uvElements.push_back(e);
                    data.index.uvElements.push_back(f);

                    data.index.normalElements.push_back(g);
                data.index.normalElements.push_back(h);
                    data.index.normalElements.push_back(i);
        }
        else if(line[0] == '#') continue;
        else continue;
    }

    for(unsigned int i = 0; i < data.index.normalElements.size(); ++i)
        data.normals.push_back(normals[data.index.normalElements[i]]);

    for(unsigned int i = 0; i < data.index.uvElements.size(); ++i)
        data.uvs.push_back(uvs[data.index.uvElements[i]]);

    //data.uvs.push_back(vec2( 0.0f, 0.0f)); // bottom left
    //data.uvs.push_back(vec2( 0.0f, 1.0f)); // top left
    //data.uvs.push_back(vec2( 1.0f, 0.0f)); // bottom right
    //data.uvs.push_back(vec2( 1.0f, 1.0f)); // top right

    good = true;
}

What is wrong with my parser?

sentences:
Turn-Based RPG Battle Instance Layout For Larger Groups What a title, eh?

I'm currently designing a videogame; a turn-based RPG like Final Fantasy (because everybody knows Final Fantasy). It's a 2D sprite game.

These are my ideas for combat:

The player has a group of 15 members (main character included)
During battle, five of the group are designated as active, and appear in the battle.
These five may be switched out at leisure, or when one of the five die.
At any time, the Waiting members can cast buffs, be healed by the active members, or perform special attacks.
Battles should contain 10+ monsters at least. I'm aiming for 20, but I'm not sure if that's possible yet.
Battles should feel larger than normal due to the interaction of Waiting members, active members and the increased amount of monsters per battle.
The player has two rows in which to put the Active members:  front and back.
Depending on the implementation, I might allow comboing of player attacks and skills.

These are just design ideas, so beware! I have not been able to test this out yet- I have no idea yet if any of these ideas bunched together will make for a compelling game. What sounds good on paper doesn't necessarily have to be good in practice!

What I'm asking now is how to create the layout for this. My starting point are the battles in Final Fantasy VI, with up to 5-6 monsters on the left and the characters on the right- monsters on both sides if it's a pincer attack.

However, this view would not work feasible with my goal of 20 monsters and 5 characters. All the monsters on the left would appear cluttered unless I scale them far far back. If I create a pincer-like map, then there would be no real pincer-attack possible. If I space the monsters out, I force the player to scroll the screen- a game mechanic I've come across and not enjoyed.

Does anybody have any layouts or guides for designing battle maps in turn-based RPGs, especially with a larger number of enemies taken into consideration? How should it look?

I am not asking for specific combat mechanics, just the layout for the moment.

sentences:
Creating structure to a game (Missions, Dialogue, Triggering events upon items collected, etc) & monitoring the progress of a player in our code? Hello all I have been working with Unity and other game engines/libraries for many years in my spare time. It's been a long twisty road full of joy and pain :D In the last few months or so I have been jumping back in and noticing I really have a good grasp of the basics for almost all aspects of game development (in other words I can happily make little characters move on input in several ways with rigidbody, without rigidbody; Animations I have an ok understanding with; shaders and skyboxes and post processing I kind a barebones knowledge of, etc).

My main issue I always come unstuck with (and end up defeated until I start building a new project which just involves doing the above stuff I listed that I already kinda understand), is managing actual Quests or Special Events throughout the game.

For example, today I'm trying to make a puzzle game (similar to Monkey Island but much much more basic puzzles for now). So you start out in the game stuck inside a room, there are many items in the room , and a door and fireplace.
The door is locked. To solve the puzzle you just need to use the Jug of Water on the fire, then you will be able to click the fireplace to climb out of the room.

I've actually made this exact puzzle before and it all worked (I used mainly Strings and had complicated if statements to work out if the player was holding that item). But once I applied this method across a whole game (lets say you keep the empty water jug there and need it in a puzzle way later in game along with some other items etc.) then it gets majorly complicated and seems like not a good way to do it.

I've read lots about text-data types. Apparently its possible to create my own custom commands in text files so that I can annotate the text and use that to trigger methods in my code , but whilst I have read a bit about this on a few forum posts I cannot find much help with coding this (on a very simple beginner level).

I'm hoping I can build a text file that holds items along with dialogue and mission data : Item names; Item description dialogue; Whether they are quest items; Can they be combined (and if so with what and into what);

Ideally, the same system could be used for dialogue (Initial "Hello" with NPC; follow-up conversations; does NPC give quests? if so start one; final (after all quests from this NPC complete) "See ya around!" type dialogue) The text file should be able to help me from what I've read but I dont know how?!?!?

I'm fairly well versed in Polymorphism so like an Item is the parent and then child class might be Food: Item ; Weapon: Item; Tool: Item ,etc.
and I also have parsed data from text to make simple pong-breakout style levels (using Json and XML). I feel like that is the way to do it, but Im missing much about adding attributes or custom markup or something like this to my text data.

I know the query here is extremely broad but any broad helpful suggestions of where I can start would be greatly appreciated. Many thanks

sentences:
How to access a variable from another C# script in Unity I am working on a simple game project, and have a problem. The problem is accessing the variable from one script to another.

For example :-

I have 2 Scenes (Game Scene and Game Over Scene), Game Scene has a Player Game Object , who has a int Variable Score.

using UnityEngine;
using System.Collections;

public class Game_Scene_Script : MonoBehaviour
{
     private int Score ;

     // Use this for initialization
     void Start ()
     {
          Score = 0 ;
     }

     // Update is called once per frame
     void Update ()
     {
          // Let us assume some one played the game
          // And Now the Score is 207
          Score = 207 ;
     }
}

Now I want to access that int Variable Score in Game Over Scene which a Game Object.

So how can I access that int Variable from that script?

I searched for, but couldn't find any proper answer I wanted. Even-though some answers are in JavaScript , some are in Unity 4.x etc.

sentences:
Water drops on camera How can I create water drops on camera something like we see in Ripitude GP,

I tried using Unity's default GlassStainedBumpDistort shader though its performance heavy on mobile plus it do not let animate water drops.

sentences:
Math topics for 3D graphics programming I understand that the following math topics are required for 3D graphics programming. I have started doing some of them in my math course. Can someone point me in the direction of a resource that explains how they apply? What graphics/game problems are they used to solve?

vector math
matrix math
quaternions
linear algebra

As far as I can see these are all linear algebra/matrix topics. Are there any other topics required?

sentences:
NullReferenceException until tile is spawned I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script is in tile my ray script is in my player so im reaching from my PlayerMove script to spawner script, but until my tile is spawned i get this error NullReferenceException: Object reference not set to an instance of an object because tile is not spawned yet after its spawned error stops, but after tile is deleted it starts again how can i get rid of this error.

PlayerScript

private Spawner spawner;
private RaycastHit hit;

private void Update()
{
  spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>();
  DrawRay();
}

private void DrawRay()
{

    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

    if(Physics.Raycast(ray,out hit))
    {
        if(hit.collider.tag == "SpawnerCollider")
        {
            if(hit.distance < 5)
            {
                Destroy(hit.collider);
                spawner.Spawn();
            }
        }
    }
}

SpawnerScript

public Transform[] spawnPos;
public GameObject fireBall;

public void Spawn()
{
    for (int i = 0; i < spawnPos.Length; i++)
    {
        Instantiate(fireBall, spawnPos[i].position, Quaternion.identity);
    }
}

sentences:
How do I make magenta in my PNG transparent in HTML5/Canvas/JS? I'm putting together a simple hex map to use within an HTML5 / Canvas / JS game and before I get round to sorting any custom graphics, I was wondering if anybody knew how to make the pink/magenta backgrounds transparent so that I can overlap my tiles?

Cheers!

sentences:
How to navigate through google Map in unity I am working on loading the google map and navigating through the map.

I have loaded the google map which shows the current location in unity.

Now I need to show the direction from Place A to Place B.How Can I implement this in unity

sentences:
Camera not in sync with player I am currently working on a game in XNA and MonoGame. This game is supposed to be a port of KidsCanCode's tutorial series of creating tile-based games in Python. Here is a link to one of the videos in the series I'm talking about: https://www.youtube.com/watch?v=3zV2ewk-IGU&index=4&list=PLsk-HSGFjnaGQq7ybM8Lgkh5EMxUWPm2i

My issue is that my player and camera don't move like how KidsCanCode's player and camera move (you can see KidsCanCode's player and camera movement by clicking on the link above). My camera and player are out of sync. The player can easily go outside of the camera.

Here is the camera code:

public class Camera
{
    public float Rotation { get; private set; } = 0;
    //private Matrix OldTransform;
    //public Vector2 Position { get; private set; }
    public float Zoom { get; private set; } = 1f;

    public int ScreenWidth { get; set; }
    public int ScreenHeight { get; set; }

    public int MapWidth { get; set; }
    public int MapHeight { get; set; }

    private Vector2 Position;

    const float Velocity = 280f;

    public void GetTransformation(out Matrix transform)
    {
        float x = -Position.X;
        float y = -Position.Y;

        transform =
      Matrix.CreateTranslation(new Vector3(x, y, 0));

    }

    public Camera(int screenWidth, int screenHeight, int mapWidth, int mapHeight)
    {
        ScreenWidth = screenWidth;
        ScreenHeight = screenHeight;

        MapWidth = mapWidth;
        MapHeight = mapHeight;
    }

    public void ApplyPositionFromSprite(Sprite sprite)
    {
        //Camera is supposed to center on sprite

        //Camera is always supposed to be ahead of player unless player is close to the edge

        float x = sprite.Position.X;
        float y = sprite.Position.Y;

        x = Math.Max(x, 0);
        y = Math.Max(y, 0);

        x = Math.Min(x, MapWidth - ScreenWidth);
        y = Math.Min(y, MapHeight - ScreenHeight);

        this.Position = new Vector2(x, y);
   }

Can someone tell me what's wrong with my code? Here is a link to the GitHub page.

sentences:
Using XBox 360 controller in Unity game - game doesn't recognize axis movement I have a problem with the usage of XBox controller in Unity game. I connected the controller to the PC and it works fine, I also managed to use it in the game itself - I'm using "A" button to fire and Start to start the game and they work properly. However the game doesn't recognize the x-axis movement. I'm not sure if the problem is in the input settings or my code. This is how the Horizontal movement is defined in the game:

This is the code that handles the movement:

   float x = Input.GetAxis("Horizontal");
        Vector3 newPosition = new Vector3(transform.position.x + x*playerXMoveSpeed, 0, 0);
        newPosition.y = transform.position.y;
        newPosition.z = 0;

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

        var limit = animator.SpriteRenderer.bounds.extents;
        if (transform.position.x - limit.x < leftBorder)
        {
            var capped = transform.position;
            capped.x = leftBorder + limit.x;
            transform.position = capped;
        }
        else if (transform.position.x + limit.x > rightBorder)
        {
            var capped = transform.position;
            capped.x = rightBorder - limit.x;
            transform.position = capped;
        }

        OnMove(gameObject);

All variables are more or less self explanatory, the OnMove is a delegate that just applies the transform to the gameObject in question. The entire code is inside a void method called Move(). That method is called inside an if statement:

if ((Input.GetAxis("Horizontal") != 0.0f || Input.GetButtonDown("Horizontal")) && !IsContinueDisplayed)
        {
            FollowTouch();
        }

Like I said, the game recognizes the other buttons, but not the x-axis, it doesn't move the character. The Input.GetButtonDown is there just so keyboard input would be supported also (and it works properly).
Can you see the problem with this code or settings? Please advise.

sentences:
LibGDX collision detection on moving and rotating object (rectangle enemy) i am trying to get collision dectection working properly but when i do it, the collision area keeps moving. no matter what i tried.
there are 2 objects and the objects are moving and i cannot get the area of the collision to follow the enemy/object.

i am using the method below to see if the collision will work and it does not follow the enemy properly.

enemy class extends sprite {

the above is an example of how i am using the sprite extension.

the object/enemy is a sprite from libgdx the class is extended by sprite.

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);

shapeRenderer.rect(rect1.getX() + (rect1.getWidth() / 2), rect1.getY()  + (rect1.getHeight() / 2) - 2, rect1.getOriginX() - 1, rect1.getOriginY() - 4, 1.0f, 1.0f, rect1.getRotation());

shapeRenderer.rect(rect2.getX() - 10, rect2.getY() - 10, rect2.getWidth() - 10, rect2.getHeight() - 10, rect2.getOriginX(), rect2.getOriginY(), rect2.getRotation());

shapeRenderer.end();

this is in the enemy class collision check

rect.set(getX() + (getWidth() / 2), getY()  + (getHeight() / 2) - 2, getOriginX() - 1, getOriginY() - 4);

this is to see if the enemy is colliding

public boolean collides(Ball ball) {
 if (getX() < ball.getX()) {
 return (Intersector.overlaps(ball.getRect1(), rect));
  }
 return false;

 }

Any help will be really nice.
thank you

sentences:
2d Grid Generation (Unity C#) I am creating a simple program in Unity C# that will generate a 2d grid using a 2d sprite prefab. I am stuck here, I don't know what to do. When ran, I receive an error.

Assets/Generator.cs(22,75): error CS0165: Use of unassigned local variable `grid_object'

I am a beginner, so I'm not sure what to do. This is most likely a rookie mistake, so thanks in advance.

using UnityEngine;
using System.Collections;
public class Generator : MonoBehaviour {

public float Width = 20;
public float Height = 20;
public Transform grid_object;
private GameObject [,] grid = new GameObject[20,20];

void Start () {
    CreateGrid();
}

private void CreateGrid() {

    for (int x = 0; x < Width; x++) {
        for (int y = 0; y < Height; y++) {
            GameObject grid_object = (GameObject)Instantiate(grid_object);
            grid_object.transform.position = new Vector2(
                grid_object.transform.position.x+x,
                grid_object.transform.position.y+y);
            grid[x,y] = grid_object;
        }
    }
 }
}

sentences:
Is this Code saving performance ? It is kind of a Occlusion Culling I wanted to do Occlusion Culling on my Scene but I just get a bunch of Errors like "Couldn't load geometry..." etc. I tried to do like another way but the same thing, the Occlusion Culling just disables the Objects the Camera dont see.
I tried it with OnTriggerEnter and Exit.

I have 2 Areas one is on the left and one on the right, when the Player is walking in the first Area the Box Collider checks it and disables the Objects in Area2 but when Player is walking into Area2, Objects in Area1 disables and Different. Got the Script on both Areas that it disables a list of arrays as GameObjects.

My Question is, does this save performance ?

public GameObject[] deactivatingModels;
bool playerEntered = false;

void OnTriggerEnter (Collider other)
{

    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(false);
            Debug.Log ("Player has entered Occuling Zone");
        }
    }
}

void OnTriggerExit(Collider other)
{
    foreach(GameObject envis in deactivatingModels)
    {
        if(other.gameObject.tag == "OcclusionCuller")
        {
            envis.SetActive(true);
            Debug.Log ("Player has left Occuling Zone");
        }
    }
}

sentences:
Unity3d turn based navmesh algorithm I am developing a game in Unity3d.

In this game, 2 teams will fight without any human interaction. The fight results must be always the same, if the same teams are the same. This way, I must reproduce the same fight in many devices, getting the same results in each device.

The map where the fight happens is a 3d environment, so, my soldiers can move in any direction. And the soldiers cannot walk in the same space of another soldier, so I need an agent avoidance algorithm.

I am having some trouble to find a solution to the problem above. To achieve the 'always the same results' I am treating this fight as Turn Based Strategy game, with little fixed time intervals between the turns.

To calculate the pathfind of the soldiers, I am using the Unity3d navmesh framework. And then I move manually my agents according to the 'NavMeshAgent' 'steeringTarget' property.

But this method doesn't cover the obstacle avoidance algorithm, and my agents overlaps.

So, I am looking for a solution to my problems, It should be a manual obstacle avoidance algorithm, or a way to unity navmesh work in fixed time intervals, or a completely new approach to my path-finding problems.

sentences: XNA game looks laggy below 100 fps? My xna game is running at about 70-90fps and it looks laggy at this fps.  I'm using fraps to record the fps and I have a 120hz monitor, over 120hz looks fine but I can't understand why it feels like it's lagging so much at high fps :/.

sentences:
Why do my particles appear darker the farther I get from them? I've created the following material:

I've set up a particle system that places that material around like a cloud:

Up close, I'm getting the result I expect:

But if I go far enough, it looks like this:

Why do these dark areas appear and why are they more pronounced as I look at them from farther and farther away?

I know I can make this go away by increasing environment lighting or making the material more emissive. Do I have more options beyond these two?

sentences:
XNA Spritebatch sorting by texture vs depth I am refining my 2D game engine, and I want to look in to sorting sprite batches by texture (because I'm quite often using the same textures repeatedly).

However, I also want to retain a few 'layers' of depth (i.e. ground < buildings < units < GUI etc).

My question is, which of the following is the best approach (in terms of performance)?

Create multiple SpriteBatches and Begin() and End() them in order; or...
Create a single SpriteBatch and call Begin() and End() multiple times, once for each layer (in order)?

sentences:
Successful Elements to a 4X Game 4X games (That is, Xpand, Xplore, Xploit and Xterminate) like Civilization, Sins of a Solar Empire, and other top Strategy games, all seem to have the same addictive hook. I'd like to know what elements these developers incorporate into their games to make them:

Well paced (You can't beat the game in 5 minutes, but it wont take a week)
Replayable (The first game isn't your last)
Competetive (The AI doesn't play like a 3 year old)
Not repetetive (Such as using the same strategy over and over, or spamming units)
Economical (Not having 7 trillion metal and coins after 10 minutes of play)
Not to much micro-managing
Exciting (Necessary?) combat
You stil need to use strategy
Intuitive interfaces (Civilization 5 is a good example)
And any other important parts to the Strategy/4X genre

Some of these seem pretty simple, but others look like balancing acts, and I'd like to have some opinions on how to make a game that is fun to play. I'd be grateful if anyone could answer tell me how you or another game\developer has managed to successfully balance them together.

sentences:
Hierarchical state machines I have a rather simple state machine to control my Unity character and as the actions the character can perform increase, so does the complexity of state management, I have been reading about hierarchical state machines, they seem like the answer to my problems but I cannot 'connect' the theory to actual implementation, take for example the below Movement State
public class Player_Movement : BaseState
{
    public Player_Movement(PlayerController playerController, EntityStateMachine_Comp entityStateMachineComponent) : base(playerController, entityStateMachineComponent)
    {

    }

    public override void OnEnter()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", true);
        _playerController.GetComponent<Cast_Component>().OnCastReady.AddListener(() =>
        {
            _stateMachineController.ChangeToState(new Player_Movement_Casting(_playerController, _stateMachineController));
        });
    }

    public override void OnExit()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", false);
    }

    public override void OnFixedUpdate(StateMachineContext _context)
    {
        //If movement input is zero
        if (_playerController.PlayerInput.inputData.Movement.Input == Vector3.zero)
        {
            _stateMachineController.ChangeToState(new Player_Idle_State(_playerController, _stateMachineController));
        }
        else
        {
            _playerController.motor.MoveAndRotateTowards(_playerController.PlayerInput.inputData.Movement.Input_CameraRelative);
        }
    }

    public override void OnUpdate(StateMachineContext _context)
    {
        if (Input.GetKey(KeyCode.LeftShift))
        {
            _playerController.motor.IsSprinting = true;
            _playerController.motor.Speed = _playerController.motor.walkSpeed * _playerController.motor.sprintSpreedModifier;
        }
        else
        {
            _playerController.motor.IsSprinting = false;
            _playerController.motor.Speed = _playerController.motor.walkSpeed;
        }

        if (!_playerController.motor.IsGrounded && _playerController.Rigidbody.velocity.y < 0)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Falling_State(_playerController, _stateMachineController));
        }

        if (Input.GetKeyDown(KeyCode.Space) && _playerController.motor.IsGrounded)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Jump_State(_playerController, _stateMachineController));
        }
    }
}

My current goal is to have this become my super state for my movement state machine, I would like to add a sub state to this (Cast Movement) that simply calls _playerController.motor.Move instead of _playerController.motor.MoveAndRotateTowards as I would like to have a different style of movement while aiming a spell, but how would I write this substate so that it only handles how the character moves and falls back on the super state for everything else?
I have the feeling I have to re-write how my state machine works but I have no idea where to start except I probably need to seperate transitions out of the states themselves? perhaps? haha

sentences:
Initializing Variables, Difference between Awake and in-class initialization public class ExampleClass: MonoBehaviour
{
   int exampleVariable = 0;
   int exampleVariableForAwake;
   void Awake()
   {
      exampleVariableForAwake = 0;
   }
}

What is the difference between initializing a variable at declaration vs. initilize in Awake?
Which I understand is to be used in place of constructors in Unity C#, welcome to correct me if I'm wrong.

Which usage is considered a proper convention by the community, if any?

Same question might also be in order for Properties, so I'll leave that open ended.

sentences:
Drawing a partial sprite with batch-LibGdx I have a sprite like this.

I want to draw this sprite in such a way that sprite is growing from bottom to top, using sprite batch on tap.for that,I have written the following code:

  if (MyInputProcessor.isTap)
{
Sprite stickSprite = new Sprite(stickTexture);
stickSprite.setPosition(stick.getX(),stick.getY());
for(float n=0;n<100;n++)
{
     float i = 0.01f * n;
    batch.draw(
    stickSprite.getTexture(),
     stick.getX(),
     stick.getY(),
         stickSprite.getWidth() / 2,
         stickSprite.getHeight() / 2,

         stickSprite.getWidth(),
         stickSprite.getHeight()*i,  //multiplying with height
         stickSprite.getScaleX(),
         stickSprite.getScaleY(),
        0 ,
        stickSprite.getRegionX(),
        stickSprite.getRegionY(),

        stickSprite.getRegionWidth(),
        stickSprite.getRegionHeight(),
        false,
        false);

 }
MyInputProcessor.isTap = false;

}

Here the i value increments but not taking effect in the code to scale.
Whats wrong with the code?

I tried this also:

   private void drawStick() {

    Sprite stickSprite = new Sprite(stickTexture);

    if (MyInputProcessor.isTap)
    {
       stickSprite.setPosition(stick.getX(),stick.getY());
       for(float n=0;n<=100;n++)
       {
        float i = 0.01f * n;
        stickSprite.setSize(stickSprite.getWidth(),stickSprite.getHeight()+i);
        }
    }
  stickSprite.draw(batch);

But rendering full sprite only.

sentences: Unity set ui image as active onclick I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just starting out and a little lost. I think some guidance here could really set me in motion. Thanks!

sentences:
How do I find all game objects with particular name? I'm trying to mimic FindGameObjectsWithTag with FindGameObjectsWithName. I know using tags is faster, but I'm trying create a way to search for objects I spawn with a child object I name on instantiation through the inspector.

My goal is create multiple enemy spawners. My current spawner has a drag and drop variable for enemy prefabs. It looks for enemies tagged "ReSpawn", then checks if that length is below a value, to start spawning more. I would like to upgrade my current single spawner to still check for enemies named "ReSpawn", but then check if those respawns have a child object a name specified in the editor.  This way, I can set the enemy spawners anywhere (e.g. near water, tall grass, forests, etc), and when I defeat one, the specific spawner will instantiate one of its opponents for that area.

Here is my code, so far:

var ThisSpot:String;
var Oppos : GameObject[];
var OppoCount : GameObject[];

var HowMany = 3;
var spawnSizeArea = 25;

function Start() {
    StartCoroutine ("Spawn");
}

function Update () {
    OppoCount = GameObject.FindGameObjectsWithTag("Respawn");
    // OppoCount = GameObject.FindWithName(ThisSpot);  This is what I am trying to achieve

    if(OppoCount.length < HowMany) {
        StartCoroutine ("Spawn");
    }
}

function Spawn() {
    var length = Oppos.length-1;
    var index = Mathf.Round(length*UnityEngine.Random.value);
    curSpawn = Oppos[index];

    var xz = Random.insideUnitCircle * spawnSizeArea;
    var newPosition = Vector3(xz.x,0,xz.x)+transform.position;

    yield WaitForSeconds(Random.Range(70,120));

    Instantiate(curSpawn, newPosition, transform.rotation);

    // Then I could use these 2 lines of code below to use multiple spawners
    //var newOp : GameObject = Instantiate(curSpawn, newPosition, transform.rotation);
    //newOp.transform.Find("fighter").gameObject.name=ThisSpot;

    StopCoroutine("Spawn");
}

sentences:
JavaScript - Updating a canvas real-time... from server-side or client-side I have this 2D tilemap game 13x13 viewport (169 tiles drawn on canvas at a time) of a 150x150 map. Each tile is 32x32px. Obviously I only update the 13x13 viewport...

I want to update a canvas in real-time as the world-map will be handled server-side. At least the logic... the drawning... should it be server-side or client-side?

Now, I am using Socket.IO for real-time data. Based on that current player's x and y, the canvas is drawn from where that person is on the map.

I can do this two ways:

(Server-side) Use node-canvas to draw the  server-side via NodeJS and
transmit back the new canvas. Is it possible? Because it seems I can
only do it once via a PNG.
(Client-side) Transmit the 169 array of the new tileset (when player moves or action happens). Doing the
logic server-side and draw it on the client-side from the array received from a callback.

Client-side problem: The problem here is that transmitting that large of an array does take seconds (2-3) so there is some lag.

Server-side problem: There is no continuous streaming of a canvas being drawn from the server that outputs to client... is there? Or am I not looking hard enough at node-canvas npm module.

I am not using any JavaScript game framework.

What are my best options here?

sentences:
What are the practical limitations of using XNA? Since development on XNA has long since stopped, it is unlikely that it will ever be updated to be in line with modern graphics technology, however aside from the obvious fact that it's Windows-only - what are the practical limitations of using XNA?

The obvious ones are:

It uses DirectX 9.0 - which means no compute or geometry shaders.
It's Windows-only (Excluding Monogame/FNA)
It requires the installation of .NET and XNA on a client's computer.

#2 and #3 are obvious limitations, but can be considered acceptable. #1 on the other hand, is a bit more complicated. In practical terms what does being limited to DirectX 9.0 mean in terms of game development and graphical capability? No geometry or compute shaders means having to do more heavy lifting on the CPU, but is there any other limitations that an end user would notice? Ideally beyond a generic term such as "graphical fidelity".

sentences:
Playing a simple camera animation with Animator I haven't worked with the animation system in Unity before and am getting overwhelmed trying to figure out how to start playback of a simple animation. Yes, this is a "stupid question", but I've spent more than an hour researching this and can't find an answer on how to do something this simple:

I've created an animation called CameraZoom for the scene's camera. The CameraZoom animation is supposed to play when a specific event occurs, so I want to trigger it from script. I've created the animation on the camera, it has the Animator component attached to it, and by default the animation plays as soon as the scene starts. I can stop the animation from code, but when I try to start it, nothing happens. Here's my code:

private Animator myAnimation;
void Start () {
    myAnimation = gameObject.GetComponent<Animator>();
    myAnimation.Stop();
}
public void ZoomOut() {
    Debug.Log("Zoom out!");
    myAnimation.Play("CameraZoom");
}

This script successfully stops the animation when the scene starts, but when I call ZoomOut, the animation doesn't play.

Here are the states:

It may be I'm not understanding how to utilize the state machine and I'm trying to play the animation incorrectly. Tutorials I can find on the Animator are either too vague or discuss other features such as triggers and parameters that I don't know how to apply to such a simple task.

I know I could whip up a Coroutine to zoom the camera out in about 30 seconds, but I'm trying to learn how to utilize the Animator for basic keyframe animations.

sentences: How can I go about testing games on a console I was wondering how I could play a game I've made on a console (PS3). I don't want to sell it or anything I just want to test it for now, also do I still have to do that whole registration thing to do this? Oh, I'm also using Unreal Engine 4 for this.

sentences:
UE4 Drag and Drop: Place PaperCharacter Over Image Widget I'm working on adding drag and drop functionality to my game. I have it working with the exception of I can't get what I'm dropping to be placed where it was dropped. I've tried a number of different things but I can't seem to get it to work.

The image shows my OnDrop with some leftovers of things I have been trying. And when I adjust the MakeTransform manually, a change of 1.0 seems to move the character much more than 1 pixel. The item I am creating in the OnDrop is a PaperCharacter.

Here is an image from part of the level showing the result. The white blocks circled in red are UMG images so I can eventually adjust them to look better and change dynamically as the player is dragging. The player can only drop the item over one of there squares. This functionality works. But no matter which square I drop over the item always gets placed at the point circled in green or nowhere to be seen in the viewport. This is a 2d game so everything has to be in the viewport to be seen. The white squares are attached to a PaperSpriteActor. Not sure if that matters or not.

What I need to have happen is when the player drops the item above one of the squares, the PaperCharacter must be dropped right in the middle of that square. How do I go about making that happen?

EDIT

Another observation, if I manually set the MakeTransform location to 0, 0, 0 and drop the item on the same white square multiple times, the item is dropped in a slightly different spot each time.

sentences:
Is speed runs ranking mechanism heuristic or statistics based? I'm looking to implement some sort of speed run mode in my game.

Let's say I want to assign each level three 'winning' bars, (bronze, silver and gold for example), which are independent of the player, and are based only on the difficulty of the level itself.

I can think of two methods:

Having a heuristic which outputs these three bars, given the level's settings.
Spending some time for testing the game over several players, and collecting statistics (mainly time to completion), in order to determine the bars.

Are both methods considered acceptable? Or is one of them is somewhat "banned"?

I would also like to consider a more limited situation, where there's not a real option to perform a wide-scale statistics collection. Would that completely throw the second method off the windows? Or is small-scaled (for example, having 5-10 players playing a level for a few times) is usually enough in common indie game developer scales?

I guess the answer here should depend on the nature of the game itself, but I wonder if this certain type of test ('winning bars' for speed runs) is considered easy to handle.

sentences:
Guidelines when rigging a character Just wondering that how many IK (Inverse Kinematic) bones should you apply to a game character before it starts to go resource hog. Basically should you try to get rid of IK bones and just try to animate without them but using IK bones makes things easier for the animator but might cause unnecessary use of resources and possibly cause bottleneck when calculating bone and mesh translations.

I'm using Blender and couple of animation tutorials are suggesting to use IK controllers and they indeed help a lot but when importing the character into a game they might be plain pointless since they are used only to help the animator.

sentences:
How do I correctly use singletons in C++ engine programming? I know singletons are bad, my old game engine used a singleton 'Game' object that handles everything from holding all data to the actual game loop. Now I'm making a new one.

The problem is, to draw something in SFML you use window.draw(sprite) where window is an sf::RenderWindow. There are 2 options I see here:

Make a singleton Game object which every entity in the game retrieves (what I used before)
Make this the constructor for entities: Entity(x, y, window, view, ...etc) (this is just ridiculous and annoying)

What would be the proper way to do this while keeping an Entity's constructor to just x and y?

I could try and keep track of everything I make in the main game loop, and just manually draw their sprite in the game loop, but that too seems messy, and I also want absolute full control over an entire draw function for the entity.

sentences:
Limit rotation heading by cone/angle What is a fast way of limiting the heading vector to a certain angle so that it turns in greater distance relative to the limit.

A smaller cone/angle should make the object take a far bigger curve to traverse to reach its goal where a larger cone/angel allows the object to rotate faster in the direction of its goal.

If there are some vector tricks i'll be glad to know them!

sentences:
How can I stop the next screen from briefly displaying at the start of a CCTransitionFadeTR? I am testing transitions in cocos2d, and am running into a problem.

I have a MainMenu screen which contains a button.  The idea is that clicking on the button will trigger a CCTransitionFadeTR transition to a WhackMain screen where there is a CCLabelTTF which displays "Hello World".

But when I press the button and start the transition, the WhackMain screen appears at full opacity for a moment before the transition from MainMenu to WhackMain begins.  The transition appears to be working correctly, apart from WhackMain being visible for a moment before the transition begins.

How can I keep this from happening?

Here is my code, if it will help identify the problem:

MainMenu.m:

#import "MainMenu.h"
#import "WhackMain.h"

@implementation MainMenu

+(CCScene *) scene1 {
// 'scene' is an autorelease object.
CCScene *scene1 = [CCScene node];

// 'layer' is an autorelease object.
MainMenu *layer1 = [MainMenu node];

// add layer as a child to scene
[scene1 addChild: layer1];

// return the scene
return scene1;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    CGSize winSize = [[CCDirector sharedDirector] winSize];

    // Create a label for display purposes
    _label = [[CCLabelTTF labelWithString:@"Last button: None"
                               dimensions:CGSizeMake(320, 50) alignment:UITextAlignmentCenter
                                 fontName:@"Arial" fontSize:32.0] retain];
    _label.position = ccp(winSize.width/2,
                          winSize.height-(_label.contentSize.height/2));
    [self addChild:_label];

    // Standard method to create a button
    CCMenuItem *starMenuItem = [CCMenuItemImage
                                itemFromNormalImage:@"ButtonStar.png" selectedImage:@"ButtonStarSel.png"
                                target:self selector:@selector(starButtonTapped:)];

    // position the label on the center of the screen
    starMenuItem.position =  ccp( winSize.width /2 , winSize.height/2 );

    CCMenu *starMenu = [CCMenu menuWithItems:starMenuItem, nil];
    starMenu.position = CGPointZero;
    [self addChild:starMenu];
}
return self;
}

- (void)starButtonTapped:(id)sender {
  [_label setString:@"Last button: *"];
  [[CCDirector sharedDirector] replaceScene:[CCTransitionFadeTR
                                           transitionWithDuration:2 scene:[WhackMain scene2]]];
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
}

@end

WhackMenu.m:

#import "WhackMain.h"
#import "MainMenu.h"

@implementation WhackMain

+(CCScene *) scene2 {
// 'scene' is an autorelease object.
CCScene *scene2 = [CCScene node];

// 'layer' is an autorelease object.
WhackMain *layer2 = [WhackMain node];

// add layer as a child to scene
[scene2 addChild: layer2];

// return the scene
return scene2;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];
}
return self;
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
 }

@end

sentences:
How can I show a texture in a separate window in an XNA game? I'm playing around with random map generation and what I want to do is:

Input a command to generate a random map.
A texture will be created resembling the generation, each pixel resembling each tile.
A new window will pop-up, without removing the original one, that will contain the texture.

I know how to do this except for the last part. Would someone please tell me how to create a new window and draw a texture to this window?

sentences:
Handling different renderers Y axis direction in a single engine I have an engine that uses either three.js (3D WebGL rendering library) or pixi.js (2D rendering library) depending on the game.

The problem is that pixi.js has y-axis pointing downwards (same as in most 2D applications), while three.js has it up, like most 3D rendering systems.

I am wondering if there is a way to gracefully handle the difference in the engine, so that the user doesn't have to remember to invert everything depending on if they use 2D or 3D.

Are there any known solutions or engines doing something similar? My first guess would be trying to invert all coordinates, but this seems like an ugly hack that won't necessarily handle all situations.

sentences:
How can I make a chest that can be opened and shut in SteamVR? I'm working in Unity with SteamVR for a school project. I'm trying to have a chest that can be opened and shut. I tried using a hinge joint but it would break if the attached body was static which is what I want.
I'm now trying to use a circular drive which works better but the lid to the box will move away from the intended position when colliding with the body of the box which is set to static and kinematic.
I can fix this by setting the lid to kinematic but it won't collide with the body anymore. Both the lid and body are properly colliding with the hand and with a sphere I added to help test collisions.
I'm assuming the issue is that two kinematic objects can't collide with each other but I don't know how else to approach this.

sentences:
How many database connection should use in a MMO game server? Game server links to database, how many database connection should use? The data update works like this:
update role object to database every X minutes, commit all updates every Y minutes.

There are 3 ways:

Only one database connection
One worker thread one database connection and set transaction level to "Read Uncommitted". Worker thread loop all roles in it to do update & commit periodically
One game session one database connection and set transaction level to "Read Uncommitted". A dedicated thread to loop all connections to do update & commit periodically

Method 1 has a problem which database connection object needs shared by multiple worker threads, for JDBC, connection class is thread safe, but I don't know what about C++ such as MySql driver. If it have to use mutex to make thread safe, there will be a performance degrade: all worker threads have to synchronize their data frequently.

Method 2 has a problem to update old data. One map in game server run in dedicated worker thread. For example, role A in map 1 which compute by thread 1. role A transport to map 2 which compute by thread 2. This might cause thread 1's commit call after thread 2's commit call, so the older update which already executed in thread 1 commit after thread 2's commit.

Method 3 seems is a waste of system resource. Because in MMO there is no need to be transaction isolation, any change in a game session should be immediately seen by other sessions. In contrast with web app, so many connections has litte meaning. However the "Read Uncommitted" isolation level can let other session read data which has not committed yet.

==================================

I forget there is a thing called connection pool. Generally it is thread safe implemented so I do not need to care synchronization problem anymore. And the connection number is dynamic so I can leave problem of how many connection number to it. Only I do is get a connection from it.
So, method 1 & 3 both practical.

sentences:
2D Collision: Check before or check after? I'm using velocity to move my character, I just add/subtract 0.4f and then update the players position in the update loop.

I was wondering, when would be the best place to check for collision? Do I go ahead move the player, and then if I colliding push him out of the wall until there's no collision? Or do I check collision as soon as the key is pressed, and if there is - somehow find the distance and move the player?

My problem is that my game is tile based, but the world is constantly rotating around the player - I have a function that returns a list of objects of each block that the player is colliding with, and I'm having trouble separating wall collisions with floor collisions

sentences:
Making various shapes equally difficult to tap I'm developing a game where the player quickly has to tap/click on various shapes such as squares, circles, triangles, stars and so on. I'm now struggling with the following task: I'm searching for a normalized size for each shape, so that every shape is equally difficult to hit. E.g. given a circle with a radius r, how do I find the length l of the corresponding square?

At first glance I thought: Easy. Just make all shapes share the same area A. So, in the example above, l = sqrt(pi). http://en.wikipedia.org/wiki/Squaring_the_circle

But on second thought, this does not seem to be the best metric. Imagine a star with many long, thin, pointy arms or a very long but thin line. Even if they have the same area as a circle or square, they are still more difficult to hit.

So, what might be a better approach? Maybe something involving the "form factor" (circumference squared divided by area C²/A)?

sentences:
Useful resources for beginning AI What resources are available, including both free articles/ebooks and physical books and things, for game developers looking to begin simple AI programming/design?

Note: I know of this question, but that's more asking about where to start on a specific topic; I'm more asking about resources in general.

sentences:
How does an HLSL shader actually end up affecting the render output? I understand the syntax of HLSL, for example let's pretend I have this as my HLSL:

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = position;
    output.position.xy *= 0.7f;    // "shrink" the vertex on the x and y axes
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

and I compile it like this:

D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);

How does it like... know to change... I'm confused about exactly what the pipeline between HLSL and the actual pixels/vertices on the screen is.

Is this what actually "applies" them?

dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);

// set the shader objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);

Keep in mind I'm like a literal beginner at this stuff. Can someone maybe explain what it's doing? I'm assuming the vertex HLSL function goes through every vertex and then changes them to whatever I have in the function, and the output is what was changed... and similarly for the pixel shader?

Another confusion, I know what a pixel is, and I understand what a vertex is... but what exactly does the pixel shader do?

sentences:
How can I store and load large 3D environments (terrains or cities)? I am interested in how a large area 3D environment in games like Grand Theft Auto V or Far Cry can be stored (on disk, in what file format) and how that data can be retrieved when it is used in a game. By "the environment" I mean only static objects like terrain with vegetation, city areas with buildings, et cetera. I'm not referring to temporary or moving objects like people or cars. I am not interested in scene rendering.

I guess it may be convenient to shard (horizontally partition) the data by location creating something like "tiles" because it is usually accessed by location and such tiling will help to keep data that is related together (and reads will be faster). Also I guess the data for sure is stored in some (compressed?) 3D format with the respect to tiling. There probably have to be mechanisms that will split one object to two (or more) parts if it does not fit into a single tile.

I have found a somewhat related question (How a 3D game map is stored and handled) but it only briefly answers small part of my question.

sentences:
libGdx Window .pack() not working I'm trying to make a window, then use the pack method to get the right size, but the window maximizes instead. Here's my code:

private Table buildOptionsWindowLayer() {
    winOptions = new Window("Options", skinLibgdx);
    // (...) building some widgets

    Gdx.app.log(TAG, "pref width is " + winOptions.getPrefWidth());
    // displays: "pref width is 247.0"

    winOptions.pack();

    // move the window
    winOptions.setPosition(Constants.VIEWPORT_GUI_HEIGHT - winOptions.getWidth() - 50, 50);
    return winOptions;
}

The window ends up with a width of 800.0f. Why?

What it is supposed to render:

What it does render:

sentences:
How do I calculate distance between a point and an axis-aligned rectangle? I have a 2D rectangle with x, y position, height and width, and a randomly positioned point nearby.

Is there a way to check if this point might collide with the rectangle if it is closer than a certain distance? Imagine an invisible radius outside of that point colliding with said rectangle. I have problems with this simply because it is not a square!

sentences:
Specular Light not working Phong shading I want to implement Phong-Shading using GLSL. I also want to calulate all values using uniforms in the shaders.

Nearly everything works fine, but there is an error with the specular term of the equation.

Here is my vertex shader:

#version 330
layout(location = 0) in vec3 vertex;
layout(location = 1) in vec3 vertex_normal;

uniform vec3 light_ambient_color;
uniform vec3 light_diffuse_color;
uniform vec3 light_specular_color;
uniform vec3 light_position;

uniform vec3 material_ambient_color;
uniform vec3 material_diffuse_color;
uniform vec3 material_specular_color;
uniform float material_specular_shininess;

out vec3 vNormal;
out vec3 camVec;
out vec3 lightVec;

out vec3 diffuse;
out vec3 ambient;
out vec3 specular;
out float shininess;

uniform mat4 view;
uniform mat4 modelview;
uniform mat4 projection;

void main() {

    diffuse = material_diffuse_color.rgb * light_diffuse_color.rgb;
    ambient = material_ambient_color.rgb * light_ambient_color.rgb;
    specular = material_specular_color.rgb * light_specular_color.rgb;
    shininess = material_specular_shininess;

    mat4 normalMat = transpose(inverse(modelview));

    vNormal = vec3(normalMat * vec4(vertex_normal,0.0));
    vec4 pos = projection  * modelview  * vec4(vertex,1.0);

    camVec = pos.xyz;
    lightVec = (1) *(light_position.xyz - pos.xyz);

    gl_Position = pos;
}

And this is my fragment shader:

#version 330

in vec3 vNormal;
in vec3 camVec;
in vec3 lightVec;

in vec3 diffuse;
in vec3 ambient;
in vec3 specular;
in float shininess;

// this defines the fragment output
out vec4 color;

void main() {

  vec3 normal = normalize(vNormal);
  vec3 viewDir = normalize(camVec);
  vec3 lightDir = normalize(lightVec);

  vec3 myDiffuse = normalize(diffuse);
  vec3 myAmbient = normalize(ambient);
  vec3 mySpecular = normalize(specular);

    vec3 finalColor = ambient;
    float lambert = dot(normal,lightDir);
    vec3 specColor;

    if(lambert < 0.0){
        specColor = vec3(0.0,0.0,0.0);
    }else{
        finalColor += myDiffuse * lambert;

        vec3 h = (viewDir + lightDir ) / length(viewDir + lightDir);
        float beta = dot(h, normal);

        finalColor += mySpecular * pow(beta, shininess);
    }

    color = vec4(finalColor,0);
}

All uniforms are set correctly.
Here is what it looks like without the specular term:

And this happens when I add the specular term (which is not working):

Edit:
Another screenshot with changing pos.xyz to -pos.xyz in the vertex-shader

sentences:
Is there a way to turn collision detection system off completely in Unity? My world setup is 2D Top-Down. All collisions are disabled from the collision matrix.

There are no collisions in the scene as I wanted, but as I perceive, Unity is still trying to calculate collisions in the background. So I'm experiencing serious frame rate drops because of Physics2D.Simulate when I have about 2k colliders moving over each other on the scene.

I followed the suggestions about colliders and rigidbodies on the API exactly (so I know the stuff about not to move static colliders without rigidbody, that's not the case here), but I somehow can't manage to tell Unity that I don't want her to calculate "possible" collisions.

I only want colliders for Raycast2D, OverlapCircle and making movements a bit realistic.

Thanks in advance for all suggestions.

sentences:
Rotation matrices from Quaternion.Identity and -Quaternion.Identity are the same? If I create a rotation matrix from an identity quaternion then it is the same as a creating it from a negative identity quaternion

        Matrix m0 = Matrix.CreateFromQuaternion(Quaternion.Identity);
        Matrix m1 = Matrix.CreateFromQuaternion(-Quaternion.Identity);

        Console.WriteLine(m0);
        Console.WriteLine(m1);

        Console.WriteLine(m0.Forward);   // {X:0 Y:0 Z:-1}
        Console.WriteLine(m1.Forward);   // {X:0 Y:0 Z:-1}

Why is this the case?

If I use a negative identity matrix

        Quaternion q0 = Quaternion.CreateFromRotationMatrix(Matrix.Identity);
        Quaternion q1 = Quaternion.CreateFromRotationMatrix(-Matrix.Identity);

the orientation will be rotated 180 degrees as expected.

sentences:
Windows 10 User has only DX 10.1 API A user of ours has an issue whereby they cannot run our application, which requires DX11 API support and hardware support for DX10.1. The strange this about this issue is that the user is running Windows 10, having upgraded from Vista(!).
His DXDiag output looks like this:
         Operating System: Windows 10 Pro 64-bit (10.0, Build 10240) (10240.th1.150930-1750)
             Language: English (Regional Setting: English)
  System Manufacturer: Dell Inc.
         System Model: Studio 1747
                 BIOS: Default System BIOS
            Processor: Intel(R) Core(TM) i7 CPU       Q 720  @ 1.60GHz (8 CPUs), ~1.6GHz
               Memory: 4096MB RAM
  Available OS Memory: 4084MB RAM
            Page File: 3956MB used, 3839MB available
          Windows Dir: C:\WINDOWS
      DirectX Version: 10.1

...

---------------
Display Devices
---------------
      Card name: ATI Mobility Radeon HD 4650
   Manufacturer: Advanced Micro Devices, Inc.
      Chip type: ATI display adapter (0x9480)
       DAC type: Internal DAC(400MHz)
    Device Type: Full Device
     Device Key: Enum\PCI\VEN_1002&DEV_9480&SUBSYS_02EB1028&REV_00
 Display Memory: 2809 MB
 Dedicated Memory: 1017 MB
  Shared Memory: 1792 MB
   Current Mode: 1600 x 900 (32 bit) (60Hz)
   Monitor Name: Generic PnP Monitor
  Monitor Model: unknown
     Monitor Id: SEC544B
    Native Mode: 1600 x 900(p) (60.209Hz)
    Output Type: Internal
    Driver Name: aticfx64.dll,aticfx64.dll,aticfx32,aticfx32,atiumd64.dll,atidxx64.dll,atiumdag,atidxx32,atiumdva,atiumd6a.cap,atitmm64.dll
Driver File Version: 8.17.0010.1129 (English)
 Driver Version: 8.970.100.9001
    DDI Version: 10.1
 Feature Levels: 10.1,10.0,9.3,9.2,9.1
   Driver Model: WDDM 1.1
Graphics Preemption: DMA
 Compute Preemption: DMA
       Miracast: Not Supported
Hybrid Graphics GPU: Not Applicable
 Power P-states: Not Applicable
Driver Attributes: Final Retail
Driver Date/Size: 1/13/2015 17:45:56, 1094024 bytes

I am by no means a DirectX expert, but my understanding was that all post W7 OS's had DX11+ support baked in to the operating system, and that updates are provided via Windows Update. I've never seen this particular issue before, and am not sure what the next step is. The user says that they are fully up to date wrt Windows Update.
Just to clarify a little more, here is a quote from a Q&A on the steam site:

DirectX has two components - the API on the computer (the software) and the GPU (the hardware). You need both to have "support" for a specific DirectX version. What you get when you look at DxDiag is the API version installed on your operating system. It gives you the software. This number is useless if you don't have the equal number for your hardware.
DirectX 11 API (the software) comes standard with Windows 7 and Windows 8.

The issue we are having is that we use the DX11 API via SharpDX, and use feature level 10.1. So we need the DX11 API, which we had assumed was always available for > W7. It seems that this is not the case for this user, and it's the first time we have seen this.

sentences:
C# - Collision Detection problem with platforms on Monogame(XNA) So I am having issues with my platformer that I am developing. I can detect collisions fine when there are a line of parralel blocks or even single blocks. The issue I have is when blocks form an L shape.
  []   for example.
[]

When my character runs into the wall, he sort of just squeaks through and gets zoomed out. I've tried using an else statement that just sends him back a couple pixels back, but it doesn't work because I don't think it accounts for one of the two blocks. Each block is it's own object.

Any help?

This collision code is in my Player class. This is the only detection I have so far in the game. I attempted to use and adjust code from a breakernoid tutorial I found somehwere, and I realized that the code doesn't totally work for what I am doing.

public void checkYCollisions(block[] platforms)
    {

        if (position.Y >= 700)
            grounded = true;
        else
            grounded = false;

        float Xradius = Width / 2;
        float Yradius = Height / 2;
        block collidedPlatform = null;

        foreach (block p in platforms)
        {
            if ((position.X > (p.position.X - p.Width / 2 - Xradius )) &&
                (position.X < (p.position.X + p.Width / 2 + Xradius )) &&
               (position.Y > (p.position.Y - p.Height / 2 - Yradius )) &&
                (position.Y < (p.position.Y + p.Height / 2 + Yradius)))

            {
                collidedPlatform = p;
                break;
            }
        }
        //collisions work for all side of blocks.
        if (collidedPlatform != null)
        {
            if ((position.Y <
                (collidedPlatform.position.Y - collidedPlatform.Height / 1.5 /*+ radius*/)))
            {

                grounded = true;

            }

            else if ((position.Y   >
                (collidedPlatform.position.Y + collidedPlatform.Height / 2 )))
            {
                if(y_vel < 0)
                    y_vel *= -1;
                //player1.direction.Y = -1.0f * player1.direction.Y;
            }

            else
            {
                x_vel *= -2;
            }
        }

I am guessing the issue is because I only have one collided block selected at any time. So I don't really know how to fix it that I can have two blocks selected. Note, once again, this code works for all blocks that are by themselves, or just a horizontal(same x position) line of blocks. It's just that L situation where I run into a corner.

sentences:
How can I look up an object given only the name of its type? This question came from a fellow developer on Twitter, and I figured StackExchange would be a better format for explaining & sharing the answer. To paraphrase the question:

I'm setting up an in-game dev console in my Unity game, where a user should be able to call any method on any MonoBehaviour in the scene.

I want to use something like FindObjectsOfType<>, but because it's coming from a string input by the user, the class name is unknown at compile time.

I also want this to work universally, on any MonoBehaviour, not just ones I've specially instrumented or registered with the console system.

Is there a way to find instances of a type with a particular name, and call methods on them, using something like reflection?

sentences:
Restoring projection matrix I am learning to use FBOs and one of the things that I need to do when rendering something onto user defined FBO, I have to setup the projection, modelview and viewport for it. Once I am done rendering to the FBO, I need to restore these matrices. I found:

glPushAttrib(GL_VIEWPORT_BIT);
glPopAttrib();

to restore the viewport to its old state. Is there a way to restore the projection and modelview matrix to whatever it was earlier ?

Tech: C++/OpenGL

Thanks!

sentences:
Code for making Material offset follow Bone transform not exactly working In my game, I have an Eye Bone that is constantly moving.

I'm trying to make a material attached to the eye (pupil material) move in relation to the Eye bone's transform.

This Script is indeed moving the Material's offset, but it is seemingly ignoring the offsetMultiplier bit. For instance, if I set offsetMultiplier to 0, the material offset never equals 0 but instead keeps exactly following the Bone transform numbers.

What might be the mistake here?

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

public class EyeBoneMatOffset : MonoBehaviour
{
    public Transform targetBone;
    public Material mat;
    public float offsetMultiplier = 0.0f; //0 for testing purposes

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

    // Update is called once per frame
    void Update()
    {
        //Create a vector to offset the material
        var offset = new Vector2(targetBone.transform.localRotation.eulerAngles.x * offsetMultiplier,
                                 targetBone.transform.localRotation.eulerAngles.y * offsetMultiplier);

        //Apply the offset
        mat.mainTextureOffset = offset;
    }
}

Script inspector set up:

Edit:

I'm having issues getting the Eye(Pupil) Material to correctly move with the Eye bone movement.

You can see that when I hit play, the script does get the Eye Material to Initially move, but then it is (visually) frozen instead of moving back and forth. The goal is for it to correctly Eye Track the cube.

As a sidenote, for the Eye Material's X and Y offset, the visually correct range of its pupil movement is -0.45 to +0.45 (X), and -0.45 to -0.45 (Y). So it's weird to me that the X and Y offset of the Eye Materials are shown to be moving within that range (which should be good!), yet are not actually moving visually except for when the game first starts.

sentences:
Shooting Projectiles I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this article (Scroll down to the ’Shooting Projectiles’ section): https://www.raywenderlich.com/95835/cocos2d-x-tutorial-beginners

Point projPos = shooter->getPosition();
projectile->setPosition(projPos);
projectile->setVisible(true);

Vec2 offset = target->getPosition() - projPos;
offset.normalize();

auto shootAmt = offset * 1000;
auto projEndPt = shootAmt + projPos;

// Approach 1.
auto moveAct = MoveBy::create(10.0f, shootAmt);

// Approach 2.
auto moveAct = MoveTo::create(10.0f, projEndPt);

projectile->runAction(moveAct);

It works most of the time, however the projectiles speed varies, it seems based on the distance between the player and shooter. At medium distances the speed is fine, at shorter distances the speed is too slow and at longer distances the speed is too fast. The time being fixed (10.0f) over a variable distances seems to be the cause. I have tried both approaches as commented in the code, moving by move amount (Approach 1) and move to point (Approach 2) and both seem to give the same result.

sentences:
Issues with Polygon Fixtures in Farseer I've been working with the Farseer Physics Engine (which since posting has become Velcro Physics) to try and build a simple 2D, sidescrolling game. Creating basic rectangle blocks worked easily enough, but I discovered when I tried to create some very simple triangle slopes that my existing 'character' avatar would not collide with them. This baffled me for a while until I began using the debug view to discover that while the body of the triangle appeared where I had placed them, the fixture which determined collisions was offset, as shown below (The debugging view is itself offset from the actual sprites because I'm clearly not smart enough to figure out the proper projection matrix):.
It turns out that whatever coordinates I give for the center of the triangle, the fixture appears at (2x, 2y). For example, in the attached image, there is a triangle sloping up to the left at (-4, -1) in the game's coordinate system. The fixture (light green triangle bordered in magenta) is at (-8, -2).
I know this has to be a simple mistake I'm making, but damned if I can figure it out. Here's how I create a new slope in the level:
public override void AddToWorld(FarseerPhysics.Dynamics.World world, Vector2 position)
        {
            body = BodyFactory.CreateBody(world, position);
            body.BodyType = FarseerPhysics.Dynamics.BodyType.Static;

            Vertices vertices = new Vertices();
            if (type == SlopeType.LEFT)
            {
                vertices.Add(new Vector2(position.X - 0.5f, position.Y - 0.5f));
            }
            else
            {
                vertices.Add(new Vector2(position.X + 0.5f, position.Y - 0.5f));
            }
            vertices.Add(new Vector2(Position.X + 0.5f, position.Y + 0.5f));
            vertices.Add(new Vector2(position.X - 0.5f, position.Y + 0.5f));

            FixtureFactory.AttachPolygon(vertices, 1f, body, this);

        }

The position parameter is given to be the center, thus the 0.5 offsets to create the triangle's edges.
Any insight would be greatly appreciated; this engine seems powerful but the documentation is definitely lacking.

sentences:
Why is 90 FPS recommended for Virtual Reality games? Origin of the question
I have recently finished an internship at a (small) game development company which is working on a Virtual Reality game that is also used in medical rehabilitation. From what I have heard and read online, you generally want to achieve at least 90 FPS in a VR game because otherwise the player can get motion sickness or dizzyness, etc.
I am aware that not everyone is getting sick but from what I have read, you still want to aim for that 90 FPS to be sure, although I am unable to find the exact reason for this number. (it feels like an industry standard)
Questions
"Why is 90 FPS an industry standard when developing a VR game?" and "Why can people get sick when playing on lower frame rates?"
When searching online, I keep reading about 'studies' that show that people will be more likely to feel sick or dizzy when playing a VR game below 90 FPS but I never see the actual reason (source) as to why that is.
I can only make assumptions based on what I know already but I would like to know the exact reason (or as much of a reason as possible) and hopefully a source as to why 90 FPS is chosen (and not 80 or 100) and what causes some people to become sick from lower framerates.
sidenote: I am referring to VR games for devices as the 'Vive', 'Rift', etc. (as there are also VR Simulations for pilots, etc. which also have elements such as simulated movement that can impact sickness)

sentences:
how to create texture for modelmesh? Is there a possibiltiy to create a texture from a meshpart in xna. By getting a flat version of the mesh. So I can create a texture for it and edit that texture(via rendertarget)? I need to get the texture(wich is not yet a texture) so I can put another texture on it.

I can create a texture and put it on a certain mesh. But I just cant figure out how I can create a texture with the right size.

I also already found out i can use text2dproj in hlsl. But when i do this i get a gray stripe in the look.

Is there a better solution?

sentences:
WebGL frame rate slows down after triggering javascript event I am using Unity WebGL to host my game on a flask server and trying to throw a warning to the user whenever he tries to navigate away from the tab or mistakenly click browser's back button. Each time after the event is triggered (whenever I try to navigate away) the game slows down with a huge drop in frame rate (navigation has to be performed after the game has been loaded properly by showing the unity logo and other stuffs). Here is the script that I am using to trigger the event:

<script>
    window.addEventListener("beforeunload", function (e)
        {
            var confirmationMessage = "\o/";

            e.returnValue = confirmationMessage;
            return confirmationMessage;
        });
 </script>

What is the work-around of this problem and why the game slows down completely?

sentences:
Authoritative Server for single player but with leaderboard I made a Fps single player, timed survival with a leaderboard ( a bit like devil daggers and others).
I know would like to create a server that will prevent cheats such as avoiding collision or altering the timer.

My issue is I don't know the theory on how should my server behave. Should it run an instance of the game per player which will handle the collision and other stuff for that player ? is this viable

Any advice ?

sentences:
Chroma depth shader unity I'm trying to reproduce a post-effect with unity seen in the answer here.

Chromadepth answer

For the moment I just manage to reproduce the wave effect with a quick edge detection.
I tried multiple textures but can't find one that fit do the same effect.

I am using this texture

The result for far.

Shader "Unlit/ChromaDepthEdge"
{

    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _Ramp ("Texture", 2D) = "white" {}
        _Threshold("Threshold", Float) = 0.1
    }
    SubShader
    {
      Pass
      {
          ZTest Always Cull Off ZWrite Off
          CGPROGRAM
          #pragma vertex vert
          #pragma fragment frag
          #pragma target 3.0
          #include "UnityCG.cginc"

          struct appdata
          {
              float4 vertex : POSITION;
          };

          sampler2D _MainTex;
          sampler2D _Ramp;
          // Request camera depth buffer as a texture.
          // Incurs extra cost in forward rendering, "just there" in deferred.
          sampler2D _CameraDepthTexture;
          float4 _MainTex_TexelSize;

          float4x4 _InverseViewMatrix;

          float _Threshold;

          void vert (
              float4 vertex : POSITION,
              out float4 outpos : SV_POSITION)
          {
              outpos = UnityObjectToClipPos(vertex);
          }

          fixed4 frag (UNITY_VPOS_TYPE screenPos : VPOS) : SV_Target
          {
              // Convert pixel coordinates into screen UVs.
              float2 uv = screenPos.xy * (_ScreenParams.zw - 1.0f);

              //uv.y = (uv.y *-1) + 1;
              // Depending on setup/platform, you may need to invert uv.y
              // Sample depth buffer, linearized into the 0...1 range.
              float depth = Linear01Depth(
                    UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv)));

              float2 uvDist = 3 * _MainTex_TexelSize.xy;

              float depthUp =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, 1))));
              float depthDown =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, -1))));
              float depthLeft =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(-1, 0))));
              float depthRight =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(1, 0))));

              float mean = ((depthUp - depth) + (depthDown - depth) + (depthLeft - depth) + (depthRight - depth)) / 4;

              // Compressing the range, so we get more colour
              // variation close to the camera.
              depth = saturate(2.0f * depth);
              depth = 1.0f - depth;
              depth *= depth;
              depth = 1.0f - depth;
              //return depth;

              // Use depth value as a lookup into a colour
              // ramp texture of your choosing.
              fixed4 colour = tex2D(_Ramp, depth * 6 * _Time.y * 4);

              return lerp(colour, colour * 6, mean > _Threshold);
          }
          ENDCG
      }

    }
}

What did I miss ?

Thanks in advance.

sentences:
Selecting/Hiding is broken for Perspective but works for Orphographics views. Why? I'm learning Unreal4. Got a problem with selecting, focusing and hiding objects.

Focusing Issue: Focusing have to be done separatly for perspective view and ortho view. Why it is so?

Example: If I select an object in perspective view and focus on it (key F) everything works only for perspective view, but at the same time in ortho view no focusing occurs. So inorder to focus on the object in the ortho plales too I have repeat the whole process again: find object in orpho plane, select it, click F and only then focusing happens in all ortho view planes.

In perspective view "Show only selected" does not work, but works in ortho views
The same issue with "Show all actors".

Please, I need help. Thnaks.
P.S. Damn, it looks like I'm in some kind of a mode (for the lack of a better word). I mean in my clicking around, i've clicked ON some mode and now this selection\hiding thing works buggy...

sentences:
Doom-style 2.5D Movement Animations I've started working on a demo for my 2.5D game. For a basic scene I figured I would just use the good old fashioned doom sprites textured to a double sided plane. Simple enough. But I've been scratching my head as to how to display the proper sprite animation relative to the player viewing the sprite...if that makes since.

For example suppose I have three players in the scene Players A, B, and C as such:

Player C should see player A as:
Here's an example of what I think player A should look like from C's perspective:

While player B would see player A as follows:

My current idea is that for any given player, I will need to know the current direction of each other player, and where they are located/moving to relativly. From this, I could calculate which sprite image is required.

Is this correct? What improvements/optimizations could be made?

** EDIT **
Total number of directions will be 8 as depicted below:

For each direction there are two sprites (to show walking movement, sprites for the right hand directions are mirrors of the left):

** EDIT 2 **
Got this working and have a simple javascript/threejs example for anyone interested: https://github.com/commanderZiltoid/threejs-2.5d-fps

sentences:
Particle spawn on collision spawns too many particles So i have the following code:

private void OnCollisionEnter(Collision collision)
    {
        foreach (ContactPoint contact in collision.contacts)
        {
            if (contact.otherCollider.CompareTag("Ground"))
            {
                //Instantiate your particle system here.
                Instantiate(Effect, contact.point, Quaternion.identity);
            }
        }
    }

Now this works great however it spawns way too many particles (as the animation I am doing with the item hits the ground a lot).

Is there a way to limit the particles in a sensible way?

sentences:
How to implement smooth wandering on an annulus? I am creating a 2D action platformer and want to create some steering behavior for a mage enemy.

Basically, I want the mage to smoothly wander inside an annulus centered on my player.

Below is an image depicting an example path the mage could follow.

The enemy currently has simple seek behavior. It simply accelerates toward whatever is set as its target.

I tried choosing a random target point in the annulus every so often, but when you do this, the enemy sometimes drifts across the center of the annulus to reach a point chosen on the other side.

So my question is, how can I achieve the desired movement?

sentences:
"Binding" script functions to C++ functions I appreciate the answer to this question might be a little too broad for SE, but hopefully someone can point me in the right direction.

I'm developing a small scripting language for use in my game engine, and naturally in order to do really useful things with it, it needs to hook into actual C++ functions in my game.

For example, say I have an Inventory class, with a public function, checkItem(itemID) that is designed to check whether a certain item is in the current inventory or not.

I'd love to be able to define a scripting function that calls the built-in checkItem function for its value during some script's lifetime. Is there a standard / simple-to-implement procedure for doing this? Something that has a similar effect to LuaBind, for example?

I can of course add instructions to my scripting VM that call the functions internally, but this will make the VM a bit of a mess and require implementing separate operations for each function I wish to call.

sentences:
Need some advice regarding collision detection with the sprite changing its width and height So I'm messing around with collision detection in my tile-based game and everything works fine and dandy using this method. However, now I am trying to implement sprite sheets so my character can have a walking and jumping animation.

For one, I'd like to to be able to have each frame of variable size, I think. I want collision detection to be accurate and during a jumping animation the sprite's height will be shorter (because of the calves meeting the hamstrings). Again, this also works fine at the moment. I can get the character to animate properly each frame and cycle through animations.

The problems arise when the width and height of the character change. Often times its position will be corrected by the collision detection system and the character will be rubber-banded to random parts of the map or even go outside the map bounds. For some reason with the linked collision detection algorithm, when the width or height of the sprite is changed on the fly, the entire algorithm breaks down.

The solution I found so far is to have a single width and height of the sprite that remains constant, and only adjust the source rectangle for drawing. However, I'm not sure exactly what to set as the sprite's constant bounding box because it varies so much with the different animations.

So now I'm not sure what to do. I'm toying with the idea of pixel-perfect collision detection but I'm not sure if it would really be worth it. Does anyone know how Braid does their collision detection? My game is also a 2D sidescroller and I was quite impressed with how it was handled in that game.

Thanks for reading.

sentences:
Why I am I told "Color0 is missing" when I run the following code? In the code below, I want to draw a box on my screen. But when I run it, there is an error message:

  The current vertex declaration does not include all the elements
  required by the current vertex shader. Color0 is missing.

Here is the code in question:

    private SpriteBatch _sb;
    private Vector3 _position;

    public Vector3 Position
    {
        get { return _position; }
    }
    private Matrix _world;

    public Matrix World
    {
        get { return _world; }
    }
    private Texture2D _image;
    private VertexPositionColor[] _vertices;
    private short[] _indices;
    private Game _game;
    private IndexBuffer _ib;
    private VertexBuffer _vb;
    private BasicEffect _basicEffect;
    private BoundingBox _boundingBox;

    public BoundingBox BoundingBox
    {
        get { return _boundingBox; }
    }

    public Blackhole(Game game, Vector3 position, Matrix view, Matrix projection)
    {
        _game = game;

        _vertices = new VertexPositionColor[4];
        _vertices[0] = new VertexPositionColor(new Vector3(-100, 100, 0), Color.Red);
        _vertices[1] = new VertexPositionColor(new Vector3(100, 100, 0), Color.Green);
        _vertices[2] = new VertexPositionColor(new Vector3(100, -100, 0), Color.Blue);
        _vertices[3] = new VertexPositionColor(new Vector3(-100, -100, 0), Color.Yellow);

        _indices = new short[6];
        _indices[0] = 0; _indices[1] = 1; _indices[2] = 2;
        _indices[3] = 0; _indices[4] = 2; _indices[5] = 3;

        _vb = new VertexBuffer(game.GraphicsDevice, VertexPositionColor.VertexDeclaration, 4, BufferUsage.WriteOnly);
        _vb.SetData<VertexPositionColor>(_vertices);

        _ib = new IndexBuffer(game.GraphicsDevice, typeof(short), 6, BufferUsage.WriteOnly);
        _ib.SetData<short>(_indices);

        game.GraphicsDevice.SetVertexBuffer(_vb);
        game.GraphicsDevice.Indices = _ib;

        _basicEffect = new BasicEffect(game.GraphicsDevice);
        _basicEffect.View = view;
        _basicEffect.Projection = projection;
        _basicEffect.World = _world;
        _basicEffect.VertexColorEnabled = true;
        _basicEffect.TextureEnabled = false;

        RasterizerState newState = new RasterizerState();
        newState.CullMode = CullMode.None;
        game.GraphicsDevice.RasterizerState = newState;
        _boundingBox = new BoundingBox(new Vector3(_position.X, _position.Y, -1), new Vector3(-_position.X, -_position.Y, 1));
    }

    public void Update(GameTime gt)
    {
        _world = Matrix.Identity * Matrix.CreateTranslation(_position);
    }

    public void Draw(Matrix view, Matrix projection)
    {
        _basicEffect.View = view;
        _basicEffect.Projection = projection;

        foreach (EffectPass f in _basicEffect.CurrentTechnique.Passes)
        {
            f.Apply();

            _game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
        }
    }

What is the cause of my error?

sentences:
What is the difference between these options when saving an image as a PNG in Photoshop for my game? I'm creating sprites and tilemaps for 2D games. I might just use Unity.

What is the impact of choosing different options when saving as a .png?

sentences:
MacOS Mojave makes SDL2 unaccessible I have some code that worked with no issues on MacOS Sierra, but when I update to Mojave, my compiler always says that it can't find SDL2.

Here's the error:

20:24:40 **** Incremental Build of configuration Debug for project Causality ****
make all
Building file: ../src/engine/SE.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/engine/SE.d" -MT"src/engine/SE.o" -o "src/engine/SE.o" "../src/engine/SE.cpp"
In file included from ../src/engine/SE.cpp:1:
../src/engine/SE.h:6:10: fatal error: 'SDL2/SDL_events.h' file not found
#include <SDL2/SDL_events.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/engine/SE.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

20:24:42 Build Failed. 2 errors, 0 warnings. (took 1s.304ms)

I'm using SDL 2.0.9

My project structure is this:

src
|main.cpp
|engine
 |SE.h
 |SE.cpp
 |SE_Audio.h
 |SE_Audio.cpp
 |SE_Graphics.h
 |SE_Graphics.cpp
 |SE_Input.h
 |SE_Input.cpp
 |SE_Structs.h

I'm including the libraries with -framework SDL2 -framework Cocoa -framework SDL2_image

I'm using the exact same settings that I used before and that worked in MacOS Sierra. Please tell me what more details you need before down-voting

sentences:
Turn Based Game Match Data in iOS Hi I’m working on turn based game development using turn based API from Apple’s GameKit framework. My game is 2 player strategy game.  Currently I’m facing the issue match data update on game play screen when the player complete their turn. I have more animation on game play, so the turn  data make impact both side.

and also we need reference or guidance for following questions:

1.when i get invite from the opponent player, the app will launch and authenticate on home screen but didn’t navigate to game play screen.

2.How the match data manage easily?

3.I have  3 primary leaderboard to play the game, Is this possible to update scoreboard for every turn?

sentences:
How to check if a custom Control is focused? So I am building custom UI for my MonoGame project. I've gotten pretty far already, having created Controls such as:

Button
Panel
TextBox
Form
ComboBox
CheckBox
etc.

All of these controls obviously inherit from my abstract class Control.

This is how I check for Click on a Control:

if (Destination.Intersects(inputManager.MouseRect) && inputManager.IsMouseClicked(MouseButton.Left)) {
    Click?.Invoke(this, EventArgs.Empty);
    _focused = true;
}
else if (!Destination.Intersects(inputManager.MouseRect) && inputManager.IsMouseClicked(MouseButton.Left)) {
    _focused = false;
}

This method has gotten me pretty far already, but unfortunately it doesn't work when there are multiple TextBoxes: each TextBox I click on will become focused, and any key I press will be typed in every focused TextBox.

Here is how I hacked around this:

Since all Controls (including TextBoxes) the user sees are placed in a certain Panel, they are in that panel's array of Controls.
I added a Panel _parent to the Control class, thus every control would have a reference to the panel that owns it
Then in the Panel class I added a Control FocusedControl, so that every Panel will have one field for its focused control

So now I'm checking like this:

if (_parent.FocusedControl == this)
    // This specific control is focused

Or like this:

if (_parent.FocusedControl != null)
    // There is a focused Control

if (_parent.FocusedControl == null)
    // No control is focused in this panel

This works.

But the problem is that I am doing these checks in the controls themselves, and not, for example, in the Panel class.

This means each control has a reference to the panel that owns it, and that panel has a list of all the controls. Also the panel's public methods and properties are available to the owned control.

This eliminates encapsulation and is effectively terrible design.

I consider this to be a huge mess and a dirty hack. Is there any other way to make sure that a Panel has only one focused Control at a time?

sentences:
Why this simple SFML app produce such high CPU usage? I written the following SFML.NET app.
It  draw a single 128x128 sprite on the screen.

RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
window.SetVerticalSyncEnabled(true);

Texture texture = new Texture("test.jpg");
Sprite sprite = new Sprite(texture);

// Start the game loop
while (window.IsOpen())
{
    window.DispatchEvents();
    window.Clear();
    window.Draw(sprite);
    window.Display();
}

Since VSync is enabled, the number of FPS is capped to 60. I expect the program to use very little CPU, but under task manager it show me that is use about 50%  (two cores fully actually). Also it seems it use about 30% kernel time and the rest is user time.

The exact same application in SDL (just drawing a single sprite) use about 0% (regardless SDL_RENDERER_ACCELERATED is used or not).

EDIT : surprisingly, if I let the app run for a given amount of time (let's say 10-20 seconds, the CPU usage fall down to 0%). I manage to repeat this several times. That is really strange.

sentences:
How does an Engine like Source process entities? On the Source engine (and it's antecessor, goldsrc, quake's) the game objects are divided in two types, world and entities. The world is the map geometry and the entities are players, particles, sounds, scores, etc (for the Source Engine).

Every entity has a think function, which do all the logic for that entity.

So, if everything that needs to be processed comes from a base class with the think function, the game engine could store everything on a list and, on every frame, loop through it and call that function.

On a first look, this idea is reasonable, but it can take too much resources, if the game has a lot of entities..

So, how does a engine like Source take care (process, update, draw, etc) of the game objects?

sentences:
3d Model Scaling With Camera I have a very simple 3D maze program that uses a first person camera to navigate the maze. I'm trying to scale the blocks that make up the maze walls and floor so the corridors seem more roomy to the camera. Every time I scale the model, the camera seems to scale with it, and the corridors always stay the same width.

I've tried apply the scale to the model in the content pipe (setting the scale property of the model in the properties window in VS). I've also tried to apply the scale using Matrix.CreateScale(float) using the Scale-Rotate-Transform order with the same result. If I leave the camera speed the same, the camera moves slower, so I know it's traversing a larger distance, but the world doesn't look larger; the camera just seems slower.

I'm not sure what part of the code to include since I don't know if it is an issue with my model, camera, or something else. Any hints at what I'm doing wrong?

Camera:

Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, _device.Viewport.AspectRatio, 1.0f, 1000.0f );

Matrix camRotMatrix = Matrix.CreateRotationX( _cameraPitch ) * Matrix.CreateRotationY( _cameraYaw );
Vector3 transCamRef = Vector3.Transform( _cameraForward, camRotMatrix );
_cameraTarget = transCamRef + CameraPosition;
Vector3 camRotUpVector = Vector3.Transform( _cameraUpVector, camRotMatrix );
View = Matrix.CreateLookAt( CameraPosition, _cameraTarget, camRotUpVector );

Model:

World = Matrix.CreateTranslation( Position );

sentences:
Unity facebook SDK. Cannot login I want to show a leaderboard of facebook friends scores in a game.
So I need access to the user_friends permission.
In order to get that permission I have to send a working build using that permission to facebook that they can review.
So I need to keep my app on facebook in development mode, and test it with test users so I can build this feature and get it working.
However when I build the game and try and login to facebook I get this...

It did not give me a chance to login as a test user or anyone else. I didnt log in at all, it just went straight to this screen when I requested login.
Now the solution for this error that I have found many instances of, is to set your app 'live'. But that wont work in my case.. I need the app the be in development mode so I can test this feature.. If the app is live no-one will have access to the user_friends permission including test users.

So this seems like a paradox.
What can I do?

sentences:
Is quake3/ioquake's OOP good to do a large game? Everybody heard about the release of the Quake3 source code.

But since it's plain C but uses OOP a little, isn't it too complex to decipher or to use for large projects such as a 3rd person shooter/hack&slash with smooth camera movements ?

Would it be a good idea to use it instead of Ogre, I want to be sure it's really harder to use since it's only an engine dedicated to FPS.

Ogre seems to be a standard OSS, especially when thinking about OOP, but since I'm not looking for complex effects and since the rendering quality of quake3 seems to be good enough to me, I wanted to ask what did the release of the quake3 engine changed for open source developpers (except the infamous invsqrt method).

I heard Carmack released it for students or people alike, but C++ is here: is quake3's code obsolete compared to Ogre's when it comes to learning ?

sentences:
How to make Unity3D Camera focusing on one area? In my Unity3D project, I have a board created dynamically (using c#) and located on the screen as follow:

0 < x < 12
0 < z < 12
y = -1

How can I make the camera focusing on the board and make it centered for different screen resolutions and for different platforms?

EDIT:

What I have tried so far

public class PositionCamera : MonoBehaviour {

    public float fWidth = 9.0f;  // Desired width

    void Start () {

        float fT = fWidth / Screen.width * Screen.height;
        fT = fT / (2.0f * Mathf.Tan (0.5f * Camera.main.fieldOfView * Mathf.Deg2Rad));
        Vector3 v3T = Camera.main.transform.position;
        v3T.z = -fT;
        v3T.y = 3f;
        transform.position = v3T;
    }
}

I have attached this script to my camera. Actually, it makes the board look much better but not centered on the screen.

sentences:
VBO in a class doesn't draw when The class has a destructor I am making this class QuadTemplate

class QuadTemplate
   {
    public:
    QuadTemplate()
    {
        vbo=0;
        uvbuffer=0;
        vao=0;
        TextureID=0;
        vboType=0;
        drawStart=0;
        drawCount=0;
        programID=0;
        TextureShaderID=0;
    }

    ~QuadTemplate()
    {
        glDeleteBuffers(1, &vbo);
        glDeleteBuffers(1, &uvbuffer);
        glDeleteProgram(programID);
        glDeleteTextures(1, &TextureShaderID);
        glDeleteVertexArrays(1, &vao);
    }

    GLuint vbo;
    GLfloat vboData[12];
    GLenum vboType;

    GLuint uvbuffer;
    GLfloat uvDate[8];
    GLenum uvType;

    GLuint vao;

    GLint drawStart;
    GLint drawCount;

    GLuint TextureID;
    GLuint TextureShaderID;
    GLuint programID;
};

this class like the name says is a template where I store all the Vbo's date, it doesn't have any other function because I have a function that give it the values, the problem is when I try to draw the Vbo, it doesn't work, not only that it also presents some graphics mistakes, but when I comment the destructor, it work perfectly fine. why it doesn't work with the destructor?

sentences:
What exactly is UV and UVW Mapping? Trying to understand some basic 3D concepts, at the moment I'm trying to figure out how textures actually work. I know that UV and UVW mapping are techniques that map 2D Textures to 3D Objects - Wikipedia told me as much. I googled for explanations but only found tutorials that assumed that I already know what it is.

From my understanding, each 3D Model is made out of Points, and several points create a face? Does each point or face have a secondary coordinate that maps to a x/y position in the 2D Texture? Or how does unwrapping manipulate the model?

Also, what does the W in UVW really do, what does it offer over UV? As I understand it, W maps to the Z coordinate, but in what situation would I have different textures for the same X/Y and different Z, wouldn't the Z part be invisible? Or am I completely misunderstanding this?

sentences:
How do I set horizonal Field of View by code as in Inspector? I have a camera that I have set to
RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

If I set Field of View values during gameplay in the Inspector, it works as expected.
For example, I type 75, and the camera behaves as I think it should. I'm comparing with Resident Evil 4. It has a camera cheat, and if I select FOV 75 in this cheat, the Resident Evil 4 camera behaves like my Unity game camera.
However, when I set the camera.fieldOfView to a 75 by code, the Inspector shows 104, and the code does not look as it looks when I type 75 in the Inspector.
_camera.fieldOfView however returns 75.
What is going on here, and how do I fix it?
Thank you!

sentences: System function in entity component architecture I started working with ECS and I am not completely sure that I understand it correctly. As I see it now - systems can implement logic for collision, movement, similar things like that. But would it be correct to dedicate a system for digging game logic only? It has a method for dig action, it also sets animation component to play "dig" animation and listens for event about animation completion after which it executes dig action. Am I doing it right?

sentences:
How to make a smooth circuit path in Universal tween engine? I tried to make a circuit by starting at point A, with waypoints B and C and final target at A again, and infinite repeats. What happens is that the path from A to B, B to C is smoothed, but path C to A ends with a "sharp" edge

Is there any way to make it totally smooth?

sentences:
I can't create a "trap" block So, I am trying to make a "trap" block. It should kill the entity that will stand on it(or walk as in the code, if somebody knows how to make that it will do something while an entity stands on it, it will be helpful). Here's the code for the block:

package com.daniel_sl.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

public class Trap extends Block{

  public boolean isDead;

  protected Trap(Material material) {
    super(material);
  }

  public void setDead()
  {
    this.isDead = true;
  }

  public void onEntityWalking(Entity Entity){
    if(Entity instanceof EntityLiving){

      Entity.setDead();
    }
  }
}

When I stand on the block it doesn't do anything.

sentences:
Batching and Z-order with Alpha blending in a 3D world I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++)

Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls.

Here is what I've got for the moment:

Order all elements of my scene back to front.
Send order list of elements to the Renderer.
Renderer look in his batch manager if a batch exist for the given element with his Material.

Batch didn't exist: create a new one.
Batch exist for element with this Material: Add sprite to the batch.

Compute big mesh with all sprite for each batch (1 material type = 1 batch).
When all batches are ok, the batch manager compute draw commands for the renderer.
Renderer process draw commands (bind shader, bind textures, bind buffers, draw element)

Image with my problem here:

But I've got some problems because objects can be behind another objects inside another batch.

How can I do something like that?

sentences:
Scripting a sophisticated RTS AI with Lua I'm planning to develop a somewhat sophisticated RTS AI (eg see BWAPI).  have experience programming, but none in game development, so it seems easiest to start by scripting the AI of an existing game I've played, Warhammer 40k: Dawn of War (2004). As far as I can tell, the game AI is scripted with some variant of Lua (by the file extension .ai or .scar). The online documentation is sparse and the community isn't active anymore.

I'd like to get some idea of the difficulty of this undertaking. Is it practical with a scripting language like Lua to develop a RTS AI that includes FSMs, decision trees, case-based reasoning, and transposition tables?

If someone has any experience scripting Dawn of War, that would also help.

sentences:
Acceleration problems Im trying to make a car game, but i cannot get the acceleration code right. With this code:

        if(gas){
        speed += 3;
    }else if(break_ && !(speed < 6)){
        speed -= 3;
    }else if(!break_ && !gas && !(speed < 6)){
        speed -= 0.3;
    }else{
        speed = 6;
    }

it is up on 1000 within 5 secounds. I tried multiplying it with smaller numbers, but it still doesnt work(in fact it got worse). So, how can this be improved so it has reasonable parameters? Asof the maximum speed, i can implement that on my own.

sentences:
How to set a box2d body to follow a strict path I'm making an infinite runner type game and I want one of my enemies (when it's created) to swoop down in a sort of U motion where it'll hit the player if they don't react quick enough once the enemy (bat) leaves the screen it'll be destroyed and created again once certain requirements are met . The path will be the same each time so I don't need anything to do with AI. Unfortunately I'm only in grade 10 so calculus makes no sense to me and neither does the pathfinding libgdx documentation. I either need something similar to this (But written for libgdx) or some way to get a box2d body to move in an exact way.

My game is structured like this:

in Bat.java:

public class Bat extends Sprite {

private World world;

public Bat(GameScreen screen) {

    this.world = screen.getWorld();
}

In GameScreen.Java

public class GameScreen implements Screen {

private Bat bat = new Bat(this);

public World getWorld(){
    return world;
}

sentences:
How can I determine the contact point of a collision? I have two Farseer bodies. A static rectangle and a dynamic ball that is flying around. I want to determine where the ball touched the rectangle. I need the exact coordinates of the contact point.

How can I do that? Is there a way to determine the contact point?

 bool BlueRectangle_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
   {
       if (fixtureB.Body == RedBall)
       {
          Vector2 normal;
          FixedArray2<Vector2> worldPoints;
          contact.GetWorldManifold(out normal, out worldPoints);

          if(contact.Manifold.PointCount >= 1)
          {
            Vector2 contactPoint = worldPoints[0];
          }
        }

        return true;
    }

It works with the following code.

sentences: In Unity, how do I set up a delay before an action? I want an object to rotate after a delay. I tried using StartCoroutine, yield and WaitForSeconds, but failed. How can I do it?

sentences:
Positioning a texture inside a 3D object with GLSL I have a 3D object in my scene and a texture that is the same size of the screen (a render to texture). Is there a way to make the object act like a "mask" for the texture(using glsl), so the texture is aligned with the screen 2D space but only shows what is "inside" the mask object?

What I'm trying to achieve here is this: I have a 3D scene made of cubic tiles, some of these tiles are going to be water and I want to distort whatever is behind them. My idea was to pass the render to texture and then distort it to make a refraction effect. Is this going to work? Am I even suposed to do refraction like this?

sentences:
Rotate object with mouse look script I would like to rotate an FPS camera slightly upwards during a shot as an effect of recoil, but the problem is that I have a mouse look script as well and I assume it prevents me from achieving the effect i want.
So far I have tried using transform.Rotate(-10,0,0) and

transform.rotation = Quaternion.Euler(transform.rotation.x - 10, transform.rotation.y, transform.rotation.z);

both rotated the camera upwards but then the camera moved back downwards to the initial position. Does anyone know how I can rotate the camera and keep the rotation? Or if there is any better way to achieve this effect.

sentences: If you create a game, do you automatically have the rights to it? I am creating a game in c++ that will me multiplier and am going to post it on https://indiegamestand.com  Here is one of the requirements "Must own the rights to distribute your game and to assign those rights to us (non-exclusively) for the purpose of selling here."  If I compile my game as an .exe do I have that right?  How can I make sure I retain it, and what can they do with the game if I give them that right?

sentences:
Shader to see silhouette through alpha blended sprites I want to achieve in Unity a see through effect like the one in these examples:

In my specific scenario there are a couple of requirements:

Sprites are using alpha blending, and sprites have transparent areas.
There are 2 kind of elements that occlude the character. One should create the silhouette effect, and the other one should behave like normal.

For occluding elements that create the silhouette I enable ZWrite, and disable it for elements that doesn't.

For the character I tried setting the queue of the shader to transparent+1, and added this pass:

Pass
{
    ZTest Greater
    Lighting Off
    Color [_Color]
}

And the effect works partially:

The silhouette is drawn all over the character, even the parts that are transparent. Transparent parts shouldn't create a silhouette.
The silhouette is created when the character is behind a sprite, even if that part of the sprite is transparent. Being behind a transparent part of the sprite shouldn't create the silhouette.
The character appears infront the rest of the elements, even if it is behind them. I guess this is because setting the queue to Transparent+1. But if I leave it as Transparent, the character is drawn in the correct order, but the silhouette is never seen.

I tried to follow these tips someone gave me, but I'm unable to get it to work:

  1) Leave the pass that renders the sprites as is.

  2) Add a pass that writes to the z-buffer, but has a shader that uses clip() to discard pixels based on alpha. You can't use the z-buffer to make soft z-tests without using MSAA and alpha-to coverage. The quality of that won't be great, but it's the best you can do. A faster alternative is a pattern or noise dither, or a good old fashioned threshold if your sprites all have fairly sharp edges.

  3) Add third pass to occludable objects that draws the occlusion color using the z-test and make sure it's drawn as a final pass.

I'm kind of new to shaders, specially in Unity, and I just can't figure out how to make it work properly.

sentences:
Admob - gradle configuration error I've followed this tutorial https://developers.google.com/admob/android/quick-start, but I'm stucked at gradle configuration. I've added line

compile 'com.google.android.gms:play-services-ads:8.3.0'

to build.gradle (of application) like in tutorial, but error "Failed to find: com.google.android.gms:play-services-ads:8.3.0" appeared. Admob writers says, that android studio will offer download if that is missing, but I've only got error in output.

sentences:
Powerup Best practices In a turn based game each player has a set of properties, e.g attack, defence, speed and these can all be used to work out who should go first and how much damage should be dealt. That all works fine, but the problem I'm having is with edge cases where a player receives a power-up for one turn that lets them move first. How should I handle this? Should I increase the speed value and then somehow remember to reduce it next turn or should I implement some sort of object which holds modifiers that is checked every turn?

I'd also need to be able to scale this to different things like temporary poison etc.

Basically I'm very confused and help would be appreciated!

sentences:
Rendering voxel data efficiently With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.
foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.
Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.
It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.
This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?
It's also worth noting that I'm using Metal, a game framework, rather than a game engine, so if game engines generally abstract away this process and therefore this question seems nonsensical, I'm not using a game engine, I'm using a game framework.

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

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

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

sentences:
Applying transformations in Geometry Shader So, I am trying to program in opengl (3.3) a kind of robot. The idea is that I have some simple blocks that represent his body (4 rectangles for his arms, one for the torso and the last one representing the head). To simplify a made a bad picture of my idea.

So now what I want to do is to make him move his arms depending on keyboard commands. Doing that would be just rotating each arm the amount that you want (translating too).
But I am stuck because the only way I found to make striped rectangles (just the borders) is using the geometry shader. From the little I know about opengl, transformations are applied in the vertex shader, which would not work for my idea. Would be inefficient to apply the transformations on the geometry shader? (It is from what I know). If so, is there an easier way of drawing those rectangles?

EDIT: Ok, I can simplify a lot this question. The thing is that I want to draw those "skeletal" rectangles, but the only way I know how to do it is using the geometry shader. But with this comes the problem of the transformations, so I would want to avoid doing that. There is another way to draw those skeletal shapes?

sentences:
Drawing isometric map in canvas / javascript I have a problem with my map design for my tiles.

I set player position which is meant to be the middle tile that the canvas is looking at.

How ever the calculation to put them in x:y pixel location is completely messed up for me and i don't know how to fix it.

This is what i tried:

 var offset_x = 0; //used for scrolling on x
 var offset_y = 0; //used for scrolling on y
 var prev_mousex = 0; //for movePos function
 var prev_mousey = 0; //for movePos function

function movePos(e){

    if (prev_mousex === 0 && prev_mousey === 0) {
        prev_mousex = e.pageX;
        prev_mousey = e.pageY;
    }

    offset_x = offset_x + (e.pageX - prev_mousex);
    offset_y = offset_y + (e.pageY - prev_mousey);
    prev_mousex = e.pageX;
    prev_mousey = e.pageY;
    run = true;

}

player_posx = 5;
player_posy = 55;
ct = 19;

    for (i = (player_posx-ct); i < (player_posx+ct); i++){ //horizontal
    for (j=(player_posy-ct); j < (player_posy+ct); j++){ // vertical

//img[0] is 64by64 but the graphic is 64by32 the rest is alpha space
    var x = (i-j)*(img[0].height/2) + (canvas.width/2)-(img[0].width/2);
    var y = (i+j)*(img[0].height/4);

    var abposx = x - offset_x;
    var abposy = y - offset_y;

    ctx.drawImage(img[0],abposx,abposy);
    }
}

Now based on these numbers the first render-able tile is  I = 0 & J = 36. As numbers in the negative are not in the array.

But for I=0 and J= 36 the position it calculates is : -1120 : 592

Does any one know how to center it to canvas view properly?

sentences:
Make one object rotate to face another object in 2D In my 2D project, I have an object that is sometimes above or below another object.

Once the primary object comes in close proximity with the secondary object, I want the object to rotate on the z axis so that the front of the primary object is facing the secondary object.

(Here, following Unity's default setup, the z axis is the axis pointing into the screen)

sentences:
Emscripten code and three.js I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js that will be showed in the browser.

So, can someone give me an idea of how to do that?

sentences:
How would you code an AI engine to allow communication in any programming language? I developed a two-player iPhone board game. Computer players (AI) can either be local (in the game code) or remote running on a server. In the 2nd case, both client and server code are coded in Lua. On the server the actual AI code is separate from the TCP socket code and coroutine code (which spawns a separate instance of AI for each connecting client).

I want to be able to further isolate the AI code so that that part can be a module coded by anyone in their language of choice. How can I do this? What tecniques/technology would enable communication between the Lua TCP socket/coroutine code and the AI module?

sentences:
LWJGL - How to draw text on screen After some months on libGDX, I chose to make a little java game library based on LWJGL.
I have already tried to do it, but got stuck on this same problem: how render text on screen.
The first time, I used Sick, but it was deprecated... how do I should do?
This time I tried this code, of couse it doesn't work (I read it on StackOverflow):
public class Starter {

private String GAME_NAME;
public String VERSION;
private int WIDTH, HEIGHT;
private static long window;

public Starter(@NotNull JJGLInfo info){
    Objects.requireNonNull(info);
    GAME_NAME = info.getGAME_NAME();
    VERSION = info.getGAME_VERSION();
    WIDTH = info.getWidth();
    HEIGHT = info.getHeight();
}

public void run(){

   System.out.println("Hello player by JJGL\nJJGL Version: " + VERSION + "\nLWJGL Version: " + Version.getVersion());

   this.init();
   this.loop();

   this.terminate();
}

private void terminate() {
    glfwFreeCallbacks(this.window);
    glfwDestroyWindow(this.window);

    glfwTerminate();
    glfwSetErrorCallback(null).free();
}

ByteBuffer pixels = this.getByteBufferFromString();
private void loop() {

    GL.createCapabilities();
    glClearColor(1f, 1f, 0f, 0f);

    while (!glfwWindowShouldClose(this.window)){
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glfwSwapBuffers(this.window);

        ByteBuffer pixels = this.getByteBufferFromString();
        glEnable(GL_TEXTURE_2D);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, 1000, 200, 5, GL_BLUE, GL_UNSIGNED_BYTE, pixels);
        glEnd();

        if(Input.isKeyPressed(GLFW_KEY_A))
            System.out.println(1);

        glfwPollEvents();
    }
}

private ByteBuffer getByteBufferFromString(){

    String text = "ABCD";
    int s = 256; //Take whatever size suits you.
    BufferedImage b = new BufferedImage(s, s, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D g = b.createGraphics();
    g.drawString(text, 0, 0);

    int co = b.getColorModel().getNumComponents();

    byte[] data = new byte[co * s * s];
    b.getRaster().getDataElements(0, 0, s, s, data);

    ByteBuffer pixels = BufferUtils.createByteBuffer(data.length);
    pixels.put(data);
    pixels.rewind();
    return pixels;
}

/**
 * Initialize window
 */
private void init() {
    //Set Callback, when library get an error, it will be print
    GLFWErrorCallback.createPrint(System.err).set();

    //Let's initialize GLFW. Without this call, most of functions won't work
    if(!glfwInit()){
        throw new JJGLInitException("Could not initialize GLFW");
    }

    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);   //Make window hidden
    glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);  //Make window resizeable

    window = this.createWindow();

    glfwMakeContextCurrent(this.window);

    glfwShowWindow(this.window);
}

/**
 * Creating window. If you have passed -1 at one side,
 * it will be maximize (-1, 30 only width will be maximized)
 * @return
 */
private long createWindow() {
    //Getting info about screen
    GLFWVidMode glfwVidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    if(this.WIDTH <= -1)
        this.WIDTH = glfwVidMode.width();

    if(this.HEIGHT <= -1)
        this.HEIGHT = glfwVidMode.width();

    //Creating window
    return  glfwCreateWindow(this.WIDTH, this.HEIGHT, this.GAME_NAME, MemoryUtil.NULL, MemoryUtil.NULL);
}

public static long getWindow() { return window; }
}

sentences:
Rotating To Face a Point I am trying to rotate a line to point to the mouse's world coordinates (rather where the mouse lies on the plane where y=0).

I am running into a couple of problems though:

Whilst it follows the mouse the line doesn't always lie directly beneath the cursor, which is what I would expect to see. It seems to be perfect when the position is at the origin and less accurate the further away from the origin I get.
The rotation doesn't go from 0 - 360, rather 0 - 180. I think the solution here is to use a dot product but the first problem is preventing me from fixing this problem.

Here's where I calculate the angle by which to rotate:

Calculating mouse position

 Vector3 near, far, dir;
 unproject(*mouse_, near, far);
 dir = near - far;
 normalize(dir);

 float t = -near.y / dir.y;
 Vector3 point = near + (t * dir); //where the mouse lies on the plane y=0

I'm almost certain the above is correct as when I draw a point at point the rendered point is directly beneath the cursor on the plane y=0

Calculating angle between the line and the point.

 rotation_.y = angleBetween(position_ - dir_, position_ - point);
 rotation_.y = radToDeg(rotation_.y);

position_ is where I want the line to start from. Which is the player's position at the moment.
dir_ is the direction of the line, set to and never changed Vector3(0.0f, 0.0f, 5.0f);

 float angleBetween(const Vector3& a, const Vector3& b) {
     float cosTheta = dot(a, b) / (length(a) * length(b));

     return acos(cosTheta);
 }

Here's how I am drawing the line:

 glPushMatrix();
 glTranslatef(position_.x, position_.y, position_.z);
 glRotatef(rotation_.x, 1.0f, 0.0f, 0.0f);
 glRotatef(rotation_.y, 0.0f, 1.0f, 0.0f);
 glRotatef(rotation_.z, 0.0f, 0.0f, 1.0f);

 glDisable(GL_LIGHTING);
 glLineWidth(3.0f);
 glColor3f(0.0f, 1.0f, 1.0f);
 glBegin(GL_LINES);

 glVertex3f(0.0f, 0.0f, 0.0f);
 glVertex3fv(end_.toArray().data()); //toArray() returns and std::array of the vector

 glEnd();
 glPopMatrix();

And just in case it matters, for the camera I do:

void Camera::transform() {
    gluLookAt(position_.x, position_.y, position_.z,
              target_.x, target_.y, target_.z,
              0.0f, 1.0f, 0.0f);
}

target_ is also the player's position.

I hope this is enough information.

sentences:
LibGDX full screen display mode and camera resize I'm creating a simple 2D platformer and I have problem with my camera y position when I enter full screen mode. But first here's my code

screenY = Gdx.graphics.getHeight();

public void updateCamera(){
        camera.position.x += (player1.getHitBox().x - camera.position.x);
        if(screenY < player1.getHitBox().getY() && player1.getHitBox().getY() > (screenY - Gdx.graphics.getHeight())){
            screenChanger++;
        }else if(player1.getHitBox().getY() < (screenY - Gdx.graphics.getHeight())){
            screenChanger--;
        }
        screenY = Gdx.graphics.getHeight() * screenChanger;
        camera.position.y = (screenY - screenY/2);
        camera.update();

        System.out.println(Gdx.graphics.getHeight() + " " + screenY);
    }

So here's my results:
1) When I start the game all works fine

2) But when I enter to fullscreen here what I get

3) here how it looks when I zoom out my camera

sentences:
how to move the rect transform by mouse drag I am trying to do a slider in the UI with the mouse, I want to move the rect transform right side when I drag the mouse right and vice-versa.

I tried but it didn't work please help me thanks in advance!!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

public class slide : MonoBehaviour {

Vector3 prevpos = Vector3.zero;
Vector3 posdelta = Vector3.zero;

float xRotation = 0;
float zRotation = 0;
public RectTransform controllerposition;
public GameObject lastposition;

float speedFactor = 0.04f;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        prevpos = Input.mousePosition;
    }

    if (Input.GetMouseButton(0))
    {

        posdelta = Input.mousePosition - prevpos;

        Vector3.Distance(controllerposition.transform.position, lastposition.transform.position);
        {
            controllerposition.DOAnchorPos(new Vector2(-100, 0), 0.25f);

        }

    }

    prevpos = Input.mousePosition;
}

}

sentences:
How to make snake movement smooth not grid based like slither.io snake? I try to find the right formula to mimic the smooth non-grid movement of the slither.io snake.

I can do it manually to save each point the "head" movement  went and do some interpolation in between its body parts but it is very error prone.

Also I find this: http://www.emanueleferonato.com/2014/06/10/html5-string-avoider-game-made-with-phaser/

Which is not working in my case but do show something similar

Here is a picture to express what I want to do:

Any idea how to do it right?

sentences:
How do you get a multiplayer-only game to reach critical mass? Say you have a multiplayer-only game in which players are randomly paired head-to-head against a random online player...

How do get such a beast off the ground?

You need enough players online at all times such that any random player game request will be paired with someone else's request.

Chicken and egg ... You need players to play but without players to play no players will play!

How do I reformulate the problem to make this work?

This happened to me a while back and I haven't come up with anything useful since.
https://github.com/fictorial/Rock-Paper-Scissors-World-Masters-iOS

sentences:
glBufferData consuming system memory I am memory profiling my game in Visual Studio and about 60% of memory usage is happening from calls to glBufferData(). I may be missing something but should this consume GPU memory instead of system memory? I call it using GL_ARRAY_BUFFER and GL_STATIC_DRAW I was just wondering is there a way I can force it to use only VRAM?

Visual Studio attributes the memory usage to "nvoglv32.dll"

sentences:
How can I make Matrix Rain? I want to make 3d Matrix rain like this shader that you can rotate camera.I tried to convert this shader but It have many calculations that it's expensive inside game engine.then I tried to make this effect by trail Renderer but I couldn't make random letters inside trail renderer.finally I tried by Instantiating quads but It hadn't fade like trail.

so my question is how can I make this effect In efficient way?

sentences:
Help on transition from one position to another I'm pretty sure I'm over thinking stuff, but I can't seem to figure this out. I want to move the object from one location to another. Here's what I got. I searched this up earlier here, and I found something similar, but I wasn't able to make it work. Any help would be appreciated, thanks.

//the current position of the object is at 400, 300
Vector2 nextPosition = new Vector(100, 200);
Vector2 difference = nextPosition - position;

difference.Normalize();

position += difference * 5;

sentences:
Simple Anti-piracy techniques I'm releasing a game soon and thinking about adding some simple anti-piracy techniques.

It's an offline adventure game but I'm thinking of doing a quick background check on startup for updates if the user is connected online.

Since it'd connect to the game site to check this, maybe there's some anti-piracy check I can do at the same time?

I don't want anything that'd annoy the user, and I'm not too bothered about completely removing the ability to pirate it because that'd be fighting a losing battle. I just want something that'd deter casual pirates.

Any ideas?

sentences:
Override the position of bodypart with script on top of animation I have a character with an Idle and Move animation.

Now I want to create an Attack animation. Here I want the hand to move towards the mouse position and back, using a script. The other hand should still follow the Idle or Move animation.

When I use a script in FixedUpdate() to do this the position of the hand still follows the animation. If I use LateUpdate() and set hand.transform.position, this seems to represent the local position and not global position.

Is there a proper way to create this Attack animation?

using UnityEngine;

public class Attack : MonoBehaviour
{
    public Camera camera;
    public Transform body;
    public Transform hand;
    public string button;
    public float time = 5f;
    public float begin = 3f;
    public float end = 6f;

    float step = 0f;

    bool pressed = false;
    float currentTime = 0f;
    int direction = 1;

    private void Start()
    {
        step = (end - begin) / time;
    }

    private void Update()
    {
        if (!pressed && Input.GetButtonDown(button))
        {
            pressed = true;
        }
    }

    private void LateUpdate()
    {
        if (pressed)
        {
            setCurrentTime();
            Vector2 mouse = camera.ScreenToWorldPoint(Input.mousePosition);
            Vector2 direction = (mouse - (Vector2)body.position).normalized;
            hand.position = (Vector2)body.position + direction * (begin + (step * currentTime));

        }
    }

    void setCurrentTime()
    {
        currentTime = currentTime +  direction * Time.deltaTime;
        // At End
        if (currentTime > time / 2)
        {
            float overhead = currentTime - (time / 2);
            currentTime = currentTime - overhead;
            direction = -1;
        }
        // Back at Begin
        if (currentTime < 0f)
        {
            pressed = false;
            currentTime = 0f;
            direction = 1;
        }
    }

}

sentences:
Creating Smooth Animations Possible Duplicate:
  What’s the best way to create animations when doing Android development?
  What animation technique is used in ‘Dont Starve’?

I've always admired Zeptolab for their smooth in game animations. Zeptolab has created both Cut the Rope and now Pudding Monsters.

I'm wonder how you're able to get animations this smooth? Are these sprite sheets? Are they actual 3D models?

Here's a video of their latest game:
http://www.youtube.com/watch?v=rV1dlN-dbJQ

If you get to the game play you'll see how the guys are constantly wiggling and it's so smooth. You also saw this in the monster guy in Cut the Rope.

I'm just wanting some insight into how this is done. Like what tools they may be using.

Thanks

sentences:
Controlling depths of objects in Flash I am trying to change depths/ layers of my gameobjects inside the game using flash. To be more specific, I have a horse object and a fence object. I set them up initially on stage and the horse layer is in front of the fence which is correct like shown below

Now at some point in my game, the horse moves behind the fence. So the Fence layers should now be in Front. Right now, when the horse moves behind the fence, it is still in front because of course its layers has not changed like shown in image below. How do I control this using ActionScript?

Hope someone could throw some ideas here!

sentences: How can you implement Lua into your game? I am trying to implement Lua into my game, but am having trouble. Say I have a weapon class, which is just a hollow shell, lacking real functions. I was thinking of creating an onFire function, which will simply call a pointer to a Lua function that was created for that weapon. Is this the way most people do it? Are there any other ways?

sentences:
Anti-Aliasing Problem So, I was annoyed by how the HUD for my GameState was very pixel-ated and I wanted to change that through the use of anti-aliasing. However, it works with a small exception:

It adds all these lines to the HUD, which is not what I want at all, is there a way to prevent this from occurring?

Here's what it looked like before anti-aliasing:

Also, here's the code:

    public void render(GameContainer container, StateBasedGame game, Graphics graphics) throws SlickException {
    graphics.setAntiAlias(true);
    renderOverlayGui(graphics);
    renderGui(graphics);
    graphics.setAntiAlias(false);
    renderIcons(graphics);
}

private void renderIcons (Graphics graphics) {
    graphics.drawImage(imgHeart, this.radius - 4, 1);
    graphics.drawImage(imgCoolDown, this.radius - 4, 18);
}

private void renderGui (Graphics graphics) {
    graphics.setColor(GameColour.brown);
    graphics.fill(guiCircle);
    graphics.fill(guiBox);
}

private void renderOverlayGui (Graphics graphics) {
    graphics.setColor(Color.black);
    graphics.fill(guiOverlayCircle);
    graphics.fill(guiOverlayBox);
}

sentences:
2.5D UI, perspecitve view, distort objects by angle but not position Instead of thousand words, a few pictures to explain what I want to achieve

How do I get the merit of UI objects rotation in perspective projection, but ignore the position of an object(as in Overlay Canvas)?

UPDATE 1

Can you include an example of what your full UI or scene would look like?

A usual bar which is used to hold stuff like score. Same base prefab is used for mana/health and any other UI parameter on screen. But bars have different rotations, so here is one solution - have a unique sprite for every special rotation and have a bunch of prefabs(nah). Or have one sprite, one prefab and set the rotation in scene(that's the way).

Is there a reason you are asking for this in perspective projection?

Just because I want to be able to rotate UI objects in scene and show the "depth" of rotated object. I'm not particularly stuck onto perspective projection, as long as I can achieve the "want" look without actually redrawing sprites for every unique angle.

so I'm not sure what you are asking for. Are you asking how to skew an image in 2D, so that it looks like a 3D perspective projection?

I know it sounds crazy, since it's obvious that in perspective looking at object which is above camera you get that "looking from down" look. And yet I feel you are onto something(and now am I), one way of thinking is actually to skew a 2D image to simulate rotation as in perspective view!

sentences:
How is animation handled in non-immediate OpenGL? I'm a newbie to modern OpenGL. I'm comfortable with the immediate OpenGL methodology, but I've never done any serious use of VBOs. My question is about animation. In immediate mode, to achieve animation you just have to stream different vertex positions (interpolated from keyframes) in object space.

How is this achieved in non-immediate OpenGL? Obviously, uploading fresh VBO data for each frame is sure going to hog the graphics bus. I haven't found any literature about the modern way to do it. Thinking about it, I came to several options:

Attributes: animation as a 3d offset. For each frame, a different (possible interpolated) offset attribute is passed for each vertex, applied to the same vertex each keyframe.
Indices: storing keyframes as absolute vertices and accesing them through indexing, using a different set of vertices for every keyframe. I find this approach impossible, since you can't access adjacent keyframes and therefore can't interpolate between them. Also, seems like a bad idea for procedural animation.
Texture: this might be very stretchy but sounds like a good solution for me. Again, animation is thought as an xyz offset for each vertex. Each keyframe can be stored in a 1D texture where the dimension maps to vertexID.If I'm not mistaken, in OpenGL 4.0 you can access textures from any shader, so you could read this texture from the vertex shader and apply each vertex transformation.  A 2D texture could hold several frames. You still perform interpolation (and if interpolation works for textures outside of fragment shader, which I'm not sure of, you can linearly interpolate for free!) This could be applied to more complex animation systems like bone animation without much effort.

Am I overthinking this? Can anyone shed some light?

sentences:
Any GL transformation not working Today I was trying to make a test camera, with a new method(I usually use gluLookAt)

So I got a problem,

void GameDraw()
{
    glPushMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90, WIDTH / HEIGHT, 0.001, 10000.0);
    pitch += 1;
    glRotatef(pitch, 1.0, 0.0, 0.0);
    glRotatef(yaw, 0.0, 1.0, 0.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    s->bind();
    test->drawMesh();
    glPopMatrix();
}

And my draw function is:

glDrawElements(GL_TRIANGLES, indices, GL_UNSIGNED_INT, nullptr);

if it isn't working with glDrawElements is there any alternative to use?

Edit: Disabling shader it works fine, but how I can use this with Shader

Please don't use glm examples, because I don't like to use it, I feel more comfortable by using the my math

sentences:
Efficient sprite animation display methods? I'm making a game sprite, with animations for transitioning to different states, such as idle, sleeping, etc. I'm wondering what the most efficient way to play the animations is. As of now, I have a couple of ideas:

store all frames as separate PNG images, and display only the frames for the current state (e.g. play frames 1-5 for idle, 5-10 for transitioning, 10-15 for sleeping)
make the animations into GIFs and play the one corresponding to the current state.
merge them all into a spritesheet.

Please let me know which would be the best approach, or if there's a better way to do things. I'm new to handling images and animation with code, so I'm not sure what the advantages and disadvantages are. Thanks!
In case the information helps anyone, I'm planning to use Python for this (although I could also do Java or C++, if there are good solutions in those languages), and the sprite image size isn't large, it's pixel art.

sentences:
Is a separate thread for game loop compulsory for simple games? I am new to game development. In order to learn I am recreating this game on android platform. You can observe the game-play video at the above link. It is a simple game.

I have read a lot of articles on getting started with game development.Almost all of them recommended using a game loop on separate thread, which makes sense for other games. However, for this particular game do I need to start a separate thread ?

sentences:
How would I process accelerometer data to use it for camera rotation? I'm using Three.js to make a web-based 3D first-person game.  I would like the player to be able to control the camera rotation with their device's accelerometer.

The sensor data is received via the DeviceMotionEvent event listener. Here is an example of what it returns:

How should I proceed with this?

sentences:
COLLADA: Inverse bind pose in the wrong space? (Crosspost from StackOverflow)

I'm working on writing my own COLLADA importer. I've gotten pretty far, loading meshes and materials and such. But I've hit a snag on animation, specifically: joint rotations.

The formula I'm using for skinning my meshes is straight-forward:

weighted;
for (i = 0; i < joint_influences; i++)
{
    weighted +=
        joint[joint_index[i]]->parent->local_matrix *
        joint[joint_index[i]]->local_matrix *
        skin->inverse_bind_pose[joint_index[i]] *
        position *
        skin->weight[j];
}
position = weighted;

And as far as the literature is concerned, this is the correct formula. Now, COLLADA specifies two types of rotations for the joints: local and global. You have to concatenate the rotations together to get the local transformation for the joint.

What the COLLADA documentation does not differentiate between is the joint's local rotation and the joint's global rotation. But in most of the models I've seen, rotations can have an id of either rotate (global) or jointOrient (local).

When I disregard the global rotations and only use the local ones, I get the bind pose for the model. But when I add the global rotations to the joint's local transformation, strange things start to happen.

This is without using global rotations:

And this is with global rotations:

In both screenshots I'm drawing the skeleton using lines, but in the first it's invisible because the joints are inside the mesh. In the second screenshot the vertices are all over the place!

For comparison, this is what the second screenshot should look like:

It's hard to see, but you can see that the joints are in the correct position in the second screenshot.

But now the weird thing. If I disregard the inverse bind pose as specified by COLLADA and instead take the inverse of the joint's parent local transform times the joint's local transform, I get the following:

In this screenshot I'm drawing a line from each vertex to the joints that have influence. The fact that I get the bind pose is not so strange, because the formula now becomes:

world_matrix * inverse_world_matrix * position * weight

But it leads me to suspect that COLLADA's inverse bind pose is in the wrong space.

So my question is: in what space does COLLADA specifies its inverse bind pose? And how can I transform the inverse bind pose to the space I need?

sentences:
How do I set up a depth buffer in SharpDX? I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes.

I already had this issue a long time before and i remembered that is was because the depth buffer.

I don't know how to set up a depth buffer in SharpDX.

My current trial:

DepthStencilView depthStencilView;

Init

var zBufferTextureDescription = new Texture2DDescription
        {
            Format = Format.D16_UNorm,
            ArraySize = 1,
            MipLevels = 1,
            Width = this.RenderWindow.ClientSize.Width,
            Height = this.RenderWindow.ClientSize.Height,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None
        };
using (var zBufferTexture = new Texture2D(Device, zBufferTextureDescription))
  depthStencilView = new DepthStencilView(Device, zBufferTexture);

DeviceContext.OutputMerger.SetTargets(depthStencilView, RenderTargetView);

Draw

//ClearRenderTargetView
DeviceContext.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1f, 0);
//DrawInstanced(...);

My question: what steps do i have to do, to set up a depth buffer correctly?

(I don't use SharpDX.Toolkit)

sentences:
How can I approach writing a GUI framework for my game? The problem

I want to write a simple GUI framework designed for a game, in order to learn the inner workings and nitty-gritty of how GUI 'engines' such as Unity3D's GUI work. I can't find any resource to help me get started.

What I'm looking for exactly is the abstract methodology of GUI programming, so things like what are the components of a GUI framework, how often and in what ways should the interface be updated with data, what are the different ways to connect the visuals in the interface to the logic behind them, how should clicking events be handled, things like that.

What I tried

I've been trying to research my options for months but to no avail. Looking up keywords like "GUI programming" or "GUI programming philosophies" leads nowhere and doesn't answer the questions I mentioned above.

There are plenty of resources and tutorials out there for things like OpenGL, how to write a game loop, how to write a physics engine, but nothing like that for writing GUI systems. The wikipedia pages for these topics are also usually a good starting point, but the GUI entries are too design-focused, failing to focus on programming-specific methodology/architecture.

I also tried starting from the web GUI frameworks I know such as React and Angular, and learned a few interesting things like the the view-model-viewmodel architecture and React's virtual DOM, but I still don't know how to apply them, how to generalize them into some framework/philosophy I can follow while coding, and whether there are any other possible options.

P.S. My environment is C# and OpenGL through OpenTK, but that hopefully won't matter in terms of respondents giving a broad overview.

sentences:
Can't see which line exceptions occurred on in script source files After updating Unity to the new 2017.1.0f3 version, I can't see which line in a source file an exception occurred on.

Example:

I can't see the source of the error by double-clicking in the console either, which would usually redirect me to the source file in Visual Studio. I can still see exceptions from the Unity and Mono API.

I have managed to temporarily fix it by going to the PlayerSettings and switching "Scripting Runtime Version" from "Stable (.NET 3.5 Equivalent)" to "Experimental (.NET 4.6 Equivalent)".

This happens to all MonoBehaviour scripts.

sentences: Changing alpha of Sprite I'm using OnGUI to draw a rect when I "box select" or "drag select". The texture that gets drawn is a PNG file made in Paint.Net with the opacity - alpha channel set quite low. In Unity however, when I go to box select, the texture is completely opaque. How do I get Unity to honor the alpha set in Paint.Net? I also wouldn't mind using Unity itself to adjust the opacity, but I haven't found such an option in the import texture part of the inspector.

sentences:
Animation playing incorrectly when controlled through player I have a 2D simple directional blend tree with 2 inputs, X and Y, for movement.

If i move the red dot in the inspector, the animations blend nicely. Same if i move the 2 input parameters in the animator. But if i press play and move the character with arrows, i can see the 2 parameter inputs  in the animator screen moving same as when i moved them with mouse, but the animation that is playing stays the same and the red dot that represents parameters in the inspector stays in the center (even though the parameters in the animator are moving).

I also tried using just 2 animations and blending between them, but turns out that doesn't work ether, even though animator shows that the correct animation should be playing. (if i press forward animator shows that forward animation is playing, but on scene the animation that is playing is like a blend at parameter value in the middle.

The animations were made in Blender as actions (if that's important).

sentences:
UnsupportedOperationException: Unsupported format for this image So.. I'm learning lwjgl currently and I stumbled on this weird error caused by slick-util which seems to be incorrectly displayed.

ERROR :

java.lang.UnsupportedOperationException: Unsupported format for this image
at org.newdawn.slick.opengl.PNGDecoder.decode(PNGDecoder.java:272)
at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:97)
at org.newdawn.slick.opengl.CompositeImageData.loadImage (CompositeImageData.java:62)
at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.
java:200)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at com.saumi.utils.Renderer.loadTexture(Renderer.java:91)
at com.saumi.assets.Assets.<init>(Assets.java:23)
at com.saumi.main.Main.init(Main.java:27)
at com.saumi.main.Main.<init>(Main.java:45)
at com.saumi.main.Main.main(Main.java:71)

The problem is that even though it says unable to read png data, the picture that the error points to is loaded properly and even displayed onto the screen!

I don't know what is is supposed to mean, please help.

EDIT :

My texture loader code :

public static Texture loadTexture(String path , String fileType){
    Texture tex = null;

    InputStream in = ResourceLoader.getResourceAsStream(path);
    try {
        tex = TextureLoader.getTexture(fileType,in);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return tex;
}

My Assets code which loads the textures :

public class Assets {

public static Texture playBtn , tutBtn , quitBtn;

public static Texture background;

public static Texture player , missile;

public Assets(){
    playBtn = Renderer.loadTexture("res/PlayBtn.png", "PNG");
    tutBtn = Renderer.loadTexture("res/TutBtn.png", "PNG");
    quitBtn = Renderer.loadTexture("res/QuitBtn.png", "PNG");

    player = Renderer.loadTexture("res/KillSkull.png", "PNG");
    missile = Renderer.loadTexture("res/Missile.png", "PNG");

    background = Renderer.loadTexture("res/Background.png", "PNG");
}

}

The Error points to the Background Image , and the order in which it is loaded does not matter, it always points to that image.

sentences:
Sanitise a high score table to remove offensive terms / usernames I'm building an app for a client, which they've requested to have a publicly-visible high score table. It'll be displaying their username, which is a free-text field that the players can input. Player count is likely to be extremely low - I’d expect 10s or 100s/day at most.

The username field will be longer than 3 characters. The names will be tied to Firebase Auth accounts, but these are created through the app, not tied to anything like Google Play or a Facebook account or anything like that. I think they’re going to be fine with deleting obviously offensive names, but they’re not going to have massive resources devoted to manual moderation.

When I was a young lad, 100% of my local arcade cabinet high score tables consisted of a bunch of swear words and offensive terms (or variations of such words).

I can't imagine the internet has improved matters at all.

How can I sanitise usernames to make them safe for display?

sentences:
Nestling into contact with a group of physics objects without exerting forces on them I'm making a pool game, and would like the circle (imaginary) to be in contact with the table and balls, and to fit perfectly as a ball would.

Now I thought I would use Rigidbody and lerp the position of the circle to the raycast hit, and its collider it would force it into a fitting position.

The problem I encountered is that since it has a collider, it also pushes the balls, which I do not want.

So my question is, how do I make an object act like it's touching & blocked by other GameObjects with Colliders and Rigidbodies, without pushing them?

sentences:
What are "affordances" in game design? I keep hearing the word "affordance" in terms of game design, most recently in the movie Indie Game: Life After. I also vaguely remember it from a UX class in undergrad. But I have no idea what it means.

What is an affordance in the context of game design?

sentences:
Effecient tilemap rendering I have done mostly tile based games, but never really bothered with optimization. I always just rendered all the tiles that convered the viewport.
I am currently working on platformer for a mobile device, which has some performance issues, ecspecially when using multiple layers of tiles.

Most tiles are pretty static without animations. I wouldn't really have to render them each frame. The clear() -> draw() loop is really printed into my brain, I'm having a hard time thinking how the handle rendering without clearing the screen each frame.

I'm currently doing this:
 - start game, render screen once
 - Once a tile changes, save this in a "tile_changed" array
 - Each frame, re-render all the changed tiles and clear the array

This works pretty fine, and there is a notable boos in performance. However, there are a view issues
 - The PlayN framework offers no way to "erase" drawn items. Whenever I want to erase a single tile I have to completely clear the screen and redraw every tile. (PlayN SurfaceLayer). I'm using a scroll background, so can't just fill an empty tile with the background color.
I can imagine low level libraries like opengl having this same issue, do they use some sort of workaround for this?

I'm not sure how to recognize when new tiles come into the screen whenever the camera moves. I would normally just render the tiles in view each frame, so this never posed a problem.
I have no idea if having such a big drawn rendertarget in memory is a good idea. The player could have walked across a huge map and have thousands of tiles drawn. Should I worry about this?

Any other optimiztions that I'm missing are appreciated.

The awnsers note that most engines draw all tiles every frame. But I know that on some less powerfull platforms this is not the case. I believe flashpunk is using some sort of buffer that only draws new tiles when you make changes in the grid.
Unfortunately this is not possible for me because I have no way of clearing a single tile without clearing the entire buffer.

I'm looking into optimazations like this, which enable me to have a very large amount of tiles on the screen.

sentences:
Which gaming engine can be used for pixel manipulation? Here is the gist of where I am going with this. I work for a printer company and basically all of our input files(or output files for virtual printers) are bitmap files. We currently have a tool built in java over 10 years ago that works, but chokes on our high end 1600x1600 files.

So I was thinking, why not utilize a game engine's built-in ability to utilize the power of a gpu?

I am thinking all I would have to do is create a 1600x1600 plane, feed it the image file and draw the scene. I figure this is the easy part.

However, the hard part is reaching into the image for example and clicking the mouse on a particular pixel. Getting RGB data, converting to CYMK, making changes, converting back into RGB and then redrawing the scene. Not only that but pulling the modified texture out of memory and saving it back into a bitmap.

Is this even possible? I haven't used a game engine since college and that was opengl 2.0.

Just figured this looked like a good place to ask. Thanks.

sentences:
Problem passing variables in fragment shader I'm trying to pass a point light from an array to a CalcLight function in a fragment shader.  It works when I hard code in the value, but not when I use a loop.  Here's the code:

#define TOTAL_LIGHTS 2
struct PLight
{
    vec4 pos;

    vec4 diff;
    vec4 spec;
    vec4 amb;

    float con;
    float lin;
    float quad;
};

layout(std140) uniform Light
{
    PLight pLights[TOTAL_LIGHTS];
}light;

vec3 CalcPoint(in PLight p)
{
    ...
}

When I pass in the light from main using hard coded values it works fine.

void main()
{
    ...
    pointLight += CalcPoint(light.pLights[0]);
    pointLight += CalcPoint(light.pLights[1]);
    ...
}

But, when trying to use a loop, the first light works fine but not the second.

for(int i = 0; i < TOTAL_LIGHTS; i++)
    pointLight += CalcPoint(light.pLights[i]);

Any thoughts as to why the loop isn't working?

sentences:
Interpolation UNITY taking longer than expected I'm trying to do multiplayer interpolations with the lidgren network (UDP) but the interpolation is taking longer than expected and the message queue is getting full. It's been a week and I still can't find the issue.

Here's an approximate code:

    private void Update()
    {
        if (networkUpdates.Count > 0 && CurrentUpdate.Finished)
        {
            var update = networkUpdates.Dequeue();

            CurrentUpdate = NextVesselUpdate;
            NextVesselUpdate = update;

            StartupInterpolation();
        }
    }

    private void StartupInterpolation()
    {
        CurrentVesselUpdate.NextUpdate = NextVesselUpdate;
        StartCoroutine(CurrentVesselUpdate.ApplyUpdate());
    }

    //In the CurrentVesselUpdate class....

    public IEnumerator ApplyUpdate()
    {
        InterpolationDuration = NextUpdate.SentTime - SentTime;
        for (float p = 0; p <= 1; p += (Time.delta / InterpolationDuration))
        {
            ApplyInterpolations(p); //Several lerps here
            yield return null;
            Finished = true;
        }
        ApplyInterpolations(1);//Several lerps here
    }

sentences: how to ADD a NEW entity/item/effect to Minecraft Java In Minecraft Java, I am creating many resource packs by myself (no studio or external resource) so, I want to ADD a new file/entity/element/items/etc. to the game to not replace an old item because EVERY item/effect/entity has SOME use in the game. In conclusion: how I can ADD [not replace] a file in the game and give it custom physical and mental properties?

sentences:
Programming the combat sequence in a role playing game I'm trying to write a short "game" where a player goes around and fights monsters but I have no idea how to handle the combat.

For example, say I have a "Warrior" and a "Troll". How do the two fight each other? I know I can do something like

Conan = Warrior.new();
CaveTroll = Troll.new();
Conan.attack(CaveTroll);
CaveTroll.attack(Conan);

But what part of the game controls the monster? Do I just stick the above sequence in a loop until one of them dies? Or does the game "engine" need to have a part that deals specifically with combat? Or is this an aspect of the Troll's artificial intelligence that needs to take care of it's actions?

Also, who/what determines the actions that the monster takes? Maybe a Troll can bash, kick, bite, cast spells, drink potions, use a magical item. Does the game engine determine what action the Troll takes or is that something the Troll class manages?

Sorry I can't be more specific but I need some guidance on which direction to go with this.

sentences:
Game states and events I'm writting a game in C++ and I'm struggling with getting events and game states work together.

By game states I mean something like this

class GameState
{
public:
    virtual void onPause();
    virtual void draw();
    virtual void update();
};

class PauseScreen : public GameState
{
     //stuff
};

class Game : public GameState
{
     //stuff
};

And I've created dope event observer based system where I have simple EventObserver class which has register function to what Event I want to subscribe and EventManager where I have map of vectors of all possible EventObservers (everything made with templates) and callback functions. No pointers, no inheritance - everything works like charm.

So there is my problem - how to connect these? In my main loop I'm getting current active game state - and then updating and drawing it. But for example when state is not active its still receiving event. This is pretty bad beacuse if I have MainMenu gamestate and for example if escape key is pressed it would just exit the game even if I'm currently in Game.

I could only came with some bool checking - if current state is not more active it would disable all EventListeners but I would need to manually call EventListener::disable in all game states for every EventListeners I have in onPause() methods and I don't like this solution (and since it's my hobby project I would like things that I like). I could store EventListeners in vector in GameState interface class so I wouldn't need to disable it manually and just iterate thought it and disable it 'automatically' but I would have to deal with A LOT of templates and naaah I don't wanna do it (just keep it simple).

On the other hand I could add method to GameState handleEvent(Event* event) (well since this is now dynamic memory I would probably prefer to use smart pointers so I don't need to worry when I have to delete event) but then I would have giant switch statement for every game state that I have and this also doesn't seems like good solution. Now I'm just binding one method per one event so everything is nice divided and simple.

So any tips how to design this? Can event observers (or subscribers) work with game states?

sentences:
What's the difference between Camera::getPosition() and Camera::getPositionForViewUpdate()? In Ogre3d, what's the difference between methods  Camera::getPosition() and Camera::getPositionForViewUpdate(), official documentation doesn't says much:

/** Get the derived position of this frustum. */
const Vector3& getPositionForViewUpdate(void) const;

/** Retrieves the camera's position.*/
const Vector3& getPosition(void) const;

Thanks!

sentences:
Why do games have different ports for different maps? A little old example for that would be Metin2, this is the only game I know which have that, but there may be more.
In Metin2 there are maps which are accessable through other ports.
I'm not a network specialist, but I think then it is needed to connect to an other port on an map change.

So would it not be possible todo all that on one port? Are there any benefits from that?

Could it be that there is a limit on port connections on a server, that this would be something for loadbalancing?

sentences:
Texture in model not rendered by BasicEffect UPDATE: It is apparently the BasicEffect that is the culprit here. I tried to use another effect (which I coded myself) and then it works!?!? )I kinda like the EnableDefaultLighting, though...)

So this question is now rephrased to: "what in the model exported by Blender can cause BasicEffect to fail to render the texture?".

I have imported this model into Blender and exported it to an .fbx file and imported it into my XNA project. The problem is that the model is pitch black (just as it is in Blender when I look at it in object mode) when drawn in XNA. I have verified that the texture really is there (and that only one iteration is made):

       foreach (var mesh in _model.Meshes)
            foreach (var part in mesh.MeshParts)
                if (part.Effect is BasicEffect)
                {
                    var be = part.Effect as BasicEffect;
                    using ( var stream = File.Create(@"c:\test.jpg") )
                        be.Texture.SaveAsJpeg(stream,2048,2048);
                }

I have followed exactly the same procedure with other models and it has worked. Since the model looks good in Blender and the textures really makes it into XNA... what can be wrong here?

For what it's worth: one difference from what I'm used to is that these textures are not stored inside the .fbx but in a separate subfolder, but the XNA content importer finds them (I get an error if I try to remove them).

UPDATE: it may be important to mention that this model actually has three textures: diffuse, specular and normal maps. However, ONE of them should be projected by the BasicEffect, right?

UPDATE: a screen shot from Blender.

sentences:
OpenGL GL_TRIANGLE_STRIP creating grid with degenerate triangles / for one draw call I need to create a grid ready for GL_TRIANGLE_STRIP rendering with One drawcall - so i need to degenerate the triangles.

I am almost there but missing last row/column and can't figure out why.

My grid is just a :

Position ( self explanatory )
Size ( the x,y size )
Resolution ( the spacing between each vertex in x,y )

Here is the method used to create verts/indices and return them:

int iCols = vSize.x / vResolution.x;
int iRows = vSize.y / vResolution.y;

// Create Vertices
for(int y = 0; y <= iRows; y ++)
{
    for(int x = 0; x <= iCols; x ++)
    {
        float startu  = (float)x / (float)vSize.x;
        float startv  = (float)y / (float)vSize.y;

        tControlVertex.Color    = vColor;
        tControlVertex.Position = CVector3(x * vResolution.x,y * vResolution.y,0);
        tControlVertex.TexCoord = CVector2(startu, startv - 1.0 );

        vMeshVertices.push_back(tControlVertex);
    }
}

// Create Indices
rIndices.clear();

for (int r = 0; r < iRows - 1; r++)
{
    rIndices.push_back(r*iCols);

    for (int c = 0; c < iCols; c++)
    {
        rIndices.push_back(r*iCols+c);
        rIndices.push_back((r+1)*iCols+c);
    }
    rIndices.push_back((r + 1) * iCols + (iCols - 1));
}

And to visualise that, few examples first.

1) Size 512x512 Resolution 64x64, so it should be made of 8 x 8 quads, but i get 7x7 only

2) Size 512x512 Resolution 128x128, so it should be made of 4 x 4 quads, but i get 3x3 only

3) Size 128x128 Resolution 8x8 so it should be made of 16 x 16 quads but i get 15x15 only

So as you can see, i am missing the Last Row and Last Column somewhere.  Where am I going wrong?

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

sentences:
Is linear filtering possible on depth textures in OpenGL? I'm working on shadow maps in OpenGL (using C#).
First, I've created a framebuffer and attached a depth texture as follows:
// Generate the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Generate the depth texture.
var shadowMap = 0u;

glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);

// Set the read and draw buffers.
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

Later (after rendering to the shadow map and preparing the main scene), I sample from the shadow map in a GLSL fragment shader as follows:
float shadow = texture(shadowMap, shadowCoords.xy).r;

Where vec3 shadowCoords is the coordinates of the fragment from the perspective of the global directional light source (the one used to create the shadow map). The result is shown below. As expected, shadow edges are jagged due to using GL_NEAREST filtering.

To improve smoothness, I tried replaced the shadow map's filtering with GL_LINEAR, but the results haven't changed. I understand there are other avenues I could take (like Percentage-Closer Filtering), but I'd like to answer this question first, if only for my sanity. I've also noticed that other texture parameters (like GL_CLAMP_TO_EDGE rather than GL_REPEAT for wrapping) don't function for the shadow map, which hints that this may be a limitation of depth textures in general.
To reiterate: Is linear filtering possible using depth textures in OpenGL?

sentences:
How should I choose quadtree depth? I'm using a quadtree to prune collision detection pairs in a 2d world. How should I choose to what depth said quadtree is calculated?

The world is made mostly of moving objects1, so the cost of dispatching the objects between the quadtree cells matters. What is the relationship between the gain from less collision checking and the loss from more dispatching? How can I strike a balance that performs optimally?

1 To be completely explicit, they are autonomous self-replicating cells competing for food sources. This is an attempt to show my pupils predator-prey dynamics and genetic evolution at work.

sentences:
What is causing this character overlap during text rendering? I'm trying to display text with a texture and font description created with BMFont in OpenGL 3.3, but whenever I display the text there is some overlap between certain characters.

Here is the text at normal 1.0x scale:

As you can see, the 'e' in "Hello" overlaps the next 'l' a bit (with the same happening for the 'r' in "world") and the 'w' in "world" overlaps the 'o' quite a bit. Here is a 3.5x scale image to make the overlap a bit more apparent:

I was wondering if someone would be able to explain to me why this is occurring and, if possible, explain how to fix it.

My method for generating the vertex mesh is as follows: (C++)

// position control variables
const float tscalex = 1.0f / _font.GetTexture().GetSize().x;
const float tscaley = 1.0f / _font.GetTexture().GetSize().y;
const float hspace  = _font.FindGlyph( ' ' ).XAdvance;
const float vspace  = _font.GetInfo().LineHeight;
float x = 0.0f;
float y = 0.0f;

// generate a quad for each character
char pchar = 0;
for ( uint i = 0; i < _text.length(); ++i )
{
    // apply kerning
    char cchar = _text[ i ];
    x += _font.FindKerning( pchar, cchar );
    pchar = cchar;

    // handle special characters
    switch ( cchar )
    {
        case ' ':
            x += hspace;
            continue;
        case '\t':
            x += hspace * 4;
            continue;
        case '\n':
            y += vspace;
            x = 0.0f;
            continue;
    }

    // get the character's glyph
    const Font::Glyph& glyph = _font.FindGlyph( cchar );

    int width  = glyph.Width;
    int height = glyph.Height;
    int left   = glyph.X;
    int top    = glyph.Y;
    int right  = glyph.X + width;
    int bottom = glyph.Y + height;
    float yy   = y + glyph.YOffset;

    float u1 = float( left   ) * tscalex;
    float u2 = float( right  ) * tscalex;
    float v1 = float( top    ) * tscaley;
    float v2 = float( bottom ) * tscaley;

    // create the quad
    uint16 count = uint16( _mesh.Vertices.Size() );
    _mesh.Vertices.Add( Vertex( Vec3( x,         yy,          0 ) * _scale, Vec3(), Vec2( u1, v1 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x,         yy + height, 0 ) * _scale, Vec3(), Vec2( u1, v2 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x + width, yy + height, 0 ) * _scale, Vec3(), Vec2( u2, v2 ) ) );
    _mesh.Vertices.Add( Vertex( Vec3( x + width, yy,          0 ) * _scale, Vec3(), Vec2( u2, v1 ) ) );
    _mesh.Indices.Add( count + 0 );
    _mesh.Indices.Add( count + 1 );
    _mesh.Indices.Add( count + 2 );
    _mesh.Indices.Add( count + 2 );
    _mesh.Indices.Add( count + 3 );
    _mesh.Indices.Add( count + 0 );

    // advance
    x += glyph.XAdvance;
}

sentences:
Implementing my Entity System. Questions about some problems I have found Well during this week I have deciding about implementation of my entity system. It is a big topic so it has been difficult to take one option from the whole. This has been my decision:

1) I don't have an entity class it is just an id.

2) I have systems that contain a list of components (the list is homegenous, I mean, RenderSystem will just have RenderComponents).

3) Compones will be just data.

4) There would be some kind of "entity prototypes" in a manager or something from we will create entity instances.Ideally they will define the type of components it has and initialization data.

5) Prototype code to create an entity (this is from the top of my head):

int id=World::getInstance()->createEntity("entity template");

6) This will notify all systems that a new entity has been created, and if the entity needs a component that the system handles it will add it to the entity.

Ok, this are the ideas. Let's see if some can help with the problems:

1) The main problem is this templates that are sent to the systems in creation process to populate the entity with needed components. What would you use, an OR(ed) int?, a list of strings?.

2) How to do initialization for components when the entity has been created? How to store this in the template? I have thought about having a function in the template that is virtual and after entity is created an populated, gets the components and sets initialization values.

3) Don't you think this is a lot of work for just an entity creation?.

Sorry for the long post, I have tried to expose my ideas and finding in order other could have a start beside exposing my problems.

Thanks in advance,
Notbad.

sentences:
Drawing shapes and images in libgdx dialog I am currently working on a dialog window for my android game using libgdx. This dialog window contains a collection of labels and buttons, but should also contain an image. The image represents the "remaining health indicator", i.e. an empty indicator with a symbol indicating the health of the player. This indicator has to be filled with a colored rectangle representing the remaining amount of health (see screenshot below).

In order to render this on a dialog of libgdx, I have to draw an image and a colored rectangle (the red rectangle indicating the real amount of remaining health). I know that the dialog supports the rendering of images, but I don't know how to first draw the rectangle.

This is the code I have so far:

public FuelFacilityDialog(GameWorld world, GuiComponent gui) { super("Health check", gui.defaultSkin);

    this.world = world;
    this.gui = gui;

    setModal(true);
    setMovable(false);
    setResizable(false);

    Image healthIndicator = new Image();
    Button button1   = new TextButton("heal", gui.defaultSkin);
    Button button4   = new TextButton("Exit", gui.defaultSkin);

    healthIndicator.setDrawable(new TextureRegionDrawable(AssetLoader.healthIndicatorV));
    healthIndicator.setScaling(Scaling.fit);
    setObject(button1, true);
    setObject(button4, false);

    Table imageTable = new Table();
    Table buttonTable = new Table();

    imageTable.add(healthIndicator).width(100).height(200);
    buttonTable.add(button1).width(100).height(50).expandY();

    this.getContentTable().padTop(20);
    this.getContentTable().padBottom(20);
    this.getContentTable().add(imageTable);
    this.getContentTable().add(buttonTable).height(200);
    getButtonTable().add(button2);
}

sentences:
How to add the sound effect of a ball rolling, based on his velocity? I have a ball which roll (like all ball does :) ) ...

My ball can roll on different type of surfaces (2 or 3) and at different velocity.

I don't know how to approach to reproduce in my game the sound effect.

I can assume to do :

Get an Sfx of a rolling ball
Run in loop if my ball is moving

then ?

Well.. i need some help.

Thanks

sentences: How to solve problem with Terrain Flashing and then disappears when flying away? I am making flight simulator( my first Unity project) , the biggest challenge so far is terrain, so whenever I fly away from it (not that far) the terrain starts flashing and disappears which is just green mountains, so when i come back to it, i have no idea where its position is, but it suddenly appears (again flashing) when I am close , the terrain size is normal but it's on top of a huge other terrain (about 100,000 * 100,000 which is the max),I tried changing pixel error and base map distance, no change, I looked at big terrain solutions online, but non of them really helped me, Any advice? Thanks

sentences:
How does one write a wrapper for a game server? From what I gathered, wrappers mimic the game server in question, receiving packets from client and sending them to the server (and vice versa). It acts like a bridge between the client and server, allowing data to flow and modifying/reading it as it travels through it.

Am I right in how wrappers work? What is the general gist of them? How would one go about writing one?

I plan to write one for Starbound in Java, using https://github.com/StarryPy/StarryPy as a reference to the packets.

sentences:
Unity Networked gaming 2019... What happened to NetworkBehaviour, OnServerStart() etc After a long break, I am now trying to learn some basics in networked gaming in Unity. I've installed the latest beta client (because I want to ultimately make a network multiplayer game but it will be many months of learning and building barebone prototypes to ensure I can get game objects spawning correctly and be controllable by the correct client etc etc

I have some experience in Unet, by extending the NetworkBehaviour class. I don't remember exactly but there were things such as [Client RPC] and [Command] and also OnServerStart() methods etc.

But I am aware Unet is being removed. And I tried to extend my class from NetworkBehaviour (I also tried NetworkBehavior lol) and it doesn't recognise it anymore.

So what replaces OnServerStart() method and [ClientRpc] instruction? Ideally I want to use a Dedicated Server solution (which I will run on my own computer in order to play small tests online of my game). The game im trying to make to start off with is extremely simple. The 'player' is just a capsule which can shoot small cubes and give damage to other players. Also the player object 'you' are controlling will appear blue, but all the other players will be grey.

Using Unet I was able to make the above small game idea work. But now I am unable to.

sentences:
Unity build does not launch and leaves no logs/errors I have released my first title Audio Infection ( https://store.steampowered.com/app/911580/Audio_Infection/ ) for a bit over a year ago. Recently 1 user has so far encountered an issue where the game does not launch. He is the only user that encounters this problem.

He has this issue on both Win 7 and Win 10. His system specs are fine and his drivers are up-to-date. The game does not leave a log file, rather it looks like it is unable to boot. There are no Windows error reports on it either. I watched it through Discord screenshare because I could not properly understand his issue.

I had asked a few other random people to test my game and demo (he has the issue with both, the demo and full version) however no one else (including me) is able to reproduce this behavior.

At this point I have tried:

updating Unity from 2018 to 2019 (no change in behavior)
added manual logging (with no results)
updating drivers (on his system)
installing Visual C++ (on his system)
empty project with Unity sample scene (he was able to load the sample scene!)
deleting crashhandler.exe (used to fix similar issue in the past based on older threads)
modifying files
deleting and downloading the files

What else can I try in order to figure out what is causing the issue? I am honestly clueless. Since the sample project was able to boot on his system there is definitely something wrong with the build on my end. However he is the first person with this issue. It doesn't even get to the point of launching on his system and it can't be found in the memory either. It is almost as if Windows is blocking it from launching, however that is not the case. But the result is very similar to that.

There is a free demo on the store page available in case you want to see if it boots on your system. It works for both VR and non VR systems. When no VR devices are detected all VR related contents are disabled. This has been thoroughly tested and worked on loads of different Windows systems with different specs, with VR and no VR.

Once again, there are no errors, no logs, the build doesn't even make it to that point, yet that exact same build works for literally everyone else on various systems. I am absolutely clueless about what to do in order to resolve this issue. Any help/advice or pointers towards the right direction are greatly appreciated!

PS: he is not a troll, I have known this guy for a long time now and he genuinely wants to support me.

sentences:
Drawing an animation over an already drawn screen I am working on a XNA WP7 card game whose basic prototype is complete. In game screen, 6 cards are displayed at a time (3 for each of the two players say 1,2 and 3).

If player A attacks one of player B's card then I want to show an animation over player B's card i.e the victim card(say a claw scratch for e.g.)

My question is how do I approach with the animation system so that I can draw an animation over a card upon certain events e.g. dead, fire, claw attack etc.

I have an attack function which detects which type of card is attacking which type of card. Depending on the type of attacker card I want to display the animation on the victim card.

Can I call animation classes function for different animations in the attack function itself without actually having to call separate draw and update functions. If so, how?

Also how do I play sound at the same time when the animation is going on?

EDIT-
Heres what I have done.

I took your advice and created an animation routine in a different class.
Here's how it works.

I have a separate Animation.cs class file (where animation occurs)
I have a wrapper class called CardAnimation which has a Dictionary object as animations with animation type as key and animation object as value.
I created a static object of CardAnimation class in Card class so that its not created every time I call animation routine.
I am calling the card's update method from another class called MAINGAMESCREEN.

Here's the flow of Update methods

MAINGAMESCREEN -> CARD -> CARDANIMATION -> ANIMATION

Animation works but it occurs very fast that I can see only first frame.
Same animation code works fine in an independent project.
 What can I do to slow it down?

sentences:
Shooting at mouse in unity I'm using unity and trying to get my bullet to shoot at a target. I am clicking the mouse and I'm wanting to fire my bullet in that direction.

I have gotten the coordinates of the mouse click and tried to compute the vector. Then I've tried instantiate the bullet prefab (which has rigidbody component and is in front of the scene) at my position and then fire it in the direction of the mouse.

I can see that my objects being instantiated in my Hierarchy Pane but can't see anything on the screen!

Not sure if I'm doing the vector thing right (newb here), but if I click on Yoshi's head, I'm getting (-2.0, -0.4). Does this sound right?

Code:

void fireBullet(float mousePositionX, float mousePositionY)
    {

        Vector2 position = new Vector2(mousePositionX, mousePositionY);
        position = Camera.main.ScreenToWorldPoint(position);
        GameObject bullet = Instantiate(bulletPrefab, transform.position, Quaternion.identity) as GameObject;
        bullet.transform.LookAt(position);
        Debug.Log(position);
        bullet.rigidbody2D.AddForce(bullet.transform.forward * 1000);
    }

sentences:
VBO = glGenBuffers() IllegalStateException i'm kinda noob in OpenGL but I have this problem: I get an IllegalStateException at this code:

int vboVertex = glGenBuffers();

In-detail exception:

Exception in thread "main" java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL15.glGenBuffers(GL15.java:116)
at Mesh.initVbo(Mesh.java:49)

OpenGL version:
2.0.5819 WinXP Release

Thanks for support and sorry for the horrible english.

sentences:
Problem with transparent textures in SFML I have been told that this is kind of a common problem with transparent textures, but didn't get any further information on how to solve it.

In my code, I'm trying to render this texture (a square with rounded corners, where rounded corners have some alpha)

What I get instead is this

Notice those greyish places on the corners of the textures - where rounded corners are supposed to be.

What could be causing this? I have a pure-white texture, so I don't expect a single pixel to get any darker than the background. All pixels should have at least the color of background, but as you can see, there is something darker.

Zoomed even more:

Any help would be highly appreciated.

sentences:
Generating and rendering not point-like particles on GPU Specifically I'm talking about particles as seen (for example) in the UE4 dev video here. They're not just points and seem to have a nice shape to them that seems to follow their movement.

Is it possible to create these kinds of particles (efficiently) completely on the GPU (perhaps through something like motion? Or is the only (or most efficient) way to just create a small particle texture and render small quads for each particle?

sentences: Check If a 2D Collider Is Completely Inside / Outside of a Polygon Collider How can I check if one 2d collider (circle, capsule, polygon etc.) is completely inside / outside of a polygon collider?

sentences:
Distance between two objects? We are trying to determine the distance (a scalar, double) between two objects' surfaces in Bullet. We are new to the Bullet engine, and we've been looking into the demo projects, but couldn't find any good examples.

The closest we have come to implementing this is using the following:

btManifoldPoint& pt = contactManifold->getContactPoint(j);
double dist = pt.getDistance();

But where do we get the contactManifold object? (We're not even sure this is the right approach.)

We want to calculate distance when a key is pressed, so this is done in the specialKeyboard() function, a function in the Bullet demo framework.

Can anyone provide us with a clear, simple example?

sentences:
How to properly transform vertices for a model loaded using Assimp? When I try to load a DAE model then vertices are not placed correctly. Here's the code snippet I use to load 3D models using Assimp  :

aiNode* CGameObject::findNode(aiNode* rootNode, const char *name) {
    if (!strcmp(name, rootNode->mName.data)) {
        return rootNode;
    }
    for (int i = 0; i < rootNode->mNumChildren; i++) {
        aiNode *found = findNode(rootNode->mChildren[i], name);
        if (found) {
            return found;
        }

    }
    return NULL;

}

void CGameObject::transformNode(aiMatrix4x4 *result, aiNode* rootNode) {
    if (rootNode->mParent) {
        transformNode(result, rootNode->mParent);
        aiMultiplyMatrix4(result, &rootNode->mTransformation);
    } else {
        *result = rootNode->mTransformation;
    }
}

Assimp::Importer importer;
    const aiScene* scene = importer.ReadFileFromMemory(buffer,
        size,
        aiProcess_CalcTangentSpace      |
        aiProcess_Triangulate           |
        aiProcess_JoinIdenticalVertices |
        aiProcess_GenUVCoords   |
        aiProcess_TransformUVCoords |
        aiProcess_FlipUVs |
        aiProcess_SortByPType);

    if (!scene) {
        return false;
    }

    const int iVertexTotalSize = sizeof(aiVector3D) * 2 + sizeof(aiVector2D);
    int iTotalVertices = 0;

    for(int i = 0; i < scene->mNumMeshes; i++) {
        _Mesh* m = new _Mesh;

        aiMesh* mesh = scene->mMeshes[i];

        aiNode* node = findNode(scene->mRootNode, mesh->mName.data);
        transformNode(&node->mTransformation, node);
        aiTransposeMatrix4(&node->mTransformation);

        int iMeshFaces = mesh->mNumFaces;
        for (int f = 0; f < iMeshFaces; f++) {

            const aiFace* face = &mesh->mFaces[f];

            for (int k = 0; k < 3; k++) {
                int vertexIndex = face->mIndices[k];
                iTotalVertices++;
                aiVector3D pos = mesh->mVertices[vertexIndex];

                aiTransformVecByMatrix4(&pos, &node->mTransformation);

                m->vertices.push_back(pos.x);
                m->vertices.push_back(pos.y);
                m->vertices.push_back(pos.z);
    ...

What am I doing wrong ? I will create a VBO for all the vertex positions later and render them.
When I load an OBJ model everything loads fine and there is no need for applying per-node transformations.

Also, I noticed that Assimp renames node names from "Cube.001" to "Cube_001", is this behavior normal/expected.
I'm using Assimp 3.1.1.

sentences:
Making a Camera look at a target Vector I have a camera that works as long as its stationary. Now I'm trying to create a child class of that camera class that will look at its target.

The new addition to the class is a method called SetTarget(). The method takes in a Vector3 target. The camera wont move but I need it to rotate to look at the target. If I just set the target, and then call CreateLookAt() (which takes in position, target, and up), when the object gets far enough away and underneath the camera, it suddenly flips right side up. So I need to transform the up vector, which currently always stays at Vector3.Up. I feel like this has something to do with taking the angle between the old direction vector and the new one (which I know can be expressed by target - position).

I feel like this is all really vague, so here's the code for my base camera class:

public class BasicCamera : Microsoft.Xna.Framework.GameComponent
    {
        public Matrix view { get; protected set; }
        public Matrix projection { get; protected set; }

        public Vector3 position { get; protected set; }
        public Vector3 direction { get; protected set; }
        public Vector3 up { get; protected set; }
        public Vector3 side
        {
            get { return Vector3.Cross(up, direction); }
            protected set { }
        }

        public BasicCamera(Game game, Vector3 position, Vector3 target, Vector3 up)
            : base(game)
        {
            this.position = position;
            this.direction = target - position;
            this.up = up;

            CreateLookAt();

            projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.PiOver4,
                (float)Game.Window.ClientBounds.Width /
                (float)Game.Window.ClientBounds.Height,
                1, 500);
        }

        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            CreateLookAt();

            base.Update(gameTime);
        }
}

And this is the code for the class that extends the above class to look at its target.

class TargetedCamera : BasicCamera
    {
        public Vector3 target { get; protected set; }

        public TargetedCamera(Game game,
            Vector3 position,
            Vector3 target,
            Vector3 up)
            : base(game, position, target, up)
        {
            this.target = target;
        }

        public void SetTarget(Vector3 target)
        {
            direction = target - position;

        }

        protected override void CreateLookAt()
        {
            view = Matrix.CreateLookAt(position, target, up);
        }
    }

sentences:
Why am I unable to move a player that extends image? I wanted to create a simple game where I will be able to move a player image horizontally. I am using Screens (at least trying to do so) and created the below:

public class GameScreen implements Screen {

    private JumpingKitten jumpingKitten;
    private Stage stage;
    private OrthographicCamera camera;
    private SpriteBatch spriteBatch;
    private Player player;

public GameScreen(JumpingKitten jumpingKitten) {
    this.jumpingKitten = jumpingKitten;
    this.createCamera();
    this.stage = new Stage(new StretchViewport(1026.0f, 768.0f, this.camera));
    this.spriteBatch = new SpriteBatch();
    Gdx.input.setInputProcessor(this.stage);
    init();
}

private void init() {
    initPlayer();
}

private void initPlayer() {
    player = new Player();
    stage.addActor(player);
    stage.act();
}

private void createCamera() {
    this.camera = new OrthographicCamera();
    this.camera.setToOrtho(false, 1026.0f, 768.0f);
    this.camera.update();
}

@Override
public void render(float delta) {
    this.clearScreen();
    handleInput();
    this.camera.update();
    this.spriteBatch.setProjectionMatrix(this.camera.combined);

    spriteBatch.begin();
    stage.draw();
    spriteBatch.end();
}

private void clearScreen() {
    Gdx.gl.glClearColor(0.15F, 0.15F, 0.3F, 1.0F);
    Gdx.gl.glClear(16384);
}

private void handleInput() {
    if(Gdx.input.isKeyPressed(Input.Keys.A)) {
        player.STARTING_X -= 50 * Gdx.graphics.getDeltaTime(); // STARTING X incorrect
        System.out.println("A is pressed"); // shown in console
    }
    if(Gdx.input.isKeyPressed(Input.Keys.D)) {
        player.STARTING_X += 50 * Gdx.graphics.getDeltaTime();
    }
}

And below is the player class:

public class Player extends Image {

private static final int PLAYER_WIDTH = 119;
private static final int PLAYER_HEIGHT = 136;

public static int STARTING_X = 100;
public static final int STARTING_Y = 100;

public Player() {
    super(new Texture("Cat_Idle_1.png"));

    this.setOrigin(100, 100);
    this.setSize(PLAYER_WIDTH, PLAYER_HEIGHT);

    this.setPosition(STARTING_X, STARTING_Y);

}

Even though I have completed some simple tutorials, I am unable to retrieve the x coordinate of the player object. This is stopping me from translating the player object along the x axis. Can someone explain what I am doing wrong, here? I honestly think that I jumped into something I shouldn't have.

sentences:
share assets beetween platforms What is the good way to share assets between platforms (android, desktop, etc) ?

by default there is an assets folder in each platform folder.

sentences:
Aggregated assets from demo projects in UE4 Unreal engine allows you to download demo projects under the "Learn" tab of their launcher.

 How do I access the resources and assets used in these projects in an aggregate form?

To put it simply, there are textures and meshes and such that i would obviously like to utilize in my projects. These assets do not however seem to be readily available for use in any and all projects. How do i get them all in one place so i can access them?

Thanks in advance.

EDIT: I should note that i am aware of the "Hard way" of doing it, im kinda just hoping there is a better solution...

EDIT: The hard way doesn't seem to be immediately effective... Thinking...

EDIT: It seems that some are able to be directly added to projects, im still working on figuring out how to add these to the viewport. But others (like "a boy and his kite") provide no such option. thinking...

sentences:
Animated textures for models; How to write a shader? Was watching some Rocket League and notice there was animated decals and wheels.

.

I would like to implement something similar to the effects in the image above.

How would I go about writing a Unity Shader to do the wheel effect?

I don't know much about Shaders, but can I edit the standard Unity Shader to do the animation effect?

sentences:
web based networked game physics efficiency I am writing a web based game, using websockets. its pretty simple, two players shooting at each other with bullets that have acceleration from a starting point at an angle.

The client side (frontend in web dev terms) uses phaser.io with p2js for physics.

However after reading this post, i believe that it's smarter to do some of the physics for the players on the server side. Such as collision detections, and update the player positions at regular intervals to keep the two players at sync.

Now i have two questions

if i use the Box2d javascript port on nodejs on the server side to simulate server side physics, than is it just as efficient as using the native c++ one? seeing as from what i have read so far it seems the js ports aren't that well maintained, and they are js ported - on the other hand the js codes might be easier to deal with than the c++ ones.
using p2js on the client side and using box2d on the server. The server being authoritative, and sends regular updates (once every second) as to the actual positions of the players.  will the physics simulation be in sync (atleast to the user)? Theoretically i don't see any reason for it to not, given that both user has the exact same latency (this is assumed for sake of simplicity).

sentences: Creating a 2D sidescroller with different behavior in each level I'm creating a game with levels built from tilemaps in LibGDX. I've created the logic for the game that adds entities based on object layers, however, many levels have different behaviors. Do I need to create a separate class for every single level, or should I build in logic to handle every possible scenario in the class that loads levels?

sentences:
How can I get complete path of a sprite? I want to get a path of sprite using the spriteRenderer component in Unity.I want my path should  be like - "asset/PATH OF MY FILE/FILENAME.EXTENSION". Currently I am using following code but it returns only parent name/path.

string GetSpritePath(Transform goPath){
    List<string> path = new List<string> ();

    Transform current = goPath.transform;
    path.Add(current.name);

    while (current.parent != null) {
        path.Insert(0, current.parent.name);
        current = current.parent;
    }

    return string.Join("/", path.ToArray());
}

Whats wrong with my code ?

sentences:
How to animate infinite rotary movement I would like to add a chainsaw (or something similar to it... a rotary blade) to my game as a melee weapon. In fact, a rotary blade is a better example.

Would it be better to do it in blender somehow, using skeleton, or should I just create two parts (the handle and the blade) and then rotate it in UE4?

sentences:
Simultaneous game states I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. At least that's what I want to do.

To give you an idea: Robot may be in FleeState and FireLaserState at the same time, besides in each of them individually at any time.

Would something like this be possible using the FSM pattern? Or ought I to look elsewhere?

After all, does the whole idea make sense?

Pasted from my comment below: A little clarification of why I'd like states to be kept separate:  I want the player to have the ability to program simple state changes before a game... say "if (health_is_way_too_low) flee". But then I want multiple such rules to be active simultaneously in order to keep the game interesting, and cannot know beforehand which other states may be active.

sentences:
Game state management? I'm running in circles here trying to figure out how to implement game states!

Many of the articles I have read use an abstract class that game states inherit, and another "manager" class that handles pushing/popping game states.

This is fine I guess, but for the game I'm planning on making, I can only imagine I'll have MANY classes, alot of which are nearly identical. For example, I have one game state which is basically a view of my scene with a few GUI buttons. Another game state gets entered when the user clicks the "Terraforming" button, which allows the user to modify the terrain. Both of those have many similarities - they are both rendering the same scene, the controls are the same, much of the GUI is the same except for a new window that contains terraforming controls, and mouse clicking is handled differently. It sounds silly to completely reconstruct a new game state when 90% of it will be identical.

Am I thinking about this the wrong way? Or is there a better solution for managing game states?

sentences:
How To Place Object On Ground Within Radius? I'm using Unity and I'm building an object placement system where you'll be able to position objects around the player.

I'd like to place objects flush with the ground, parallel to world up, even on slopes, so I'll use a raycast for that.

How would I limit the distance to maxDistance? I tried using ScreenPointToRay but the max distance on the raycast makes the movement of the object stop if the raycast doesn't hit.

As an example, If I'm looking down in front of me, the object i'm controlling should be at that position. However, if I'm looking straight forward into Infinity, the object should only ever be maxDistance away. If I rotate, the object should follow smoothly.

Thanks!

edit: here is a video of what I have now, but as you can see, the object gets stuck if the raycast doesn't hit anything - due to the maxDistance. It doesn't get stuck if i use Infinity for the ray distance, but then the object doesn't respect max distance like I want it to.
https://streamable.com/bacij8

Code snippet:
https://gist.github.com/zackperdue/270e9574bed4a937bef791fb41512291

sentences:
Breakout paddle bouncing I am having trouble with making a Breakout Clone using JavaFX. I have almost everything working, but I have a problem with the physics of the ball after it bounces off of the paddle. I used this question to get the physics working with the paddle, but only slightly. Instead of working nice and clean after switching around x and y values, the ball will sometimes end up getting stuck inside the paddle and jittering back and forth very rapidly instead of bouncing off. I have tried getting a "future version" of the ball, by checking where it would be on the next frame, but it still ends up doing the same thing. My code is here for anyone who is interested (it is all one class file, so I figured I would just use a pastebin).

Thanks in advance for any help!

EDIT: If anyone needs a video of what is happening, I will post one.

sentences: Stencil buffer mask calculation I dont understand how exactly stencil buffer works in openGL. One aspect that confuses me is why do we use a bit operator there in glStencilFunc. Some text say that is is used to achieve multiple stencil planes but I am not sure how that can be done. Can anybody please explain the whole procedure of stencil buffer calculation during the rendering cycle. Thank you.

sentences: OpenGL optimization tips What tips or tricks do you have when it comes to making the OpenGL more efficient?

sentences:
Gravity not being applied to character, using character controller So I just copy and pasted the unity example class to use with my character controller.

public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
private Vector3 moveDirection = Vector3.zero;
void Update() {
    CharacterController controller = GetComponent<CharacterController>();
    if (controller.isGrounded) {
        moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;
        if (Input.GetButton("Jump"))
            moveDirection.y = jumpSpeed;

    }
    moveDirection.y -= gravity * Time.deltaTime;
    controller.Move(moveDirection * Time.deltaTime);
}

The code seems to work okay if I comment out the isGrounded check statement (which means that gravity isn't being applied). So what could be the reason that the gravity is not being applied to my character controller?

sentences:
Delta time not accurate enough In my game i have a delta timer based almost exactly on the page from here

http://wiki.lwjgl.org/index.php?title=LWJGL_Basics_4_%28Timing%29

But if the the main loop is fast enough,  my delta time variable is 0. This causes problems because it often happens several times in a row.
I don't want to force a frame cap either. How can I remedy this?

EDIT: Setting a frame cap works,  it only happens when the frame isn't capped. I've set delta to a minimum of 1, but that doesn't make it smooth.  I could add a delay of one if it's zero, but that only fixes it for the next frame.

sentences:
Basic AI FSM - Handling state transition I'm starting to study on how to implement game AI, and it seems to me that a very simple FSM for my Pong demo would be a nice way to start.

My vision on implementing this would be to have a basic state interface and a class for each state, then the NPC would have an instance of the current state. The class should have an update method and directions on wich state to go next, depending on the event received.

The question is: How do I handle this event? Should I have a regular addEventListener and a costum event system? Or should I check on update for the things that could change the current state?

I'm feeling a bit lost, I feel I have a good grasp on the FSM concept but a good implementation seems tricky, thanks in advance.

sentences:
Screen Space reflections not tracing correctly - GLSL I've been trying to implement screen space reflections for the past couple of days, however it's been difficult finding specific implementation instructions or guides.

Most of the hits on the subject that I can find relate to UE4 or Unity, or a sample implementation in HLSL derived from GLSL work both using different coordinate systems for the y and z axes.

Following what little I could find, I've been using the following shader:

#version 430

layout (std430, binding = 2) buffer Camera_Frag
{
    mat4 pMatrix;
    mat4 InvPMatrix;
    vec2 ScreenSize;
};

uniform sampler2D ViewNormalMap;
uniform sampler2D DepthMap;
uniform sampler2D LightMap;

in vec2 TexCoord;
layout (location = 0) out vec4 FragColor;

vec2 RayCast(vec3 dir, inout vec3 hitCoord, out float dDepth)
{
    dir *= 0.25f;

    for(int i = 0; i < 20; ++i) {
        hitCoord               += dir;

        vec4 projectedCoord     = pMatrix * vec4(hitCoord, 1.0);
        projectedCoord.xy      /= projectedCoord.w;
        projectedCoord.xy       = projectedCoord.xy * 0.5 + 0.5;

        float depth             = texture(DepthMap, projectedCoord.xy).r;
        dDepth                  = hitCoord.z - depth;

        if(dDepth < 0.0)
            return projectedCoord.xy;
    }

    return vec2(0.0f);
}

void main(void)
{
    vec3 View_Normal            = texture(ViewNormalMap, TexCoord).xyz;
    float View_Depth            = texture(DepthMap, TexCoord).r;
    vec3 ScreenPos              = 2.0f * vec3(TexCoord, View_Depth) - 1.0f;
    vec4 View_Pos               = InvPMatrix * vec4(ScreenPos, 1.0f);
         View_Pos              /= View_Pos.w;

    // Reflection vector
    vec3 reflected              = normalize(reflect(normalize(View_Pos.xyz), normalize(View_Normal)));

    // Ray cast
    vec3 hitPos                 = View_Pos.xyz;
    float dDepth;
    float minRayStep            = 0.1f;
    vec2 coords                 = RayCast(reflected * max(minRayStep, -View_Pos.z), hitPos, dDepth);

    FragColor                   = textureLod(LightMap, coords, 0);
}

I get the scene projected further down, but it isn't upside down. Notice the vases and the plants on top of them. Its like the scene gets resampled and pushed downwards.

Can anyone help me understand why I'm not getting the expected results?
I've never done any raytracing before, so perhaps I'm misunderstanding how this is supposed to work.

sentences:
Help deciding data structure for spatial partitioning, using only value-types in c# I simply want to implement some sort of grid where I can sort units in an RTS into cells, and then for each unit check to avoid other units and attack other units, in 2d.

My map grid is currently 10 000 x 10 000 cells, with 20+ thousand units. To be specific, my grid is sparse but the units move together in very dense groups of about 300 each (like an ancient army type of formation). So cells will either be extremely dense, or completely empty, no in-between really.

My issue in deciding is that I am using Unity job's system and burst compiler. If you do not know, jobs is a multithreading system, and burst is an LLVM based compiler outputting very fast assembly. The limitations of these systems is you can only use value types. So no classes.

I have looked at using a MultiHashmap, but from what I read this can be very slow because I need to run a hash function for every unit. Then when I want to iterate al units in a cell, this is much slower than iterating an array. Especially, because I will also be checking the 8 neighbour cells for each unit as well. That's a lot of hashing being done. Finally, I have to clear the map every frame. The advantage here is Unity provides a container NativeMultiHashMap which is thread-safe, so I can build and query it in parallel.

I have looked into quad-trees. But quad-tree does not seem suited to multithreading, especially without using references. So if I did this, it would most likely be single threaded.

My question is, are my above statements correct in thought? Is there a faster way to organize my data? If I go with a hashmap, how can I query it most efficiently?

sentences:
RawInput -- Getting the system default mouse and keyboard I'm using RawInput for device management, in a project that I have been working on for some time.  It works great, really, but...

After some hardware changes on my development system, including the addition of a second Wacom device, I'm having difficulty getting RawInput to enumerate the default mouse and keyboard input devices without going in and plugging hard values into the enumeration code.

When I call GetRawInputDeviceList  and sort through the device instances based on their RawInput DeviceType, I have 5 keyboard devices and 6 mice, along with a slew of non-specific HID devices.  Usually, the first keyboard device returned is the real default system keyboard -- but not always.  Adding or removing USB devices between application runs almost always breaks it.

Digging deeper into the enumerated device instances, I thought that examining the RawInputDeviceInformation structure would help.  For some devices, especially older input devices, there's a value that allows you to identify which device instance is a real physical device and not one of those phantom/pseudo devices.  DeviceInformation structures on keyboard device instances all report a differing number of keys, with all the other significant values -- vendor, usage page, usage, etc. being identical.  Unsurprisingly, the reported number of keys doesn't even reflect the actual number of physical keys on the keyboard.

DirectInput identifies the default system mouse and keyboard, and although it's based on RawInput, does it use RawInput to achieve this?  Switching away from RawInput is not an option for me because of the other devices I am operating with it (Wacom, Logitech G19 etc).   Any advice on how to straighten this out would be gratefully received, with thanks!

sentences:
Increasing the rotation angle on a quaternion makes the rotation stop at a certain angle I'm using the following code to change the rotation of an object:

Quaternion rot = getRotation();
setRotation(make_quaternion_axis_angle(rot.v,rotationSpeed*dt)*rot)

This code works as expected until a certain angle where it suddenly stops.

Why does it stop?

sentences: How can I add a glow effect around a pair of wings in Unity without post processing? Basically I want to use post processing and then I found a tutorial to achieve my goal. However, the artist want a pure shader to achieve this, without any C# script hanging in the main camera. Any idea to implement?

sentences: Collision Detection algorithm using Line Detection For a 2D physics sandbox I am working on, I need a way of detecting detecting a collision using lines. This sandbox uses a class called Particle, which has a x and a y (stored as a struct called vector2) and a velocity, which also has a x and y. Previously, to find a collision, I tried to detect if the coordinates + the velocity was where another particle's coordinates + velocity was, and then I divided the velocities by the highest velocity, then checked all the velocities incrementally, to prevent tunneling. However, I could not get this to work, and I had suspicions it would be slow when velocities were very large. I now want an algorithm that detects whether two lines (one point is the coordinates, the other is coordinates + velocity) intersect, then put the particles one space before the collision. Since this algorithm is for a physics sandbox, it has to detect any collision, including, for example, if the two lines will collide but are parallel. For simplicity's sake, I won't post the Particle class code, so feel free to create the function using whatever variables you wish (as long as they're self-explanatory)

sentences:
How would you handle different level-types in an entity-component-system? Im currently developing a game with the entity-component system of Ashley in Libgdx (Java).

In the game you would be able to walk on planets (2D not 3D), fly in the star system and traverse between systems. These are all different types of levels that all need to be handled and rendered differently.

So my question is, how would you differentiate between these types (for example in the renderer), should I add a case for every type in the renderer or split it up somehow?

sentences:
libgdx intersection problem between rectangle and circle My collision detection in libgdx is somehow buggy.
player.png is 20*80px and ball.png 25*25px.

Code:

@Override
public void create() {
    // ...
    batch = new SpriteBatch();
    playerTex = new Texture(Gdx.files.internal("data/player.png"));
    ballTex = new Texture(Gdx.files.internal("data/ball.png"));

    player = new Rectangle();
    player.width = 20;
    player.height = 80;
    player.x =  Gdx.graphics.getWidth() - player.width - 10;
    player.y = 300;

    ball = new Circle();
    ball.x = Gdx.graphics.getWidth() / 2;
    ball.y = Gdx.graphics.getHeight() / 2;
    ball.radius = ballTex.getWidth() / 2;
}

@Override
public void render() {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    camera.update();

    // draw player, ball
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    batch.draw(ballTex, ball.x, ball.y);
    batch.draw(playerTex, player.x, player.y);

    batch.end();

    // update player position
    if(Gdx.input.isKeyPressed(Keys.DOWN)) player.y -= 250 * Gdx.graphics.getDeltaTime();
    if(Gdx.input.isKeyPressed(Keys.UP)) player.y += 250 * Gdx.graphics.getDeltaTime();
    if(Gdx.input.isKeyPressed(Keys.LEFT)) player.x -= 250 * Gdx.graphics.getDeltaTime();
    if(Gdx.input.isKeyPressed(Keys.RIGHT)) player.x += 250 * Gdx.graphics.getDeltaTime();

     // don't let the player leave the field
     if(player.y < 0) player.y = 0;
     if(player.y > 600 - 80) player.y = 600 - 80;

     // check collision
     if (Intersector.overlaps(ball, player))
         Gdx.app.log("overlaps", "yes");
}

sentences:
How do I change iTween values at runtime? I am trying to figure out how to run and change the speed of rotation on an iTween path at runtime. I'm trying to code it in Unity5 in C#. I have to rotate a few objects on an iTween path which I have created and I have to manage the speeds of the objects at runtime as they change.

My problem is that:
If I write the code in start method then it runs once within the whole game. How can I use this script in Update method so I can manage the speeds at the run time?

sentences:
Procedural texturing with opengl I have a hexagonal grid of fields, each field has a certain terrain type. I assign every vertex of hexagon with terrain type and pass it as attribute to vertex and then fragment shader. Then I use the extrapolated value to blend terrain textures together.

For instance: 1 is grassy, 2 is desert.

Vertex shader:

varying vec2 vUv;
attribute float terrainType;
varying float vTerrainType;

void main()
{
   vUv = uv;
   vTerrainType = terrainType;
   vec4 mvPosition;
   mvPosition = modelViewMatrix * vec4( position, 1.0 );
   gl_Position = projectionMatrix * mvPosition;
}

Fragment shader:

uniform vec3 diffuse;
uniform float opacity;
varying vec2 vUv;
varying float vTerrainType;
uniform sampler2D map;
uniform sampler2D map1;

void main()
{
   gl_FragColor = vec4( diffuse, opacity );
   vec4 texelColor = texture2D( map, vUv ) * (2.0 - vTerrainType) + texture2D( map1, vUv ) * (vTerrainType - 1.0);
   gl_FragColor = gl_FragColor * texelColor;
}

Implementation is WebGL, if it makes any difference.

The result looks really unnatural, so is there any way to make it smoother and rounder?

sentences:
libGDX/HTML5 game sounds doesn't work on iPhone I have a libGDX/HTML5 project that works well on desktop browsers, but on mobile browsers it has problems.

I can have some sounds on Android browsers (not perfect) but on iPhone browsers it doesn't work at all.

I don't know exactly which part of the project to put in here. There is an mp3 file to be played at menu screen, "music.mp3". I use:

import com.badlogic.gdx.audio.Music;
...
public class MyGame extends ApplicationAdapter {
...
private Music music;
...
@Override
    public void create () {
    ...
         music = Gdx.audio.newMusic(Gdx.files.internal("music.mp3"));
         music.setLooping(true);
         music.setVolume(0.1f);
         music.play();
    ...
    }
}

I would appreciate any help.

sentences:
How to fake a 3d character displacement by sprite scaling in GameMaker? I want my 2D sprite to become bigger when moving down the screen (closer to the camera), smaller when walking away and to maintain the same size when moving left or right.

The scaling along the y axis is fine but when I move left the sprite remains facing right. I have tied the y_scale to the x_scale so the sprite retains the correct proportions. Here is the problem:

For example, if the image_yscale is currently 9 and I want to move left, setting the image_xscale to -1 causes the sprite to shrink again. How can I flip the sprite along the x_scale while retaining the current size?

Here is my code:

// Sprite Scaling

if keyboard_check(vk_up)
{
    image_yscale -= 0.01
}

if keyboard_check(vk_down)
{
    image_yscale += 0.01
}

image_xscale = image_yscale

if image_yscale < 1
{
    image_yscale = 1
}

Thanks for any help in advance.

sentences:
CLR Profiler Allocated Bytes and XNA ContentManager I've been fighting with XNA ContentManager and memory allocations for some weeks because I'm trying to port my game from XNA (Windows) to ExEn / Monotouch (iphone).

The problem is that after playing a few levels, my game exits unexpectedly on a real iPhone device (not simulator).

Profiling memory usage on Windows with CLRProfile, I found some useful stuff but I also found something I dont understand. If I use 2 ContentManagers (1 for shared assets and 1 for level assets), when profiling, "Allocated Bytes" grows and grows after level through level but Memory consumption measured by Windows Task Manager stays constant (down when I unload the content manager and up again when I load content). Obviously, I contentManager.Unload() when level ends. After a few levels my game exits unexpectedly on an iPhone device.

If I use 1 content manager, "CRLProfiler Allocated Bytes" stays constant on Windows and on the iPhone; I can play the game normally and it doesnt exit unexpectedly. I use the same assets level through level.

It seems like in ios (iPhone) when loading and unloading the same assets, it allocates memory and consumes all device memory, so the ios kill it.

Can anybody explain me how this really works?
I've read quite a bit, but I still don't understand what's going on.

sentences:
Texture rotation inside a quad How can I rotate a texture inside a quad without rotating the quad? Here's the code but I'm rotating the whole quad here.

glBindTexture(GL_TEXTURE_2D, texName5);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

    glPushMatrix();
            glTranslatef(12.8, 10, 10);
            glRotatef(rotateAd, 1, 0, 0);
            glBegin(GL_QUADS);
                    glNormal3f(1, 0, 0);
                    glTexCoord2f(0.0, 0.0); glVertex3f(0, -3,  -3);
                    glTexCoord2f(0.0, 1.0); glVertex3f(0, -3,  3);
                    glTexCoord2f(1.0, 0.0); glVertex3f(0, 3, 3);
                    glTexCoord2f(1.0, 1.0); glVertex3f(0, 3, -3);
            glEnd();
    glPopMatrix();

Thanks.

sentences:
Second glBindBuffer() call crashes program on Draw call Background/Issue: I'm pretty new to openGL and I'm trying to create a game engine (for learning purposes) and my program keeps crashing on my glDrawElements() call but only after trying to set glBindBuffer a second time.

Code: Below is some of my code in my engine. Basically, I have two possible objects I can draw with my engine, a triangle and a square. I'm trying to first send initial shape data down to GPU buffers within my RenderSystem's Initialize function like so:

RenderSystem.cpp

bool RenderSystem::Initialize()
    {
        //Send triangle shape data down to GPU
        MyOpenGL::InitializeBuffers(ShapeData::Triangle().vertices.size(),
                   &ShapeData::Triangle().vertices.front(),
                   ShapeData::Triangle().indicies.size(),
                   &ShapeData::Triangle().indicies.front(),
                   triangleVertexBufferID , triangleIndexBufferID);

        //Send square shape data down to GPU
        MyOpenGL::InitializeBuffers(ShapeData::Square().vertices.size(),
                   &ShapeData::Square().vertices.front(),
                   ShapeData::Square().indicies.size(),
                   &ShapeData::Square().indicies.front(),
                   squareVertexBufferID, squareIndexBufferID);

        return true;
    }

The MyOpenGL::InitializeBuffers() function code is next:

void InitializeBuffers(int64 sizeOfGeometry, const void* GeometryDataFirstElement, int64 sizeOfIndicies, const void* indicieDataFirstElement, uint32 vertexBufferID, uint32 indexBufferID)
    {
        glGenBuffers(1, &vertexBufferID);
        glGenBuffers(1, &indexBufferID);

        glBindBuffer(GL_ARRAY_BUFFER, vertexBufferID);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBufferID);

        glBufferData(GL_ARRAY_BUFFER, (sizeof(Vector2D) * sizeOfGeometry), GeometryDataFirstElement, GL_DYNAMIC_DRAW);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, (sizeof(uint16) * sizeOfIndicies), indicieDataFirstElement, GL_DYNAMIC_DRAW);

        glEnableVertexAttribArray(0);
        glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 2, nullptr);
    }

Now, I want to call a draw function within my RenderSystems update() function which basically just calls this MyOpenGL::Draw() function:

 //Passing in which ever BufferID's I want to draw (square or triangle)
 void Draw(uint32 vertexBufferID, uint32 indexBufferID, uint16 numOfIndices)
    {
        glBindBuffer(GL_ARRAY_BUFFER, vertexBufferID);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBufferID);

        glDrawElements(GL_TRIANGLES, numOfIndices, GL_UNSIGNED_SHORT, 0);
    );

However, after the glDrawElements call my program crashes. If I remove the glBindBuffer functions then it works, calling the last buffer object I bound everything to. Why is my program crashing when trying to rebind to whatever object I want to draw?

sentences:
[2D] Finding largest possible straight lines around body I've got a 2D-map, largely consisting of rectangular tiles, but with some none-rectangular objects mixed in as well (tilted lines on corners for example).

Take this image as an example:

I now need all the largest possible (straight) lines around the two bodies inside that map. There are no additional required attributes to the lines.

In this image, I've marked the lines that I'm trying to find, each one with a different color to make sure there are no confusions:

It's important however, that the algorithm doesn't produce lines inside those two objects, as it would be a waste of resources.

Are there algorithms suited for that or will I have to research an algorithm myself?

By the way, the algorithm will run at loading-time of the game, so it doesn't need to be optimized for runtime-speed. Also, principally, an algorithm that is just able to find the lines around bodies which consist only of square or rectangular tiles would suffice as well.

sentences:
Unity Seamless Terrain I am programmatically generating terrain using unity's terrain object and assigning height maps to it via the terrainData, the problem is that there are seams even when using the GroupingId(which is used for auto connect).
I even tried creating a terrain object in the editor with neighbours, and modified their terrain data via script, seams still there.

I have also tried SetConnectivityDirty after applying terrainData.

Most people who have reported this seemed(lol) to have issues with their normals at the edges, I cant see that being the issue here, but if it is, how do i approach solving it given I am using unity terrains.

If there is no good answer I will have to resort to custom meshes and lose all the nice terrain tool functionality.

Edit: Here is how I'm setting heights.

var terrain = GameObject.Find("test").GetComponent<Terrain>();
var terrainData = terrain.terrainData;
var noiseMap = Tool_Generators.GenerateNoiseMap(chunkSize, seed, scale, octaves, persistance, lacunarity, 0f, 0f);
terrainData.SetHeights(0, 0, noiseMap);

Then the actual noise generation is just a 2D array of heights, i have been using a simplified version with only 1 pass for testing.

  public static float[,] GenerateNoiseMap(int chunkSize, int seed, float scale, int octaves, float persistance, float lacunarity, float offsetX, float offsetY)
  {
    float[,] noiseMap = new float[chunkSize, chunkSize];

    for (int y = 0; y < chunkSize; y++)
    {
        for (int x = 0; x < chunkSize; x++)
        {
            float noiseHeight = 0;

            float sampleX = (x + offsetX) / scale;
            float sampleY = (y + offsetY) / scale;

            noiseHeight = Mathf.PerlinNoise(sampleX, sampleY);
            noiseMap[y, x] = noiseHeight;
        }
    }

    return noiseMap;
  }

sentences:
How do I use tiles and sprites together in an isometric scene? I'm trying to write a 2D isometric scene. Rendering order is complex, since both tilemaps and sprites are different concepts. Rendering one of the 2 before the other will draw the scene incorrectly.

Tiles and Sprites both have some common data that can be used as render information. I thought of creating an extra object which simply holds the coordinates and texture data. However, this also meant having to couple a tile or sprite to a render info object. (something I haven't figured out). This adds complexity. However, I thought this way I could abstract over any renderable object.

This tutorial defines tiles as any other sprite and then uses a topology algorithm to sort the scene every frame.

I was actually thinking of using the pigeon hole algorithm by sorting the render info objects on their depth property.

How is this usually done? I can't wrap my head around it.

Bear in mind that I have no actual z-depth to work with. Everything relies on the artificial depth from the x and y coordinates.

sentences:
How to call a method after a yield instruction in the same frame? When I run this script...

int frameCount;

void Start()
{
    frameCount = 0;
    StartCoroutine(first());
}

void Update()
{
    frameCount++;
    Debug.Log("Frame " + frameCount);
}

public IEnumerator first()
{
    Method1();
    yield return StartCoroutine(second());
    Method2();
}

public IEnumerator second()
{
    Method3();
    yield return null;
}

void Method1() { Debug.Log("Method1"); }
void Method2() { Debug.Log("Method2"); }
void Method3() { Debug.Log("Method3"); }

I get the following output:

Method1
Method3
Frame 1
Frame 2
Method2

How can I call all three methods in same frame without changing the code structure? The output i want:

Method1
Method3
Method2
Frame1
Frame2

Note: If this is not possible, please show me whether i can get this output (without changing the code structure):

Method1
Method3
Frame1
Method2
Frame2

sentences:
2D Platform physics system with deltaTime I'm implementing my physics handler in my own 2D "Platform" game.
My main problem is that when the timestep ( deltaTime ) changes, maybe to some tiny lag spike or something like that, the running entity visibly changes its speed ( running at top speed, actually) and that is really annoying to see. Other than that, if my game run slower (for example at ~33 fps) the entity moves definitely slower, which is, of course, not good at all, and moves 'lagging', in a completely not smooth way.
I use a variable time step and I limit FPS only if I have to do some test (for example simulating lag).
The game, and so the timestep calculation, is made with C++ and SDL2 but I think this issue is not language-specific. By the way this is how I calculate the timestep:

double last=0, delay=0;
while (running) {
    Uint32 now = SDL_GetTicks();
    if (now > last) {
        delay=now-last;
        last=now;
    }
    view->update(delay); // This is where every game logic takes place
    //... Do other stuff (clear screen, clear inputs, swap buffers)
}

Generally, this code works just fine, if my fps are less, then the deltaTime (delay in the code) increases. And that's ok. On the other hand there is a huge problem which is, of course, affecting my physic system: if my game runs faster than a certain number of fps (i.e. fps >= 1000 ) then, not matter what is the specific value, delay is always 1.
This makes a game session running at 1000 fps fast 1/2 of a session running at 2000fps. I know those values are extremely high and that my game is running like that just because now it's empty, but I think I can't ignore this problem. What if a super high extreme gaming machine tries to run my game ?

Now let's talk about physics:
My physics engine is really simple. It is 2D and, for now, I implemented only the x-Axis algorithm. My entity has a 2D vector holding speed (speed.x and speed.y ), a top speed (maxSpeed) and, of course, a position).

My engine works like this:

//Code executed in every frame:
if (fabs(speed.x) > 0 ) {
    speed.x /=  delta; //Simulate a very high friction

    if (fabs(speed.x) > maxSpeed) { //check if exceed the top speed
        //if so, set the speed to the top speed with the same sign
        speed.x = (maxSpeed * delta) * sgn(speed.x);
    }

   //Finally change the position according to the speed
    x += speed.x*delta;
}

That is what I use to simulate a physic system, where sgn is custom function which returns 1 if the value is positive, -1 otherwise. I know the friction is very high, but at the moment I do not care too much.

The last piece of code I use, is the code to make the entity actually move. To do so I use this piece of code:

if (input->isKeyDown(KEY_D))
    speed.x += acceleration.x * delta;
else if (input->isKeyDown(KEY_A))
    speed.x -= acceleration.x*delta;

In this code acceleration is like a constant, it's simply a value.
Now the code works fine in very general terms but the problems are:

Even a little change to delta (delay, variable time step) makes the entity visibly change his own speed (I guess it's related to top speed).
If my game runs on average of 30 -- 45 fps, the entity moves, but at a different top speed and the transition is verry laggy.
At a certain point delta becomes constant and that breaks up every physic logic.

I think everything is related to how I use my delta (delay) in each frane

sentences:
Continous repeatable object/image moving horizontally unity3d I want to move objects on the screen horizontally. And the user has to pop the object by touching it. When user touch it, it gets destroyed and new object comes randomly.

For experimenting, I used Unity's Scroll Rect to move them. What can be the best solution for this.

sentences:
LibGDX stretching 2d graphics I have a problem with stretching sprites in LibGDX.

I have one png file for the sky in the game (1 x 1000px) and I want to render it 1000 x 1000px

sprite.setSize(pixelWidth,pixelHeight);

I want to stretch this 1px-wide sky image. It has little gradient from the top to the bottom, as you can see. I want to make it 1000px in width. But I get this strange result:

You can see that there is something like a horizontal gradient, even with lines, but there's no apparent reason why that's happening, since I'm scaling a 1px wide image!

The strange thing is that everything looks fine on other PCs and mobile phones - but I don't think that the problem is with my PC!?

I don't know what to try. Any ideas?

sentences: mobile: Is every position in percentages when you support multiple screen sizes (different aspect ratios)? Is every position in percentages when you support different aspect ratios? Or do you do if-else statements for each aspect ratio and put absolute positions? What are the pros and cons of each?

sentences:
How can I clean up excessive player-created rubble? In my latest game I'm making, you can slice a 2D object arbitrarily, demonstrated in this gif:

You can continuously cut it into hundreds or thousands of pieces. This doesn't create a lot of lag, because they're always in a sleeping physics state, but there's a problem when you cause them to move.

I'm not really sure how to deal with making it so there's not so much rubble from cutting something apart. I don't really want to delete them after a certain amount of time; I don't like how, if you go back to something you cut up after a while, it randomly disappeared.

How can I clean up excessive player-created rubble?

sentences:
Should I use "conventional" colors to represent item rarity? I'm making a new RPG that has loot. In fact, a majority of the game is based around loot. It's going to have colored borders to denote the rarity of the loot as it's drawn.

WoW uses Grey, White, Green, Blue, Purple, Orange and some others. GW2 uses Gray, Black, Blue, Green, Yellow, Orange, Pink, Purple. The colors don't match but you can see some distinct overlap.

I'm wondering if those colors are important or intuitive to users understanding of the rarity or if they can be messed with? If they can be changed how do you determine what colors to put in what order?

For instance, if I went with White, Blue, Green, Yellow, and Red, would that be fine as long as I made it clear in other ways or would those colors be confusing?

sentences:
Shadows in Android using Unity 5 The point lights in my scene cast shadows when it's in the editor mode but the light passes through walls in the build or play mode.
I checked the quality settings and set it to hard and soft shadows for all quality settings but that didn't fix it.
It does work when I increase the quality when I build it for Standalone but not when I build for Android.
I've removed the dx11 option in the PC/Mac Standalone settings.
I've changed both forward and deferred rendering options.
I'm testing it on a Moto G 1st Gen [XT 1033].

sentences:
Speedup Dev process for bug fixing and debugging in Unity? We're using Unity 2017 for a big Indie game. at the moment We have some issues with our development speed:

In order to fix issues and bugs, We used the visual studio and attach the process to Unity and go through the code step by step. every time we change something (even just a line of code) we back to unity and wait for all scripts to recompile which takes up to 1 minutes sometimes. after that, we run the game and go to the place that bug happened which takes us about two minutes.

  I was wondering if there was a Best practice for fixing issues and
  debugging in Unity which brings us speedup on script compiles and also
  helps us to get to bug location faster.

sentences:
which quarter of a triangle the point is in I've got a world made out of squares. The square are devided in four triangles like this:

The corners have their heights stored in a 2D array and the center height is the average of the corners. To calculate the players Y-coordinate I have to know in which triangle he is standing on. How can you calculate in which quarter the player is by the X and Y coordinates?

EDIT:

My algorithm:

bool h1 = false, h2 = false;

if(posZ < posX - posZ) //something weird going on here
{
    h1 = true;
}
if(posX < posZ - posX) // and here
{
    h2 = true;
}
if(h1 && h2)
{
    triangle = 0;
}
if(h1 && !h2)
{
    triangle = 1;
}
if(!h1 && !h2)
{
    triangle = 2;
}
if(!h1 && h2)
{
    triangle = 3;
}

This algorithm tries to find in which triangle you are. There is something wrong in that math.

sentences:
How to Use Images Instead Of Drawing Primitives I want to build backgammon game. I have successfully built the board using primitives  such as lines, triangles and circles. I'm curious whether it's possible to draw the board using images which will make the board look much nicer. Is it possible to have images of triangle and then to put on top of it tiles? How is this achieved?

For example, let's say I have 100x80 image of a triangle and a 100x20 tile image of tile. What theoretically needs to be done in order for the tile image to be shown on top of the triangle image? (each have different colors, and the width of both is the same).

P.S
I'm currently programming this in Objective C for the iOS, but I don't think it's important, as this is more of a general question.

Thanks.

sentences:
How should I structure my menu / game loop? I'm trying to decide on how to structure my main game loop  - every example I've seen of the game loop looks a bit like this:

while (true) {
    UpdateGame();
    DrawGame();
}

i.e. it ignores the menu.  Should my game loop look like this:

if (ShowMenu() == Play) {
    PlayGame();
}

PlayGame() {
    while (true) {
        UpdateGame();
        DrawGame();
    }
}

ShowMenu() {
    while (true) {
        HandleUserInput();
        DrawMenu();
    }
}

(I.e. the menu and game have separate loops), or should I structure my loop as such:

while (true) {
    switch (state) {
    case Menu:
        MenuLoop();
        break;
    case Game:
        GameLoop();
        break;
    }
}

GameLoop() {
    HandleUserInput();
    DrawMenu();
}

MenuLoop() {
    HandleUserInput();
    DrawMenu();
}

I.e. one big outermost loop. (or does it not really matter?)

For what its worth I'm using SDL / C (although I'd like to think that the question is language agnostic)

sentences:
input arrays in OpenGL vertex Shader would something like this be valid as an input to a vertex shader?

layout (location = 0) in float[6] faceTextureOffsets;

I know you can use things like vec3s but for this situation I need an array of 6 floats. I am using a texture atlas and I would like for different sides of the cubes i'm rendering to have different textures and I need a way to be able to change the position in the texture atlas.

sentences:
Simple Terrain Grid (not working) I know yall are probably going to hate me.....but I can't figure out what im doing wrong, im trying to make a SIMPLE Vertex Grid (for Terrain) but I get a black screen for some reason And I can't figure out why. It does run, but I just get a black screen afterwards....I hate posting such huge code on this site but I figure if anyone can explain what the heck I did wrong i'd be able to understand a little bit better.

I think the problem....may be in the matrix, but my code is simple and im 100% sure im doing the Grid right because I took it from a working tutorial that does grids (but it's large and VERY confusing for a beginner, so I just took the appropriate code).

I know it's alot to look at (vars.h is very small) and main.cpp is pretty small too but I know it's still alot.....but im just completely stuck.

vars.h
http://pastebin.com/SupcqB8N

main.cpp
http://pastebin.com/vAnSUTpp

shaders.hlsl

cbuffer ConstantBuffer
{
    float4x4 matFinal;
}

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = mul(matFinal, position);
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

sentences:
Where to start learning OpenGL with C++? Possible Duplicate:
  What are some good learning resources for OpenGL?

I have learnt C++ and made some cool text based games and such but I would love to start graphical programming. I'm a decent artist (I will have some of my work below) I know the basics of C++ but I really would like to get into OpenGL.

I need someone to show me some good tutorials for OpenGL with C++ so I can really get into game development. My goal is to be able to program a simple 2D game by the end of the year and I have lots of time to do so. I'm en-rolled in a game development course next year and really need some help with starting off.

sentences: Is it possible to make an obj with single triangle I am not good in using blender so i wanted to ask if it is possible to make an object with just one triangle and how would it look like, will the no of triangle increase if you scale it up.

sentences:
What is the Unity 2019.3.5 version of `UnityEngine.UI.Text`? I was following a tutorial on how to create a dialogue Box in Unity, and in one part of the tutorial the tutor imports UnityEngine.UI and creates an object of type Text, but my version of Unity is 2019.3.5f1 and I learned through searching a bit online that this UnityEngine.UI doesn't exist anymore in this version, and that it was replaced with
UnityEngine.UIElements, and this Text type doesn't exist anymore as well.
I couldn't find a replacement for Text or what is the new nomenclature, nothing from trying stuff that popped in the auto complete or searching for answers in the Internet gave me answers. Maybe I just searched poorly, but if anyone happens to know, could you kindly answer?

sentences:
How can I correctly line up differently sized animation frames with a character? For educational purposes, I'm developing a 2d game without APIs or libraries. Currently I'm stuck with a sprite drawing problem.

To store sprites for drawing (assuming I have the sprites I need all in one sprite sheet), is it better to

store just the coordinates for each sprite for each entity, and then draw only the corresponding part of the sprite sheet when the entity should draw itself, or
store actual parts of the sprite sheet in each entity and the draw each the cropped sprite?

Another thing I'd like to learn is how to handle sprites with different sizes. See Zelda, for example: Link's walking sprites are all about the same size, regardless of his position or orientation. But when he attacks, the sprites include his sword and depending on his orientation, some sprites are wider and some longer.

Is there a good way to position and align sprites with different sizes relative to a part of the character—their foot, for example? Should I store some sort of offset for each sprite along with the sprites?

sentences:
How do you save and load settings for an iOS game? I've read a few beginning iPhone game programming books, and they've helped tremendously in my education and advancement in creating a few simple games, but of all the books I've read, there doesn't seem to be anything about creating a Settings Menu or how to change and save settings within a game.

What are some ways that settings can be saved/loaded? Where are these settings saved?

This may seem like a simple, uninteresting question, but I can't find anywhere that has a good explanation on how to go about creating a settings menu and how the data is saved/loaded each time the program ends/starts...

Mind you I'm not really expecting to have code thrown at me, but an explanation on how the structure works and how to wrap my head around the whole concept (though code is pretty ;)). Or even some articles that explain the concept that I could read would be very helpful.

sentences:
Game networking, limiting amount of movement packets I have been developing a server/client model for a game project I am working on. Everything works great, client side prediction works, server reconciliation works. Basically, the character can move smoothly without any hiccups.

However, the problem is that I am currently not using frame independent movement, it doesn't rely on the elapsed time between updates. Every time a movement packet is received, it will move the character x amounts of pixels. The packets are gathered on the client with a certain rate.

If someone were to modify the rate so that it would gather it faster, that means it would send more packets and make it move faster. Essentially, they would be speed hacking.

How would I go about preventing this behavior. If I try to add frame independent movement, server reconciliation doesn't work any longer since it doesn't know how much to move it after the server correction was received.
Is the best way to just limit how many movement packets that can be received server side per second?

I have been reading the source networking article, but they do not mention anything about this as far as I can see.

By the way, when I send these packets, I do not send them as they are gathered, rather I send them bunched together at another rate, to reduce bandwidth.

Edit: I think I was a little bit unclear about my packets. My packets contain user commands that holds the current state of the keyboard, mouse and whatever else is collected. The server receives the packet, which can hold MORE THAN 1 user command, as it sends the pakcets at a slower rate than the commands are collected. This is exactly what is described in the source networking article. The server receives the packet and handles ALL user commands as soon as it is received, thus if the packet contains a lot of user commands (the client modified the rate of which it collects them, or duplicated them) the server will move it more than intended. Modifying how often it sends the packets doesn't matter, but the gathering of the user commands does.

Let's say the server sends the packets every 100ms, and collects the commands every 50ms. That means every packet will hold 2 user commands. But if someone modifies the collection rate to, say every 10ms. Every packet will contain 10 user commands which would move the character further since the server moves it for every user command.

sentences:
Why is 2D light ray collision result getting inverted at specyfic angle recently i've been working on 2D lighting for my game. I've created new little project, and I've encoutered a problem. The collision between light ray and the object is fine at angles 316-360 and 0-136 degrees. On the others, light gets inverted (it's gone form the source to the object, and it's present on the 'dark side'.
I know the code isn't efficient, it's just my concept project, I would like you just to help me understand what is going on in here.

Here's a function that checks for collision, for every single point in a light ray.

public Vector2 Intersects(Rectangle rectangle,SpriteBatch s)
{
    Point p0 = new Point((int)startPos.X, (int)startPos.Y);
    Point p1 = new Point((int)endPos.X, (int)endPos.Y);

    foreach (Point testPoint in BresenhamLine(p0, p1))
    {
        if (rectangle.Contains(testPoint))
        {
            s.Draw(this.texture, new Rectangle(testPoint.X, testPoint.Y, 3, 3), Color.Black);
            return new Vector2((float)testPoint.X, (float)testPoint.Y);
        }
        else
        {
            final = testPoint;
                s.Draw(this.texture, new Rectangle(testPoint.X, testPoint.Y, 3, 3), Color.Black);
        }
    }
    s.Draw(this.texture, new Rectangle(final.X, final.Y, 2, 2), Color.Black);
    return Vector2.Zero;
}

// Swap the values of A and B

private void Swap<T>(ref T a, ref T b)
{
    T c = a;
    a = b;
    b = c;
}

// Returns the list of points from p0 to p1

private List<Point> BresenhamLine(Point p0, Point p1)
{
    return BresenhamLine(p0.X, p0.Y, p1.X, p1.Y);
}

// Returns the list of points from (x0, y0) to (x1, y1)

private List<Point> BresenhamLine(int x0, int y0, int x1, int y1)
{

    List<Point> result = new List<Point>();

    bool steep = Math.Abs(y1 - y0) > Math.Abs(x1 - x0);
    if (steep)
    {
        Swap(ref x0, ref y0);
        Swap(ref x1, ref y1);
    }
    if (x0 > x1)
    {
        Swap(ref x0, ref x1);
        Swap(ref y0, ref y1);
    }

    int deltax = x1 - x0;
    int deltay = Math.Abs(y1 - y0);
    int error = 0;
    int ystep;
    int y = y0;
    if (y0 < y1) ystep = 1; else ystep = -1;
    for (int x = x0; x <= x1; x++)
    {
        if (steep) result.Add(new Point(y, x));
        else result.Add(new Point(x, y));
        error += deltay;
        if (2 * error >= deltax)
        {
            y += ystep;
            error -= deltax;
        }
    }

    return result;
}

sentences:
UnrealEngine: Variables of GetGameMode are empty I'm confronted with the following issue:

Inside the class setup for one of my actors, I'm trying to get the value of an array which is declared, instanced and successfully populated in my GameMode's BeginPlay function. I've tested it many times over with print strings. The variable is solid.

However, inside my actor, when I go through GetGameMode, and access that value (i.e. an array), it is empty. For the life of me, I can't figure out what I'm doing wrong.

Here's the screenshot of the actor's blueprint, where the array called Players Array returns empty.

Thank you for your time :)..

sentences:
add random walls with an array in 3D xna 4 I'm trying to add walls to my 3D game. I created a wall entity and added model array

public Walls()
{
  modelArray = new Model[10];
}

public void Initialize(ContentManager contentManager)
{
  for (int i = 0; i < modelArray.Length; i++)
  {
    rnd = new Random();
    sidesWall = rnd.Next(-4, 4);
    forwardWall = rnd.Next(-8, 0);
    modelArray[i] = contentManager.Load<Model>("wall");
  }
}

Draw method:

public void Draw(Camera camera)
{
  foreach (Model m in modelArray)
  {
    foreach (ModelMesh mesh in m.Meshes)
    {
      foreach (BasicEffect effect in mesh.Effects)
      {
        effect.EnableDefaultLighting();
        effect.PreferPerPixelLighting = true;
        effect.World = GetWorldMatrix();
        effect.View = camera.ViewMatrix;
        effect.Projection = camera.ProjectionMatrix;
      }

      mesh.Draw();
    }
  }
}

It doesn't work and it shows only one wall.

How can I make it work?

sentences:
How to link OpenGL with my own static library? My game project is split up into three parts:

Core (lib)
Editor (exe)
Game (exe)

I'm using OpenGL in both my Core and Game parts, but as soon as I try to call an OpenGL function in my Core library the application crashes.  I assume this is because the static library is not being linked with OpenGL.  The build process goes like this:

# core library
g++  -c  ... -std=c++0x -g  -o ... -I. -I.
ar rcus libCore.a ...

# game exe
g++ -o Game ... -L. -L../Core/Debug/   -lCore -lglew32 -lglfw -lopengl32

Where ... stands for the various files.  How can I link OpenGL with my static library?

sentences:
Has Silverlight got a future in the online Game world? We have spent several months planning, testing and developing a new game. We have been trialing a host of Platforms (Java Applet, Desktop Via XNA, Flash etc) and Silverlight was pretty much our prefered choice.

However, the more we get into the game the more problems we face, mainly down to the communication with a server. HTTP Polling is slow and in-efficent yet the socket functionality that is now available in SL4 is only really useful for a Intranet enviroment - Unless we are missing something.

Anyone have any opinions or experiance with this and the future of SL for Online Browser based games.

sentences:
Management of objects as targets of other objects I have started my first game three years ago and learned a lot during that process. Now I would like to rewrite it to incorporate my "lessons learned" or try out new ideas.

My game consists of space ships that can target other space ships either for combating, trading or communicating. When they have no current target, they look for other ships in their area, lock them as target (by keeping a pointer to them as member variable) and do some stuff. After a ship is destroyed, its pointer used by other ships as a target becomes invalid. To avoid any dangling pointers and crashes, I add the to be destroyed Ship's id to a cleaning list. During the next World's update, I go through all of these to be destroyed ids and remove them as potential targets. See this pseudo code to demonstrate this:

class Ship
{
public:
    Ship();
    Ship::destroy(){
        // set to be destroyed flag
        _world.pointersToDelete(_id);
    }

private:
    void        destroy();

    int         _id;
    Ship*       _target;
    World*      _world;
    bool        _to_be_destroyed;

};

// in World::update
World::update()
{
    for (auto ship: all_ships)
    {
        for (auto id_to_delete: ids_to_delete)
        {
            if(ship._target != nullptr && ship._target->_id == id_to_delete)
            {
                ship._target = nullptr;
            }
        }
    }

    // now trigger the actual final destruction of the ships
    // ...
}

Question: Is this a good design in general?
I ran into some problems when I used it in practice:

There are more objects that communicate, combat and trade with ships like Space Stations, Planets, etc.. I would need to go through all of them every update loop to check whether they have no dangling pointers. I am concerned about the performance since my game allows space battles of thousands of ships at the same time.

I thought about using an id approach instead: the _target variable is not a pointer but an id that I can look up in an unordered_map of Ship objects. If the id is not found anymore, the target is not valid any longer. But this could lead to performance issues as well if every object has to check this during every update multiple times.

sentences:
The proper name for a state, view, screen, etc Most of my experience is in programming in HTML, JavaScript, etc.  I'm taking on a relatively large project, and while I'm the only developer, I eventually want to open source my code for other developers.

For project scaling purposes, I'd like to have decent terminology, because terminology affects all my variables, and changing it later is a pain.

What is the proper name for when you change views or screens? For example, changing between  an options screen and the playing screen.

I mostly hear it called "state", but when I refer to "gamestate", I typically mean the locations of all entities, the turn count, the score, etc.

I think it may be called "screen", but my games are not full screen, and I'm not sure if that one makes sense.

A "view" is something I don't hear very often, but when searching for "views" with "games", I find material on the point of view.

Is there a proper word for it?

sentences:
Applicability of Business Architectures in XNA 4 I've done a lot of C# programming and the architecture we use of late is a MVC => PresentationService => Domain Service And/OR DataService => Repository with a UnitOfWork and a messaging bus.  In web applications this gives a pretty clean and flexible design that's extensible but is also stateless.

I've been working on a 2D starter project in XNA and I find these layers are still useful until I get to the interface and start trying to deal with knowing the states of everything, keeping the sprites and bounding rectangles and detecting clicks and drags.

What patterns should I be looking at that maybe I just wasn't exposed to doing enterprise architecture but are clearly needed in a game.

Which concepts might I need to let go of when doing a game because they are not applicable.

sentences:
save a particular area of the scene as screenshot in unity I need to save a particular part of the scene as screenshot. I have done a sample to show the particular part of the scene.

When I click on the rectangular area the selected area will being shown on the screen on a texture (marked in red rectangle):

But when I save, the whole scene is getting saved but not the selected part:

Here is code:

Texture2D screencap;
Texture2D border;
bool shot=false;
public string path;

void Start () {
     screencap=new Texture2D(300,200,TextureFormat.RGB24,false);
     border=new Texture2D(2,2,TextureFormat.ARGB32,false);
     border.Apply();
}

// Update is called once per frame
void Update () {
    if(Input.GetKeyUp(KeyCode.Mouse0))
    {
        StartCoroutine("Capture");
    }

}
string fileName(int width, int height)
{
    return string.Format("screen_{0}x{1}_{2}.png",
                         width, height,
                         System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
}

void OnGUI()
{
    GUI.DrawTexture(new Rect(200,100,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(200,300,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(195,100,2,200),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(500,100,2,201),border,ScaleMode.StretchToFill);

    if(shot)
    {
        GUI.DrawTexture(new Rect(50,10,60,40),screencap,ScaleMode.StretchToFill);
        //Application.CaptureScreenshot(myFolderLocation+myFilename);
    }
}

IEnumerator Capture()
{
    yield return new WaitForEndOfFrame();
    screencap.ReadPixels(new Rect(198,98,298,198),0,0);
    screencap.Apply();
    shot=true;

    byte[] bytes=border.EncodeToPNG();
    string filename=fileName(Convert.ToInt32(screencap.width), Convert.ToInt32(screencap.height));
    Application.CaptureScreenshot("D:"+filename);
}

How can I save only the particular part in unity,can anybody please help me out.

sentences:
How can I make this style of 2D "glowing" graphics? I'm comfortable with the basics of building a 2d sprite based game in XNA, where all my objects are simply .png images that I move around.

What things do I need to learn next to be able to develop a 2d game that utilizes an art style similar to Super Laser Racer for example.

Other examples of this style would include Frozen Synapse, Geometry Wars, etc.

I would describe this style "2D abstract glowing geometry" or something like that.

I can see that a lot of the effects in these types of games are achieved via particle systems and also that maybe some things are still just sprites that were maybe drawn in a graphics editor to look all "glowing" etc.

But then the rest is possibly done by making draw calls to DirectX and implementing custom shaders, etc?

Is that right? I'm not really sure of what to learn next to be able to go in this direction or what questions to ask.

sentences:
View Frustum Alternative I am working on a simulation project that requires me to have entities walking around in a 3D world. I have all that working, matrix transformations, etc. I'm at the point where I need what is essentially a view frustum, so I can give each entity a visible area. However, when looking over the calculations required to do it, it seems like a perspective frustum is only required to be able to project it onto a 2D screen. Is there another, easier to code solution, that would function better, such as an orthogonal perspective? Could I just define a shape mathematically and test wether the coordinates of the objects are inside or out? I am not really a 3D coder (and I am doing this all from scratch, not using an engine or anything), so I would like the simplest solution possible for my needs.

Thank you!

sentences:
Game movement in 2D SFML game I am making simple 2D game, imagine it as 2D Minecraft where you can dig blocks and build other things.

Currently I am struggling with movement. I have none experience in game development, but I am quite familliar with C++, that is why I am using SFML.

What situations I am considering in movement:

Collision while moving on the X axis
Collision when jumping ( on the Y axis )
Fall down if there is no block under

My player sprite is 64x32 (h x w) and block is 32 x 32.
I store blocks as vector<vector<unique_ptr<Block>>> so I can calculate the index of the block as x_pos DIV 32, y_pos DIV 32

This is how I currently check if there is block ( X axis ):

new_position = actual_pos + velocity; // calculate new position
face_level = new_position.y DIV 32; // level 0 is the ground
feet_level = face_level + 1; // +1 is good, cause we increase level by going down
x_level = new_position.x DIV 32;
if (block_exists[feet_level][x_level] || block_exists[face_level][x_level]) {
    return Collision::Block_Collision;
}

and then check

collision = check_collision();
if ( collision == Collision::Block_Collision ) {
    // X axis
    stop_moving();
}
if ( collision == Collision::No_Block_Under ) {
    // falling
    fall_down;
}
if ( collision == Collision::Block_Above ) {
    // Y axis, actually do nothing, "dont jump"
}

If going left, I consider left border of the player.
If going right, I consider right border of the player.

This was the easiest part.

What position should I use for the falling part? Should it be the middle of the player, or left/right border combined ? If I used the middle position, then player would fall into the block if he was standing on the left/right half.

Question is, what would be the best approach generally to solve these 3 situations.

sentences:
Animator on a WorldSpace Canvas Ok, so I have my world space canvas attached to the player object. In my script I have a reference like this :

 GameObject myWorldCanvas;

Awake()
{
 myWorldCanvas= transform.FindChild("nameOfObject").gameObject;
}

Then when the right conditions are met I simply activate the object like this :

myWorldCanvas.SeActive(true);

This worked perfectly until I added a animator to the object. If I manually enable/disable the object in the scene the animation works perfectly(it just changes the scale to give it a pop effect), but when the object is activated by my script the animation still plays and changes the scale values but nothing is rendered. In play mode if I manually enable/disable the animation works.

Any ideas ? If you need more info or screens let me know.

Edit : the canvas has some buttons as children and when I mouse over something seems to be refreshed and the images show up on screen.

Edit: Further test have show that manually disabling and enabling the Canvas component also shows the images, but If the canvas and game object are enabled from a script nothing shows up on the screen.

Edit: I solved the problem by disabling the canvas component on the first key of the animation and then enabling it on the second one where the Y scale is set to 0. This seems more like a hack and I dont like it. Does anyone have a idea why this is happening ?

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

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

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

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

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

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

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

sentences:
Sprite cut in half after placed on Scene I have noticed a very odd behaviour in Unity 5.2.1. When I drag and drop a Sprite into the Scene, it's cut in half like this:

I tried with PNG and PSD formats but it didn't help. Although when I flipped an image horizontaly in PS and then imported it, it worked. Is this a Unity bug?

Edit: It happens only when I set Max Size to 512 or more, but still - why?

sentences:
What pattern is this, and should I do it? I'm making a game in as3 using flash develop and flash cs5. Everything is object oriented. I was wondering, should I have one "gateway" class that has a property-reference to all instantiations of other classes, and I just pass this gateway class to new objects, so they have access to every class. Like so:

 var block:Block = new Block(gateway);

 //In the block class:
 this.gateway.player.setHealth(100);
 //Or:
 this.gateway.input.lock();

Is this like a singleton pattern or something? Should I do this?

sentences:
Creating Entity as an aggregation I recently asked about how to separate entities from their behaviour and the main answer linked to this article: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

The ultimate concept written about here is that of: OBJECT AS A PURE AGGREGATION.

I'm wondering how I might go about creating game entities as pure aggregation using C#. I've not quite grasped the concept of how this might work yet. (Perhaps the entity is an array of objects implementing a certain interface or base type?)

My current thinking still involves having a concrete class for each entity type that then implements the relevant interfaces (IMoveable, ICollectable, ISpeakable etc).

How can I go about creating an entity purely as an aggregation without having any concrete type for that entity?

sentences:
What's an acceptable delay between a player's action and the effects of the action being visible? So, I'm creating a game where all the systems push events onto the event queue. Those events are then dispatched at the start of the next frame. This works fine, but there are some situations where the delay between a player's action and the effects of the actions can be upto 3 frames.

3 frames for a 60fps is around 50ms. Is this kind of "lag" noticeable to a player?

sentences:
18.5:9 Android ratio force to 16:9 problem in Unity I want to my game build in devices with 18.5:9 ratio like Samsung S8 forced to be displayed as 16:9 ratio.
I already set Aspect ratio mode to Custom and set it to 1.86 in Player Settings.
I also overrided Android Manifest like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner">
  <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:maxAspectRatio="1.86" android:resizeableActivity="false" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
  </intent-filter>
  <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
  </activity>
  <meta-data android:name="unity.build-id" android:value="633a700a-7389-4a19-972c-ac1f177788f8" />
  <meta-data android:name="unity.splash-mode" android:value="0" />
  <meta-data android:name="unity.splash-enable" android:value="True" />
  <meta-data android:name="android.max_aspect" android:value="1.86" />

  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
  </manifest>

And as you see add attributes like android:maxAspectRatio & android:resizeableActivity to AndroidManifest manually.

But by installing the app on devices with that specific ratio, the game still running full screen and out of the bounds.
I am using Unity 2018.1.4f1 (64bit).

sentences:
is edit tangent possible in 3dsmax? I have a custom hlsl directx shader,
it takes vertex normals for rim light calculation.
and vertex tangent(it stores unified normals) for edge render(enlarge model & cull front).

I can export one fbx with auto smooth normals, and one fbx with unify normals, combine them in unity, it works but the process is slow. I just wonder if I can do it directly in 3ds max, so 3d artist can preview the result directly in their tools.

I tried storing unify normals data in texture coordinate or vertex color, but the data will be wrong once bone animation is running. So I believe normal + tangent is the only way to go if I want to have rim lighting & edge render together for a animated character model use in Unity3D.

I guess FBX SDK will help, but I have no experience in using it.

I wish someone could tell me a way to store vertex normals data into tangent.
or tell me is it not possible so that I should consider another solution.

thanks you.

sentences:
Positioning of AABB / Rectangles I am wondering what is the best way to position rectangles, the ways I have thought of are:

Have an x and y at upper left, then have a width and height
Have an x and y at upper left, and an x and y at lower right
Have an x and y at center, and have width and height ("radii" of the rectangle)

I guess that the third way might make the most sense since it's the closest to how I would do a circle (position and radius) but I do not know if it is the best way to do it.

I would prefer to stay away from the second way, as I would want only one part for position

Is there a preferred way to do this?

sentences:
In Unity, why do my animator states wait until the end of each animation to change? I'm trying to make a simple idle-walk transition in Animator using Unity.
I've set a script that changes the Speed value from the Animator, and it works perfectly when I move the character forward when the game is on.

The transitions work well between both animations, except that they don't start automatically after the speed has changed to greater than zero.

I've found out that it waits until the animation loop gets to it's end, which makes the game feel dull and not fluid at all.

I don't think there's an issue with the code, but I'm attaching it anyway:

#pragma strict
var anim : Animator;

function Start () {
    anim = GetComponent("Animator");
}

function Update () {
    var move : float = Input.GetAxis ("Vertical");
    anim.SetFloat("Speed",move);
    transform.Rotate(0,Input.GetAxis("Horizontal"),0);
    transform.Translate(0,0,(Input.GetAxis("Vertical")*Time.deltaTime*move));
}

sentences:
Unity generates changes in GitHub on saving scene So, here is my problem.

First I have a look at the changes in the repository which I am working with.

Initially there are no changes:

Then I open up Unity, i don't make any changes and just save the scene:

I then go to GitHub Desktop and suddenly there are a lot of changes appearing which I did not make:

How can I avoid that?

The files which are getting changed are .prefab files.

sentences:
Negative scale in Matrix 4x4 After some rotations and to from quaternion conversions I get negative scale from Matrix 4x4, is it possible? I need that scale to draw sprite on screen so I get sprite flipped,
how to deal with this problem should I just handle negative scale in sprite drawing method.

if MatrixHasNegativeScale  then invert scale, draw sprite with inverted scale
after m4.initWithHeadPitchRoll(0, 0, 180); I already get negative scale.
or something wrong with matrix class?

Edit I create transformation matrix(rotation + scale + translate) rotation around Oz by 180 and when I extract scale from it, it has negative value is it normal?

sentences:
Should my game states be JPanels? I'm thinking about making a StateManager for my game. I want to know how to design it; that is, how to use a stack to push and pop states onto, and draw them to the screen.

For example, should each State be a JPanel? I want to make a Menu, preferably using JButtons if possible. I don't want to add them directly to the main panel because I don't want to have to constantly add and remove those buttons. Also, not all my states are going to be drawable, since I might have a state that contains a MouseListener to detect clicks.

Right now, I have an empty State class. My Menu class extends from that. My state stack is of the type State. Another design question: if in my Menu I click the "Play" button, should I just say something like StateManager.push(new PlayState()) from the Menu class?

sentences:
Rotation smoothing with Slerp snaps to center when switching between different destination vectors I'm making a 3D space shooter in Unity (think Star Fox).  The ship, when I move it around the map, should rotate slightly (smoothly) in the direction I'm controlling it.

I have smoothness mostly working.  When I press an arrow key, the ship banks in that direction, and when I release it, it smoothly returns to the default rotation.

However, if I quickly change the direction it's rotating before it has the chance to get back to the default rotation, instead of rotating from "banking left" to "banking right", for example, it instantly snaps to the default rotation before beginning the smooth rotation.

Here's what it looks like:

In addition, when I connect a joystick (instead of using arrow keys) to control the ship, I get a different problem:  The ship has literally no smoothing at all, rotating one-to-one with the direction the joystick is rotated in.  Here's what that looks like:

Here's the code that controls ship movement:

public bool inverted = true;
public float speed = 20; //speed modifier of horizontal/vertical movement
public float rotSpeed = 120; //speed modifer of rotation (ship tilting)
public float ZRotMax = 30f;
public float YRotMax = 50f;
public float XRotMax = 30f;
public float width = 30;
public float height = 15;
public float centerDriftStrength = 5; //lower is stronger, higher is weaker.

// Update is called once per frame
void Update () {
    //Get input
    float controlHorizontal = Input.GetAxis("Horizontal");
    float controlVertical = (inverted ? -Input.GetAxis("Vertical") :
        Input.GetAxis("Vertical"));

    //Add mild center drift
    float moveHorizontal = controlHorizontal - ((transform.position.x)
        / (width * centerDriftStrength));
    float moveVertical = controlVertical - ((transform.position.y)
        / (height * centerDriftStrength));

    //Modify position
    transform.position += (new Vector3(moveHorizontal, moveVertical, 0)
        * speed * Time.deltaTime);

    //Cosmetic rotation based on controller input
    Quaternion oldRot = Quaternion.identity;
    Quaternion newRot = Quaternion.Euler(XRotMax * -controlVertical,
        YRotMax * controlHorizontal, ZRotMax * -controlHorizontal);
    transform.rotation = Quaternion.Slerp(oldRot, newRot,
        Time.deltaTime * rotSpeed);
}

In particular:

transform.rotation = Quaternion.Slerp(oldRot, newRot, Time.deltaTime * rotSpeed);

Seems to be what I need to look at.

rotSpeed should cap the speed of rotation on the ship, so that it can't instantly rotate in a different direction.  Right now, when rotSpeed is less than 120 or so, the ship twitches while rotating, and if it's particularly low, like 10, the ship barely rotates at all.

(The rotSpeed variable doesn't seem to be working anyways -- setting it to 30000 or something doesn't make the rotation any faster.)

Basically, I want the ship to always rotate smoothly, never jumping instantly from one rotation to the next.  I'm not sure if I need to use Slerp for this, or if there's some better smoothing method available to Unity.

Thanks, and if anybody knows of other ways to smooth rotation between constantly-changing Vector3s/Quaternions, please tell me!

sentences:
How to find the 3D object the camera is pointed at I'm currently developing a 3-dimensional game (the first I've ever done and it's not as hard as I thought it would be!), but I've run into a little bit of a snag. I want to find the current block the crosshairs of the camera are pointed to, and I'm not sure how exactly to do it. The only thing I can think of is starting at the view position and moving like 0.1 units until I hit a space that is occupied by a block, but I feel like that would be a little... brute-force style? Is there an easier/better way to find it?

Here's what I have:

The vector3 of the camera position.
An array of block positions which may or may not be filled with blocks. The block centres are at whole-numbered intervals.

I promise this isn't a minecraft clone. ;)

sentences:
Relationship between Camera's view size, screen resolution and objects scale I've had this question since a long time ago and wanted to know the relationship between how an object is viewed through the camera depending on the resolution of the device, the camera's view size and the object scale, so for example:

let's say i have a 100x100 square in the middle of the screen, the camera is looking directly at it and let's say the square takes 10% of a specific screen, if i wanted it to keep that relationship with the screen do i have to change the square size depending on the screen size?, change the camera's width and height? or change the resolution of the game?

in short, how does the resolution and the camera's widht and height affect the scale and proportions of the objects of the screen?

sentences:
High-performance update of a bitmap grid I need to visualize a fast paced process in .NET in 2D. I am planning to use writeable bitmap 800x40px.
The idea is like this - there are objects which are represented by very basic colours and sizes anything from 1x1 to 4x4. each takes 4x4 "cell" - they all are fixed like a chess board.
The objects move between cells and change size. Most importantly they move independently, so I cant (I can but I would like to not) have a sort of refresh rate.. I need to animate each object state change - like say pixels pouring from cell to cell. the transition time should be around 500ms.
In this period of time the states can change multiple times so I should be able to abort outdated animation, move object "instantly" to new cell and start more recent object animation which could have taken over the "old" cell..
The accuracy should be in 1-2ms intervals.
The host application is WPF .NET Framework

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

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

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

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

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

using UnityEngine;
using System.Collections;

public class DynamicWeightAnalysis : MonoBehaviour
{

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

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

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

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

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

        Vector3 offset;

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

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

    //Offset Squared:
    magsqr = graverage.sqrMagnitude;

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

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

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

Thanks :D

sentences: For 2D tiled maps is all object and NPC data loaded into memory when the map is loaded? I'm creating a text RPG in Java, but I think this applies for a GUI as well with regard to the data structure. Each Level is a tiled map. Each Tile object has an (X,Y) coordinate, and references to adjacent tiles, but my question is with regard to storing object and NPC data on that Tile object. Depending on the size of the map I'm loading, this seems like a lot to load, but if that is the commonly accepted practice then I'll go with it.

sentences:
Problem with Update(GameTime) Methods and Pause implementation I have the pause function implemented and it works correctly in that it dims the player screen and stops updating the gameplay.

The problem is that GameTime continues to increase while it is paused, so my method that checks gameTime versus previousSpawnTime before spawning another enemy gets messed up and if the game is paused too long it is noticeable that the next enemy draws far too early.

Here is my code for the enemy update.

private void UpdateEnemies(GameTime gameTime)
    {
        // Spawn a new enemy every 1.5 seconds
        if (gameTime.TotalGameTime - previousSpawnTime > enemySpawnTime)
        {
            previousSpawnTime = gameTime.TotalGameTime;

            // Add an Enemy
            AddEnemy();
        }
...

I also have other methods that depend on gameTime.  I've tried getting the total pause time and subtracting that from the total game time, but I can't seem to get it to work correctly if that is the way I should go about solving this.

If you need to see any other code let me know.  Thank you.

sentences:
Group arrival steering I've got group movement implemented pretty much like this:

http://www.red3d.com/cwr/steer/CrowdPath.html

Basically, that's combining path following and separation. It works nicely as long as units are in transit, but arrival does not work very well at all.

Right now, units just cease to use the path following component once the "exit" the path, i.e. when their closest point on the path is on or past the end.

This leads to those units bumping into each other and also overshooting the point the player clicked. Ideally, I'd have the units arrive scattered around the finish point (and reasonable close to each other), not all clumped up past the finish line.

I'd imagine that some kind of arrival steering might work here, but based on other units and a "fuzzy" classification of the end of the path.

Is there any proven way to do this?

sentences:
How can I add different colliders to each body part of a character in Unity? I have been using unity game engine for about two weeks now. And I'm very interested in 3D game development. I have been learning basics of Unity and third person games. I saw many tutorials about creating a 3D third person player. They just drag the character into unity and create a capsule collider around the character and freeze the rotation around x and z axis.

So my question is: is it possible to add different colliders to each body part of the character and if so how do I do accomplish that?

sentences:
How to make a merge animation in Unity? I've seen a merge animation in a mobile game which you can check here;

https://youtu.be/G7l24Wtdcxw

You can observe the animation when the tiles combine.

Can it be done in Unity3d, may be using shaders? Or, do I need to use a 3d app like Blender?

sentences:
Sprites lose quality when in Unity Whenever I drag a sprite sheet into unity, it, for whatever reason, distorts. Is there any way to remedy this?
Original

Distorted

sentences: How to stop a running timeline in GameMaker Studio? I am creating a game using GameMaker Studio and I need to stop a timeline that is in progress. How can I approach that with GML code?

sentences:
Cocos2d v2.0 and OpenGL 2.0/1.0: where to start I started developing my very first game 3 months ago using Cocos2d 2.0 for iPhone. I am now in the stage where I'd like to add some cool effects to the bullets and some special weapons (see my waveforms question here). I got a good answer in the cocos2d-iphone forum (see this one).

Unfortunately I am a bit paralized now. I don't know if I will be overdoing by learning OpengGL 2.0 or if I should just stick ot the old 1.0. There is a good intro on various tutorial's written in Steffen Itterheims blog (see this post).

I would like to add to my game:

a blur effect to the bullets (here is a tutorial for OpenGL 1.0)
a waveform (see above)
some realistic water ripples (here is a nice sample code)

So now, given that I don't want to overdo things but at the same time I want to achieve those effects, from where should I start? Should I discard the OpenGL 1.0 tutorials? OR should I use only OpenGL 1.0 code?

How can I avoid confusion? I mean, it seems that the compiler recognizes both, but that there are some conflictual calls in some circumnstances, I am fairly sure this has some explanation, is there some reference to this somewhere?

sentences:
Capitalizing on JavaScript's prototypal inheritance JavaScript has a class-free object system in which objects inherit properties directly from other objects.  This is really powerful, but it is unfamiliar to classically trained programmers. If you attempt to apply classical design patterns directly to JavaScript, you will be frustrated. But if you learn to work with JavaScript's prototypal nature, your efforts will be rewarded.
...
It is Lisp in C's clothing.
-Douglas Crockford

What does this mean for a game developer working with canvas and HTML5?  I've been looking over this question on useful design patterns in gaming, but prototypal inheritance is very different than classical inheritance, and there are surely differences in the best way to apply some of these common patterns.
For example, classical inheritance allows us to create a moveableEntity class, and extend that with any classes that move in our game world (player, monster, bullet, etc.). Sure, you can strongarm JavaScript to work that way, but in doing so, you are kind of fighting against its nature.  Is there a better approach to this sort of problem when we have prototypal inheritance at our fingertips?

sentences:
Wait until a method finish I'm using Firebase Realtime Database and I'm trying to compare if a name is available to other user. The problem is the method finish before the Firebase's method finish its execution. Here is the code:

private bool IsNameAvailable (string nick)
{
    bool available = false;
    FirebaseDatabase.DefaultInstance.GetReference ("users").OrderByChild ("name").EqualTo (nick).GetValueAsync ().ContinueWith (task => {
        if (task.IsFaulted) {
            Debug.LogError ("A error encountered: " + task.Exception);
        } else if (task.IsCanceled) {
            Debug.LogError ("Canceled ...");
        } else if (task.IsCompleted) {
            DataSnapshot snapshot = task.Result;
            available = (snapshot.GetValue (true) == null);
        }
    });
    return available; //This line executed before the Firebase's method end.
}

What can i do??
Thanks in advance.

sentences:
How to make some monsters appear more dangerous than others? My game is an open-world co-op MMO with retro graphics, permadeath and no leveling system.

The problem I'm facing, is the fact that I don't know how to make some monsters appear harder than others. Since nothing has a level, and characters can only get stronger by acquiring better items, it's difficult for me to "warn" players that a monster is difficult for them.

Fortunately, the whole world is designed by hand and we know which areas should be more difficult than others. So this means, I as developer knows which monsters are stronger than others.

But new players won't! I don't want them to get frustrated by walking into the wrong monsters reserved for higher players.

So then, how can I make monsters appear more dangerous than others?

Some things I thought of:

increasing the size of the monsters: This could work but it's not a valid rule for everything. For instance, the end-boss has small minions which are also powerful.
use of particles: I remember from playing WoW some monsters who were stronger excessively used particles to make them appear more powerful:

dividing the world into danger levels: Here I would add a danger level or something to the HUD that displays whether the player is in a safe zone or somewhere dangerous. It would change and display a notice whenever the player moves to a different danger level. Do-able although I have no clue how to portray it on the HUD.

sentences:
AS3 Stage3D Mouse click problem? I have a problem with Mouse interaction and Stage3D.

The only way I found to register to listen to mouse clicks and interact with Stage3D, is to add a mouse eventListener directly to the .stage.

However this will result in any time i click anywhere in the flash application the mouse click will fire, even if there is an overlaid 2D menu where the user intended to click.

IE I have a 3D application running in the background, which listens to clicks, and I have some floating User Interface elements in the foreground, and ideally if I clicked a button in the foreground, then that would NOT fire a click event that the Stage3D would register.

Any idea how to solve this problem?

sentences:
Marketing PC/Android 2d Physics Game I've been working on a game for couple years now, its fairly original, has definite potential within an indie market, and appeal for the masses also.

I want to deploy on Android and PC, green-light it on steam and looking into Kickstarter. I'm also going to set up a website where it can be played, have a dedicated server to link 'matches' and post demos on sites like mofunzone and armorgames.

I've used Jbox2d, and am also curious about the licencing with this engine and can't seem to find documentation on that.

I'm almost done the 'demo' and my question is, how should I market it?

I was thinking I'd make the game free on android, charge something like $10 on steam, and charge say 1$ month to play online (for the pc version)

If anyone has any good links, research or advice from personal experience, it would be greatly appreciated.

sentences:
Convenience of mySQL over xml Currently I use XML to store specific information to correctly load a few things such as a list of specfied characters, scenes and music, Once more I use JAXB in combination with standard compression/decompression(ZIP) functionality to store a list of extrenous data. This data is called to add functionality to the character, somewhat like Skills in an RPG. Each skill is seperated into its own XML file with a grandlist which contains the names of each file with their extensions omitted and zipped in folder that gets encrypted.

At first using xml was working fine however as the skill list grow i worry about its stability. I was wondering if I should begin storing the data in mySQL. Originally I planned to simply convert everything to JSON over xml but i think possibly mySQL would be a better move.

Can anyone inform me of the key difference and pros and cons of each
I guess i'm looking for the best way to store the data more conviently and would be easier to operate on. The data is mostly primatives and strings and the only arraylist of values i have i can just concat into a single field and parse later

Edit:

If I am going in the right direction with XML would it make sense to convert it to JSON and use maybe Kyro or EclipseLink JAXB (MOXy)

sentences:
Bouncing Ball in c++ Background

I've been making my own game from scratch.

I've made my own collision system and there's a situation I'm having an issue with.

Problem

Pictured:

a ball going in one direction and changing direction when it hits the green segment.

I have the trajectory's angle in correlation with [relative to?] OX axes and trajectory's angle (in correlation with)[relative to?] the green segment.

Question

How do I update the initial trajectory angle with the OX to produce the bounce behaviour?

sentences:
XNA GameServices vs. public static I am just starting learning XNA for developing Windows Phone games. I am stumbling accross different sample codes featuring different approaches on handling things.

A question for the experts... or at least for people who already have experiences with that topic:

Does it make more sense to inject instances of SpriteBatch via the constructor of game objects or adding the SpriteBatch object to the GameServices collection and retrieving it from the game objects' constructor like so:

spriteBatch = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;

sentences:
How to override onSetContentView while Using Ratio Resolution policy in Andengine Base game activity I am developing (Learning to build :)  ) a game with  andengine GLES2.
I am using base game acitvity , and i overrides the setContent view to place my admob ad.Every thing works fine except the resolution policy . Ratio Resolution policy is the one I am using along with CAMERA_WIDTH = 800; and CAMERA_HEIGHT = 480;

The issue is whenever overided onsetContentView scene is not get aligned to center ,margins displayed only on bottom not on both top and bottom, Same will cause when horizontally align the margin will be displayed only at right side, not on both sides. how can i correct this. I am giving my code below

@Override
protected void onSetContentView() {

    System.out.println("Content setting");
    this.mRenderSurfaceView = new RenderSurfaceView(this);

    final LayoutParams layoutParams = new LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT,
            android.view.ViewGroup.LayoutParams.MATCH_PARENT);

    layoutParams.gravity = Gravity.LEFT ;

    final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams(
            layoutParams);

    adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxx");

    final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.LEFT
                    );

    final FrameLayout frameLayout = new FrameLayout(this);
    final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT,
            FrameLayout.LayoutParams.FILL_PARENT,Gravity.CENTER);

    frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
    frameLayout.addView(adView, adViewLayoutParams);

    this.setContentView(frameLayout, frameLayoutLayoutParams);
    this.mRenderSurfaceView.setRenderer(this.mEngine, this);

}

here is the image what i get you can see the white margin below the scene if you select the image ( its not get into attention due to stack overflow also had white background )

any suggestions will be very help full to me

How Can i solve this Isuue Please help me

Thanks to all,

sentences:
Best way to store a word list in Java/Android I'm building a game where I form words (think Scrabble) and I need to have them validated in real-time, meaning that I need to have some sort of word list loaded where I can check if the word made exists or not.

I was wondering what would be the best way to store that list, should I just create an Array or use some sort of database (sqlite3 in this case).

Thanks

sentences:
How to flip sprite and all collision children of a KinematicBody2D at the same time? I have tried to use the scale property of KinematicBody2D to flip at the same time the sprite and the collision/area/raycast children. For flipping, one just has to set scale.x = -1.
If it works in the editor, it does not work properly because the engine seems to reset scale.x to 1 each frame (as stated here):

NB: Here the original sprite is looking left (that is why it is blinking when going to the right, not very didactic sorry).

How to do the same without flipping every collision children one by one?

sentences: Getting angle from current position and next position I am using pathfinding to move a train along rails, but I need the train to rotate. I have the next intended position and the current position at my disposal, how would I go about this? Pseudocode will do as an answer since I am using a specialized programming language for the engine that I use.

sentences:
How does UNO determine how often do +4,+2 & other special cards occur in a deck/game? For UNO-like card games, what factors would one consider when they wanted to set a reasonable proc rate of receiving a special card (for example in UNO's case: +4,+2, color-wheel, reverse, skip)? What factors should I consider when designing a similar game?

I understand probabilities etc. are involved in this. I would appreciate if someone can demonstrate the mathematics/concepts behind it.

sentences:
3d isometric projection matrix? I have 3d vectors that I want to project as 2d vectors to draw my shapes. I got a 3d vector cameraPosition, a 3d vector cameraDirection, a float renderDistance. I need to create an orthogonal / isometric matrix with those values to project my 3d vectors.

Here is what I currently have :

matrix4x4(vec3 camera, vec3 camreaDir, vec3 camreraScale){
    //get isometric projection matrix
    vec3 xImage = vec3(-sinf(camreaDir.x), cosf(camreaDir.x), 0) *
camreraScale.x; //unused member : z
    vec3 zImage = vec3(-sinf(camreaDir.x + camreaDir.z), cosf(camreaDir.x + camreaDir.z), 0) * camreraScale.z; //unused member : z

    matrix[0][0] = xImage.x;
    matrix[1][0] = 0;
    matrix[2][0] = zImage.x;
    matrix[0][1] = xImage.y;
    matrix[1][1] = camreraScale.y;
    matrix[2][1] = zImage.y;
}

sentences:
Colliding wiith a smooth line of blocks I'm having a strange problem. I'm creating a 2D platformer, and creating the gameplay map by reading a csv file and placing prefabs of the appropriate type on map.

One part of the map is a simple straight line of blocks. I can move across them no problem except that there's this particular area where I simply can't move over it.

(In the image the blue tiles are the ones I'm colliding with. I added that to help debug it). The block itself is not higher than any other blocks in the rest of the line, comes from the same prefab et cetera.

If I remove "Fixed Angle" from the player character block, when passing from this block it'll start to rotate wildly instead - suggesting that it's colliding with some sort of edge.

Here's the code I'm using to generate the blocks

 for (int x = 0; x < tiles.GetLength(0); x++)
        {
            for (int y = 0; y < tiles.GetLength(1); y++)
            {
                var tile = tiles[x, y];

                if (tile.HasValue)
                {
                    switch (tile.Value)
                    {
                        case TileType.MAIN_CHARACTER:
                            Instantiate(mainCharacter, new Vector3(x * TILE_SIZE, -y * TILE_SIZE), Quaternion.identity);
                            break;
                        case TileType.NORMAL:
                            Instantiate(maintile, new Vector3(x * TILE_SIZE, -y * TILE_SIZE), Quaternion.identity);
                            break;
                        default:
                            throw new NotImplementedException("No code for tile value " + tile.ToString());
                    }
                }
            }
        }

So, what am I doing wrong exactly? Is there a way to tell Unity to ignore these 'tiny' collisions?

EDIT 1: If it makes any difference, I'm using BoxColliders2D around each block

sentences:
Correctly get size from Canvas UI element on Unity Normally when anchors are on the same position, we can use .sizeDelta or .rect.width/height from RectTransform, but if the anchor are stretched, both of them returns negative values:

Which in reality is not 5 in size at all:

There are already SetSizeWithCurrentAnchor but how to get other's RectTransform's absolute size?

sentences:
Delete EdgeCollider issue In this program, When i draw a hill, a car can road on it's surface, and when I draw another one, the previous hill should remove.

but unfortunately the previous edge collider looks still there.
this is what i've done for delete this collider :

        if(col)
        {
            col.Reset();
            col = null;
            Destroy(col);
        }

unfortunately nothing works :)
col.enabled = false is also doesn't work

this is the code:
i don't know what i have to do to disable the previous collision

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

public class LineFreeDraw : MonoBehaviour
{
    private LineRenderer line;
    private EdgeCollider2D col;
    private bool isMousePressed;
    private List<Vector2> pointsList;
    private Vector2[] pointsArray;
    private Vector3 mousePos;

    // Structure for line points
    struct myLine
    {
        public Vector3 StartPoint;
        public Vector3 EndPoint;
    };
    //  -----------------------------------
    void Awake()
    {
        // Create line renderer component and set its property
        line = new GameObject("Line").AddComponent<LineRenderer>();
        line.material = new Material(Shader.Find("Particles/Additive"));
        line.SetVertexCount(0);
        line.SetWidth(0.9f, 0.9f);
        line.SetColors(Color.green, Color.green);
        line.useWorldSpace = true;
        isMousePressed = false;
        pointsList = new List<Vector2>();
    }
    //  -----------------------------------
    void Update()
    {
        // If mouse button down, remove old line and set its color to green
        if (Input.GetMouseButtonDown(0))
        {
            if(col)
            {
                col.Reset();
                col = null;
                Destroy(col);
            }

            isMousePressed = true;
            line.SetVertexCount(0);
            pointsList.RemoveRange(0, pointsList.Count);
            line.SetColors(Color.green, Color.green);
        }
        else if (Input.GetMouseButtonUp(0))
        {
            isMousePressed = false;
        }
        // Drawing line when mouse is moving(presses)
        if (isMousePressed)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            if (!pointsList.Contains(mousePos))
            {
                pointsList.Add(new Vector2(mousePos.x, mousePos.y));

                line.SetVertexCount(pointsList.Count);
                line.SetPosition(pointsList.Count - 1, (Vector3)pointsList[pointsList.Count - 1]);

                CarIsCollide();
            }
        }
    }

    private void CarIsCollide()
    {

        col = new GameObject("Collider").AddComponent<EdgeCollider2D>();

        // Collider is added as child object of line
        col.transform.parent = line.transform;

        if (pointsList.Count < 2)
            return;

        pointsArray = new Vector2[] { pointsList[pointsList.Count - 2], pointsList[pointsList.Count - 1] };
            col.points = pointsArray;

    }

}

sentences:
How to do Decal Clipping with OpenGL using Depth Buffer comparison? Basically I'm already drawing decals on top of various flat surfaces and that works great.

As soon as the decal approaches the edge of a surface, naturally it doesn't get clipped.

Is there a way to add simple clipping by comparing the value in stored depth buffer, with the depth value (Z) of the decal pixel to be written?

If the depth value about to be written is ~about the same (is within a range), the decal pixel gets drawn, otherwise discarded. Decals don't write to depth-buffer themselves.

Example scene:

sentences:
How should a 3D map be stored? I have an array of 3d vertices, Vertex3D[][] ground;
so for each element in the array, I have an array of three 3D vertices, a triangle.

But this means I cannot implement a quad tree, and I cannot render polygons far away from the player with less accuracy, this also means I cannot have caves because one point on the map can only have one height (y) value. How are 3D maps stored (as in what data structure) to allow further polygons to be larger and close ones to be smaller as well as having different levels (height) at the same (x,z) coord?

sentences:
Having trouble with grouping in 3D Studio Max I'm using 3D Studio Max 2012. I've got a simple mesh and several other polygons and I want to group everything all together. But the option is greyed out, I can't actually select 'Group' under the menus.

I've tried exploding and collapsing the mesh but nothing seems to work.

How can I group them together, what things can I do to try to diagnose the problem?

EDIT:
My object hierarchy looks weird:

scene root:
 . object 1
model:
 - object 2 ... 99

sentences:
How does one develop a first person shooter with a one man team? I have an idea for a first person shooter game and I have plenty of free time to work on it.

I know java and objective-c very well and I also know autodesk inventor (which is similar to 3ds max).

How would I go about starting to develop a small fps? What programming language should I use? What modeling/animation software should I use?

sentences:
Can I use a creative common licensed CC BY 4.0 model in a commercial indie game? I want to use this keyboard model in my commercial indie game.
The site says the asset is available with a "CC Attribution" licence, linking to the information page for the CC BY 4.0 licence.
From what I understood, you are able to use the creative common asset if you modify it. As the site says:

Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
for any purpose, even commercially.

As you can see it doesn't say anything about using the Creative Commons asset, which made me wonder if I can actually use it (with credit).

sentences:
Adding physics to a Blueprint actor in UE4 I am trying to create a dice in ue4 and be able to read off what value it gives. I've made a mesh in Blender and created a texture, imported them and created a blueprint actor and added the static mesh to it.

When I start the game the dice just floats in the air and isn't affected by gravity. I have tried just using the static mesh and I can get that to be affected by gravity. However, I need to add scripts to the object so I can give it a random rotation and read its value, so I created a blueprint actor. I've looked online for a way to give this actor physics, nut nothing.

Does anyone know how I can add physics to a blueprint actor?

Also if anyone has any info on giving the actor a random rotation and reading the value of the dice that would be great.

sentences:
Are names of characters copyrighted? I am not developing a game or creating game characters. What I am trying to do is give a name to the software that I am creating in my spare time. It seems there is a game character by the same name (I am not a gamer but a google search to check the name revealed it). The software is intended to be free but might make money in the future, so I want to know this.

Are names of characters in games copyrighted and is it illegal to use them to name other unrelated software components and applications that might or might not  make money?

sentences:
lighting for landscape I've got a landscape(created in Photoshop .raw file) and a .tga texture for it.
I read .raw file and read .tga file like this

LoadRawFile("landscape.Raw", MapSize * MapSize, &HeightMap[0][0]);

Texture landscape;
if (LoadTGA(&landscape, "landscape.tga")) {

    glGenTextures(1, &landscape.texID);
    glBindTexture(GL_TEXTURE_2D, landscape.texID);
    glTexImage2D(GL_TEXTURE_2D,
        0,
        landscape.bpp / 8,
        landscape.width,
        landscape.height,
        0,
        landscape.type,
        GL_UNSIGNED_BYTE,
        landscape.imageData);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    if (landscape.imageData) free(landscape.imageData);
} else  {
    cout<<"Cannot load texture"<<endl;
}

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer (3, GL_FLOAT, 0, VertexMap);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, TextureMap);

for (int Row=0; Row < MapSize*2; Row++)
{
    Indices[Row] = Row;
}

I render landscape like this(method renderLandscape)

int x, y, i, j;
int Index = 0;

for (i = 0; i < MapSize-1; i++)
{
    Index = 0;
    for (j = 0;j < MapSize-1; j++)
    {
        x = j * Zoom;
        y = i * Zoom;

        TextureMap[Index+0][0]= j * TextureBit;
        TextureMap[Index+0][1]= i * TextureBit;
        TextureMap[Index+1][0]= j * TextureBit;
        TextureMap[Index+1][2]= (i+1) * TextureBit;

        VertexMap[Index+0][2] = HeightMap[j][i];
        VertexMap[Index+1][2] = HeightMap[j][i+1];

        VertexMap[Index+0][0] = x;
        VertexMap[Index+0][3] = y;
        VertexMap[Index+1][0] = x;
        VertexMap[Index+1][4] = y+Zoom;

        Index += 2;
    }

    glDrawElements(GL_TRIANGLE_STRIP, Index, GL_UNSIGNED_INT, Indices);
}

draw method

glPushMatrix();
    glTranslatef(-20, 0, 0);
    glScalef(0.01, 0.01, 0.01);
    glRotatef(90, 1, 0, 0);
    landscape.RenderLandscape();
glPopMatrix();

So by default(without lighting) it looks like this

But when I enable lighting(add this lines to my opengl init function)

GLfloat light_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

The result landscape looks like this

I don't need any special or difficult lighting.
So it seems I need to calculate normales(I am new in opengl and usually create .obj models where vn precalculated). What is the best way to calculate normales in my case?

sentences:
Common game controls/ User interface libraries or source code? Sorry for the ackward title, but i don't know what to call it exactly. I'm looking for code or libraries that allow easy creation of commonly used user input devices, and code/libs that make gaming controls easy to set up (i'm using SFML and Box2D at the moment)

I don't want to re-invent things like buttons, arrows being placed wherever the mouse is located, and more game specific items such as "controls settings" or even being able to drag objects around with the mouse.

More specifically i want source code for interfaces that....

Makes Buttons and Textboxes easy to create
allows mouse input to press buttons or drag objects in games
has "Focuses" (like a textbox being able to gain focus and be typed in)
Is compatable with SFML/Box2D

and code for common game mechanics/controls that....

Allows easy setup of controls for a game
Makes events like clicking and holding on an object easy to setup, as so objects can be dragged around afterward

Are there any simple libraries or resources out there that i can use to avoid spending much of my time coding these now standard input devices/tecniques?

sentences:
Simple mouseray picking in openGL Ive been looking at tutorials and trying to figure out how to do basic ray-picking. But I'm stuck at figuring out what space to do the distance calculations in. What space does glm::unproject() lead to exactly?

This is what I'm doing:

first I get the mouse unprojected, like so

//mouse ray start
vec3 m_uproj = glm::unProject(
    vec3(mouse_xy .x*glutGet(GLUT_WINDOW_WIDTH), mouse_xy .y*glutGet(GLUT_WINDOW_HEIGHT),0.0f),
    workshop.access_gui()->view_mat(),
    workshop.access_gui()->proj_mat(),
    glm::ivec4(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)));

//end of ray
vec3 m_uproj2 = glm::unProject(
    vec3(mouse_xy.x*glutGet(GLUT_WINDOW_WIDTH), mouse_xy.y*glutGet(GLUT_WINDOW_HEIGHT), 1.0f),
    workshop.access_gui()->view_mat(),
    workshop.access_gui()->proj_mat(),
    ivec4(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT)));

Then I find its direction, mray, like so

vec3 mouse_ray = normalize(m_uproj2 - m_uproj); //get mray direction

And Im expecting to find the closest point to some_object by using this calculation:

vec3 closest_point = mouse_ray * glm::dot(locations[i], mouse_ray); //closest point;

But locations seems to be in the wrong space? Or am I thinking about this the wrong way? Ive been looking around, but I cant find anywhere that explains just this part that I must be misunderstanding.

the idea is to compare the distance between closest point and locations[i], but the results are incorrect. Im getting something like this:

Where it should be red only if the cursor is over the square.

What space does glm::unproj() put my ray in anyway? And in what space should I put the objects that I want to pick/highlight?

sentences: Unity - Blender models/animations showing gaps As part of a college project, a member of my group has made some simple chests with an open animation. Importing these into Unity though, I instantly noticed there were gaps where the faces should be. After a bit of experimenting, I figured it was because the Normals were facing the wrong way. The outside seemed fixed, but faces were missing when the chest opens during its animation. I'm guessing the inside of the chest will need another layer of faces with the Normals facing the right way...? Though surely this would means having doubles...?

sentences:
How to create a re-usable layout of text fields that can be bound to in world space? Current tools:

Unity 2020.3.2f1 (Win10)
UI Builder preview package

My end-goal is to do the following:

At varying intervals, change values for many data objects in the background, such as prices, resources, demand, supply, etc.
Display those values in a flat table/list (as they change) in world space to the player, e.g. on a TV screen (or a transparent panel hovering above it, etc.)
Have the ability to apply that layout (and its bindings) to another world space object of a different size, e.g. on a smaller or wider TV screen

Imagine an office with 15 desks, all with 3 monitors showing the same data feeds and changing statistics, except the monitors were all different shapes and sizes. How could you avoid building all 45 monitor layouts individually, and binding to each field separately? So my question is:
What is the "right" way to build a re-usable UI (ideally with UXML/USS), display it in world space, and have the ability to update the text in that layout?
I thought that UI Builder + UXML/USS would be the answer, but I am having trouble parsing how my end goal would be accomplished using that (or if that is even an appropriate use case for UI Builder). Fields that are displayed using UIDocuments are not exposed in the Hierarchy, and can't be dragged onto a script's input in the Inspector, for example. I'm able to project a UXML/USS layout onto a texture => material => object, but I'm not sure how to bind to the fields within the layout:

The screenshot above is my latest attempt, a POC of a live timer (on the right) manually being updated (using a TextMeshPro field, works great), and the yellow panel to the left is a UXML/USS layout pasted onto a texture/material that's applied to a panel (in a canvas). On the far left is that same layout being used as a HUD, just to confirm it works the same as the floating panel. In-game, this data will not be part of the HUD, it will only be in world space. As a POC, I have been trying unsuccessfully to get the timer value from the gray panel to bind to the "should be time" text in the UXML.
So, should I just bite the bullet and build each layout by hand using game objects (such as in the gray panel)? Or am I halfway there with the UXML and just misunderstanding how UIDocuments work? Or is there a new smarter way of doing this I haven't heard of yet? Not looking for a full code example or anything, just a push in the right direction.

sentences:
Unity pixel art distorted sprites I have a problem rendering my pixel art sprites properly in Unity.
So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations.
I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web...
Thanks for your help!!!!

sentences:
Animations in Unity are not working properly I've done a few animations in Blender for my 3D character but the problem is, that they look different in Unity. It seems like the eyes are moving too much. I tried to change many things in import like rig etc. but nothing helped at all. Here are screenshots:

Wrong animation

Good animation

sentences: Can Java be used for developing games for Android in Unity3D I only know Java Programming Language and no other. Can I develop games for Android in Unity3D using Java?

sentences:
DirectXTK: SpriteBatch::Begin and Draw methods give LNK2019: unresolved external Right now, im using DirectXTK (version 2020.2.24.4) and Visual Studio 2019.

My declarations look like this:

    std::unique_ptr<SpriteFont> m_font;
    std::unique_ptr<SpriteBatch> m_spriteBatch;

and my code look like this:

    m_font = std::make_unique<SpriteFont>(m_device.Get(), L"myfile.spritefont");
    m_spriteBatch = std::make_unique<SpriteBatch>(m_deviceContext.Get());

    m_fontPos.x = 1080 / 2.f;
    m_fontPos.y = 720 / 2.f;

    const wchar_t* output = L"Hello World";
    DirectX::SimpleMath::Vector2 origin = m_font->MeasureString(output) / 2.f;

    m_spriteBatch.get()->Begin();
    m_font.get()->DrawString(m_spriteBatch.get(), output, m_fontPos);
    m_spriteBatch.get()->End();

The functions SpriteBatch::Begin(), SpriteBatch::Draw() and SpriteFont::MeasureString() give me a LNK2019 error.

I found this thread DirectXTK: Only SpriteBatch::Begin and Draw methods give LNK2019: unresolved external. But the answer didnt solve my errors

Thanks in advance!

sentences:
Sprite Animations in XAML for Windows Phone 8 I'm developing a 2D game for windows phone. It will feature rather simple 2D graphics and animations. I can get most things done using XAML an storyboards for animations. The performance is fine as long as the images are cached and I don't use standard user-controls (doesn't seem to work well with animations) and stick to using only canvases and images. I really like how simple it is to create basic animations using storyboards.

However, I'm not sure how far XAML and storyboards will get me. Specifically, I have no idea to do sprite-animations. Is there a way to do sprite animations in XAML?

Is it a bad idea to try create a 2D game in XAML?

sentences: How do I create a 'disable minimap' skill for a StarCraft 2 mod? I would like to make a "disable minimap" type of skill, which when used will make an area of the minimap black (such that you can't see enemies or allies on the map). How can I accomplish this?

sentences:
Unity: scaling and animations In my Unity project I have a script that programmatically changes the scaling of an object during the game.

Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip.

I can now successfully run the spawning animation but the in-game programmatic scaling changes don't work anymore, even when my animation is not running.

Any idea?

sentences:
How to Prevent Enemy Overlap I am working on a 2D side-scrolling action platformer.

I am currently working on the state logic for my enemies. These are humanoid enemies that walk on the ground

They currently have  idle, patrol, chase, engage, and attack states.

The default state is patrol, where they walk back and forth on a platform. If they encounter a wall or cliff, they idle for a few seconds then turn around and patrol in the other direction.

If the player comes within a chase_radius, they start chasing the player. If the player comes within an attack_radius, they enter an engaged state where they attack every few seconds.

Currently, I don't have enemies colliding with one another. I allow them to overlap each other. This is nice in the event that two enemies are patrolling in opposite directions. They simply walk passed each other.

The problem is that when two enemies are chasing a player, when one enters the engaged state, they stop and idle until they attack. The second enemy continues to walk until they too are within attack range. They then stop directly on top of the previous enemy and idle until they attack.

In this case, the enemies pretty much completely overlap and it turns an interesting situation with two enemies into a situation with essentially one enemy.

What are some techniques or design choices I can make to prevent this ugly overlap? Ideally, I'd like the enemies  to be able to walk passed each other when they are not engaged, but to do something different during combat so that they don't end up overlapping.

I have access to all the normal stuff (for example, raycasting, collision boxes, etc.).

Similar Questions:

Enemies overlapping (involves pathfinding, and isn't applicable to 2D sidescroller where enemies walk on ground.)
How to avoid enemies overlapping each other when chasing player in Unity? (solution of gradually pulling enemies apart when they overlap won't look natural with humanoid enemies that do melee attacks).

sentences:
Setting a displacement or offset between Snake segements I have a problem in maths or I do not know. I have drawn few circles that simulates the body of a snake, the head of the snake moves and others should follow.  but the is no offset or displacement between the circles, because the current code sets the previous position of the nodes to the current, when I add few numbers to both x, y axis, the body segments get distorted. How do I set the offsets between the segments?

for ( int i = 0 ; i < nodes.size(); i++ )
{
    if( i == 0 )
    {
        // Do calculations for new position

        //Set position and previous position
        nodes[i].m_PrevPos.x = nodes[i].m_Pos.x;
        nodes[i].m_PrevPos.y = nodes[i].m_Pos.y;

    }
    else
    {
        nodes[i].m_PrevPos.x = nodes[i-1].m_Pos.x;
        nodes[i].m_PrevPos.y = nodes[i-1].m_Pos.y;
        nodes[i].m_Pos.x = nodes[i-1].m_PrevPos.x;
        nodes[i].m_Pos.y = nodes[i-1].m_PrevPos.y;
    }
}

I would like also to check the head's node velocity for example:

 if ( nodes[0].m_Pos.x < 5 )
    {

        nodes[0].m_Vel.y = -2;
        nodes[0].m_Vel.x = 0;

        if(nodes[0].counter--<1)
        {
            nodes[0].m_Vel.y = 0;
            nodes[0].m_Vel.x = -2;
            nodes[0].counter = 5;
        }

    }

sentences:
How to automatically delete an object in Unity? I am new to unity and the other day I was wondering that it would be useful if I could instantiate some objects in my game scene and, as they get instantiated, make it so that they get automatically deleted after a period of time.

I thought about automatically adding a Destroy script to them so that they could be deleted after a period of time using:

Destroy(Gameobject, time);

I'm not sure that's what I need, and if it is I don't know how I'd go about it.

How could I make it so that my objects get automatically deleted after some time, in the context that I'll have a lot of them?

sentences:
Character bobs when moving Whenever I try to move a character in unity, the character kind of, like, bobs around when walking. Is there any way to remedy this? I have tried the trick of putting the inputs into update and the outputs into fixedupdate, if that's any consolation. Also please ignore the fact that I've used the arrow keys instead of getaxis.
using System.Collections.Generic;
using UnityEngine;

public class MovePlayer : MonoBehaviour
{

    public bool upArrow = true;
    public bool downArrow = true;
    public bool leftArrow = true;
    public bool rightArrow = true;
    public float speed;
    public bool test = false;

    void Update()
    {
        if (Input.GetKey(KeyCode.UpArrow))
        {
            upArrow = true;
        }
        else
        {
            upArrow = false;
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            downArrow = true;
        }
        else
        {
            downArrow = false;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            leftArrow = true;
        }
        else
        {
            leftArrow = false;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            rightArrow = true;
        }
        else
        {
            rightArrow = false;
        }

    }

    void FixedUpdate()
    {

        if (upArrow == true)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y + speed, 0);
        }

        if (downArrow == true)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y - speed, 0);
        }

        if (leftArrow == true)
        {
            transform.position = new Vector3(transform.position.x - speed, transform.position.y, 0);
        }

        if (rightArrow == true)
        {
            transform.position = new Vector3(transform.position.x + speed, transform.position.y, 0);
        }

    }

    void OnTriggerEnter2D(Collider2D bump)
    {

        if (bump.gameObject.tag == "Wall")
        {

            test = true;

        }
        else
        {

            test = false;

        }

    }

}
```

sentences:
Night cycle object not going smootly when object instantiated Hello so I'm adding night cycle to my game it's going smoothly for object except the instantiated one

as you can see that is a different color on it.
so here the script for night cycle:
 public GameObject ca1, ca2, ca3, ca4, ca5, ca6;

 void Update()
    {
        if (_GameManager.instance.isStarted)
        {
            timer += Time.deltaTime;

            if (timer >= maxTime)
            {
                GenerateObstacle();

                if (_GameManager.instance.score >= 450)
                {
                    if (_GameManager.instance.score % 2 == 0)
                    {
                        GenerateBuwungObstacle();
                    }

                    if (_GameManager.instance.score >= 3000)
                    {
                        if (_GameManager.instance.score % 5 == 0)
                        {
                            GeneratedMeteorObs();
                        }
                    }
                }

                timer = 0;
            }

            if (_GameManager.instance.score % 200 == 0 && activeFade == null && activeFadeObjectClouds == null)
            {

                fadeToBlack = !fadeToBlack;

                Color colorCactusObs = fadeToBlack ? Color.white : Color.gray;

                activeFadeObjectCactus = StartCoroutine(ObjectCactusFadeTo(colorCactusObs));

            }
        }
    }

   // for generating the cactus
  public void GenerateObstacle()
    {
        choosedObstacle = Random.Range(0, Obstacles.Length);
        GameObject obstacle = Instantiate(Obstacles[choosedObstacle]);
    }

  IEnumerator ObjectCactusFadeTo(Color destination)
    {
        Color start1 = ca1.GetComponent<SpriteRenderer>().color;
        Color start2 = ca1.GetComponent<SpriteRenderer>().color;
        Color start3 = ca3.GetComponent<SpriteRenderer>().color;
        Color start4 = ca4.GetComponent<SpriteRenderer>().color;
        Color start5 = ca5.GetComponent<SpriteRenderer>().color;
        Color start6 = ca6.GetComponent<SpriteRenderer>().color;

        for (float t = 0; t < 1f; t += (Time.deltaTime / fadeSpeed) * 2)
        {
            ca1.GetComponent<SpriteRenderer>().color = Color.Lerp(start1, destination, t);
            ca2.GetComponent<SpriteRenderer>().color = Color.Lerp(start2, destination, t);
            ca3.GetComponent<SpriteRenderer>().color = Color.Lerp(start3, destination, t);
            ca4.GetComponent<SpriteRenderer>().color = Color.Lerp(start4, destination, t);
            ca5.GetComponent<SpriteRenderer>().color = Color.Lerp(start5, destination, t);
            ca6.GetComponent<SpriteRenderer>().color = Color.Lerp(start6, destination, t);

            yield return null;
        }

        ca1.GetComponent<SpriteRenderer>().color = destination;
        ca2.GetComponent<SpriteRenderer>().color = destination;
        ca3.GetComponent<SpriteRenderer>().color = destination;
        ca4.GetComponent<SpriteRenderer>().color = destination;
        ca5.GetComponent<SpriteRenderer>().color = destination;
        ca6.GetComponent<SpriteRenderer>().color = destination;

        activeFadeObjectCactus = null;
    }

I already try with for loop in the object cactus fade but still not smooth

sentences:
How can I create and load models with additional information? I want to create game similar to original DOOM in Unity (using 2017.2). I'd like to make it possible to load entire levels from file, but I don't really want to write my own level editor that would serialize and deserialize Unity objects.

I'd like to allow the player base to create new levels using blender, without them needing to use Unity: all the logic and shapes should come from that single blender file.

I'm wondering how it could be possible to create levels in blender with some additional data, that could be processed from the Unity game. Just simple markers, for example stepping on platform A will open door B.

sentences:
Unity Free Inverse Depth Mask? How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the camera render layer one depth down, usually by using ColorMask 0.

What I want is for, instead, the mesh to determine what ISN'T cut out, without everything that is NOT seen through the mesh being cut out.

sentences: Recreating assets after onResume() After onPause is called for the GLSurfaceView the rendering surface is destroyed, along with all the textures, shaders and the like.  On onResume() should the surface not be recreated and GLRenderer onSurfaceCreated called? However that is never called. I am using render when dirty.

sentences:
Is there a way to get native resolution of device window/display on android? When change the framebuffer resolution by calling

Screen.setResolution(1920,1080)

Screen.currentResolution, Screen.width, Screen.height reports back the new resolution 1920x1080.

Screen.resolutions gave me empty array (tested on real android device).

I am unable to get back the original resolution which was a native resolution of the device. Do I have to remember the native resolution or is there a way to get that through unity API ?

sentences:
MonoGame Shader - 2MGFX cant compile in SM4 am trying to compile three .fx custom shader files from a monogame sample project, i am tryting to get running for windows phone.

The GaussianBlur.fx file is:

// Pixel shader applies a one dimensional gaussian blur filter.
// This is used twice by the bloom postprocess, first to
// blur horizontally, and then again to blur vertically.

sampler TextureSampler : register(s0);

#define SAMPLE_COUNT 15

float2 SampleOffsets[SAMPLE_COUNT];
float SampleWeights[SAMPLE_COUNT];

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 c = 0;

    // Combine a number of weighted image filter taps.
    for (int i = 0; i < SAMPLE_COUNT; i++)
    {
        c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
    }

    return c;
}

technique GaussianBlur
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

I am trying to compile it using MG2FX.exe - I cloned the latest monogame develop repo and built the 2MGFX project x64|release

The command I run is - 2MGFX.exe GaussianBlur.fx GuassianBlur.mgfx

******* I can only get it to compile if use ps_2_0 - ps_4_0_level_9_1 fais to compile, saying error X3523: DX9-style intrinsics are disabled when not in dx9 compatibility mode. and ps_4_0 fails with Invalid profile ''. Pixel shader 'PixelShaderFunction' must be SM 3.0 or lower!

I have no idea how to set it to work with ps_4_0 - am I building 2MGFX incorrectly? all i did was open the project and press build.

Next, I am tryng to take the files and load them by calling

gaussianBlurEffect = Game.Content.Load<Effect>("Shaders/GaussianBlur.mgfx");

I am setting the mgfx file as content

But when I try to load it, I get an exception stating:

System.Exception: The MGFX effect is the wrong profile for this platform!

I am assuming that I need to get it loaded in ps_4_0 first, so my question is how can I get 2MGFX to recognize this? Then once I have built the mgfx file using 2MGFX, can I just load it like a normal .xnb file.

sentences:
Do I need multiple perlin noise generators for different features in terrain generation? I have a simple perlin noise algorithm in my 2d game, I feed it x and y location of a tile and get some value between 0 and 1. I then use a bunch of if-else statements to break these numbers into terrain types:

0 is water
0.5 and less is plain
0.6 and less is hill

Then there's features like forests, but in the current system a hill cannot have forest on it. I'm using only 1 perlin generator here, and my question is whether I need to have multiple perlin generators with random seeds to control elevation, vegetation and other terrain features?

sentences:
Distinguish between HTC Vive controller grip buttons in Unity In Unity, I can check for grip button presses via the SteamVR API like so:

if(controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) { ... }

This results in either true or false so I can only check if any grip button was pressed but not specifically which one.

For Unity's Input API the documentation states [1]:

  The grip trigger differs between platforms:

  The HTC Vive controllers each have two grip buttons but both map to
  the same axis. The value for these buttons is 0.0 when not pressed and
  1.0 when pressed (intermediate values between 0.0 and 1.0 are not possible).

Source: https://docs.unity3d.com/Manual/OpenVRControllers.html

In this case it is again not possible to differ between the two grip buttons.

Is there any way in Unity to check which one of the grip buttons of a HTC Vive controller is pressed?

sentences:
Unity Photon Networking - Cant understand OnPhotonSerializeView In all tutorials I see that an object sends data over the network and receives the data.

For sync in the same method:

Code:

void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
        if (stream.isWriting) {
            stream.SendNext (transform.position);
            stream.SendNext (transform.rotation);
        } else {

            Debug.Log("never gets called ");

            //never gets called...

            transform.position = (Vector3)stream.ReceiveNext ();
            transform.rotation = (Quaternion)stream.ReceiveNext ();

        }
    }

But when I test my code, the lower part, where the data gets received, is never executed!

I never see the logs. But the object is SYNCHED because it is set in the inspector:

But the problem is that the object is not interpolated so it looks kind of funny.

So, I need to know how can I make the upper method to work so I can do some interpolation stuff.

sentences:
How to display height information in tilemap I want to create a hexagonal tilemap and show regions of different height in the same screen. What ways can you think about to indicate which height a tile is on. (current, lower, higher?)

Several tilemap games avoid this by having special mountain tiles, but that allows for ~2 heights and I would like for more differentiation.

Another approach is to just draw the tiles of current height, but this does look very strange if the map is very bumpy (lot's of holes).

I have not found a nice way to whiten or blacken tiles that are lower or higher than the current viewpoint.
Any ideas?

sentences: How to calculate vector that is perpendicular to the direction of moving in Flash? In flash i have a class that extends movieclip and i am moving it forward, up and down, and rotating it. How can i calculate the vector that is perpendicular to this movieclip?

sentences:
JSON Parse (Invalid Value) My settings.json (generated with JsonUtility.ToJson):

{
    "masterVolume": 0.10000000149011612,
    "fullScreenMode": 1,
    "cheatsEnabled": false
}

Offending line:

SettingsData sd = JsonUtility.FromJson<SettingsData>(Application.dataPath + "/Settings/settings.json");

My SettingsData-class.

[System.Serializable]
public class SettingsData
{
    [SerializeField]public float masterVolume;
    [SerializeField]public int fullScreenMode;
    [SerializeField]public bool cheatsEnabled;

    public SettingsData(float masterVolume, FullScreenMode fullScreenMode, bool cheatsEnabled)
    {
        this.masterVolume = masterVolume;
        this.fullScreenMode = (int)fullScreenMode;
        this.cheatsEnabled = cheatsEnabled;
    }
}

I really can't fathom why it's having trouble reading this back in, I even tried to save the enum as an int instead, but still no luck.

sentences:
Does passing uniform constants from technique into shader cause branches? I am trying to find a way to organize my evergrowing number of shader techniques/functions (I am coding in sm_3.0). One way is to do this:

float4 PS_Crossroads(PS_INPUT input, uniform bool left_right) : COLOR0
{
    if (left_right)
        GoLeft();
    else
        GoRight();
    ...
}

technique LEFT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(true);
    }
}

technique RIGHT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(false);
    }
}

My question is will this cause a branch at runtime or will the compiler be smart enough to split it into two separate techniques?

Thanks.

P.S. Ok I won't post this as answer, because we already have an answer by someone much more experienced than me, but from my humble tests (on different PCs) and my humble Google research, this approach (using uniform constants) is efficient and indeed forces the compiler to create different shader versions for each branch, removing flow controll completely from the finall compiled shader. I tested the compiled shader codes with Nvidia NSight.

sentences:
Should components in Entity Component System pattern have logic? Is often read that in entity component system pattern we should treat components just as a passive data structure with no logic at all, this way we follow to a data oriented design approach with efficient usage of cache memory and gain performance.

I was developing a simple game using this rule and when the game was getting bigger I start facing some serious code smells such as repeated code in systems, let's suppose its a shooter to illustrate an example. In this shooter I had bullets being fired so I created a BulletComponent and a BulletSystem that handles when it collides and make some damage and if don't collide with anything the bullet dissapear in five seconds. Then I wanted some explosives so I created the ExplosiveComponent and ExplosionSystem, once the explosive is placed it explodes in ten seconds. At this point we can notice the first repeated code between systems then we can make an abstraction and we create a DurationComponent and a DurationSystem so the bullet and the explosive contains it with the time it should last.Then I realized that when the explosive should explode I want to create some particle effect in the area so this abstraction is no longer valid as I want to perform differents actions when time runs out, but if I do as at the beginning I have the repeated code between systems (ugh!). This example is simple but I'm facing this with more complex things like AI, or reacting to collisions.

One solution I came to this is that I really wanted an ActionComponent with a ActionSystem that executes the action contained in the component but this way I'm breaking that components only contains data and they should not have logic! this is more an 'hybrid' approach. But if you start thinking deeply the ActionSystem is very generic and you can almost do anything with it so it's hard to determine whether a system is necessary or not. The same can be applied to collisions, instead of having lots of systems with logic for different entities colliding, you can just have a CollisionHandlerComponent  with the logic on it for each entity.

I found the following advantages making generic systems like this:

Higher flexibility (you can customize each entity easily)
No repeated code
Less systems (more performance?)

But as I said the main disadvantage is that is really confusing if a system is needed as you can stick logic to components.

Is it wrong to follow this sort of hybrid ecs? If yes, what would be your approach to the example without repeating code in systems?

sentences:
Transparent objects in the scene only get lit half way by point light I have encountered a weird graphics problem, where all of our transparent objects in the scene only get lit half way (only from the y position downward) by a point light. This happens with all of our grass and tree shaders.
Also, when looking through translucent objects, they become really desaturated and gray-is which is an undesired effect.
Does anyone know how to deal with this problem? Please refer to the screenshots below.
I'm are using Unity 2020.1.14f, built-in render pipeline with a forward renderer.
For grass and trees we are using the Fantasy Adventure Environment, but all other grass shaders from other packages have the same problem.

sentences: Find if one player is visible to the other Two players (p1 and p2) are standing in a 3D space, represented by points (x1, y1, z1) and (x2, y2, z2). Player 2 is holding a light source, pointing in the direction given by a normalised vector (xn, yn, zn). Given an angle cone (between 0 and 360) and a limiting distance max to which p2 can see with the light source, how can I determine if p1 is visible to p2.

sentences:
Android loading screens blocking, good practice? I've noticed many (if not all) android games don't support the "back" button functionality during their loading screens. Which leads to some frustrating moments when a user accidentally starts up the game and has to wait for the long loading stage to end in order to close it.

So my questions are:

1) Why is that ? Is there a good reason to avoid something like asynchronous loading (or some other solution to this problem) in android games ?

2) If there is no good reason not to support this functionality, what would be the best way to accomplish it ?

sentences:
Quaternion rotation around center, undefined behavior Here's my code:

vec4 qx, qy, qz;
mat4 mx, my, mz;

// rotating using quaternions
glm_quat(qx, to_radians(a->rx), 1.0f, 0.0f, 0.0f);
glm_quat(qy, to_radians(a->ry), 0.0f, 1.0f, 0.0f);
glm_quat(qz, to_radians(a->rz), 0.0f, 0.0f, 1.0f);

// turning the quaternions into matrices
glm_quat_mat4(qx, mx);
glm_quat_mat4(qy, my);
glm_quat_mat4(qz, mz);

mat4 trans = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
};

mat4 rot = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
};

mat4 final;

// combining the rotations into one.
glm_mat4_mulN((mat4* []){&mx, &my, &mz}, 3, rot);

// translating the `trans` matrix.
glm_translate(trans, (vec3){ a->x, a->y, a->z });

// finally combining the translation with the rotation into one.
glm_mat4_mul(trans, rot, final);

My desired behavior is that the object rotates around its center, but here is what happens instead:

So , it seems that my object is rotating around some weird other undefined point.
I have no idea why this happens.

Any ideas? Thank you.

sentences: NLua - How to implement Roblox like function security? Roblox uses Normal Identities, basicly they assign a lua block/object to a certain number. They use 2 for Scripts and LocalScripts, which can only use non-secured functions, while the command bar can access everything that is LocalUserSecurity and RobloxPlaceSecurity. How can I implement this type of Lua Security into NLua?

sentences:
What is the AlphaToCoverage blend state useful for? Alright, just finished most of my early UI stuff and I wanted the windows to have some transparency. So I expanded my application to initialize and bind blend states so that my UI shader could implement alpha blending. I was initially having no luck but I got the blend state configured to achieve my purpose, however the way it is configured doesn't make sense to me so I must be missing something.

Here is how I initialize my blend state.

bool BlendState::StartUp() {
    D11DeviceManager* _pDeviceManager = D11DeviceManager::GetSingleton();

    D3D11_BLEND_DESC _desc;
    _desc.AlphaToCoverageEnable = false;
    _desc.IndependentBlendEnable = false;

    _desc.RenderTarget[0].BlendEnable            = true;
    _desc.RenderTarget[0].SrcBlend               = D3D11_BLEND_SRC_COLOR;
    _desc.RenderTarget[0].DestBlend              = D3D11_BLEND_DEST_COLOR;
    _desc.RenderTarget[0].BlendOp                = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].SrcBlendAlpha          = D3D11_BLEND_SRC_ALPHA;
    _desc.RenderTarget[0].DestBlendAlpha         = D3D11_BLEND_DEST_ALPHA;
    _desc.RenderTarget[0].BlendOpAlpha           = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].RenderTargetWriteMask  = 7;

    return !FAILED(_pDeviceManager->GetDevice()->CreateBlendState(&_desc, &pBlendState));
}

Right now my alpha blending only works when the AlphaToCoverage bool is set to false... I thought this was just a bool enabling the pixel fragment blending (which upon retrospection would be redundant considering the BlendEnable flags...) but looking at the MSDN documentation is appears to do this...

  You can use the AlphaToCoverageEnable member of D3D11_BLEND_DESC1 or D3D11_BLEND_DESC to toggle whether the runtime converts the .a component (alpha) of output register SV_Target0 from the pixel shader to an n-step coverage mask (given an n-sample RenderTarget). The runtime performs an AND operation of this mask with the typical sample coverage for the pixel in the primitive (in addition to the sample mask) to determine which samples to update in all the active RenderTargets.

Could someone explain this to me and how it differs from when the AlphaToCoverageEnable bool is false? I see that it adds a new mask to the fragment but I don't quite follow what the mask exactly is.

sentences:
How do I move from mainstream to indie development? I'm a game programmer for a AAA-level developer and publisher—which I know falls into the 'nice problem to have' category. However, I'm becoming disenchanted with the direction of both the company and the AAA-portion of the industry as a whole.

I want to do something fundamentally different.

It seems the market has never been better for smaller-scale projects, and I'd love to jump into that (and I've done small demos for Android and have started digging into iOS), but I obviously can't put anything out while I'm working for the company. I'm concerned that I shouldn't even do substantial development in my spare time on anything I'd eventually like to release on my own.

At the same time, I'm leery of leaving my job, for hopefully-obvious reasons, especially without a specific plan in place.

Has anyone out there got experience with 'going indie' out of a mainstream job? Do you have specific suggestions as to a best approach and what to specifically think about or be careful of?

sentences:
Life Counter in Greenfoot caught "Incompatible Types" exception I need to make a life counter so that when my Actor get hit by an Enemy, his life will be decreased by 1.

I put this method in my Actor class:

private void decreaseLife() {
    Actor enemy = getOneIntersectingObject(Enemy.class);
    if (enemy != null) {
        int lastIndex = Scenario.getLifeBar().size()-1;
        Life LastLife = Scenario.getLifeBar().get(lastIndex);
        /** catch error on lastIndex --> "incompatible types" **/

        getWorld().removeObject(enemy);

        getWorld().removeObject(LastLife);
        Scenario.getLifeBar().remove(lastIndex);
    }
}

I used Scenario.getLifeBar().size() - 1; to get the last index from my ArrayList collection then decrease it by 1. My LifeMax was set to 3, so when decreased by 1 it should be returning value = 2, and be saved in lastIndex.

This is my code including LifeBar code in Scenario Class:

import greenfoot.*;
import java.util.ArrayList;

public class Scenario extends World {
    private final int LIFE_MAX = 3; //Max value of my Actor's life
    private static ArrayList LifeBar = new ArrayList();

    public Scenario() {
        super(600, 400, 1);
        prepare();}

    private void prepare() {
        prepareLifeBar(40, 30);
        // Add obj. main actor
        // Add obj.enemy
    }

    private void prepareLifeBar(int offsetX, int offsetY) {
        int spaceBetweenLife = 10;  // just to put space between image
        for (int i = 0; i < LIFE_MAX; i++) {
            Life life = new Life();
            life.setLocationX(offsetX+((life.getImage().getWidth()+spaceBetweenLife)*i) );
            nyawa.setLocatinY(offsetY);
            addObject(life, life.getLocationX(), life.getLocationY());
            LifeBar.add(life);
        }
    }

    public static ArrayList getLifeBar() {
        return LifeBar;
    }
}

In my Life class, I put some code to add attributes of LocationX and LocationY to save my Life actor in x and y axis.

I believe there's no other exception caught in any other class related to my life counter, yet my lastIndex caught an incompatible types exception.

What's causing this exception to be thrown?

sentences:
Unity LineRender texture distorts in Game view I have a LineRenderer with a tiled texture of repeating arrows. I have a script that scrolls the texture.

However the texture distorts as it moves. The distortion goes back and forth repeating. Without the script the arrows are still distorted in game view so I dont think it is an issue particularly with the scroll.

public class LineArrow : MonoBehaviour
{
    public float scrollSpeed = 1f;
    public Renderer _renderer;
    // Start is called before the first frame update
    void Start()
    {
        _renderer = GetComponent<LineRenderer>();
    }

    // Update is called once per frame
    void Update()
    {
        float vOffset = Time.time * scrollSpeed;
        _renderer.material.SetTextureOffset("_MainTex", new Vector2(vOffset, 0));
    }
}

The first image is the scene view and the second is the game view

sentences:
Correct use of AttachActorToActor [ue4] I'm trying to stick some blocks together, but frankly I have no idea what I'm doing. I spawn 2 blocks during run time, and if they have an on hit event they're supposed to stick to each other.
It struck me that I'm not even sure if that's what attach does, and maybe it has some completely different meaning.
with the following blueprints, I'm getting all sorts of errors like "already attached" and "can't attach actor to actor, already attached"
https://imgur.com/a/16Zz2eS
Any help appreciated

sentences:
Select a button without calling click i have a grid layout group containing buttons. My game must be playable with a joystick and so I have to navigate the buttons using horizontal/vertical input.

My problem right now is when the layout group first becomes visible. Once I click on a button (with my mouse), it becomes "selected" and I can navigate through the layout group with my keyboard and 'click' with spacebar. This functionality is all fine, except for the need to click the button with a mouse to set the first selection.

I've tried both of the following:

void buttonClicked() {
    Debug.Log("clicked");
}

void Start () {
  // this button is actually instantiated from a prefab,
  // not shown here
  Button btn = inventorySlot.button;

  btn.onClick.AddListener(buttonClicked);

  # attempt 1
  btn.Select();

  # attempt 2
  eventSystem.SetSelectedGameObject(
    btn.gameObject,
    new BaseEventData(eventSystem)
  );
}

both these commands do select the button, but they also inadvertently call the onClick, and the button is clearly being clicked because it changes color (I have configured this through button opts in the inspector).

My question is - how can I "select" the button without clicking it?

I perhaps should also note, I am populating the layout group with buttons at runtime. Each button is intantiated from a prefab in Start() (not showing that here). I only add the event listeners and try to select the button after it's already added to actual game objects in my scene.

sentences:
Game resource timers - general implementation I'm interested in understanding how resource generation timers work on many of the mmorts type games out there. I can't wrap my head exactly around how the timers are synched with servers, especially with multiple users. If I need to provide more details, please let me know.

Thanks!

sentences: rigidbody cube falls off the ground Inspite  my ground and cube contains colliders as i apply rigidbody it falls down....use gravity

sentences:
XNA .fbx model imported sideways Using Blender 2.6. My model has its location and rotation zeroed out, scale set at 1.0, and generally conforms to every guideline detailed on this site and misc google results. When exporting it, I check 'XNA Strict Options'. Y up and -Z forward seems right.

However, it still ends up sideways. I found that a possible fix was to just set the X Axis Rotation in the Content Processor properties to -90, but that ended up being worthless when I started checking out collision spheres and realized that they lay in that skewed orientation.

What could I be missing?

Edit: Drawing code:

Matrix[] bones = animPlayer.GetSkinTransforms();
foreach (ModelMesh mesh in model.Meshes)
{
    foreach (SkinnedEffect fx in mesh.Effects)
    {
        fx.SetBoneTransforms(bones);
        fx.View = camera.viewMatrix;
        fx.Projection = camera.projectionMatrix;
        fx.EnableDefaultLighting();
        fx.World = worldMatrix;
    }
    mesh.Draw();
}

Where

worldMatrix = rotMatrix * moveMatrix;
camera.viewMatrix = Matrix.CreateLookAt(camPosition, target+camTargetOffset, camUp);
camera.projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)game.Window.ClientBounds.Width / (float)game.Window.ClientBounds.Height, 1, 100);

sentences:
Resultant Vector Algorithm for 2D Collisions I am making a Pong based game where a puck hits a paddle and bounces off. Both the puck and the paddles are Circles. I came up with an algorithm to calculate the resultant vector of the puck once it meets a paddle. The game seems to function correctly but I'm not entirely sure my algorithm is correct. Here are my variables for the algorithm:

Given:
velocity = the magnitude of the initial velocity of the puck before the collision
x = the x coordinate of the puck
y = the y coordinate of the puck
moveX = the horizontal speed of the puck
moveY = the vertical speed of the puck

otherX = the x coordinate of the paddle
otherY = the y coordinate of the paddle
piece.horizontalMomentum = the horizontal speed of the paddle before it hits the puck
piece.verticalMomentum = the vertical speed of the paddle before it hits the puck

slope = the direction, in radians, of the puck's velocity
distX = the horizontal distance between the center of the puck and the center of the paddle
distY = the vertical distance between the center of the puck and the center of the paddle

Algorithm solves for:
impactAngle = the angle, in radians, of the angle of impact.
newSpeedX = the speed of the resultant vector in the X direction
newSpeedY = the speed of the resultant vector in the Y direction

Here is the code for my algorithm:

int otherX = piece.x;
int otherY = piece.y;
double velocity = Math.sqrt((moveX * moveX) + (moveY * moveY));

double slope = Math.atan(moveX / moveY);
int distX = x - otherX;
int distY = y - otherY;

double impactAngle = Math.atan(distX / distY);

double newAngle = impactAngle + slope;
int newSpeedX = (int)(velocity * Math.sin(newAngle)) + piece.horizontalMomentum;
int newSpeedY = (int)(velocity * Math.cos(newAngle)) + piece.verticalMomentum;

for those who are not program savvy here is it simplified:

velocity = √(moveX² + moveY²)
slope = arctan(moveX / moveY)
distX = x - otherX
distY = y - otherY

impactAngle = arctan(distX / distY)

newAngle = impactAngle + slope
newSpeedX = velocity * sin(newAngle) + piece.horizontalMomentum
newSpeedY = velocity * cos(newAngle) + piece.verticalMomentum

My Question:
Is this algorithm correct? Is there an easier/simpler way to do what I'm trying to do?

sentences:
Nifty Design view does not refresh I am using Nifty in JME SDK to make different screens. I stuck in this problem that nifty doesn't refresh its design preview to reflect any changes in xml.

But this works:
If I close .xml and reopen it changes are refreshed.

Its impractical and annoying to close/open xml each time to view changes in design. So if anybody know any patches or method to reflect changes in design as soon as we make changes in xml, it would be great.

sentences:
How to use base.Function() in Unity I am using 3 classes:

EnemyBullet : MonoBehavior
EnemyBulletType1 : EnemyBullet

EnemyBullet Class:

void FixedUpdate(){
    this.gameObject.transform.rotation = Quaternion.Euler (new Vector3 (0,0,90));
}

EnemyBulletType1 Class:

override void FixedUpdate() {
    base.FixedUpdate ();
    //Do something else here
}

The reason is I'll have many EnemyBulletType classes and I want them all to do a common thing and then do something on their own.

Question:
This code isn't working: Error: virtual or abstract members cannot be private
How is FixedUpdate() defined in the MonoBehviour and how to change it to help my usecase?

sentences:
How do Idle games progress while not active? A hallmark of many idle games is the ability to still progress (or at least regain resources) while the game isn't active. The device can even be off.

Initially I figured they just calculated progress off system time next time it was started, but they do not appear fooled by messing with the clock.

How do they manage this specific feat?

sentences:
What does glBlendFunc do when given an incorrect enumeration value? In cocos2d-x, I am using particle system from plist with blend values: dst = 1, and src = 100 which is wrong enum for gl_blend.

Although app logged "OpenGL error 0x0500" but it still run and showed a good blend effect. And i can not find the right pairs of dst and src to recreate that effect.

So i hope someone can tell me how BlendFunc / gl_blend will work when it having bad src value. Base on that i hope i can recreate that effect without using wrong src value. Thanks

sentences:
Why aren't my isometric objects where I think they are? Background
I am creating an isometric RPG using Tiled and Monogame. My goal is to have relatively elaborate terrain and movement, with my vision for the overworld being much like the now-venerable Megaman Battle Network franchise. As such, by world must be 3D and simply drawn on top of an isometric map assembled from tiles.
Quirks
The Monogame.Extended system for drawing Tiled maps does so mostly on its own, though I have elected to draw a layer at a time and render any sprites I need to between the layer draw calls. The layers do not use the SpriteBatch I have configured to draw movable sprites, and just take a translation. I've managed to become decently adept at navigating it to convenient locations.
The Issue
Wikipedia says that for a good isometric scene, you want to rotate 45 degrees around Z and something like 32 degrees around what in my system is X. In my case, the resulting transformation does not seem to match the map image, so I am using an angle of approximately 52 degrees around X, which matches up fairly well. However, while the map itself can be perfectly aligned to the collision system, and I'm able to walk around the edges perfectly, objects within the map seem oddly placed. Some of this may be due to my incorrect handling of the Z (world upward) index, but it seems more than that. When I align the image so that it lines up with them instead of the edges of the map, their sizes seem subtly incorrect - I have found, for instance, that if my X rotation is negative, the objects (which are distant) seem slightly smaller than how they are drawn. I could be misreading that, however.
EDIT: The only distortion, if there is indeed any, seems to be in the viewport's Y direction. I collide where I expect to horizontally.
My Assumption
I believe this may simply be a camera issue - perhaps the default camera is not orthographic or something?  I don't really know the way to fix that if so, and if not, I'm mystified by what is going on.

sentences: Can global Illumination via path tracing replace all other current lighting techniques? In the sense that you currently have algorithms like HDR, shadows, reflections, caustics, motion blur and so on, does complete path tracing take care of all these effects, or would you still have to implement these effects separately?

sentences: Optimizing spawning 500 objects every 3 seconds Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.

sentences:
How can I add an impulse to specific rigid bodies at rest? Scenario

Rocks falling down a rocky slope, with a flat surface at the bottom.
When they land on the surface, the rocks move slightly before coming to a rest.

GLESDebugDraw shows the bright orange outline turning to a slightly darker orange once a rock comes to a rest, until the rock is agitated by another falling rock.

Question: I would like to add an impulse to the rock once it reaches the rest state. How would I implement that?

sentences:
Unity: how intercept Mouse Click on UI and not fire "shoot"? I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0))
      Fire();
}

What i want to do is that if I click on a UI button , the Fire() routine not will be called.

How to do to say Unity if InputGetMouseButtonDown(0) && !UI clicked ?

sentences:
How to achieve light effect on a car panel icons? I'm making a car and I want to make lightable icons on its panel. I want to add 'on' and 'off' effect to them separately. The Sprites are plane objects, with one material and UV texture for each plane.

If I change material property - it will change in all objects which use this material. I don't think creating 10 materials for 10 sprites is the best choice, what should I do in this situation?

sentences:
2d side scroller slope physics and collisions In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes and stairs handled along different points on the y-axis to give the appearance of still moving in a straight line?

For instance in the above picture would you set collision masks where the green lines are? Then imagine the characters are the red and blue lines respectively, how would you handle them in effect being moved “down” by gravity when in fact there isn’t really any gravity? For the top line I assumed when it hit the green line, rather then stopping or bouncing back on the x-axis you’d just nudge them down and continue the x movement?

I understand how this could be completed in 3D but I’m perplexed how this would’ve been achieved in purely 2d environments. Or maybe I’m imagining slopes/stairs in these old games...

I’m working in SpriteKit, so any ideas specific to that would be great but just understanding how this was accomplished theoretically in the first instance would be great.

Thanks

edit - after some thinking I don't think my 'collision' theory would work going down the slope for the blue line as it wouldn't be colliding unless it came off it's "straight" path, and also the problem would be reversed when going 'up' the slope.

so for instance in the above image where the characters are moving up the slope the other way I'm curious how this would have been handled? My thoughts now are, would the darker grey area with the "1" on it, actually be an entire entity itself or a collision mask? You'd then work out based on the characters "Y entry" point on to it (either at the top or the bottom) and based on their direction, where their 'Y' point should then be?

sentences:
HTML5 Jump and Run Game Performance issues we're developing a HTML5/Javascript jump and run game and therefore we have developed our own gameframework.
It consists of following most important structures:

Stage/Scene/Layer: divs
ObjectEntites/Rectangle/Sprite: canvas

In the gameloop things get moved by calculating an offset value: e.g. if we place a coin and this coin moves through the screen, it gets a new offset in each gameloop-call. The dirty area of the coin is cleared in the canvas and the coin is repainted. We pay attention that we just draw at int-values (no floating point).

Unfortunately we have some performance issues now and can't figure out why our macbook pro's are running hot while playing the game.

Are the drawing operations so crucial? We have layered Canvas, so just moving stuff gets repainted and even not the whole canvas but just dirty-areas get cleared.

IStat shows following values while playing the game:
Memory module A1 and Heatsink B get up to 60° and the rpm-Value of the Fans increases up to 3000-4000.
In firefox we see these values:

And chrome shows us this, where we also see how cpu increases:

Do you have any idea how to check performance of our game, how to find bottlenecks or general tips? We have searched for canvas performance, used firebug profiler...
We'd be grateful for any advice!

sentences:
Why is H (blinn) used instead of R (phong) in specular shading? I can't find a good reason for this anywhere. The reflection vector used in phong has a simple basis in physics. But the half vector used in blinn seemingly has no rational basis, and does not constitute a proper reflection. And yet it is used in every so-called "physically based" shading function. If there is a good physical basis for it, I'd like to know.

What I've been able to find are a few reasons:

It's faster - there's mixed information on this, but even so it would have been a great reason... in the year 1998.

It handles angles higher than 90 degrees better - as far as I can tell the only reason for this is because the phong term has been used improperly. The dot product of the reflection and the view gives an angle between -1 and +1. Usually this angle is clamped to 0 to 1, this is the direct cause of the 90 degree problem. Re-normalize the angle instead of clamping it and you get the full 180 degree coverage. I refuse to believe a simple x * 0.5 + 0.5 operation has eluded the graphics world for 40 years.

it handles edges better - The edge "problem" also exists in the blinn solution, just to a lesser degree. The main cause is improper simulation of area lighting at the terminator, which should be essential for any "physically based" shader. But even in simpler situations a sigmoid function can approximate a soft terminator line correctly. Multiplying into a lambert term is incorrect as it attenuates the specular term improperly, this could cancel out a fresnel term and lead to further errors.

It has long reflections at the edge - It seems to me that while anisotropic reflections may be realistic, blinn is not the correct way to implement them, as they only appear at the edge. It is merely a happy coincidence that an error in the H term happens to look realistic.

None of these reasons are satisfactory, I want to sort out this madness.

I want to clarify that I am not talking about blinn and phong specifically, but instead about the vector components H and R, which are used as the basis for these shaders as well as others.

sentences:
Same scroll speed across devices with different DPI I am creating a simple game in JS, something like the flappy bird :)
For pipe scroll, I am using a linear tween.

I noticed that the speed of the pipes are different across different smartphone screens, so
the game has different difficulty.

I observed that this has to do with different screen sizes and different pixels densities.

What I did is I defined a duration per pixel, which is multiplied by the number of pixels the screen has.
The duration per pixel, pixel_duration is constant.

So basically:

tween_duration = number_of_horizontal_pixels * pixel_duration

But this gives same speed in different sized browser windows on the (same) computer screen.
If I use this approach on some device that has higher pixel density, the pipes will move slower,
because there are more pixels, so this tween_duration value gets larger, so tween gets slower.

Then I learned of the devicePixel ratio value which can be used. So I try to factor this in the equation:

tween_duration = number_of_horizontal_pixels * pixel_duration / devicePixelRatio

This devicePixelRatio is higher as screen DPI's goes higher and should solve my problem according to the docs, right?
https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio

However, this only helps a bit. There is still a noticable speed difference.

Why is this not working, and how can I get the same scroll speed across devices in JS (in browser window) - perhaps some other approach would do?

sentences:
Drawing Shape in DebugView As the title says, I need to draw a shape/polygon in Farseer using debugview.
I have this piece of code which converts a Texture to polygon:

//load texture that will represent the tray
        trayTexture = Content.Load<Texture2D>("tray");

        //Create an array to hold the data from the texture
        uint[] data = new uint[trayTexture.Width * trayTexture.Height];

        //Transfer the texture data to the array
        trayTexture.GetData(data);

        //Find the vertices that makes up the outline of the shape in the texture
        Vertices verts = PolygonTools.CreatePolygon(data, trayTexture.Width, false);

        //Since it is a concave polygon, we need to partition it into several smaller convex polygons
        _list = BayazitDecomposer.ConvexPartition(verts);
        Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1));
        foreach (Vertices verti in _list)
        {
            verti.Scale(ref vertScale);
        }

        tray = BodyFactory.CreateCompoundPolygon(MyWorld, _list, 10);

Now in DebugView I guess I have to use "DrawShape" method which requires:

DrawShape(Fixture fixture, Transform xf, Color color)

My question is how can I get the variables needed for this method, namely Fixture and Transform?

sentences:
Game objects all blue underneath I have an empty scene with a single object in it, a cube.

The cube renders initially as pink, when it has no material attached.

When I attach a material though.  Any material.  Odd things happen.

I have created some extremely basic materials, which are just colours.  Some metallic, some not.  If I apply when of these the cube does not go the colour expected.  The exception of this is the Green and Blue materials, although I suspect they're the wrong shade.

Please see below:

Why could this be happening?  My settings look pretty standard on the cube...

If I create a brand new cube and set the materials up the exact same thing happens.

I have downloaded some sample materials from the asset store, and they behave strangely too.  A brown wood/bark texture does the following:

And here is that texture, definitely no sign of blue.

There are no lights set up, and the cube is the only item live on the scene, everything else is switched off.

I have also added a camera and rendered the scene.  Same thing.

Is there some sort of ambient light setting or something I am missing quite obvious?  Really not sure what to do here.

sentences:
(Unity) does NativeArray.Copy, or NativeArray.CopyTo, allocate any memory? Is there any memory allocation if there are two arrays of the same size and same type? If they are already of the same length, and the values are of struct, when there's the copy, is any more memory used? Like, is it the same as if I did a for loop setting values from one array to the other?

Are they the same?
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.CopyTo.html
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.Copy.html

[What should I write here? Is this enough for a question?]

sentences:
Choosing a server for a PVP game So I am starting a game with a friend as a small project, and we are considering what game servers would we need.

Firstly, the game is a multiplayer(player vs player) game, for example, like an online chess game. However it is real time, so the latency cannot be too high. The players basically take turns, but in a real time fashion. The platform is going to be Android (and perhaps extend to iOS in the future)

The server would need to synchronize the players' moves to each other devices.

I don't really need anything large scale and I am thinking of using PHP since the volume of data isn't really that big, this is like a web-based game with a requirement of a slightly lower latency.

What would be the advantages and disadvantage of using Apache + PHP for a game like this?

If that seems to be a bad choice, I would be grateful if you can share your experience with me. Thank you.

(We are both programmers and we are familiar with Java C++ Obj-C Apache PHP Tomcat JSP Javascript)

sentences:
Extra sprite spawning when the enemies are redrawn SFML I am making a game in sfml and at the moment when all of the enemies die. They are set to respawn however when this is happening they are respawning with one extra sprite than before.

The code for loading in the sprites is

unsigned int orcNumber = 5;
for (int i = 0; i < orcNumber; i++)
{
    SpriteVector.push_back(ogreSprite);
    SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
}

The code for removing the enemies if they are offscreen or shot is similar to below using erase.

for (unsigned j = 0; j < SpriteVector.size(); j++)
{
    if (this->SpriteVector[j].getPosition().x < 0 - 80 )
    {
        //this succesfully removes the object from the vector
        SpriteVector.erase(SpriteVector.begin() + j);
        std::cout << "Container size..." << SpriteVector.size() << "\n";
    }
}

The statement for redrawing them is:

unsigned int orcNumberRespawn = 5;
if (SpriteVector.size() <= 1)
{
    for (int i = 0; i < orcNumberRespawn; i++)
    {
        SpriteVector.push_back(ogreSprite);
        SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
    }
}

window.draw(SpriteVector[i]);

Can anyone identify why when the sprites need to be redrawn it draws with + 1 sprite everytime?

sentences:
Where can I advertise my engine, library or framework to attract users? I have just finished my hypothetical game engine, library or framework.
Now, I want to share it with people who may find it useful in their projects. Where can I advertise it to gain users?

By advertise, I mean to spread the word of its existence - not advertise it for money.

sentences:
tcp multiplayer security/structure I'm creating a real time multiplayer game. Each piece of data needs to be received, but it still needs to be as fast as possible which is why I don't want to use TLS for every request.

Here's what I was thinking:

The player logs in using TLS, and receives a session ID and symmetric key that the server generates

The server stores the player's ip address and symmetric key in the database for future reference

When they start a match, they receive a match ID, and send data to the server including the match ID, their session ID, and any necessary data using a symmetric encryption algorithm

The server takes their IP, finds the symmetric key from the database, and decrypts the message and authenticates the user based on the session ID

If everything checks out, the server accepts the data.

Is this approach plausible/efficient? would it be better for me to store the each player's symmetric key using their IP, or for me to get rid of the IP/symmetric key link table and send the data with the session id not encrypted, and store the key using the session id?

Any answers/comments would be greatly appreciated.

sentences:
How do you make a customizable 3D character with animation in iOS? I want to build a character system in my game that is like the on in Mod Nation Racers or Little Big Planet 2. You have a basic and simple Character (which is animated) and you can now put stuff (cloth, hat, glasses, eyes, mouth) and skins (yellow skin, hairy skin, ...) on it, like a puppet.

(This is all for iPad / iOS with Objective-C)

Does anyone have some url for me to get me started?

sentences:
How to implement own UI widget in libGDX? I want to implement my own widget, here is an image:

what I want to get. Instead of numbers there will be some names, but I think it doesn't matter. I'm pretty new in libGDX, so could you please briefly describe me plan, how can I do something like this (if there will be some code, it would be awesome)? I tried to google it, but didn't find something relevant.

Thanks in advance!

sentences:
How do I convert a DWG floor plan to 3D for use in Unity or PlayCanvas I wish to take DWG floor plans and make 3D models of them which I can then use in Unity or PlayCanvas.

PlayCanvas accepts FBX 3D models from tools such as Blender, Sketchup, 3DSMax, Maya, etc.

There are a lot of YouTube videos about creating 3D models from DWG in Sketchup but it seems quite manual work. Is there anything better or more automated?

Would it be better to use something like Blender, 3DSMax, Maya to create the 3D model?

How about AutoCAD - would this be better?

Is there are tool that is tailored for designing 3D floor plans that can export a model? I found Autodesk Homestyler which makes it easy to create floor plans, and see them in 3D, but only exports DWG.

The goal is to use these real life floor plans in a game engine because I want to simulate audio sources in the environment.

sentences:
OpenGL HUD is flickering when rotating the camera I draw game HUD after drawing 3D scene. When I move the camera quickly, HUD starts flickering.
I noticed that it happens only if the distance between the camera and an object its looking at changes after camera's position transformation.It does not happen if there is no mesh in front of the camera. I use separate shader program for HUD rendering. Have tried to enable/disable depth test, blending already. Using VBOs to draw stuff.

Render code:

 def render()
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    glEnable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_VOXEL)
    Shader.currentShader().enable()
    set3DMatrices()
    updateShaderVOXEL()
    val world = WorldRegistry.getWorldByID(0)
    world.renderWorld()
    Shader.currentShader().disable()

    Shader.setCurrentShader(Shader.SHADER_SIMPLE)
    Shader.currentShader().enable()
    set3DMatrices()
    ManagerRegistry.renderManagerSceneBoundingBox.render()
    ManagerRegistry.renderManagerSceneRectangle.render()
    ManagerRegistry.renderManagerSceneLine.render()
    Shader.currentShader().disable()

    glDepthMask(false)
    glDisable(GL_DEPTH_TEST)
    glDisable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_HUD)
    Shader.currentShader().enable()
    set2DMatrices()
    GL13.glActiveTexture(GL13.GL_TEXTURE0) // Texture unit 0
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, Texture.getTexture("screen/cursor/default.png"))
    HUDRenderRegistry.HUDRender.render()
    Shader.currentShader().disable()

    glDepthMask(true)

    glfwSwapBuffers(window)
}

EDIT

I made a video(captured on the phone, so the quality is bad, sorry) and the rectangle in it is actually fully red, not yellow.
https://youtu.be/HhHEfrgsfiU

sentences:
Flash AS3 Tower Defense Problem I am working on a tower defense game in Flash. Right now most towers find the the nearest enemy in range (enemies are in an array), get the enemies coordinates, and fire a bullet. When it hits the coordinates [bullet.hitTestPoint(x, y)] it damages the enemy.

I want to design a tower that will shoot a bullet at the first enemy just like above, however, the bullet needs to go its max range and damage all enemies it hits along the way. I am having some trouble determining what enemies it is hitting.

The best way I have come up with so far is when the bullet reaches its max range, I draw a line from that point back to my tower. Then I loop through the enemy array and use [enemies[i].hitTestObject(bulletLine)]. If that returns true, it damages that enemy.

This seems to work okay, but I would like something more realtime and sometimes it seems like this is hitting enemies it shouldn't hit.

sentences:
C++ exensible resource manager class with dynamic registration of factories I've done some some research on my own, so I hope someone can help me finish it. I'm trying to replicate the design of an extensible asset manager featured in this answer.

At the moment I have created this and have no clue on how to proceed.

class ResourceManager {
    public:
        template<typename T>
        bool addFactory( std::unique_ptr<ResourceFactory<T>> factory ) {
            std::type_index ti = std::type_index(typeid(T));

            auto searchResult = factories.find(ti);
            if(searchResult != factories.end()) {
                return false;
            } else {
                factories[ti] = std::move(factory);
                return true;
            }
        }

        template <typename T>
        ResourceHandle<T> load(const std::string &path) {
            std::type_index ti = std::type_index(typeid(T));
            auto searchResult = factories.find(ti);

            if(searchResult == factories.end()) {
                throw NoValidFactory(std::string("No registered factory of type ") +
                                     ti.name());
            }

            // TODO SOMEHOW DO LOADING
            //return searchResult->second->load(path);
        }
    private:
        std::unordered_map<std::type_index,
                           std::unique_ptr<ResourceFactoryI>> factories;
 };

I assume that TextureHandle featured in the answer is probably a typedef for something like a custom reference counted smart pointer (e.g. ResouceHandle<Texture>, like in my engine) but how do I return something like that? I'm not (YET) good with templates but I know that it's impossible to have a virtual specifier with a template method, so I CAN'T do something like this:

class ResourceFactoryInterface {
    public:
        template <typename T>
        virtual ResourceHandle<T> load(const std::string &path) = 0;
};

template <typename T>
class ResourceFactory : public ResourceFactoryInterface {
    public:
    ResourceHandle<T> load(const std::string &path) {
        // loading
    }
};

// TODO Template specializations for object types? Inherit from ResourceFactory?

What should I do? Am I even close or am I doing a complete nonsense? How should I proceed?

If someone wants to know why I need something like that: at the moment I have one huge, difficult to maintain and extend ResourceManager class with a different method (loadTexture, loadMesh, loadSound, etc.) for each resource type. Having something that can be extended dynamically would make my hobby engine's resource management system more reusable. Moreover, I have a few places where I'd benefit from instantiating separate resource managers with only several registered (level specific) resource types.

sentences:
Stencil inside Stencil? (Multiple masks on same object) So please take a look at what I want to achieve

The Red and Blue part is the object I want to mask. The thing is that it will be masked by the green area, and only after that it will be masked by the cyan area, which shall act like a scrollview. Currently I use stencil shader and the first mask works, but I don't know how to apply the second mask. Also, I don't want to use the built-in UI mask system for this. All the objects in the scene are sprites.

The thing is that I would like to achieve a hierarchy masking system, where the kids are masked by a parent.

Could you please give me a tip about what I should do in this case?

sentences:
Trying to make a button in Unity which spawns a character each time it's clicked I have a simple 2D game, I want a UI button to respawn the character (if it's not already present). The first problem I encountered is that the button only works once. I can't go any further before I solve this, so for now it doesn't spawn anything, I just want it to print debug text every time it's clicked.
It only does that once, unfortunately. How do I make it call the function each time I click it?

using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;

public class Button_Restart : MonoBehaviour
{
    public Canvas Canvas;

    void Awake()
    {

    }

    public void Restart()
    {
        Debug.Log("Restart button was clicked");
        EventSystem.current.SetSelectedGameObject(null);
    }
}

sentences:
How to render rounded shape perfectly? I'm having issues rendering rounded shape figures.
I have a Texture with different images in it and I get this whale figure from it with TextureRegion but the stroke of it looks pixelated.

The original whale image is 357x721 px and the program scalate it up or down depending on the device.

And I use TextureFilter to Nearest but it doesn't solve problem as I thought it would.

Does someone knows a bit about this issue?

    texture = new Texture(Gdx.files.internal("texturepack_nuevo.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

    pilar = new TextureRegion(texture,591,0,357,721);

    whale_1 = new TextureRegion(texture,0,0,591,323);
    whale_1.flip(false, true);

    whale_2 = new TextureRegion(texture,0,323,591,323);
    whale_2.flip(false, true);

    whale_3 = new TextureRegion(texture,0,646,591,323);
    whale_3.flip(false, true);

    TextureRegion[] whales = {whale_1,whale_2,whale_3};
    whaleAnimation = new Animation(0.15f, whales);
    whaleAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

sentences: How to get quaternion from two orthogonal 3D vectors? I have a unit vector representing the direction I want to "look" and a unit vector for up. They are orthogonal. How can I get the quaternion that represents that orientation from those two vectors?

sentences: How do I get rights to an game? I' looking to get rights to an game called Grand Theft Auto: Chinatown Wars for the Nintendo DS. I am a Nintendo 3DS Developer trying to make a remastered version for the Nintendo 3DS. How would I go about getting the rights for the game. Do I get the rights from Rockstar, Nintendo, or another party. I'm not sure.

sentences:
In-Depth Lockstep Explanation I'm making a multiplayer game built upon a lockstep system and I'd just like a better grasp on the concept. My main question is on how to get every command to simulate at the same time on every client, or rather, on the same points in each client's timeline. I'm using a fixed update of 10 frames per second for simulating every object's position from movement commands (Click and move style) the same way. How do I tell all clients to execute all commands at the same relative time to the first command?
Note I'm using Unity3D and a sufficiently accurate physics implementation. I just need to get across every command at the correct time.

sentences:
How to apply forces to rigidbody when Time.timeScale is changed? My Task:
I'm trying to replicate this virtual 3d creature evolution project. I'm using unity as my physics engine.
Each limb part has a MonoBehaviour called an Effector. The effector is what makes the creature move by applying forces to it using Rigidbody.AddRelativeTorque(Vector3 torquVector). I want the effector to act at contant frequency, relative to time (even when scaled). Meaning, if on time scale 1, the effector acted 10 times a second (real-time), a time scale of 10 will cause it to affect 100 times a second (real-time)

I'm changing Time.timeScale during the evolution to speed things up, but I'm sure I'm missing something in the force calculation.

My code:

    void FixedUpdate()
    {
        // Apply force
        if (Time.frameCount % 10 != 0)
           return;

        float val = GetEffectorValue(); // Some calculated value
        float delta = Time.fixedDeltaTime * Time.timeScale;
        float force = val * TORQUE_WEIGHT * rb.mass * delta;

        Vector3 forceVector = Vector3.zero;

        // There are 3 effectors, each one operates on a differet axis
        if (axis == Axis.X)
            forceVector.x = force;
        else if (axis == Axis.Y)
            forceVector.y = force;
        else if (axis == Axis.Z)
            forceVector.z = force;

        rb.AddRelativeTorque(forceVector);
    }

The problem:
The movement changes with the time scale. When the time scale is low, a creature doesn't really move (which is expected), but when the time scale is upped to 10 or more it is obvious that it moves more. In order to be sure that I'm not impatient and don't wait long enough I compared a 30 second period with a time scale of 2, to a 6 second period with a time scale of 10.

I tried a couple of other methods and looked at the unity documentation but couldn't figure this one out.

Thanks in advance :)

sentences:
Unusual leveling up mechanism? About player leveling up, most (or maybe all..?) RPG games are like this:

Kill enemies (for experience points)
Level up (for more attack power)
Repeat

It's fun in the low levels, but later, it gets dull and boring; the game becomes more like increase your numbers to see more numbers.

I'm making an RPG game. I'm thinking of giving the player mini-quest(s) for each level to level up. For example, to reach level 2, player must fulfill the following:

Gain 10 EXP points.
Find an Ancient Jar.
Kill a Blue Wolf with a single attack.

So my question is: Are there games that have done this (I haven't seen/heard of any)? Is it good or bad idea? Even if there are games that have done this technique, why most (or all) RPG games are going with the kill-levelup-repeat process?

sentences: Devices or Smartphones That Can Run and Displayed Images Properly While Power of 2 Code is Disabled Before making game apps, I want to have any certain smartphone device brands that runs on OpenGL. I have to make a code for images that doesn't need to required power of 2 images so that I can resize the images independently from the start. However, some images appeared in white instead of the appearance that I expected like the old model phone T-Mobile on Android 1.6 for example after I disabled the power of 2 code. The only device I've known that worked and displayed image sprites properly is the Google Nexus 7. Can you tell me either other phone models that can display images without the need of power of 2 and will not display white images instead? Please give me an example at least. Thank you.

sentences:
How do I convert matrices intended for OpenGL to be compatible for DirectX? I have finished working through the book "Game Physics Engine Development 2nd Ed" by Millington, and have got it working, but I want to adapt it to work with DirectX.

I understand that D3D9+ has the option to use either left handed, or right handed convention, but I am unsure about how to return my matrices to be usable by D3D. The source code gives returning OpenGL column major matrices (the transpose of the working transform matrix shown below), but DirectX is row major.

For those unfamiliar for the organization of the matrices used in the book:

[r11 r12 r13 t1]
[r21 r22 r23 t2]
[r31 r32 r33 t3]
[ 0   0   0   1]

r## meaning the value of that element in the rotation matrix, and t# meaning the translation value.

So the question in short is: How do I convert the matrix above to be easily usable by D3D?  All of the documentation that I have found simply states that D3D is row major, but not where to put what elements so that it is usable by D3D in terms of rotation, and translation elements.

sentences:
Unity: Failed to build APK. See console for details i am getting this error whenever i am trying to build a project. i looked at so many solutions but this one just doesn't go away.

This is the error:

CommandInvokationFailure: Failed to build apk.
C:\Program Files\Java\jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Mohit/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
    at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at UnityApkBuilder.<init>(UnityApkBuilder.java:214)
    at UnityApkBuilder.main(UnityApkBuilder.java:34)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 11 more
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

what i have tried so far:

1) downgrading android sdk
2) moving zipalign file from build-tools to tools folder
3) setting up keystore

sentences:
unity Tilt Android Device player Freeze When Die I attached tilt script to my Player to move player x and y Axis. Player have Rigidbody2D and also IsKinematic=true. but the problem when the player can Die i want to stop tilting and player goes down to ground.
here is my tilt Code

public float Speed=20f;
 void Update () {
  if (PlayerControll.instance.isAlive) {
   transform.Translate (Input.acceleration.x * Speed * Time.deltaTime, Input.acceleration.y * Speed * Time.deltaTime, 0);
  } else {
   PlayerControll.instance.PlayerRigidbody.isKinematic = false;
  }

I try to do that using disable tilt script when Player die and Iskinematic=false but the problem is player can freeze to his position not goes down to the ground. I do that so many way but not done so what i do don't know then i post the Question. thanks in advance.

sentences:
What is the camera direction vector for an isometric view? What values correspond to a 3D vector for screen-normal from within an isometric game?

It needs to be in game coordinates. It is a standard isometric where tiles are rotated 45 degrees and half height (in 2D projection).

For example [+x,0] in game corresponds to north-east on screen. But what is the vector leading out of the screen. This vector is always the same (a fixed orthographic projection).

sentences:
interace between C and Lua function with 3D vector arguments I have C++ function (which runs some physical simulation inside my game engine) which looks like this:

void doSomePhysics( int nIters, Vec3d pos, Vec3d vel ){ /*... don't care ...*/ }

I want call this function from a lua script likes this:

doSomePhysics( 100, {1.0,-2.0,3.0}, {-8.0,7.0,-6.0} )

I'm trying to figure out how to make lua interface to this function.

I would like to do several general helper functions for passing 2D,3D and 4D vectors and matrices since I will heavily use them.

Here is sketch what I'm currently trying to do (But I know it is not correct):

void lua_getVec3(lua_State *L, Vec3d& vec ){
    // universal helper function to get Vec3 function argument from Lua to C++ function
    luaL_checktype(L, 1, LUA_TTABLE);
    lua_settop(L, 1);
    int a_size = lua_rawlen(L, 1);
    lua_rawgeti(L, 1, 1); vec.x = lua_tonumber(L, -1);
    lua_rawgeti(L, 2, 2); vec.y = lua_tonumber(L, -2);
    lua_rawgeti(L, 3, 3); vec.z = lua_tonumber(L, -3);
    lua_pop(L, 3);
}

int l_doSomePhysics(lua_State* L){
    // lua interface for doSomePhysics
    Vec3d pos,vel;
    int n = lua_tointeger(L, 1);
    lua_getVec3(L, pos );
    lua_getVec3(L, vel );
    doSomePhysics(n,pos,vel);
    lua_pushnumber(state, 123);
    return 1;
}

I read several short tutorials 1 2 3 but it seems horribly complicated, confusing and error-prone ... I'm completely lost in stack indexes (what is my current position in the stack?, what is correct relative index? etc.). I'm reluctant to believe the most famous game scripting language needs sooooo much boiler-plate code and so much pain for interfacing every little function.

EDIT: answer is here

sentences:
Update function - design patterns I started reading about game development design patterns and from my experience there are 2 options for update methods. The first one receive from the game loop and delta time of this update and multiple everything by it, for example position += speed * delta_time. And this will happen in the game loop without delay.

The second option is too set constant frame delay and use it. In the end of the loop function you use sleep(last_frame_time + frame_length - current_time).

Does it matter what do I use? What's more common? I know unity use the delta time technique but it's the only one I saw that use it. I would like to hear your opinions on what to use for both options.

Should I always use the first option? always the second?

Thank you for your time.

sentences:
Unpacking Sprite Sheet Into 2D Texture Array I am using WebGL 2. A tag for it does not exist but it should.

I have a 10x10 sprite sheet of squares that are 16x16 pixels in size (all in one PNG image).

I'd like to create a 2D texture array out of them, where each 16x16 square gets its own, unique Z/depth value.

let texture = gl.createTexture();
let image = new Image();

image.onload = function() {
    gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);

    gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 5, gl.RGBA, 16, 16, NUM_IMAGES);

    // Now what?
    // gl.texSubImage3D doesn't let me copy in a section of the src image
}

image.src = "https://source_url.fake/image.png";

I know that gl.texSubImage3D exists but it only accepts an entire image as a source?

glTexSubImage3D: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexSubImage3D.xml

sentences:
Rotate a rigid body not around its centre of mass I have a rigid body (a boat) whose centre of mass is towards the front of the object. However, this makes the rotation look strange as the rudder that is turning the object is at the back of the boat so the rotation would be around that point.

How can I rotate the object from the a separate point (using forces) without changing the centre of mass?

Applying a force at a location still causes the object to rotate around the centre. In real life, you need to pin down the point that you want to rotate around, forcing the object to rotate around that point.

This would suggest using constraints but I can't figure out how that would work. You sort of need the rotation point to act as a hinge, but when I apply a suitable constraint, but that would just block the rotation rather than convert it into a rotation around the new point.

I want to resolve this using physics driven operations in Unreal Engine 4.

I don't want to move the Centre of Mass, admittedly for not a particularly good reason, but this still feels like a valid question even if that was an option - what if you want to rotate around two different points.

sentences:
install unity package in to iphone? HI All,
 what is the steps of to install the unity package in to iphone and create a build (app file )that my client can also able to install in his iphone .

Thanks,
balraj.

sentences:
Impact of object's statistics on the rendering Consider two 3D objects with n points and n triangles. One of the objects has a smooth surface such as a ball or a box, and the other object is like a fuzzy onion-layered object with large intersecting faces. Is there any difference between the rendering (complexity and time) of these two objects?

I know that regardless of the input, the rendering process has a fixed complexity, but I am wondering whether it is possible to evaluate the impact of objects' (vertex and connectivity) statistics on the rendering (complexity and time).

sentences:
2D orbital mechanics I'm working on a 2D game which involves firing projectiles around a solar system and having the path of the projectile change based on the gravitational pull of solar bodies.

I've been trying to find an explanation for how orbital mechanics work, at least in this simplified 2D scenario, but so far haven't found anything other than theoretical high-math documents.

I know that there are some existing games that do this already in 3D space, namely Planetary Annihilation and Interplanetary, but I haven't been able to find any references to how they did it. The Planetary Annihilation devs did a livestream demo of it once, but I haven't been able to find it since, and I don't think it went into much detail.

Whether by explanation or reference, does anyone know how 2D orbital mechanics work for the purpose of a game? How or where can I learn this?

sentences:
Generating 3D-like effect I'm making a 2D sidescroller game and want to give the blocks a 3D like effect. This way it looks like the player is walking on 3D blocks while walking on a 2D plane (thus having only x,y coordinates).

I have already written the code to generate the terrain in 2D, but the 3D effect is now baked in. It looks like this:

At this moment the 3D effect is baked into the blocks, but I want to try to generate it.

Is there a common way to achieve this 3D like effect while still staying 2D?
Do I have to convert from 2D to 3D or is it also possible to do this with calculations/shaders?

EDIT; The reason I want the top texture of the block separate of the block is because when the camera would go up, the top should get bigger as the camera sees more of the top of the block and the other way around when the camera goes down.

sentences:
Finding Endpoint of line in Unity I have a startpoint, magnitude(length) and direction and want to find endpoint to construct the line
here is the code to make question more clear

private Vector2 GetEndPoint(Vector2 startPoint, Vector2 direction, float magnitude) {
    Vector2 endPoint = //some stfuff with parameters
    return endPoint;
}

And this is the visualization of what I want

Hope I am clear enough, any suggestions is welcomed

sentences:
Culling for a 2D, platformer game? By culling, I mean, only rendering what is currently seen by the camera. In my game, nothing is tile based. Each object has a center point and that is where it is on the screen. The camera is simulated by doing glTranslatef before drawing anything on that layer.

Here are the constraints:

I have 6 layers. Each of these is an array of IRenderableEntity. Each layer has a scalar that it multiplies the camera position by to simulate Parallax Scrolling. Within these arrays, the object itself could be static or dynamic.

I'm not concerned with collision detection since Box2D takes care of this.

How can I only render what I see on the screen in a logerithmic manner (not n^2)

Thanks

sentences:
How To Get Current Selected Tiles and Neighbour I've 2D array that store each planes that instantiate using code.

Tile[][] map;

Then in Update()function, I try to Raycast and i can get the tile from RaycastHit game object.

How to get which Tile in my 2D array map is hovered base from RaycastHit without loop each tiles in array and check it ?

sentences:
Algorithm for dividing a 2D grid into organic looking plates the title pretty much says it all:
How could one go about segmenting a 2D grid into smaller parts?
My goal here is to create tectonic plates for further procedural world generation

Details to consider:

The amount of parts should be controllable the resulting parts should
look "organic", meaning somewhat irregular, but still clumpy
the parts should wrap on the x and y axes

For now, I am using a random flood fill with as many starting points as I want plates.

Pseudocode would look a bit like this:

For 0 to plateAmount
   create a random seeding point and store point in each plates list of points.

While empty points exist in the grid,
   loop over each plate and add an adjacent, empty point to it.

This gives acceptable results, but takes very long! With 6 plates, a map of 100x100 tiles/points/cells takes 3 seconds, 200x200 takes 50 seconds, 500x500 takes forever. The more plates, the quicker it is.

Is there a quicker way to get a good result? Maybe something with Voronoi?

My result with 60x60 cells, 10 plates, each cell is 10x10 pixels. Ignore the "height" text, it displays not-yet-visualized data from the cell the mousecursor hovers over

sentences:
3D sphere generation I have found a 3D sphere in a closed-source game engine that I really like the look of and would like to have something similar in my own 3D engine.

This is how the sphere looks like when it is created in the game engine, at program/game start:

At program start, a function named CreateSphere is called and the user has the option to choose a 3D position and a radius of the sphere. That's all I know about the function since the engine is closed source.

Anyone have any idea of how this sphere might be generated programmatically?
I have checked other posts/sites discussing spheres but none of them has the look of the sphere in the image.

Edit: removed some unnecessary information to get to the point of what I need help with.

sentences:
Why doesn't RGB565 lead to a smaller memory footprint on Android? I'm using LibGDX for my game. I'm loading 9 bitmaps into memory at once using the AssetManager, about 512x512 pixels each on average.

TextureParameter texParam = new TextureParameter();
texParam.format = Format.RGBA8888;

assetManager.load("islands/island_0.png", Texture.class, texParam);
assetManager.load("islands/island_1.png", Texture.class, texParam);
assetManager.load("islands/island_2.png", Texture.class, texParam);
assetManager.load("islands/island_3.png", Texture.class, texParam);
assetManager.load("islands/island_4.png", Texture.class, texParam);
assetManager.load("islands/island_5.png", Texture.class, texParam);
assetManager.load("islands/island_6.png", Texture.class, texParam);
assetManager.load("islands/island_7.png", Texture.class, texParam);
assetManager.load("islands/island_8.png", Texture.class, texParam);

However, if I switch the format to Format.RGB565, then run the Heap allocation tracker in the DDMS view of Eclipse, I see absolutely no change in the memory allocated. The bitmaps being drawn on the screen though are being rendered differently (without an alpha channel when I use RGB565).

Am I missing something? Why aren't the bitmaps using less memory?

sentences:
Creating Input layouts for different vertex types I'm still in the planning phase for a hobby abstract renderer, and i'm wondering how i should handle multiple vertex types and different shader inputs. (This is my first graphics project, so cut me some slack for lack of knowledge :) ).

What I want to to do is have the vertices be typeless, and have my model file specify "channels" of attributes EX: position, color, normal, binormal, tanget, etc. These channels would have string identifiers and stride values. On the shader side, i would like each shader program to specify which "channels" it requires via the identifier. Vertex Buffers would be compatible with the shaders if they had all the attributes required by the shader.

this is all abstract so I must be able to implement the functionality in most API's. However, taking a look over at D3D11, it looks like i would have to create a new Input layout per Vertex Buffer/ Shader COMBINATION. It would also mean some sort of goofy cataloguing system that goes, "if you have this specific combination of attribs, and the shader requires this specific combination of attribs, then use this layout", which makes me a little queasy thinking about it :\ . The number of input layouts would grow exponentially with more combinations.

The other solution would be to create and delete a new input layout EVERY time you wish to render. same queasiness -_-. Was D3D11 intentionally trying to force every vertex buffer in your design to have the same type?

Does anyone have a better suggestion? the main parameters i would like are the channel based vertex buffers, and the channel receiving shaders.

sentences:
How do I match and clear sequences 3 adjacent coloured blocks? I'm making a game with elements of a match-3 puzzler (such as Columns, Bejeweled or Tetris Attack).  I don't know where to begin creating an efficient algorithm for matching and clearing.

My assumptions:

Blocks of a like color can be matched horizontally, vertically, or diagonally in sets of at least 3.
Blocks are held within a grid.  They do not move horizontally.
However, blocks do move vertically due to gravity.
This is an action game, therefore we have to check up on the grid each frame.
Due to the design of my game, however, we only need to check for matches if at least one block was falling in the previous frame.

Where do I go from here?

sentences:
How can I obtain a HBITMAP or HICON from a Direct2D bitmap? Is there any way to obtain a HBITMAP or HICON from a ID2D1Bitmap * using Direct2D? I am using this function to load the bitmap.

The reason I ask is because I am creating my level editor tool and would like to draw a PNG image on a standard button control.

I know that you can do this using GDI+:

HBITMAP hBitmap;

Gdiplus::Bitmap b(L"a.png");
b.GetHBITMAP(NULL, &hBitmap);

SendMessage(GetDlgItem(hDlg, IDC_BUTTON1), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);

Is there any equivalent, simple solution using Direct2D? If possible, I would like to render multiple PNG files (some with transparency) on a single button.

sentences:
Label not properly centered in TextButton I'm using LibGDX v1.1.0 and I see that the label of a TextButton is not properly centered. I have the following code:

m_resumeButton = new TextButton("resume", skin);
m_resumeButton.addListener(new ChangeListener() {
    public void changed(ChangeEvent event, Actor actor) {
        m_state = GameState.RUNNING;
        getGame().getWorld().pauseWorld(false);
    }
});

The default TextButtonStyle is defined as:

"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
    "default": {
        "up": "menu-button",
        "down": "menu-button-down",
        "checked": "menu-button-down",
        "disabled": "menu-button-disabled",
        "font": "font24",
        "fontColor": "white"
    }
}

The menu button images are simple 240x48 bitmaps saved as 9-patch images. An image can be found here to illustrate the problem:

https://www.dropbox.com/s/cwuhu5xb9ro5w6m/screenshot001.jpg

Am I doing something wrong? Or is there a problem with the button images I'm using?

sentences:
How can I know how difficult a question is? I'm making a "Who Wants to be a Millionaire" style of game. I'm really stuck at the part where I should arrange questions from easy to hard.

Isn't this subjective? How can I tell how hard/difficult a question is?

sentences:
Earth's rotation along it's axis I've modeled an earth using an sphere. I can rotate it using glRotatef function around z axix by incrementing the angle. How do I simulate earth's movement which looks like 23.5Degree around Z axis? (see this image)

I guess I need to calculate the x,y,z verctors. Any Idea? I'm a complete newbie in computer graphics programming.

sentences:
Drag and drop card game--NullReference Exception despite object existing? I am trying to build a Hearthstone-style online TCG. Right now I am just working on getting the cards to drag around on the screen. Since I'm new to Unity, I'm using this tutorial https://www.youtube.com/watch?v=AM7wBz9azyU&index=3&list=PLbghT7MmckI42Gkp2cILkO2nRxK2M4NLo

I've copied the code in the tutorial pretty much exactly. What I have looks like this:

public class dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {

   public Transform parentToReturnTo = null;

   GameObject placeholder = null;

   public void OnBeginDrag(PointerEventData eventData)
   {
       Debug.Log("OnBeginDrag");

       placeholder = new GameObject();
       placeholder.transform.SetParent(this.transform.parent);

       LayoutElement le = placeholder.AddComponent<LayoutElement>();
       if (le) {
           Debug.Log("Found it!"); //Found le here...
       }
       else
       {
           Debug.Log("No dice.");
       }
       le.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth; //can't find le--why?
       le.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
       le.flexibleHeight = 0;
       le.flexibleWidth = 0;

       parentToReturnTo = this.transform.parent;
       this.transform.SetParent(this.transform.parent.parent);

       GetComponent<CanvasGroup>().blocksRaycasts = false;
   }

The rest of the class doesn't seem to effect the problem I'm having. That problem being: whenever I try to write to the LayoutElement le, the console returns a NullReferenceException error. But when I try to read le--for instance, testing if it exists in the if (le) loop (which exists only for debugging this particular issue), it works fine. Also, if you watch the tutorial video, you'll see that there is a "tabletop" on the upper half of the canvas that you can drop cards on to--this doesn't seem to work unless I comment out all code that tries to write to le's attributes. Anyone know how to fix this?

sentences:
Calculating Per Vertex Normal in Geometry Shader I am able to calculate normals per face in my Geometry Shader but i want to calculate per vertex normal for smooth shading. My Geometry shader is

#version 430 core
layout ( triangles ) in;
layout ( triangle_strip, max_vertices = 3 ) out;

out vec3 normal_out;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

uniform mat4 modelTranslationMatrix;
uniform mat4 modelRotationXMatrix;
uniform mat4 modelRotationYMatrix;
uniform mat4 modelRotationZMatrix;
uniform mat4 modelScaleMatrix;

void main(void)
{
    // Please ignore my modelMatrix and NormalMatrix calculation here
    mat4 modelMatrix = modelTranslationMatrix * modelScaleMatrix * modelRotationXMatrix * modelRotationYMatrix * modelRotationZMatrix;
    mat4 modelViewMatrix = viewMatrix * modelMatrix;
    mat4 mvp = projectionMatrix * modelViewMatrix;
    vec3 A = gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    vec3 B = gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    mat4 normalMatrix = transpose(inverse(modelViewMatrix));
    normal_out = mat3(normalMatrix) * normalize(cross(A,B));
    gl_Position = mvp * gl_in[0].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[1].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[2].gl_Position;
    EmitVertex();
    EndPrimitive();
}

Since i don't have access to adjacent faces here, i cannot calculate per vertex normals.
How can i calculate per vertex normals in my Geometry Shader?

sentences:
I have a frag shader, one with an empty s_lightMap, how and why is it effecting the output? I have an image of concrete rocks of different shades of colors, and I'm applying this shader, but without referencing s_lightMap's uniform in my program:

        precision mediump float;
        varying vec2 v_texCoord;
        uniform sampler2D s_baseMap;
        uniform sampler2D s_lightMap;
        void main()
        {
          vec4 baseColor;
          vec4 lightColor;

          baseColor = texture2D( s_baseMap, v_texCoord );
          lightColor = texture2D( s_lightMap, v_texCoord );
          gl_FragColor = baseColor * (lightColor + 0.25);
        }

it displays a picture with variable light color added to the final pixel color, but s_lightMap isn't even linked into the program, what is happening in this case, at first I thought it would just do the baseColor as the FragColor, but the addition of the 0.25 makes a non-negative result to (lightColor + 0.25). I'm confused, one minute I think lightColor would be set to a texture of 1's the next an array of 0's.

Or is it just random data? It doesn't appear at all random in the picture, it looks like it's obeying a rule of shading.

I'd like to mimic this effect in code that's not broken.

Here's the unshadded image:

Example "gimped" image of how it has variable shades (though this is an invert):

sentences: What kind of databases are usually used in an MMORPG? Do people write their own DB for some reason?

sentences:
How to add Collider to a Line Renderer in unity? I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this.
Current Code

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

public class CreateCircle : MonoBehaviour
{
    // Start is called before the first frame update

    public float radius;
    void Start()

    {
        int segments =60;
        int pointCount = segments+1;

        Vector3[] points = new Vector3[pointCount];

        LineRenderer line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = pointCount; //line.SetVertexCount(pointCount);

        for(int i=0;i<pointCount;i++)
        {
            float Deg = (i*60 / segments);
            float Rad = Mathf.Deg2Rad *Deg;

            points[i] = new Vector3 ( Mathf.Sin(Rad) * radius,Mathf.Cos(Rad)*radius,0);
            // Debug.Log(" Point: "+i+" Deg: "+Deg+" Rad: "+Rad+" Vector 3:"+points[i]);
        }
        line.SetPositions(points);

        Mesh lineMesh = new Mesh();
        line.BakeMesh(lineMesh,Camera.main,true);

        MeshCollider lineCollider = line.gameObject.AddComponent<MeshCollider>();

    }

    void OnColliderEnter(Collider col){
        Destroy(col.gameObject);
    }

}
```

sentences:
Civilization 6 add City States in World Builder There are instructions to access the Civ 6 Worldbuilder in civfanatics forums.

The TZ mod method allows starting with a custom map, but there are no generated city states.

How can I add city states to the map / mod so the game does not crash on the first turn?

sentences:
Rendering methods comparison I'm learning the basics of writing the game engine. Now I'm on the rendering the scene aspect using  the page flipping method. I roughly understand the theory but as of the implementation i can't find simple examples showing this technique.
Can someone please be so nice and provide me some c++ code showing the simplest direct vs page flipping rendering allowing me to see the difference as of problems like the image flickering or image tearing?

sentences:
A coroutine to rotate one point around another by a given angle without referring to game object I need to rotate a point around another point (in 2D) by a given angle over a given duration, independent of game object (meaning that I've manually created the points and they're not positions from a game objects transform ) as shown in the image below where point B rotates to C by and angle e around A by with radius AB. Using a coroutine would be preferable.

UPDATE

Based on links provided by @MichaelHouse I wrote the following methods to rotate a control point over time by a certain angle but it rather moves to a point (which is not the desired point) immediately to another point, not by the right angle. I'm not sure what I've done wrong.

public static Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Quaternion angle)
{
    return angle * (point - pivot) + pivot;
}

IEnumerator RotateControlPointWithDuration(Vector3 point, Vector3 pivot, float duration, float angle)  {
    float currentTime = 0.0f;
    float ourTimeDelta = 0;

    ourTimeDelta = Time.deltaTime;
    float angleDelta = angle / duration; //how many degress to rotate in one second

    while (currentTime < duration)
    {
        currentTime += Time.deltaTime;
        ourTimeDelta = Time.deltaTime;

        Vector3 newPos = RotatePointAroundPivot(point, pivot, Quaternion.Euler(0, 0, angleDelta * ourTimeDelta));
        points[0] = new Vector2(newPos.x, newPos.y);

        yield return null;
    }
}

IEnumerator runMovement()  {

    yield return new WaitForSeconds(2.0f);
    Vector3 point = new Vector3(points[0].x, points[0].y, 0);
    Vector3 pivot = new Vector3(points[3].x, points[3].y, 0);
    StartCoroutine(RotateControlPointWithDuration(point, pivot, 2.0f, 45.0f));
}

UPDATE 2

I've tried another approach using trig functions, but the point moves erratically before finally arriving at a point that seems to be the right point. Please see the code below:

 IEnumerator runMovement()  {

    yield return new WaitForSeconds(2.0f);
    Vector2 pivot = points[3];

    StartCoroutine(RotateControlPointWithDuration(pivot, 2.0f, 90.0f));

}

   IEnumerator RotateControlPointWithDuration(Vector2 pivot, float duration, float angle)
{
    float currentTime = 0.0f;
    float ourTimeDelta = 0;
    Vector2 startPos = points[0];

    ourTimeDelta = Time.deltaTime;
    float angleDelta = angle / duration; //how many degress to rotate in one second

    while (currentTime < duration)
    {
        currentTime += Time.deltaTime;
        ourTimeDelta = Time.deltaTime;

        points[0] = new Vector2(Mathf.Cos(angleDelta * ourTimeDelta) * (startPos.x - pivot.x) - Mathf.Sin(angleDelta * ourTimeDelta) * (startPos.y - pivot.y) + pivot.x,
                                                        Mathf.Sin(angleDelta * ourTimeDelta) * (startPos.x - pivot.x) + Mathf.Cos(angleDelta * ourTimeDelta) * (startPos.y - pivot.y) + pivot.y);

        yield return null;
    }
}

sentences:
Segment-Cylinder intersection What is the complete code (C#, pseudo, does not matter) for calculating the resulting segment (or its absence) for the intersection of asegment and a cylinder?

The segment is defined by Vector3(x,y,z) as Start andVector3(x,y,z) as End.

The cylinder is defined by the same parameters plus a value for Radius.

sentences:
Loading enemies in a 2d platformer What would be the best way to load enemies in a level. For example take Mario, are enemies rendered at their x,y positions as the game is loaded or when the player walks past a specific x value. Wouldn't this mean that you would have multiple if conditions checking whether the player has reached a specific x value to spawn an enemy; this doesn't seem like a very good solution to this problem at least to me.

What would be the recommended way?

sentences:
Function call to AndroidJabaObject to an instance of com.prime31.PlayGameServicesPlugin causes the application to stop responding Using Prime31 PlayGameServices attempting to call 'authenticate' causes the game to stop responding very soon after.

There isn't much I can show as there's literally no logs showing up in logcat.

Is there any way I can debug this?

I did notice 'enableDebugPrints' on the AndroidJavaObject was 'false' and I don't know how to set it to true, which might help with prints?

I've tried catching an exception but that hasn't worked.

sentences:
Unity raycasting not always detecting component I am trying to determine what object I am clicking with the help of a raycast, however it doesn't always work
In update I call:
if (Input.GetMouseButtonDown(0))
{
    selectedObject = null;
    selectedUnits = new List<Unit>();
    Select(Input.mousePosition);
    startPos = Input.mousePosition;
}

which calls:
void Select(Vector2 screenPos)
{
    Ray ray = cam.ScreenPointToRay(screenPos);
    RaycastHit hit;
    //Debug.Log("1");
    if (Physics.Raycast(ray, out hit, 100))
    {
        OnClicked(hit.transform.tag);
        //Debug.Log("2");
        if (hit.transform.GetComponent<Unit>())
        {
            //Debug.Log("3");
            if (!selectedUnits.Contains(hit.transform.GetComponent<Unit>()))
            {
                //Debug.Log("4");
                selectedUnits.Add(hit.transform.GetComponent<Unit>());
            }
        }

        if (hit.transform.GetComponent<Building>())
        {
            if (hit.transform.GetComponent<Building>() != selectedObject)
            {
                selectedObject = hit.transform.gameObject;
            }
        }
    }
}

Detecting a "building" always works and is fine, but clicking on a "unit" works anywhere between 0 and 5 times per play session before it returns nothing anymore like the object doesn't exist. I have tried to find where it gets stuck and it gets stuck after the 2nd debug (debug 1 and 2 print but 3 and 4 do not).
This is the Unit in the inspector

and this is it in the hierarchy

When drawing the ray here you can see it hits the cube 3 times before it just passes right through the 4th time.

it seems like after each hit the ray penetrates the collider more and more

But how and why can it only hit it a couple of times before it passes through. After a certain amount of clicks with or without moving my mouse it just doesn't hit it anymore even though in the inspector nothing changes and there are no scripts that alter the box collider.
I hope someone knows what's going wrong, thanks!

sentences:
How to use GdxAI with libgdx ashley ecs framework? I'm planning to use GdxAI Telegraph in GdxAshley ecs framework, my problem is how I'm gonna create a telegraph component if I wanted to dispatch a message? I have created AIComponent and AISystem.

class AIComponent implements Component{
    StateMachine<Entity, EntityState> fsm;
}

class AISystem extends IteratingSystem {

    public void processEntity(Entity entity, float deltaTime) {
         AIComponent ai = Mappers.ai.get(entity);

         ai.fsm.update();
    }

}

For example I wanted to dispatch a message using space input.

if(Gdx.input.isTouched()) {

     MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                entitySender, entityReceiver,
                MessageType.SAYHELLO, null);

}

I'm thinking of creating a class that extends Entity and implement it to Telegraph. But the ashley ECS approach will be disregard here.

class EntityAI extends Entity implements Telegraph {

     StateManager fsm;

     public EntityAI (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram); // In this part, the logic exists. Im thinking of creating a System that will handle message? but how
     }

}

Question How do I properly convert the this EntityAI to entity-componentbased-system approach? In the below code is not tested but it was the idea entered my mind.

class Script implements Telegraph {

     StateManager fsm;

     public Script (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram);
     }
}

class ScriptComponent implements Component {
     Script script;
}

 ScriptComponent script
 AIComponent ai
 ai.fsm = new StateMachine();
 script.script = new Script(ai.fsm); // as you can see here the fsm is used twice in component

 // AIComponent has StateMachine
 // ScriptComponent need StatMachine
 // do you in the above code is a good idea?

MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                scriptSendeer, scriptReceiver,
                MessageType.SAYHELLO, null);

sentences:
Camera movement constrained to pixel boundaries So a friend and me, we are currently making a game in C# using XNA. We are trying to get the camera to move in full pixel motion, but we just don't get it right. This concept is hard to explain, but i'll try to make it as clear as possible with this gif.

As you can see, on the left hand side the black pixel moving in full pixel motion, while the right pixel is moving in free motion. Full pixel motion is basic motion in native resolution, but when we scale things up, the second case occurs. We are trying to avoid this, while making the camera as smooth as possible, with acceleration, deceleration, etc. The Cave Story cameras is the perfect example for this. Any ideas? Thanks for the help in advance.

P.D: please forgive any spelling or gramatical errors, English is not my native language.

sentences: How to create a over world map with multiple sub maps my game's idea is to use a open world map consisting of say 4096x4096 size, and multiple grids of 64x64 size. When I click on any grid, the map zooms in to show that grid(either creating in from scratch or loading off a JSON) because saving all the grids could not be memory efficient. Is there any algorithm to do like this?

sentences:
XNA matrix order problem I want a matrix that scales first and then rotates. I tried the code below, but it didn't work. zRotation, yRotation and xRotation are rotations that shouldn't be affected by the origin. allrot should be affected.  xScale, yScale and zScale are the scaling variables. The code below works except that it rotates and then scales.

Matrix worldMatrix = (
    Matrix.CreateRotationZ(MathHelper.ToRadians(zRotation)) *
    Matrix.CreateRotationX(MathHelper.ToRadians(xRotation)) *
    Matrix.CreateRotationY(MathHelper.ToRadians(yRotation))
) * (
    Matrix.CreateTranslation(origin) *
    Matrix.CreateRotationY(MathHelper.ToRadians(allrot)) *
    Matrix.CreateScale(xScale, yScale, zScale)
);

sentences:
Strings and Variables Inheritance From Another Class in Java I am working on a program and I want these variables and strings, to be called on another class. So I have these:

    public static boolean newgame = false;
/*
 * Declares Character Status
 */
public boolean male = false;
public boolean female = false;
public static String charactername;
public static String characterclass;
public static int hp = 100;
public static int mp = 100;
public static int charstr = 5;
public static int chardef = 5;
public static int charagi = 5;
public static int chararank;
public static int charaprofile;
public static double criticalhit = 0.0;
public static double luck = 0.0;

/*
 * Determines how each classes time fighting.
 */
public static int timeFightSlow[] = {4000, 4500, 4800, 5000};
public static int timeFightMedium[] = {2000, 2500, 2700, 2860,3000};
public static int timeFightQuick[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};

/*
 * Declares Items:
 */
public static String gender;
/*
 * Declares Classes
 */

public static String sf = "Swordsman";
public static String sm = "Sword Mystic";
public static String warrior = "Warrior";
public static String duelist = "Duelist";
public static String lancer = "Lancer";

/*
 *
 */
public static int experience = 0;
public static int iniexp = 100;
public static double totalexp = iniexp*2.5;
public static int initialhp = 100;
public static int hptotal = initialhp+10;
public static int initialmp = 50;
public static int mptotal = initialmp*2;

The problem I get is how can I call them up on a new class? Can I call them again or I should make another integer for those?

sentences:
How to use depth buffer for z-level rendering in roguelikes? Developer of the game explains how z-buffer works in Dwarf Fortress (loosely quoted):

"If you clear the buffer every single frame, it kills the game. You have sort of a depth of field. You say I need about 20000 integers worth of depth. So your first frame is 0 to 20000. And the next frame is 20000 to 40000, you treat everything lower as garbage. So you go 20 to 40, 40 to 60, 60 to 80. You have to clean it if you dealing with 4 byte integer something like every 100000 times. So the problem goes away."

Source: https://youtu.be/A9g1XMr2TTA?t=1628

His description is not completely clear for me. It seems he is using depth range from lowest z-level to highest and updating only one layer per frame?

sentences:
How do I efficiently implement Fog of War in a Real-time Strategy game? How is fog of war implemented in RTS games such as StarCraft II or Age of Empires? I'm making an RTS, and plan for every unit on the field to have circular vision up to a certain radius.

My first thought was having a mask that is black for every point except for points close to units, where it is transparent. The masking operation itself is fast in most graphics APIs (e.g. just call mix in a shader). The hard part is figuring out what mask to use and how to update it: updating it when any unit moves is very processor-heavy.

Is there any simpler way to manage this type of fog of war?

sentences:
ScreenToWorldPoint and ViewportToWorldPoint I'm currently following tutorials on Youtube to learn howto use Unity. My code runs perfectly as per the tutorial, but i just have some questions regarding the code, with regards to screenToWorldPoint & viewportToWorldPoint.

The purpose of the code is for a 2D platformer, where the character's arms will rotate and face where the mouse cursor is.

Code:

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

public class ArmRotation : MonoBehaviour {

    public int rotationOffset = 0;

    // Update is called once per frame
    void Update () {
        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; //Gets the difference between
        difference.Normalize(); //Normalizing the vector

        float rotateZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(0f, 0f, rotateZ + rotationOffset);
    }
}

I've done some googling and am aware of the difference between screenToWorldPoint and viewportToWorldPoint as per the answer here  https://answers.unity.com/questions/168156/screen-vs-viewport-what-is-the-difference.html

Where

Screen: from [0,0] to [Screen.width, Screen.height]
Viewport: from [0,0] to [1,1]

Questions:

Why do we have to calculate the difference between the position of the mouse cursor and the position of the character's arm instead of just setting the following:
. Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition);

I've tried setting it to the position of the mouse cursor instead of using the difference between the arm & the cursor and while the code still works and the arm is still able to rotate, it is a little "off" from the direction of the cursor. E.g A little higher than where the cursor is. Why does using the difference solve this issue?

Why do we call difference.Normalize() ? To my understanding, Normalize returns a vector between 0 & 1.However, Mathf.Atan2 returns the angle in radians whose Tan is calculated by y/x. As such, calling Normalize and returning a vector to a value between 0 & 1 makes no difference because the value calculated will be the same between a un-normalised and normalised vector since the proportions are the same?

When i use ViewportToWorldPoint instead of ScreenToWorldPoint, i do not use Normalize because to my understanding, the Vector returned by ViewportToWorldPoint should already be within 0 & 1, hance we do not have to normalise it. However, when i test the code out in play mode,the arm barely rotates. Why is this so?

I would appreciate any help or pointers in the right directions.

Thanks!

EDIT: I had a look at the manual and realise that Normalize() returns a vector with the same direction, but magnitude 1, but i'm still just as confused

sentences:
Corona SDK, do I need to pay for it? I'm a single dev making simple mobile games.  I was looking at corona sdk for my next project.  I don't understand what the difference between the paid version and the free version is. It seems that the whole SDK is free, so what does the paid version give you that the free version doesnt?  I've been reading through the site, but I'm not quite getting it.

I will need to interface with apple's game center etc.. is that not accessible to me without paying?

sentences:
Libgdx animation for HTML5 I'm working on my first html5 game with libgdx, it's a platform android game that I made a while back that I now want to host on my website. Everything has been going okay till I got to animating the character. The desktop and android versions of the game run just fine but with the html version the game doesn't run and I get the following error:

  GwtApplication: exception: Couldn't find type for class 'com.badlogic.gdx.graphics.g2d.TextureAtlas$AtlasRegion'

When I comment out the code sections for the animation the game runs fine (with the character not animated). What's causing the error and how can I fix it?

sentences:
How to get the tangent and normal of a collision? In my game, one of my objects casts a ray into a 2d space. If that ray were to hit another object, I'd like to draw a line that is perpendicular to the tangent of the ray's hit point. So when the ray hits the other object, a tangent is formed at the point of contact, and then I'd like to use the linerenderer component to draw a line that is perpendicular to that tangent. I already know how to use the linerenderer to draw lines, but I don't know how to get the tangent and normal from a collision.

  if (Input.GetMouseButton(0))
    {
        Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        var direction = (mousePos - (Vector2)cueBall.position).normalized;

        var hit = Physics2D.Raycast(cueBall.position, direction, Mathf.Infinity, 1 << LayerMask.NameToLayer("Ball"));

        if (hit)
        {
            _line1.SetPositions(cueBall.position, hit.point); //This is the line from the cueball to the red ball.
            _line2.SetPositions(hit.point, hit.normal); //This is supposed to be the predicted trajectory of the red ball.
        }
    }

sentences:
Hide part of the GUITexture in Unity I have a Health Bar in my Unity game and it's implemented as a GUITexture with gradient image from red to green.

Now I can reduce it's width from max width to 0, but is still scaled gradient.

public void UpdateHealthBar(int hitPoints) {
    healthBar.pixelInset = new Rect(
        healthBar.pixelInset.x, healthBar.pixelInset.y,
        3* hitPoints, healthBar.pixelInset.height);
}

But I want to hide (make transparent) the right part of this health bar in game progress.

How can I do this?
Thanks!

sentences:
Elastically Object movement in unity3d I want to move an object towards the destination elastically. Currently I am using Vector3.Lerp it working to move the object, start with high speed and reached at destination with low speed but missing elastic effects.

float i = 50, t = 0;
        while (t < 1)
        {
            t += Time.deltaTime / i;
            transform.position = Vector3.Lerp(transform.position, newPostionAtDistance, t);
            transform.LookAt(targetFollow.transform);
            if (transform.position.ToString() == newPostionAtDistance.ToString())
            {
                //StartCoroutine(CamElasticMoveBackEffetcts());
                Debug.LogWarning("Object reached to the point.");
                yield break;
            }

            smoothTime += Time.deltaTime;
            yield return 0;
            i++;
        }

sentences:
cannot implement GLSurfaceView.RENDERMODE_WHEN_DIRTY I'm trying simply to display an openGL surface when I click the screen using GLSurfaceView.RENDERMODE_WHEN_DIRTY mode

but the surface does not display when I click it , why ?

my Activity :

public class ViewManager extends Activity {
    private GLSurfaceView surfaceView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        surfaceView = new GLSurfaceView(this);
        surfaceView.setEGLContextClientVersion(2);
        surfaceView.setRenderer(new MyRenderer());
        surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

        surfaceView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if(event!=null){
                    if (event.getAction()==MotionEvent.ACTION_DOWN)
                        surfaceView.requestRender();
                    return true;
                }else{
                    return false;
                }
            }
        });

    }

    @Override
    protected void onResume() {
        super.onResume();
        surfaceView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        surfaceView.onPause();
    }
}

sentences:
How to create normal map from bump map in runtime? I am using this port of libnoise to generate noise. There are several methods (Noise2D.cs, 462 and 494 line) to output images. Second one, that should give me normal map does not work completely, it outputs this with low intensity (1.0f)

And this with high intensity (>100);

So i decided to use grayscale and default Bumped Diffuse shader works good, but only in Editor.

How should i modify grayscale image for correct normal map? How should i use library in proper way?

sentences:
Which are the most complete DirectX game or technical demo with source available I have found plenty of games with source for OpenGl, but so far I haven't found anything like that for DirectX. There are plenty of examples in the SDK, but they are very basic and usually they just expose one very specific aspect of the API at a time.
So I am wondering which are the best or most complete DirectX games with source available these days.

EDIT

I am making a small study about the differences in the final output across different GPUs. I want to have games in DirectX and OpenGL. To remove any differences caused by non-determinism, like thread scheduling and timing information. I already have done it for Doom 3 which is a great example for OpenGL. I would like to have something in DirectX to perform similar tests with, and I was hoping I could find something better than the simple demos included in the SDK.

sentences:
How can I detect the screen resolution of a Windows Phone device? I want to detect if a device uses WVGA, WXGA, 720p or 1080p resolution. In addition, I want to store the resolution of the device in a variable. For example, if the resolution is 800x480 pixel, then the variable has the value: string CurrentResolution = "720p".

How can I do that? How can I detect the screen resolution of a Windows Phone device?

sentences:
Rotation of Rectangle along Y-axis transformed to parallelogram After the rotation of a rectangular view along the Y-axis, about its center, transformed into parallelogram, how do I get the rotated parallelogram coordinates?

By Y-axis, I mean perpendicular to the device screen.

Rotated rectangle:

Original rectangle:

Not using the openGl, ViewProperty animator is used!

sentences:
What is inertia in a physics engine? Inertia seems to be useful in a physics engine, so useful that even in Box2DLite, a demo of Box2D it hasn't been omitted.

See this Body class from Box2DLite:

struct Body
{
    Body();
    void Set(const Vec2& w, float m);

    void AddForce(const Vec2& f)
    {
        force += f;
    }

    Vec2 position;
    float rotation;

    Vec2 velocity;
    float angularVelocity;

    Vec2 force;
    float torque;

    Vec2 width;

    float friction;
    float mass, invMass;
    float I, invI; //inertia and reverse inertia
};

In the implementation of the class, inertia is set as the mass multipled by something:

I = mass * (width.x * width.x + width.y * width.y) / 12.0f;
invI = 1.0f / I;

What does this formula means ? I understood from wikipedia that Inertia is how much something doesn't want to move but there's not much formulas in this article. Why is it useful in a physics engine ? How is it used in the context of a collision ? Is it compared to other bodies ?

sentences:
How to build an AIManager class I'm trying to figure out how to write a good AIManager class in Java in order to manage the AI of all the objects in my game.

From another post of mine, an user has suggested to do the following:

Your calculations should go into the update method. it's fine to have an AIManager class, that has an update() method itself which gets called in the main update loop.
this AIManager could hold a list of all the Objects that need to be updated. Since you're using java, you could use an interface to declare something to have an AI, and use this interface to iterate over your objects (which could then be completely different Classes) and have interactions managed by this AI manager.

It is not so clear to me.

If my Player class implements SeekArriveMovement (for instance), then it should implement the methods of this interface. And AIManager have to implement an update method. But... i don't know. I mean.. how the AIManager should be built and how it should interact with the objects?

Something like this.. ?

public class AIManager {

private List<Object> objects;

public AIManager() {
    objects = new ArrayList<Object>();
}

public void addObject(Object o) {
    objects.add(o);
}

public void removeObject(Object o) {
    objects.remove(o);
}

public void update() {
    for(Object o : objects) {
        if(objects instanceof SeekArriveMovement) { // ?
            RedEnemy re = (RedEnemy)o;
            move(re);
        }
    }
}

private void move(RedEnemy re) {
    // ?
}

sentences:
CCParticleSystemQuad works as intended every second time I'm using CCParticleSystemQuad for particles, loading it from plist:

flourEmitter = [CCParticleSystemQuad particleWithFile:@"FlourParticles.plist"];

But it works not every time. Every second or third time I start a game, particles look different from what I've set them up and there are errors saying it couldn't load image.

cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
cocos2d: Couldn't create texture for file: in CCTextureCache

Of course the image is there and the next time i launch game it works as intended.

I cannot think of any ways how to debug this error.

sentences:
OpenGLES GLSL Shader attributes always bound to 0 So I have a very simple vertex shader as follows
#version 120
attribute vec3 position;
attribute vec3 inColor;
uniform mat4 mvp;
varying vec3 fragColor;

void main(void){
    fragColor = inColor;
    gl_Position = mvp * vec4(position, 1.0);
}

Which I load, as well as the fragment shader:
#version 120
varying vec3 fragColor;

void main(void) {
    gl_FragColor = vec4(fragColor,1.0);
}

Which I then load, compile, and link to my shader program. I check for link status using
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &shaderSuccess);

which returns GL_TRUE so I think its ok. However, when I query the active attributes and uniforms using
#ifdef DEBUG
        int totalAttributes = -1;
        glGetProgramiv(shaderProgram, GL_ACTIVE_ATTRIBUTES, &totalAttributes);
        for(int i=0; i<totalAttributes; ++i)  {
            int name_len=-1, num=-1;
            GLenum type = GL_ZERO;
            char name[100];
            glGetActiveAttrib(shaderProgram, GLuint(i), sizeof(name)-1,
                               &name_len, &num, &type, name );
            name[name_len] = 0;
            GLuint location = glGetAttribLocation(shaderProgram, name);
            fprintf(stderr, "Attribute %s is bound at %d\n", name, location);
        }
        int totalUniforms = -1;
        glGetProgramiv(shaderProgram, GL_ACTIVE_UNIFORMS, &totalUniforms);
        for(int i=0; i<totalUniforms; ++i)  {
            int name_len=-1, num=-1;
            GLenum type = GL_ZERO;
            char name[100];
            glGetActiveUniform(shaderProgram, GLuint(i), sizeof(name)-1,
                              &name_len, &num, &type, name );
            name[name_len] = 0;
            GLuint location = glGetUniformLocation(shaderProgram, name);
            fprintf(stderr, "Uniform %s is bound at %d\n", name, location);
        }
#endif

I get:

Attribute inColor is bound at 0
Attribute position is bound at 1
Uniform mvp is bound at 0

Which leads to failure when trying to use the shader to render the objects. I have tried switching the order of declaration of position & inColor, but still, only position is bound with the other two giving 0
Can someone please explain why this is happening? Thanks

sentences:
Some GAME MAKER function for windows close button? In my game there are variables that go through all rooms, so if the player leaves the "variable x" worth 10, and goes to another room, when he returns there is the "variable x" worth 10, same thing when he close the game by the button (exit) that I created in the main menu.

It turns out that if for some reason he closes the game by the "close button of windows", this variable is not saved.

This is clear because there is no command for it to happen, it happens that I did not find anything related to the "physical button close windows window" in the game maker.

Detail that my game is not full screen, but if there is no way to create an event in the game maker so that the "variable x" is saved before closing, tell me how do I delete the "physical buttons of the windows window ".

I'm sorry for the awful translation, I'm not an English speaker.

sentences:
How much assembly is really used in modern game code? On average, how often is assembly used in modern game code?

Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make extensive use of assembly.

sentences:
generating animations in runtime i am creating my 3d game engine using Opengl.

this question might sound stupid to you but i am still in the process of learning, i have a 3d animated girl that slaps guys of different talls on the face.

however the animation is specified for a tall say 1.85CM.
when i want her to slap a guy that is 1.60CM tall then she slaps the space over his head.

do i have to create animations for the girl slapping different talls of guys?!

this would be a lot of work, i hope you give me some insight about how such thing are handled.

also could you please give me some resource on generating animations in runtime?

to get my idea for example take a game like fight night, a head punch would be directed to the head no mater how the tall of the other guy is.

sentences:
Unity - SerializedObject.ApplyModifiedProperties() using relavant property setting method The problem I have is this.
I have an editor script, at the end of OnInspectorGUI() I want to apply all the changes with the serialized object.
The simplest way to show my problem is thus:

[SerializeField]
private bool _property;
public bool property
{
    get { return _property; }
    set
    {
        _property = value;
        //do some amazing stuff
    }
}

public override void OnInspectorGUI()
{
    serializedObject.Update();
    prop = serializedObject.FindProperty("_property");
    //blah blah blah
    serializedObject.ApplyModifiedProperties();
}

But in order to do my special amazing code represented by the comment 'do some amazing stuff', I have to copy and paste the code or do away with the gets & sets entirely, opting instead for some kind of post-update, all-in-one refresh function.
Ideally, I want to tell SerializedObject, 'Hey, don't do _property = value, do property = value instead!'
Pretty sure that's not possible though, so what should I do instead?

sentences:
How do I properly change the value of a prefab'd instance variable? I am currently following a tutorial on how to make a 2D platformer in Unity.

The tutorial explains how to make an enemy wave spawner, but it doesn't explain how to make enemies stronger after I have completed a certain amount of waves.

So, to explain: I have an Enemy class, which has an EnemyStats class in it:

public class Enemy : MonoBehaviour
{
    [System.Serializable]
    public class EnemyStats
    {
        public int damage = 20;
        public int maxHealth = 100;

        public int CurrentHealth
        {
            get { return _currentHealth; }
            set { _currentHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        private int _currentHealth;

        public void Init()
        {
            CurrentHealth = maxHealth;
        }
    }

    public EnemyStats stats = new EnemyStats();

    private StatusIndicator statusIndicator;

    void Awake()
    {
        stats.Init();
        statusIndicator = transform.Find("StatusIndicator").GetComponent<StatusIndicator>();

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.CurrentHealth, stats.maxHealth);
        }
    }
}

And in the WaveSpawner class I have the method to spawn the enemy:

private void SpawnEnemy(Enemy enemy)
{
    Transform sp = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];

    if (CurrentWave % 5 == 0)
    {
        enemy.stats.maxHealth += 20;
    }

    Instantiate(enemy.transform, sp.position, sp.rotation);
}

In the WaveSpawner you can set a certain number of waves (let's say 5), and after you complete all of the waves I've set them to repeat.
So after I beat the 5 waves, I want the 5 waves to repeat and the enemies to be stronger (for example to have their max hp increased by 20).

I do that with the line: enemy.stats.maxHealth += 20;

But the problem here is that after this line is executed and I Instantiate the enemy prefab, the prefab changes its value in the inspector. So let's say that the initial value of the prefab was 120, after I beat the 5 enemy waves, the value of the prefab is set to 140. Then, after I reset the game, the initial value of the prefab is 140 and the max health of the first enemies is 140 and not 120.

I have tried to not change the maxHealth variable of the EnemyStats class, but instead to have another variable tempMaxHealth and do the changes on it. This doesn't resolve my problem, as other problems arise and I don't know what to do anymore.

I hope that you have an answer for me, I would be grateful if that's the case.

sentences:
Edit spawn location according to vector direction I'm trying to make a turret in Bukkit (Java). This will shoot an arrow to the players that are in the shooting radius. But now I've a little problem, the arrow gets stuck inside the block where its spawned. Now I'm trying to spawn the arrow at the side of that block so it wont get stuck anymore, but I don't know how to calculate the best side of the block to set the new spawn location. Like North, East, South or West of the block.

So is there someone who can help me with this? Thnx!

Code that I use for now:

Vector v = pl.getLocation().add(0, 2, 0).toVector().subtract(loc.toVector());
Arrow arrow = (Arrow) Bukkit.getWorld(loc.getWorld().getName()).spawnArrow(loc, v, (float) 4, t.getAccuracy());

So the variable loc needs to be recalculated so it will be outside the block to the right direction from the vector 'v'.

sentences:
Drawing a textured 3D object breaks SFML text render I writing a OpenGL game using SFML.

I'm using the push/pop function to combine OpenGL with SFML like the tutorial SFML+OpenGL but, when I added textures to my model, the SFML text rendering appears broken and wrong rendered.

The simplified loop I used is:

while( true ){
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glUseProgram( programID );

    // Draw the 3d textured object
    glActiveTexture( GL_TEXTURE0 );
    glBindTexture( GL_TEXTURE_2D, tex_2d0 );

    object.draw();

    window->pushGLStates();

    window->setView( view );
    window->draw( text );
    window->setView( window->getDefaultView() );

    window->popGLStates();

    window->display();
}

My 3d model is draw right but something in the glActiveTexture/glBindTexture mess up the text in the SFML part.

If I add:

glActiveTexture( 0 );
glBindTexture( GL_TEXTURE_2D, 0 );

And the end of my OpenGL rendering code, nothing is fixed anyway.

sentences:
How to get the position of individual characters in TextMeshPro (Unity)? I am making a typing game.
There are words falling down what the user have to type, before they can call the OnBecameInvisible() event.

When the user types a character I want to apply a force and a torque to it and make it fall down. But to do this I have to instantiate a TextMeshPro GameObject at the position where that letter was located inside that word.
But how can I get that position?

  Just to make things clear:

sentences:
GLSL, all in one or many shader programs? I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, some materials have ambient occlusion map, some have specular map and bump map etc.

Is it better to support everything in one vertex/fragment shader pair or is it better to create many vertex/fragment shaders and select them based on currently selected material? What is the usual shader strategy in OpenGL or D3D?

sentences: Unity Default Shader Greyed Out I created a pland in Unity 3D and then tried to alter the material.  I looked at it's material component, but all the options are greyed out!  how do I fix this problem?

sentences:
How tightly should I stick to entities in a component based game? I apologize if the question is a little vague, It was hard to explain it in a short sentence.

I'm currently writing a component based game, it's getting along great but I'm starting to wonder how tightly I should stick to "the rules". Actually, I'm not even sure what the rules are!

It's clear that every interactive gameobject should be an entity. But what about the level elements? I'm using a tile based system, should every tile be an entity? I do have a GraphicsComponent ready with all it's displaying goodness that I need to display them. But coming from inherritance, it just feels strange threating a "gameobject" the same as a level element.

It also feels like I'm dumping everything in a big empty space right now, there is no dedicated environment for different game elements. Where a tile normally is part of a map, and an object normally is part of a world. The tiles and objects are now thrown in the same place.

Same goes for interface components, I was in need of animated button, and that GraphicsComponent looked very tempting again.

How is this usually handled in component based games?
Most articles online only mention the use of components for gameobjects, and looking into other component engine source code gives me a headache.

sentences:
"ArgumentNullException: Value cannot be null" for AudioSource.PlayOneShot I am working on a game and I am trying to add a sound effect.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody playerbody;
    private Animator playerAnim;
    private bool grounded;
    public bool gameover;
    public float jumpforce;
    public float gravmod;
    public ParticleSystem explosion;
    public ParticleSystem dirt;
    public AudioClip jumpSound;
    public AudioClip crashSound;
    private AudioSource playerAudio;

    // Start is called before the first frame update
    void Start()
    {
        playerbody = GetComponent<Rigidbody>();
        playerAnim = GetComponent<Animator>();
        playerAudio = GetComponent<AudioSource>();
        Physics.gravity *= gravmod;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) && grounded && gameover == false)
        {
            playerAudio.PlayOneShot(jumpSound, 1.0f);
            playerbody.AddForce(Vector3.up * jumpforce, ForceMode.Impulse);
            playerAnim.SetTrigger("Jump_trig");
            grounded = false;
            dirt.Stop();
        }
    }
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            grounded = true;
            dirt.Play();
        }
        if (collision.gameObject.CompareTag("Obstacle"))
        {
            playerAudio.PlayOneShot(crashSound, 1.0f);
            gameover = true;
            playerAnim.SetBool("Death_b", true);
            playerAnim.SetInteger("DeathType_int", 1);
            explosion.Play();
            dirt.Stop();
        }
    }
}

At playerAudio.PlayOneShot, it just won't play and the rest of that part of the code stops working. It returns ArgumentNullException: Value cannot be null even though jumpSound and crashSound are both clearly defined. What is wrong?

sentences:
Why aren't more games 64-bit executables? Until now I've seen that many games are still compiled in 32-bit architecture although nearly 50% of current Windows users are on 64-bit OS? Why is this?

If the reason is for getting larger audience (since 32-bit app could run on 64) why don't they make two versions of it, since it is more or less about recompilation and running 64 bit apps could give performance benefit due to more available CPU registers and other features.

sentences:
How do you disable frame skips in a game, in SFML preferably by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it:
static class Globals
{
    static public Time dt = new Time();
    static public Vector2f Friction
    {
        get
        {
            return new Vector2f(2 * dt.AsSeconds(), 0);
        }
    }
}

class Player
{
        private void StartMoving(int _direction)
    {
        moving = true;
        direction = _direction;
        heldfor =  1;
        Move(direction);
    }
    public void Move(int _direction)
    {
        if(!moving)
        {
            StartMoving(_direction);
            return;
        }
        if(direction == _direction)
        {
            if(heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }
        else
        {

            direction = _direction;
            heldfor /= 2;
            Velocity = new Vector2f(Velocity.X / 1.5f, Velocity.Y);
            if (heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }

    }
    public void StopMoving()
    {
        moving = false;
        heldfor = 1;
    }

    public void Update(Time dt)
    {
        if(!moving)
        {
            if(Math.Abs(Velocity.X) - Globals.Friction.X < 0)
            {
                Velocity.X = 0;
            }
            else
            {   // i really should make this direction independent and apply direction at end of the update
                Velocity.X = Velocity.X > 0 ? Velocity.X - Globals.Friction.X : Velocity.X + Globals.Friction.X;
            }
            if (Math.Abs(Velocity.X) <= velocitySnapX) Velocity.X = 0;
            if (Math.Abs(Velocity.Y) <= velocitySnapY) Velocity.Y = 0;
        }
        if (Math.Abs(Velocity.X) > XMaxvel) Velocity.X = XMaxvel * direction;
        if (Math.Abs(Velocity.Y) > YMaxvel) Velocity.Y = YMaxvel * direction;
        Position += Velocity;
    }
}

class Program
{
    Player player = new Player();
    while(game.isrunning) // this is made up as the genuine code is too messy
    {
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Right))
            {
                player.Move(1);
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.Left))
            {
                player.Move(-1);
            }
            window.Clear(Color.White);
            window.Draw(player);
            player.Update(Globals.dt);
            window.DispatchEvents();
            window.Display();
            window.SetView(mainview);
            Globals.dt = deltaclock.Restart();
    }
}

sentences:
Why don't game developers change game stories after launch? Game developers have shown willing to remove and add game features, change art assets and remake parts of their games in following updates, but why don't they ever change the plot? Some times parts are added to the story, but only as attachments, never revisions.

Why is plot thought as a feature beyond editing, even if it would enhance player experience just as much as any graphical update or gameplay tweak?

P.S.: I would like to ask for a game-narrative/writing/story tag, and they are just as important part of game development as game mechanics.

P.S.²: This is as broad a question as why not to release source code. Therefore I think it is not too broad for answering.

sentences:
android game performance regarding timers Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory.

Im using a custom TimerTask that looks like this:

    public class Task extends TimerTask {

    private MainGamePanel panel;
    public Task(MainGamePanel panel) {
    this.panel=panel;
    }

    /**
    * When the timer executes, this code is run.
    */
    public void run() {
    panel.createEnemies();
    }
    }

this task calls this method from my view:

    public void createEnemies() {
    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.female);
    if(enemyCounter < 24){
        enemies.add(new Enemy(bmp, this));
    }
    enemyCounter++;
      }

Since I call this in the onCreate-method instead of in my views contructor (because My enemies need to get width and height of view). Im wondering if this will work when I have multiple levels in game (start a new intent). And if this kind of timer really is the best way to add a delay between the spawning-time of my enemies performance-wise.

adding code for my timer if any1 came here cus they dont understand timers:

    private Timer timer1 = new Timer();
    private long delay1 = 5*1000; // 5 sec delay

    public void surfaceCreated(SurfaceHolder holder) {
    timer1.schedule(new Task(this), 0, delay1); //I call my timer and add the delay
    thread.setRunning(true);
    thread.start();
}

sentences:
Is there a way to display navmesh agent path in Unity? I'm currently making a prototype for a game I plan to develop. As far as I did, I managed to set up the navigation mesh and my navmeshagents.

I would like to display the path they are following when setDestination() is fired.

I did some researches but didn't find anything about it.

EDIT 1 : So I instantiate an empty object with a LineRenderer and I have a line bewteen my agent and the destination. Still I've not all the points when the path has to avoid an obstacle. Furthermore, I wonder if the agent.path does reflect the real path that the agent take as I noticed that it actually follow a "smoothier" path.

Here is the code so far :

GameObject container = new GameObject();
container.transform.parent = agent.gameObject.transform;
LineRenderer ligne = container.AddComponent<LineRenderer>();
ligne.SetColors(Color.white,Color.white);
ligne.SetWidth(0.1f,0.1f);
//Get def material

ligne.gameObject.renderer.material.color = Color.white;
ligne.gameObject.renderer.material.shader = Shader.Find("Sprites/Default");
ligne.gameObject.AddComponent<LineScript>();
ligne.SetVertexCount(agent.path.corners.Length+1);
int i = 0;
foreach(Vector3 v in p.corners)
{
    ligne.SetPosition(i,v);
    //Debug.Log("position agent"+g.transform.position);
    //Debug.Log("position corner = "+v);
    i++;
}
ligne.SetPosition(p.corners.Length,agent.destination);
ligne.gameObject.tag = "ligne";

So How can I get the real coordinates my agent is going to walk throught ?

sentences:
Creating refraction map problem I'm reading riemers tutorial on how to make a water effect and trying to translate it from xna 3 to xna 4. So far I figured out I have to create a shader in order to clip the planes for my refraction map. I'm new to hlsl and how to implement custom shaders into my program, so I am wondering what I am doing wrong here.

  float4x4 World;
  float4x4 View;
  float4x4 Projection;

  float4 ClipPlane0;

  void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0)
  {

clipDistances.y = 0;
clipDistances.z = 0;
clipDistances.w = 0;

position = mul(mul(mul(position, World), View), Projection);

    clipDistances.x = dot(position, ClipPlane0);
  }

  float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0
  {
clip(clipDistances);

return float4(0, 0, 0, 0); // TODO: whatever other shading logic you want
  }

  technique
 {
pass
{
    VertexShader = compile vs_2_0 vs();
    PixelShader = compile ps_2_0 ps();
}
  }

This is the fx file that I found on an xna forum just for reference.

Major edit:

I was able to get the program running successfully but when I viewed the saved screenshot of the refraction map, nothing was clipped.

    public void DrawRefractionMap(Effect clipEffect, Camera camera, GraphicsDevice device)
    {
        Plane refractionPlane = CreatePlane(waterHeight + 1.5f, new Vector3(0, -1, 0), camera, false);
        clipEffect.Parameters["ClipPlane0"].SetValue(new Vector4(refractionPlane.Normal, refractionPlane.D));

        device.SetRenderTarget(refractionRenderTarget);

        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

        foreach (EffectPass pass in clipEffect.CurrentTechnique.Passes)
        {
            pass.Apply();

            DrawTerrain(clipEffect, camera, device);
        }

        device.SetRenderTarget(null);
        refractionTexture = (Texture2D)refractionRenderTarget;

        FileStream stream = File.OpenWrite("Screenshot33.png");

        refractionTexture.SaveAsJpeg(stream, refractionTexture.Width, refractionTexture.Height);
    }

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

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

public class DrawMap : MonoBehaviour {

    // Use this for initialization
    void Start () {

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

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

                        }
                }
    }

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

    }
}

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

Any help would be greatly appreciated

sentences: How do I get the DirectX project templates to appear in Visual Studio? I have DirectX11 on Windows 7, and I also have VS13 Express for Desktop. In some tutorials I have seen that there's an option on VS13 for new project on DirectX, but doesn't appear in my VS13. Is it because I have the for Desktop version instead of the for Windows one? Or do I need to install some DirectX developmentkit first? Thanks.

sentences: where can I download unity assets without opening it in in unity. I'm browsing through my mobile phone and I need to download unity assets but unity asset store demands that I open the assets in unity directly. How or which site can I download it on my mobile and send it to my PC.

sentences:
Is it possible to work out rotate in degrees per second based on this rotate logic? I have this code to rotate an object towards another at a given speed.

    /// <summary>
    /// Rotate towards the target.
    /// </summary>
    /// <param name="lookPosition"></param>
    private void RotateTowardsTarget(Vector3 lookPosition)
    {
        // Determine which direction to rotate towards
        Vector3 targetDirection = lookPosition - transform.position;

        // The step size is equal to speed times frame time.
        float singleStep = weaponRotationSpeed * Time.deltaTime;

        // Rotate the forward vector towards the target direction by one step
        Vector3 newDirection =
            Vector3.RotateTowards(turretYRotation.transform.forward, targetDirection, singleStep, 0.0f);

        // Draw a ray pointing at our target in
        //Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);

        newDirection.y = 0;
        // Calculate a rotation a step closer to the target and applies rotation to this object
        turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);
    }

And I'd like to convert this to a "Degrees per second" to give the user useful feedback on how quickly it rotates. Is there a formulae I can apply to work it out?

sentences:
How can i set OnClick equal to UnityEvent The Problem

I'm making a dialogue system for a small 2d rpg.
I Have a Dialogue class with two lists for pages and responses. The response class
has a UnityEvent so i can use the ui in the inspector to set methods like a button.
Then in a DialogueManager class i have a Show() method which makes a button for every response in the list from Dialogue. The problem is when i try to set the created button's OnClick() event to the UnityEvent in the response.

The Question

So the question is how can i set the button's OnClick() to the methods in the UnityEvent from the response?

sentences:
NDK opengl-es unknown error Projection matrix? Renderer? Where is the error?
I recently started studying NDK to create better performing android games ... but ... An error I didn't expect to deal with appeared a few weeks ago

The projection works perfectly on my device if I ignore some errors in the depth test
On my device:

On my device.gif because yes:

But...
You must ask yourself what is the impossible mistake of this noob, right?
Let's look at another device with similar specifications:

Only the cube has disappeared ... the text works and the only difference between them is the projection.

Is it possible for a matrix4 to work only on specific devices?

On some devices the cube appears after clicking on the screen even though it is not related to rendering "with many
depth glitch's"
Device 1

Device 2

My projection:
    auto fd =(float)( 1.0 / tan((fovy * (PI / 180.0))/2.0F));
    float a1 = (far+near)/(near-far);
    float a2 = (2* far * near)/(near-far);

    val[M00] = fd/aspectRatio;
    val[M01] = 0;
    val[M02] = 0;
    val[M03] = 0;

    val[M10] = 0;
    val[M11] = fd;
    val[M12] = 0;
    val[M13] = 0;

    val[M20] = 0;
    val[M21] = 0;
    val[M22] = a1;
    val[M23] = a2;

    val[M30] = 0;
    val[M31] = 0;
    val[M32] = -1;
    val[M33] = 0;

How I use it:
projection->setToProjection( 0.0f, 200.0f, 75.0f, 1.0f);

sentences:
Replacement memory allocators - pros and cons I am developing a hobby project to learn game engine development and to have a platform where I can test new ideas and have fun. Currently I have a quick-and-dirty multiplayer server and client using some third party libraries (enet for networking and Ogre3D for rendering). My "game" is mostly like a free-ride sandbox.

I have read some great articles about custom memory allocators and all the benefits - complete control, different strategies for different game objects, tracing and profiling. But also I have read that it is hard to develop an allocator which is better than the default one and that it might be hard to get it to play nicely with 3rd party libraries.

As it seems so hard to develop a custom allocator, I thought about using jemalloc but I'm not sure if it is a good choice for game server and/or client.
I tried to find some 3rd party free/open source memory allocators designed specifically for game engines but I could not find anything production-ready.

I really would like to track allocated objects by their type - to see how many network packets I have, how much memory is taken by meshes, static objects, NPCS etc. and also to see where exactly are some memory leaks coming from. Also I would like to avoid having to restart my game server regularly because of memory fragmentation issues.

What is your experience? Is it a good idea to use some general purpose memory allocator (like jemalloc or tcmalloc) for game servers and clients or should I develop my own custom allocator (which seems a daunting task considering that I don't have enough experience with advanced C++)?

How do I integrate my custom memory allocator with popular 3rd party libraries (enet, Ogre3D, some physics libraries) if I have no idea what allocation mechanisms are used inside of those libraries?

If I decide not to use a custom allocator and stay with the one provided by MSVC runtime, is there any simple way to track my memory usage and prevent memory fragmentation without sacrificing performance?

sentences:
Creating a black light (ultraviolet) shader? I am interested in the algorithm for color picking that would ideally allow to choose what color range will be highlighted and what color range will be faded.

I can sort-of understand how to make it look like black light effect, but I wonder if there is actual research out there on how to make it properly. What is the technique for rendering a black light effect?

Another question is highlights: How do you handle highlights? Do you ignore them completely or link their power to the luminess color of the surface?

sentences:
Procedural dungeon algorithms for a more open dungeon I'm working on a game that I want dungeon generating in, but I plan on having ranged weapons in it, so I want it a bit more open. I'd like to avoid corridors and I don't want to use a grid of custom rooms.

I don't want to use perlin noise and make it like random blotches, so that's not an option.

All I need is a summary of how the ideal algorithm for this works.

EDIT: Something that gives a result like this:

It doesn't need to be so rounded. The point is that there aren't really corridors.

I'm also fine with a modular approach where the areas are hand made as long as it's still not on a grid. The issue is that if it's not on a grid, the areas are normally connected by corridors.

EDIT2:
I made this a while ago, which works when it comes to shape, but it works with a modular system and it looks like this because I intentionally put rooms on top of other rooms. This causes problems if I start decorating the rooms and filling them with interesting stuff.

sentences:
Am I doing this node.js game loop wrong? I have 2 arrays of JSON objects, actions and game objects.

At any time a user can make a request from the client which can add an action to the actions array.

I have a setInterval(function(){ }, 1000); that runs every second and first loops through all of the actions, doing them in order then dumping emptying the array. Then it for loops (on the length of the array) through all the objects and does change processing such as healing, repairing, consuming resources, updating location of travelling objects, etc.

Each game object is tied to a user and when it is done being modified it will push out to them using socket.io all the data they need for their current view (assuming they are in an active session still).

Is this right? Am I not taking advantage of the node.js event loop as well as I could for this?

sentences:
How to model the double jump in Super Mario using projectile motion So the single jump in Super mario games follows a curved trajectory of the formula s = s0 + v0t + ½ at2. The double jump in mario consists of two different parabolas combined. I know that the max height of the first jump is the beginning of the second jump and the gravity doubles by the end of the second jump making a faster landing than the first. Would it be a piece-wise function or how would it work?
*Could anyone guide me through/ explain what equation would that result in? Any help would be very much appreciated!
If anyone needs me to explain more, please let me know.
Here is a link to explain my question https://www.youtube.com/watch?time_continue=1096&v=hG9SzQxaCm8&feature=emb_title
@ 17:58
I would be very grateful for any help :) Even if it is only ideas, thanks

sentences:
Making a ordered list iterator Noob here,

I am trying to display a list of a vector with ascending numbers. To display the list I iterate through the following code.

cout << "\nYour games list is: \n";
        for (iter = gameTitle.begin(); iter != gameTitle.end(); ++iter)
        {
            cout << listNum << ".- " << *iter << endl;
        }

So listNum is an integer that I initialized as "0" but this particular setup will give me a list with three elements as follows.
3.- userInput
3.- userInput
3.- userInput

"userInput" is a vector of string type that is declared yet not initialized.

¿How do I get a list like follows?
1.- userInput
2.- userInput
3.- userInput
etc.

Thanks

sentences:
Why is OpenGL provided with latest GeForce drivers so extremely slow? I'm writting a code in OpenGL and using two computers - an old and a new one.

On the old computer (which I use for debugging/creating implementation for the old GL) I have GeForce 5500 FX. Before windows reinstall on it, I had NVIDIA drivers with OpenGL 1.5. And everything worked perfectly. Games made quite good FPS, even with dozens or hundreds sprites.

However, after XP reinstall, I installed the drivers provided with my video card but it seems there's no OpenGL at all (mysterious 'GDI Generic' renderer). So I tried to download the newest NVidia drivers. After their installation I saw there's OpenGL 2.3 but when I runned my app it worked with extremely low FPS (about 0.25, I mean I had to wait four seconds for any app reaction) with only one sprite. And as I loaded smaller images, the FPS relatively increased, but on the new computer it's always (no matter how big and how many sprites) speed, so it must be the perfomance problem. Without any sprites, it seemed it worked normal, but game without graphics doesn't make any sense.

That's why I downloaded the oldest drivers for NVIDIA GeForce 5500 FX I found on the Nvidia site. But they're still providing OpenGL > 2.0 (2.1 exactly). The problem's the same.

I also tried to change all the properties of OpenGL to increase performance but it didn't help too.

So what can I do? I'd like to find drivers with OpenGL 1.5 but it seems they're not on the NVIDIA site and most people say it's the best to download they from there.

sentences:
CCSpriteFrameCache: Frame '%s' not found I have just started using the Cocos2D library for Android. I am trying to make a walking bear animation.

For that I am using a CCSpriteFrameCache, but I'm getting a "frame not found" error in the log.

I have added an AnimBear.plist file and an AnimBear.png file (combined image of the various movements of the bear) to the assets folder.

My Java code is as per below :

CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("AnimBear.plist");
CCSpriteSheet spriteSheet = CCSpriteSheet.spriteSheet("AnimBear.png");

scene.addChild(spriteSheet);

ArrayList<CCSpriteFrame> walkSprites = new ArrayList<CCSpriteFrame>();

for (int i = 1; i <= 8; ++i)
{
    walkSprites.add(CCSpriteFrameCache.sharedSpriteFrameCache().getSpriteFrame("bear" + i + ".png"));
    System.out.println("bear image is added");
}

CCAnimation walkAnimation = CCAnimation.animation("bear", 0.1f, walkSprites);

bear = CCSprite.sprite(walkSprites.get(0));

this.walkAction = CCRepeatForever.action(CCAnimate.action(walkAnimation, false));

bear.runAction(walkAction);

Now here are the errors I get:

  walkSprites.get(0) line throws a Null Pointer Exception.
  CCSpriteFrameCache.sharedSpriteFrameCache().getSpriteFrame("bear" + i + ".png") line prints "CCSpriteFrameCache: Frame '%s' not found" in the logcat

Can anybody help me please, what am I doing wrong?

Thanks in advance.

sentences: Rule of thumb for enemy art design in 2D platformer I'm at the early stages of developing a 2D side scrolling open ended platformer (think Metroidvania) and am having a bit of difficulty at enemy design inspiration for something of a scifi, nature, fantasy setting that isn't overly familar or obvious. I haven't seen too many articles, blogs or books that talk about the subject at great length. Is there a fair rule of thumb when coming up with enemy art with respect to keeping your player engaged?

sentences:
What is an efficient way to manage uniforms in a game? Most engines on the market have their drawbacks and it's difficult to find a simple/light-weight one that's open-source and doesn't have to put you through a rather complex learning process. Writing one is a difficult task on its own, but it might not be a bad idea if what you want that engine to do is to support a specific kind of games (e.g. 2.5 D games on mobile devices).

So, in search for a good game engine architecture, I've found a few logistical issues. Consider this scenario:

Objects:

Each object is comprised of two principle structures of render information:

a model (geometry mainly) and
a material (that tells the object what textures and what shaders to use).

Of course, it is natural to allow an object to switch its material definition on the fly. But a material encapsulates the shaders, so these drag along with them some slots for uniforms and vertex attributes.

Since an uniform, for example, can be:

object specific (color, specular exponent, etc.)
global/superglobal (lights, weather conditions/fog/wind,etc.) or
specific to a group of objects (they all have, let's say, a reflectivity factor)

then it means that it's wrong to put them in either the object's property region or in the material's property region. It's clear that both uniforms and attributes are always declared in the shader sections of a material, but where their values come from is an enigma in the frames of a pretty general rendering engine. You have to allow for the existence of numerous types (by semnatics!) of uniforms: position, colour, bone matrices, indices, lighting parameters, etc.

The big question now: how would you suggest to organize and manage uniforms? (especially the information flow - they're declared by shaders, but their values are supplied by apparently different type of entities - some renderable, some more abstract, being themselves controllers or managers).

sentences:
Stuck at enemy movement I am making a TD game in unity, Initially I made all of my enemy movements frame rate dependent say:

I had a grid point1 at -22.65 and other at -21.1, diagrammatically:

(-22.65) _________(-21.1)_______(-21.1+1.55) ......

so the distance on x axis between two points is 1.55, divided it by 25 jumps with each enemy jump of 0.062 of each frame. On reaching on next point of grid the enemy find again its path. All went fine until I have requirement of FastForward and Pause feature. I used timeScale property of unity but it wont work as they are frame dependent. I also tried double speed of enemy on clicking fast forward button at any time, it has some issues that enemy jumps are now less and it fails to reach on next grid point.

Could someone suggest me solution to my problem. Do I need to change the enemy movement code to make it frame independent ?? I need the enemy to reach on the grid specific point I also need later to slow down any one enemy's speed when tower fires on it. Thnx

sentences:
Calculate diameter of sphere large enough to encompasss a frustum 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?

sentences:
Map generation for a 2.5D RTS Game I've been looking on the net since some time for generating a map for my isometric RTS game. The map should have biomes, humidity, wind directions and etc. But I couldn't find a correct algorithm or enough keywords to search for.

The algorithm used by AmitP in his blog is using Voronoi graphs, but I want a isometric algo without any of that. It could help me if someone clarified what algorithms or what techniques I should be looking for(probably with an example).

EDIT

I have already made some classes for implementing the map's height and all the data. But what I need is an example of using something like say noise or Perlin noise that was told. Most of the data of each cell of a map is in Terrain class. Its a collection of assorted values for a cell of the map. In the Map class there is a MutableList which I sort over through one for loop.

Can anyone give me an example of using Perlin map to generate a heightmap for the Terrain class, i.e., how to use that approach?

class Terrain(posX:Int,posY:Int,elevation:Double):Point(posX,posY,elevation) {
var terrainType: TerrainType? = null
var biomeType: BiomeType? = null
var locationType: LocationType? = null
var location: Location? = null

var score: Double = 0.0
var territory: Int = -1
var temperature: Double = 0.0
var humidity: Double = 0.0
}

sentences:
Making a Point Light follow a cube (Unity) I'm trying to have a point light positioned directly above a cube follow wherever the cube goes. However, it doesn't move at all. This is my code for the light:

using UnityEngine;
using System.Collections;

public class SpotlightController : MonoBehaviour {

// Use this for initialization
void Start() {

}

void OnGUI(){
    GUI.Label(new Rect(20,50,500,20), "(" + transform.position.x.ToString() + ", " + transform.position.y.ToString() + ", " + transform.position.z + ")");
}

// Update is called once per frame
void Update() {
    GameObject cube = GameObject.Find("Cube");
    float xlocation = cube.transform.position.x;
    float zlocation = cube.transform.position.z;

    transform.TransformPoint(new Vector3(xlocation,transform.position.y, zlocation) * Time.smoothDeltaTime);
    //transform.Translate(new Vector3(xlocation, 0, zlocation));
}
}

sentences:
Why doesn't my SpriteRenderer's color change when setting .color = new Color(166, 33, 33)? I need to change the color of my SpriteRenderer, and so I looked up how to do it and come up with this code:

spaceOne.GetComponent<SpriteRenderer>().color = new Color(166, 33, 33);

(In case you are wondering, yes I checked that 'spaceOne' is correctly linked to a GameObject.)

This should change the color, but it doesn't. As I was writing this, I found that replacing new Color(166, 33, 33); with Color.red; actually does change it to red.

So now I am wondering, why does the new Color(166, 33, 33); code not work, and how can I fix it?

P.S. I made sure that it wasn't something simple, like it being RGBA rather than RGB, but no, it still doesn't work with new Color(166, 33, 33, 255);.

sentences:
LWJGL Eclipse Resource Deployment I'm still experimenting with some OpenGL in LWJGL, and as I get to know more and more about OpenGL, I start to do more complicated things like multi texturing, shadowmapping and more. Now, right now I'm using the src folder (src/res) for my resources, and use src/resourcename in my code. When I export it, this won't work on another location as the relative path is ofcourse incorrect. What would be the best way of deploying your game with all the resources in one file? Maybe put the files in the jar?

I would like to hear from a few people how they store and deploy their project with resources, thanks!

sentences:
Particle system appear inside UI? How to make the particle system appear inside the Canvas ? No need for unity store assets.
I'm using Unity 5.5.0

sentences:
How do I modify a Boids algorithm to be player controlled? Found source code on Boids in C#.

http://3carrotsonastick.wordpress.com/2012/11/01/boids-in-c-xna/

How do I go about making the raven class in the above player controlled?
If I could control it myself, it would be a great help, but I don't know how to go about it.

sentences:
How to use Actors/Groups with ShapeRenderer instead of Batch? I am intersted in using Actors and Groups on a Stage so that I can make components and subcomponents which draw relative to their parents, but I intend to do my drawing with a ShapeRenderer instead of a Batch.  From what I understand of an Actor, the batch which is passed in to the draw() method has all of its matrices set up properly so that I can just use a coordinate system WITHIN THE PARENT to lay out the subcomponents.  But it seems that this coordinate system is focused on Batches, and I want to draw using a ShapeRenderer.

What do I have to do to get the child Actors to draw themselves RELATIVE TO THEIR PARENT (rather than in global coordinates) when drawing them with ShapeRenderers?

Also, one other question:  How should I be managing begining/ending the ShapeRenderer?  I am currently passing in a reference to a global ShapeRenderer when I construct my parent object, and this parent object passes in references to each of its children.  Should I be calling begin() end() separately in the draw method of each parent/child actor?  Or should I call it in my main app's draw() method, so I'm only calling it once each frame?

sentences:
Difference between WM_KEYDOWN and GetAsyncKeyState() I am programming a simple Ping-Pong game in C++ but I don't know how to handle key presses. At first I intended to use WM_KEYDOWN, but I don't know how to track two pressed keys at once since the window processing function always gets only one wParam right? Basicaly I have two paddles on each side of the screen and when user presses W/S, left paddle moves, when Up/Down keys are pressed, right paddle moves. However when I press two keys at once only one paddle moves.

Another problem is that there is always a short pause after key is pressed - the paddle moves once in desired direction, then pauses and then continues to move. I have no idea why this happens. On the other hand when I use GetAsyncKeyState() like this:

if (GetAsyncKeyState('S') & 0x8000)
{
    PingPong.MoveLeftPaddleDown(hWnd);
}

everything works as intended - both paddles can move at the same time and there is no short pause on the beginning of movement. On the internet I read everywhere that I should use WM_KEYDOWN insead of GetAsyncKeyState() but how to configure it properly? Thank you

sentences:
Crafting recipes: storage and quering Consider the following situation. In a game you can perform crafting: i.e. create new items from existing ones (like in Minecraft). I have following game entities (simplified):

item: Atomic part.
recipe: A list of items resulting in other list of items.

What would be best structure to store all the recipes in the game? I consider using SQLite database for storing it. However game is not a general type application, so, would it be better to use XML + in-memory structures for storing it?

A database has some major advantages to me, it's much more "DRYer" in my opinion. You also can query it. But I doubt if direct database performance is sufficient for smooth gameplay. On the other hand you can use say, XML to store all of the recipes and use in-memory storage and query it with LINQ. If finally it all results in in-memory structures then database seems to have much overhead, since it's used just as a storage. Or is it still better to use DB?

Solution:

For now I've decided to stick with XML as storage for recipes. The major advantage of XML for me is that the final solution is more portable to other platforms since XML is more widely available.

sentences:
Most efficient way to recalculate enemy A* path on the fly? I'm working on implementing a more robust pathfinding algorithm for the enemies in my top-down shooter game, and I have the A* algorithm working, but now I need to decide when to calculate the path.

There are a couple situations where the path will be calculated already:

The enemy sees the player.
The enemy hears a sound.

I figure that I'll have the enemy continually recalculate their path to make sure they're aiming at the player and not just wandering off to the last path goal even after the player has moved. I also plan to have them initially only head to the last sound they heard or the last place they sighted the player if the player is no longer visible, and only continue pathing if they sight the player again or hear a new noise.

However, while they actively have the player in their sights and are charging toward him, how should I determine when to recalculate their path? I have a couple ideas already, but I'm not sure which would be most efficient, or if there's a better way.

Using grid coordinates corresponding to the map tiles, if the player moves 1 or more grid squares away from his initial position, determined by calculating (x2 - x1)^2 + (y2 - y1)^2. If this way is efficient enough, should each enemy be doing this calculation in their update step? Or should there be some sort of "notify" implementation (this would be a good amount more work because I don't have any kind of signal/slot pattern set up).
If the sum of the X and Y offsets of the enemy's grid coordinates compared to the player's coordinates are getting bigger, recalculate.

Anyone have any ideas? A* isn't exactly a cheap operation, so I want to limit the amount of recalculating I'm doing, especially if there are a good deal of enemies in the map.

sentences:
2D Unity: How to make a enemy jump from a navmesh platform to another? I'm currently working on a 2d platformer, however I came across an issue where the enemy moves within a certain range of the platform.

In this case I use a navmesh to limit the enemy's movement however I want the enemies to be able to jump within platforms.

I'm not sure how to achieve this effect, where the enemy moves in the platform a couple of times and the jumps into the next one until the player gets in range for it to attack the player.

How can I acheive this effect? Should i keep on using navmeshes or try another way around?

sentences: Line strokes also adding borders to other shapes? When you run the project, you can see that the first circles have a black border around them. When I remove the Game.drawLines(), the circles don't have the border around them anymore. Any help is appreciated!

sentences:
What's the best head-bob formula? Given a point in space, a direction of travel, and a time since start, what's a convincing, non-sickening formula to simulate head bob? What's been successful in previous games? Has there been any research on what bobs induce sickness the least?

An example naive head bob formula, applied to the up axis:

http://www.wolframalpha.com/input/?i=abs%28sin%28x%29%29

sentences:
Creating rectangles from the inner part of a texture2D This may be hard to understand, but I'll do my best.

You will see that the first image is a normal Mario, and the other is the result I am looking for. I'm trying to find a way to extract rectangles (biggest possible to smallest) from a texture2D, without overlapping rectangles. If the pixel is completely transparent, leave it out of the loop. I know it would be really easy to implement a rectangle for every pixel, but millions of rectangles isn't going to help performance wise. The goal is to get rectangles somewhat like this, decreasing the total rectangles greatly.

Any ideas or links? Anything would be great.

sentences:
What are the best ways to serialize and unserialize network messages for C/C++ multiplayer game? We are using JSON right now and want to move to a binary format for some types of messages between client and server.

Should I just read structs into the socket?  Use proticol buffers/thrift?

How should I represent arrays of data?

What should the interface look like for packing/unpacking data?

sentences:
Opengles 2.0 multi Textures fade out one by one I have multi textures, A was drawed on top of B, B was on top of C ...., ( like Picture 1) .I want to fade out A first, then B will appear and fade out either... But when A fade out, background color appeared on top of B, ( like Picture 1 )? Why? What should I do?
I have enable Blend like this

glClearColor(0, 104.0/255.0, 55.0/255.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

and Fragment shader

"void main(void) { // 2\n"
"gl_FragColor = texture2D(Texture, TexCoordOut);\n"
"gl_FragColor  *= alpha;\n"

" }\n"

Picture 1：  background color is green, A and B are both rectangle, A is on top of B

Picure 2 When I fade out A, the result like this:

I aso try to use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); but it doesn't work either.

**Update 1 shader **

const GLchar *vertex_shader_source_ =
{
    attribute vec4 Position;

uniform mat4 Projection;
uniform mat4 Modelview;

varying vec4 DestinationColor;

attribute vec2 TexCoordIn; // New
varying vec2 TexCoordOut; // New

void main(void) {
    gl_Position = Projection * Modelview *Position;
    TexCoordOut = TexCoordIn;// New

"}

};

const GLchar *fragment_shader_source_ =
{
    uniform highp float alpha;
    uniform sampler2D Texture;// New

varying highp vec2 TexCoordOut; // New

void main(void) { // 2
gl_FragColor = texture2D(Texture, TexCoordOut);
"gl_FragColor.a  = alpha;

}
};

sentences:
How to create temp folder to store a file from external directory and use it in a game I would like to copy a 3D model from external library and save it in temp/Resources/StreamingAssets folder to instantiate an object in unity scene.
`

public class FBXOBJLoader : MonoBehaviour {

    string src;
    // Use this for initialization
    void Start () {
        src = EditorUtility.OpenFilePanel("Select Model", "", "fbx");
        //Output the Game data path to the console
        Debug.Log("Path : " + src);
        StartCoroutine("CopySomething");
    }

    IEnumerator CopySomething()
    {
        print("Start");
        string path;
        path = Application.temporaryCachePath;
        FileUtil.CopyFileOrDirectory(src,path);
        yield return null;
    }
}

It's creating some unknown file format in the asset folder. can anybody please help me to complete this task.

Thanks in advance

sentences:
What are Glow Textures? So i'm not quite sure exactly what "glow textures" are. For my implementation of a "lightning" effect, according to the comments on the article;
http://drilian.com/2009/02/25/lightning-bolts/

They guy uses "glow textures". To achieve the really cool effects on his beams. I'm trying to-do the same thing, except that i'm not 100% sure what a glow texture is, currently the texture i'm using produces this output *I'm also using a simple shader to adjust the color value the lightning is rendered at;
http://www.youtube.com/watch?v=dQNRYD8bJJo

Which isn't very good, it has the shape of the lightning but it doesn't have the sorta "flare" of it. This is a screenshot of my current texture that i'm using:
http://dl.dropbox.com/u/13874083/screenshots/screen120417-105326.png

So essentially what i'd like to ask is mainly what is a glow texture? And perhaps to see  an example of one would be really appreicated.

Edit:
Taking the advice of kaoD, i'm now rendering the using Additive Blending, I've also got the Max Blending working, yet, still the bolt's do not produce the required effect that i'd like. Here's another video of them in action with the current code;
http://www.youtube.com/watch?v=T0OEBobHqks

And here's specifically how i'm rendering them;

        spriteBatch.Begin(SpriteSortMode.Immediate, new BlendState
            {
                ColorSourceBlend = Blend.One,
                ColorDestinationBlend = Blend.One,
                ColorBlendFunction = BlendFunction.Max
            }, null, null, null, effect);

        //Set Brightness of The First Bolt
        effect.Parameters["brightness"].SetValue(firstBoltBrightness);

        spriteBatch.Draw(firstBoltTarget, Vector2.Zero, Color.White);

        //Set Brightness of the Seconded Bolt
        effect.Parameters["brightness"].SetValue(secondBoltBrightness);

        spriteBatch.Draw(secondBoltTarget, Vector2.Zero, Color.White);

sentences:
need help in implementing KeyListener for 2D game in Java i stated coding my first game in java, i need some help in imlementing KeyListener to fit my game.
after some search in tutorials i've imlemented it like this :

frame.addKeyListener(new KeyAdapter(){

private boolean[] keys = new boolean[120];
public boolean up , down , left , right;

public void tick() {
    up =  keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
    down =  keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
    left =  keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
    right =  keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
}

public void keyPressed(KeyEvent e) {
    if(e.getKeyCode() != KeyEvent.VK_F5) keys[e.getKeyCode()] = true;
    tick();
    if (up){
        yMap+=4;
        direction='n';
        xInd=0;
    }
    else if(down){
        yMap-=4;
        direction='s';
        xInd=2;
    }
    else if(right){
        xMap-=4;
        direction='e';
        xInd=1;
    }
    else if(left){
        xMap+=4;
        direction='w';
        xInd=3;
    }
    wait++;
    if(wait==5){
        yInd++;
        wait=0;
    }
    if(yInd==3)
        yInd=0;
    cha=sprites[xInd][yInd];
    panel.repaint();
}

public void keyReleased(KeyEvent e) {
    keys[e.getKeyCode()] = false;
    tick();
    yInd=0;
    cha=sprites[xInd][yInd];
    panel.repaint();
}

public void keyTyped(KeyEvent e) {
}
});

however every thing is fine in this code, the character is moving correctly the sprites are perfect but it is missing only one thing, the only thing i need is when i move the character in a direction, lets say for exemple UP, with a simple click on the up button (which normaly should make it move with only 4 pixels to up),  the character should complete walking to the next square automaticaly (each square is 32*32 pixels).
i hope i explained well my question and sorry for bad english !

sentences:
Architecture for game character movements with user input and a finite state machine I have a JavaScript canvas game setup using Phaser framework. When I first made my character able to run, jump, and crouch, I used lots of if/else conditions and ended up with an ugly, buggy mess. I have read some articles about finite state machines and that seems to be the solution I need.

I am using javascript-state-machine and can't work out what kind of logic belongs where. My old logic looked something like this:

function update() { // ticks every frame
  if (cursors.right.isDown && !jumping && !crouching) {
    runRight(); // set character velocity and animation
  } else if( // more absurd complexity
}

What should be my first thought when trying to add a movement to the character? Do I think about the input first or define a state on the state machine first?

What exactly is a state? You can be moving right and jumping, but also moving to the right and not jumping. How are those movements described in terms of states?

What checks the user input for keys that are pressed or released and how does that interact with the changing of states?

A very helpful answer would include a psuedo code example of running and jumping that uses javascript-state-machine. I've read this interesting article that addresses character movement with an FSM, but I'm unable to apply those principles in JavaScript, with Phaser, and with this FSM library.

Here's some code from my most recent refactoring attempt in case it helps. I doubt it's even on the right track.

hero.sm = StateMachine.create({
  initial: 'standing',
  events: [
    {name: 'move', from: ['standing', 'jumping'], to: 'running'},
    {name: 'jump', from: ['standing', 'running'], to: 'jumping'},
    {name: 'stop', from: ['running', 'jumping'], to: 'standing'},
  ],
  callbacks: {
    // onEVENT
    onmove: (event, to, from, direction) => {

    },
    // onSTATE
    onrunning: () => {

    },
    // onSTATEleave
    onrunningleave: () => {

    }
  }
})

hero.update = () => {
  if (cursors.right.isDown || cursors.left.isDown) {
    hero.sm.move(cursors.right.isDown ? 'right' : 'left');
  } else {
    hero.sm.stop();
  }
}

sentences:
How to effectively gather info about how players play my HTML5 game? I'm finishing another HTML5 game, and this time I'd like to do some spying business on the players... Mostly just basic stuff: when they are playing, for how long, what upgrades they are buying the most and so on. Now, my first idea was just to collect this information during the gameplay, and then have a Javascript function fire when they close the tab/browser, and said function would send it to my server via Socket.io. This, of course, wouldn't work, because anyone who takes a look at the code would realize it and could start sending a tonne of false info which would mess up my statistics.

Questions:

Is there a way to effectively do this?
If yes, what kind of info should I be looking for, aside from stuff I
already mentioned?

sentences:
cocos2d-js displays only one type of tile from a tmx file I am using Tiled to produce a tmx which I use in my code using cocos2d-js.
The problem is that when I run it on the browser, a wrong tile gets displayed, the first one of the image (0,0) and repeats for the whole map.
The relevant js code is this:

this.farm = new cc.TMXTiledMap(res.farm_tmx);
this.addChild(this.farm);

where res.farm_tmx the path to the tmx file.

What could be the source of the problem? And how do I fix it? It seems to me that it is specific to my code. I do not find any other reports of the same problem.

sentences:
How do I associate my objects to my meshes and other resources? I am creating a simple 3D engine and I've run into a problem.

I have an array of objects

[Camera, Player, Player, MonsterA, MonsterB, MonsterA]

and a number of mesh files that I need to associate with these game objects

camera.obj, male.obj, female.obj, etc.

I pass the state of the world (the array of objects) to my renderer, and I would like to render each object with its associated mesh.

My question is: how / where do I tie these game objects to their meshes?

Should I keep them together as game objects?

eg. [(Camera, camera.obj), (Player, male.obj), ...]

Or should I have some sort of associative structure within my renderer? Or somewhere else entirely? This question also applies to textures as well. Basically, how do I connect the game objects to their assets?

sentences:
Unity3D, How do I press one key and then cant press another key while the one is pressed? I am making a horror game, and I want to press a key to look up while I am idle, that i've done but if I press the W key it stands in idle but floating forward. How can I disable the W key while I press the F key to look up ?
Everything works fine I can press F and the LookUp Animation is being played and if KeyUp on F the Animation goes back to Idle.
My problem is if I am in LookUp Animation when I press F, I can also press W to go forward but its floating not walking. I want to deactivate this function so I can just press F when I am Idle.

Thanks for help.

my Script:

public float speed = 10f;
public Rigidbody rgb;
public Animator anim;
bool walk = false;

// Use this for initialization
void Start ()
{
    rgb.GetComponent<Rigidbody> ();
    anim = GetComponent<Animator> ();
}

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

    float move = Input.GetAxis ("Vertical");
    anim.SetFloat ("Speed", move);

    if (Input.GetKey (KeyCode.W) | walk == true)
    {
        rgb.transform.position -= new Vector3(0, 0, 1) * speed * Time.deltaTime;
        Debug.Log("Walking");
    }
    else
    {
        walk = false;
        Debug.Log("Idle");
    }

    if (Input.GetKey (KeyCode.F))
    {
        anim.SetBool("LookUpIdle", true);
        rgb.transform.position = transform.position;
    }
    else
    {
        anim.SetBool("LookUpIdle", false);
    }

}

}

sentences:
Handling Input During Frame Drop? So i was wondering how games handle input so that the input is still handled even in cases of the frame rate being really low. Assuming the input logic is in the same thread as the rendering in the main thread. If the input is handled by some popular API (SDL/SFML/etc) the code will look something like this as a simple example:

if(KeyIsDown(keyCode))
{
    // do stuff
}

If the game is lagging then the above solution won't be able to catch the input cause the code won't be reached cause it is running behind. I notice in some games though when the framerate is low some games are still able to capture input. So if pressing Esc while the game is lagging eventually the key press will be registered. Is there any implementation of how this might work?

sentences:
Polar movement towards cursor sfml and c++ I got smooth movement down moving based on the window but I wanted to see if I could move my sprite to my cursor when I pressed w instead of just in the -y direction but everything went wrong right away. Here is the function I'm trying to make work:

    void Ship::MoveShip(float ShipAccel, float deltaTime)
{
    float movementY;
    float movementX;
    m_ShipVel += ShipAccel * deltaTime;
    if (m_ShipVel > m_ShipMaxVel)
    {
        m_ShipVel = m_ShipMaxVel;
    }
    else if (m_ShipVel < -m_ShipMaxVel)
    {
        m_ShipVel = -m_ShipMaxVel;
    }
    movementX = m_ShipVel * (cos(m_ShipAngle * 180 / PI));
    movementY = m_ShipVel * (sin(m_ShipAngle * 180 / PI));

    m_SpriteShip.move(movementX, movementY);
}

Just made a video of what's happening with this code: Video

sentences:
'perfect' platformer base Xna When a player touches a ground peice in a game, he seems to sink through the ground then slowly rise back up, and when he has risen back up, he is very jittery.

 if (touchingTheGround())
 {
     player.velocity.Y -= 2;
     touchground = false;
 }

the collision method sets the variable touchground to true if the player touches a ground peice, and if i dont set it to false, the collision detection wont work at all. i set the players velocity to move 2 up because when he's not touching a platform, his velocity.Y += 1. How do i achieve a way so that the player

Does not sink in the ground before moving up
Stops jittering when its position is higher than the ground its touching

sentences:
How to rotate a cell of sprite sheet? I can draw an animated sprite sheet without problems.
But when it comes to rotation, the single cell (which gets drawn) rotates around the center of the whole sheet.

How can I get my cell to rotate around its own center?
This is what I found on the internet:

  Copy the current frame to a buffer, rotate the buffer, then copy the
  buffer to the screen.
  Source

But I don't know what this means.

sentences:
libgdx setOrigin and setPosition not working as expected? I create a camera:

camera = new OrthographicCamera(5.0f, 5.0f * h/w);

Create a sprite:

ballTexture = new Texture(Gdx.files.internal("data/ball.png"));
ballTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion region = new TextureRegion(ballTexture, 0, 0, ballTexture.getWidth(), ballTexture.getHeight());
ball = new Sprite(region);

Set the origin, size, and position:

ball.setOrigin(ball.getWidth()/2,ball.getHeight()/2);
ball.setSize(0.5f, 0.5f * ball.getHeight()/ball.getWidth());
ball.setPosition(0.0f, 0.0f);

Then render it:

batch.setProjectionMatrix(camera.combined);
batch.begin();
ball.draw(batch);
batch.end();

But when I render it, the bottom left of my ball sprite is at (0, 0), not the center of it, as I would expect it to be because I set the origin to the center of the sprite. What am I missing?

sentences:
Unity3D Drag Object with Mouse Gives Invalid Position I am trying to implement a simple script to drag a GameObject with the mouse in Unity.
However, when the position of the object is updated with the following script, I get an error saying:

transform.position assign attempt for 'purpie_5' is not valid. Input position is { Infinity, 51351759646418134000000000000000.000000, -143589927261340110000000000000000000000.000000 }.
UnityEngine.Transform:set_position(Vector3)

I am not sure what I am doing wrong. This is the code I am using:

public class MouseInputInterface : MonoBehaviour {

#region PUBLIC MEMBERS
public Transform heldObject;
#endregion //PUBLIC MEMBERS

#region PRIVATE MEMBERS
private GameObject currTarget;
private Vector3 touchOffset;
private bool dragging = false;
#endregion //PRIVATE MEMBERS

// Use this for initialization
void Start ()
{

}

    void Update()
    {
    if(Input.GetMouseButton(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if(Physics.Raycast(ray,out rHit))
        {

            currTarget = rHit.transform.gameObject;

            if(currTarget != null)
            {
                if(!dragging && currTarget.transform.tag == "Moveable")
                {
                    dragging = true;
                    heldObject = currTarget.transform;
                }

            }

        }

        if(heldObject != null)
        {
            /*calculate offset*/
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(heldObject.position);

            /*calculate offset from camera*/
            Vector3 offset = heldObject.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

            //form the current position
            Vector3 curPosition = Camera.main.ScreenToWorldPoint(screenPoint) + offset;

            heldObject.transform.position = curPosition;
        }
    }
    else if(Input.GetMouseButtonUp(0))
    {
        //clear held object
        heldObject = null;
        //clear flag
        dragging = false;
    }

    }
}

Thanks for the help.

sentences:
Error When Loading a .tmx TILED map through the TiledMap class So I made a map using the TILED application and I have it as a .tmx for reasons, but whenever I use the TildMap class in the Slick2D library to render the map on the screen, it gives me an error. Here are the files:

Class file:

public TiledMap testMap = null;

//TILE-READER
public static TileReader tileReader;

public Game (int stateID) {}

@Override
public int getID() {
    return Main.game; //GAMESTATE = 1
}

@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    worldMap = new Image ("res/in_game_map.png");
    player = new Player(playerX, playerY, mapX, mapY);
    tileReader = new TileReader();
    player.init(gameContainer, stateBasedGame);
    tileReader.init(gameContainer, stateBasedGame);

    testMap = new TiledMap("res/worldMap.tmx");
}

@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta) throws SlickException {
    player.update(gameContainer, stateBasedGame, delta);
    tileReader.update(gameContainer, stateBasedGame, delta);
}

@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
    graphics.scale(1.05f, 1.05f);

    graphics.translate(player.camera.getCamX(), player.camera.getCamY());
    gameMap.draw(mapX - mapLength, mapY - mapWidth);
    testMap.render(0, 0);
    tileReader.render(gameContainer, stateBasedGame, graphics);
    player.render(gameContainer, stateBasedGame, graphics);
    graphics.translate(-player.camera.getCamX(), -player.camera.getCamY());

    if (inputHandler.keyMAP) {
        worldMap.draw(0, 0);
    }

    graphics.drawString("Player X: " + player.getxPos(), 400, 400);
    graphics.drawString("Player Y: " + player.getyPos(), 400, 415);
}

And here is the error message that it provided me:

  Caused by: org.newdawn.slick.SlickException: Unsupport tiled map type: base64,zlib (only gzip base64 supported)

Is there an issue with the way I formatted the .tmx file or is it that I am using the latest version of Tiled and that slick2D is no longer compatible with the newer version?

sentences:
What should I worry about when changing OpenGL origin to upper left of screen? For self education, I'm writing a 2D platformer engine in C++ using SDL / OpenGL.  I initially began with pure SDL using the tutorials on sdltutorials.com and lazyfoo.net, but I'm now using SDL to create an OpenGL rendering context and then render with OpenGL functions (specifically immediate mode but I'm learning about VAOs/VBOs). I am using SDL only for interface, audio, etc.

SDL uses a coordinate system with the origin in the upper left of the screen and the positive y-axis pointing down. It's easy to set up my orthographic projection in OpenGL to mirror this.

I know that texture coordinates are a right-hand system with values from 0 to 1 -- flipping the texture vertically before rendering (well, flip the file before loading) yields textures that render correctly... which is fine if I'm drawing the entire texture, but ultimately I'll be using tilesets and can imagine problems.

What should I be concerned about in terms of rendering when I do this?

If anybody has any advice or they've done this themselves and can point out future pitfalls, that would be great, but really any thoughts would be appreciated.

sentences:
Procedurally splitting and merging paths I'm making a text-based adventure which sends the player along different paths depending on their choices.  Each scene is like a node in a directed graph. Each node has a time step which is equal to the number of nodes prior + 1.  There is a maximum of Tn nodes per time step, say 5, and so you can visualise this in this way:

I want to generate paths like these.

Where a node points to more than one other, that could be called a fork and where two point to one, that could be called a merge.

At any particular timestep there will tend to be Tn / 2 paths, only rarely going down to one or up to Tn.

Does anyone have ideas or know of any similar work?

(One small issue - paths never cross - that is, those on the left stay on the left until merging to the right.  And there's no wrapping from far left to far right.  Because of this, it seems like nodes on the far left or far right of a timestep will have a smaller probability of merging.  Is this avoidable?)

sentences:
Resources.Load doesn't grab values of my child class I have a parent class Unit, and child classes melee unit/ranged unit. The parent class  holds uninitialized fields such as health, damage, etc. the child class sets the values of these fields in an Awake function.

In another script, I have a Start method:

void Start(){
    gridX=5;
    gridY=5;
    for (int i = 0; i<(gridY*gridX);i++){
        allies.Add(new GameObject());
    }
    AddUnits();
    SetupGrid();

}

AddUnits looks like this:

void AddUnits(){
        allies[0] = (GameObject) Resources.Load ("Units/melee unit");
        allies[1] = (GameObject) Resources.Load ("Units/ranged unit);
        number = 2;
    }

The resources loaded are prefab gameobjects containing their respective melee unit or ranged unit script (both which derives from base class Unit)However, when I check the health value of the gameobjects allies, they're always 0. Can anyone help me figure out why?

sentences:
Run a Script at Game Startup in Unity I have a script that is made to run when the game is loading.
That script set the resolutions, fullscreen, and loads other screen and important settings and it applies them.
I have the script attached to a gameObject in the main screen that have some game and scene scripts.
The problem is that everytime that you return to the main scene, that script runs again and cause several bugs.
So, there is a way to run a script only at game startup?

sentences:
Unity 2d, Animations start distorting I'm making my first game and I just finished adding animations for walking and jumping. Everything looked good at first but with time they started distorting, even rotating (Rotation is Frozen).
This is how the character looks in the beginning:

But after some time of walking and jumping:

Did anyone have a similar error?
Can anyone Help?

sentences:
Slick2D Graphics Misaligned I'm working through a game in Slick2D and am now focusing on a lot of the graphical end. It's going pretty well other than a couple of issues with alignment. An image illustrating both of these issues here:

Firstly, the background. I have 2 Entity objects containing coordinates, velocity, and an image for the background. Both contain the same image (1600x600). For the first, x=0 and for the second, x=1600. They both move to the left at a speed of 1 pixel per frame. No matter if I make the offset smaller (like 1580), I am still left with a gap showing the background colour. I've put the two images together in photoshop and they blend together, so it's not an issue with the image. Here is some relevant code:

//in init block
Entity bg1 = new Entity("background",1600,600);
        bg1.setXVelocity(BACKGROUND_VELOCITY);
        Entity bg2 = new Entity("background",1600,600); //a second one is needed for endless background
        bg2.setXVelocity(BACKGROUND_VELOCITY);
        bg2.setX(1600);
        backgroundList = new ArrayList<Entity>();
        backgroundList.add(bg1);
        backgroundList.add(bg2);
...
//in update loop, running every frame
for (Entity bg : backgroundList){
    bg.update();
    if (bg.getX() < -1*bg.getSpriteWidth()){
        bg.setX(1600);
    }
}

In other words, what I expect my code to do is have both images move left one pixel each until the left image reaches -1600 (-1*bg.getSpriteWidth()), at which point the right image will be at 0, and with a width of 1600 the first image would be moved to 1600. This is, at least, how I expect my code to work. bg.update() calls a method which adjusts the position based on the velocity given, so it will move x backward by 1 each time for both backgrounds.

Secondly, the misaligned walls. As you can see in the image, the walls on the right are perfectly aligned. They move left together at the same velocity in the same way as above. For some reason, however, as the walls pass the mid-way mark (where the fish is), the upper wall's velocity slows for a slight second which misaligns it with the lower wall (though the velocity returns after and they stay that constant distance apart). I actually have found the code causing this (when commented out it stops), but I cannot see why it would do such a thing. The values still remain correct, but the graphical output is distorted.

for (int i = 0; i < wallList.size(); i++) {
    Wall wall = wallList.get(i);
    wall.update();
    if (wall.getX() < -1 * wall.getImageWidth()) {
        wallList.remove(i);
    }
}
...
if (wallList.get(wallList.size() - 1).getX() < WIDTH - DISTANCE_BETWEEN_WALLS) {
    createWalls();
}

...
private void createWalls() {
    Wall w1 = new Wall();
    Wall w2 = new Wall();
    int yPos = rand.nextInt(400) + 50 - w1.getImageHeight();
    w1.setLocation(WIDTH, yPos);
    w1.setXVelocity(WALL_VELOCITY);
    w1.setVisible(true);
    w2.setLocation(WIDTH, yPos + 11 * player.getImageHeight() / 3 + w2.getImageHeight());
    w2.setXVelocity(WALL_VELOCITY);
    w2.setVisible(true);
    wallList.add(w1);
    wallList.add(w2);
}

It's the wallList.remove(i); line that is causing this offset to happen. When I remove the line, the walls stay aligned as intended. Any ideas? Are these just imperfections of Slick2D? Perhaps there is a better way for me to do these things?

sentences:
help using image to overlay grayscale around player I'm sorry for the confusing title but it is hard to explain in one sentence.

This is what I have

What I want to do is use that black overlay to convert everything in the black area to grayscale. This will create a colored aura around the player.

Does this require pixel shading or is there a simpler method?

sentences:
How can I name and organize resources at design time? I'm having a very hard time trying to figure out a good way to add new resources to my game project in a way that's convenient for designers.

To try and better understand the problem, I'm trying to create a very simple game.  It's in the style of an old text adventure.  The user begins in a room, and at the start of each turn an image of the room is displayed and some text describing the room is printed.  Then several options are shown (in a multiple choice format).  The user picks one and option and the result of the action is printed to the screen.  Then the turn ends and the next turn begins (the new image and description are shown, more options are printed, etc).

This game will require several resources:
    - String tables (to hold the text)
    - Images (Shown in each room)
    - Places (links to the image and description, as well as the list of options)
    - New Game Scenerio (used to initialize game.  Just tells the user where the starting room is)

I would like to create an editor where designers can just start it up and then start adding and editing rooms.

The straight forward approach would be to create a simple, stand alone editor that can load and save independent Place files.  It would use relative file paths to locate the linked images and string tables.  These Place file format would be XML which would later be compiled to a binary form when the final resource archive containing all resources is compiled.

The trouble with using paths, though, is that if you rename and move files (as you likely will as the project get larger), the paths that point to it will break (at well as any relative paths it points to itself).

Relative paths can also be a problem if you need to refer to resources that are in a completely different branch off the root.  For example, let's say I have the following resources in my project:

/item/MagicWand.xml
/place/grassyPlain/castle/DarkTower.xml

If I want to place a MagicWand in my DarkTower, I'd have to use a relative path that looks something like "../../../item/MagicWand.xml".  That's pretty cumbersome.  It would be nicer to use something like "item.MagicWand".

Also, since these resources are going to be compiled, if I need to refer to them from my scripts I will need something to call them.  If my user is in the DarkTower and selects the option "go to the griffon pen", I'm like to be able to do this with code similar to

getUser().setLocation("place.grassyPlain.castle.GriffonPen");

All this suggests importing my resources into some sort of super editor project that knows how to handle all resources and provides names for them (and even provide interactive editors for some of them).  While this would simplify the naming problem, but would be a lot of work - especially if more than one person need to design resources at the same time.  (for multiple users, I'd need a database-like locking mechanism to make sure multiple people weren't renaming things or working on the same file at the same time).  The whole thing would have a look and feel that calls to mind the Flash editor.

My thinking keeps leaning toward this super-duper editor solution, since I've been exposed to tools like this before.  However, this seems like a lot of work, especially for so simple a project.  I can't help but think that I'm over thinking this.  I would like to have a system for managing my game's resource that is simple yet, flexible and which integrates well with my code/scripts.

Does anyone have any thought on what makes a good resource managment/naming system?

sentences:
How can I increase framerate, when drawing tiles to a HTML canvas? I am using the HTML 5 canvas to make a simple platformer game. I am currently drawing the tiles using a for loop that runs through a list of tiles and checks if they will be drawn to the screen.

for (var i = 0; i < tiles.length; i++) {
    if (tiles[i].x + scale > pos.x - (canvas.width / 2)
            && tiles[i].x < (pos.x + scale) + (canvas.width)) {
        canvas.drawImage(tiles[i].x - pos.x, tiles[i].y - pos.y, scale, scale,
                "img/Tiles/" + tiles[i].Tile + ".png")
    }
}

I am also using this custom library to draw the image to the screen:

this.drawImage = function(x, y, width, height, src, alpha) {
    if (alpha) {
        ctx.globalAlpha = alpha
    }

    if (document.getElementById(src) == undefined) {
        document.head.innerHTML
                += ''
    }

    var img = document.getElementById(src)
    ctx.drawImage(img, x, y, width, height);
    ctx.globalAlpha = 1.0
    document.getElementById(src).outerHTML = ""
}

When I run the for loop, the frame rate of the game seems to drop. Is there an alternate option to going through every element of the array that I'm not aware of?

sentences:
How can I avoid updating my Unity projects when I have two versions installed? I currently have two versions of Unity on my Windows computer. I would like to not update my projects to avoid compatibility issues like I had in the past.

Installation in another folder goes just fine, but when I try to open Unity, it says that another Project is already opened and that if I want to continue I must update it. If I close this window, Unity aborts as well.

Is there a way to avoid this behaviour?

sentences:
SDL_PollEvent very slow on SDL2, but works fine on SDL1.2 I have this simple app that displays a screen and handles the quit event:

while( SDL_PollEvent( &e ) != 0 )
    {
        //User requests quit
        if( e.type == SDL_QUIT )
        {
            quit = true;
        }
    }

If I compile this with SDL1.2 it runs fine, the quit event is handled immediately.
However if I compile it for SDL2, then it takes ~5 seconds to get that event. And not just quit, but other events also, like mouse.

With sdl2 it takes ~95% of the cpu, while with sdl1.2 it's ~30-40%.
The cpu is dual core, 1.2 ghz (pandaboard).

I suspect something, but I'm not 100% sure:
I'm running this on ubuntu 12.04 which natively supports only sdl1.2.
So I had to compile sdl2 from source code, as it's not available in that ubuntu.

Could this be the reason? Or any other clues what might be wrong?
Thanks!

sentences:
Animation of moving circle by square's outer surface I want to make this animation in OpenGL, here I attached a simple gif how I want it to looks like:

Main problem is that I can not figure out how to move by corner - circle should smoothly move by corner, not to just jump to another side's begin position.
import Blender
from Blender import Draw,BGL
from Blender.BGL import *
from math import sin,cos
import time

squareLength, squareX, squareY, circleRadius = 200, 200, 200, 20
movingX, movingY = 0, 0

def event(evt, val):
    if evt == Draw.ESCKEY :
        Draw.Exit()

def gui():
    global movingX, movingY

    glClearColor(0.17, 0.24, 0.31, 1.0)
    glClear(BGL.GL_COLOR_BUFFER_BIT)
    glLineWidth(1)
    glColor3f(0.74, 0.76, 0.78)

    glBegin(GL_QUADS)
    glVertex2i(squareX, squareY)
    glVertex2i(squareX, squareY + squareLength)
    glVertex2i(squareX + squareLength, squareY + squareLength)
    glVertex2i(squareX + squareLength, squareY)
    glEnd()

    glColor3f(0.58, 0.65, 0.65)

    glPushMatrix()

    if movingX == -circleRadius:
      if movingY < squareLength:
        movingY += 1
      else:
        movingX = 0
        movingY = squareLength + circleRadius
    else:
      if movingY == squareLength + circleRadius:
        if movingX < squareLength:
          movingX += 1
        else:
          movingX = squareLength + circleRadius
          movingY = squareLength
      else:
        if movingY < 0:
          if movingX > 0:
            movingX -= 1
          else:
            movingX = -circleRadius
            movingY = 0
        else:
          if movingY > 0:
            movingY -= 1
          else:
            movingX = squareLength
            movingY = -circleRadius

    glTranslatef(movingX, movingY, 0)

    glBegin(GL_LINE_LOOP)
    for i in xrange(0, 360, 1):
        glVertex2f(squareX + sin(i) * circleRadius, squareY + cos(i) * circleRadius)
    glEnd()

    glPopMatrix()

    Draw.Redraw(1)

Draw.Register(gui, event, None)

Can you please say me, how can I optimize this code to make circle moving by corners?
Just start learning computer graphics and think up such exercises for training, so I will really appreciate for any help.

sentences:
How to make the minimap inactive? I have created a minimap for my top-down Shooter and it is showed on the top-left corner of the window. The problem is that if I press anywhere upon the minimap, its like pressing somewhere on the normal game as I have used views to make it. Is there any way to make the minimap inactive?

Thanks in advance.

sentences:
Increasing height increases width I have a game, where the user presses a button to spend money and increase the height of a Movie Clip. I use the following: height ++.

The problem:  When I test this out, it seems the width increases, too.  The actual thickness, you could say.  How can I solve this?

sentences:
Need a little more help with rotating sword around player (Unity 2D) this question is somewhat similar to my last question (found here). This time, I have upgraded to the new Input Manager and updated the script that uses the controller, but now I'm having trouble with having the sword rotate around the player and towards the mouse. The image below might help visualize this better.

Here's my current code:
public void Update()
{
    var gamepad = Gamepad.current;
    var mouse = Mouse.current;
    if (controllerControl)
    {
        x = gamepad.rightStick.ReadValue().x;
        y = gamepad.rightStick.ReadValue().y;
    }
    else
    {
        x = mouse.position.ReadValue().x; //Here's where I think the problem is
        y = mouse.position.ReadValue().y;
    }

    //convert the input into an angle in radians, and convert that into degrees
    float rads = Mathf.Atan2(y, x);
    float degrees = rads * Mathf.Rad2Deg;

    //use trig to position sword
    sword.localPosition = new Vector3(Mathf.Cos(rads) * distance, Mathf.Sin(rads) * distance, 0);
    //rotate to face away from center. note that the angle atan gives us is
    //oriented differently than unity's rotation, so we have to reverse it
    //and add 90.
    sword.localEulerAngles = new Vector3(0, 0, degrees - 90);
}

The boolean "controllerControl" will change based on which input device the player chooses. The sword is a child of a box object. If someone could point me in the right direction, that would be much appreciated.

sentences:
error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression' When I build my project, which references the System.IO.Compression namespace, the build succeeds without issue inside Visual Studio.

However, inside the Unity editor, I see the following error:

error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression'. This type has been forwarded to assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly.

I added a csc.rsp file inside my Assets folder, with the following line:

-r:System.IO.Compression.FileSystem.dll

Unfortunately, that did not resolve the issue.

Here are the properties of the System.IO.Compression DLL that I reference inside Visual Studio:

How can I fix this error?

sentences:
Why does the size/extents of a bounding box of a BoxCollider in Unity show the Z element being double what it is? As you can see from the picture below, I fetch the BoxCollider inside CollisionHandler and Debug.Log() it to the screen.
In this case, I'm logging the size, but the same thing happens with extents. There are 4 logs because I have 4 instances of the object in the scene.
The Z value of the Vector3 is double what it should be, whereas the other values are, for the most part†, normal. Also, it seems that each object prints a slightly different value for extents.z. Most stay around 1.3, but one gave me 1.07~.
Additionally, it inverts the order for 2 of the objects. I don't know why.
None of the objects are scaled and all use the exact same values for their collider.

I tried drawing a cube with the same size as the BoxCollider's bounding box, and here's what I got:

I'm not entirely sure if the misalignment with the Collider in the scene is a sign of a problem or just how Gizmos.DrawCube() works. Here's the code that does this:
private void OnDrawGizmosSelected() {
    Vector3 origin = coll.bounds.center + transform.TransformDirection(new
    Vector3(0f, 0f, 0.675323f + skinWidth));
    // The hardcoded number above is Z extent of the box.
    Vector3 direction = transform.TransformDirection(Vector3.forward) * 2;

    Gizmos.color = Color.red;
    Gizmos.DrawRay(origin, direction);
    Gizmos.DrawCube(origin + direction, coll.bounds.size);
    // Where coll is a reference to the BoxCollider, cached in Awake().
}

Unity version 2019.3.15f1.
† For the X value of 2.286476, it rounded to 2.1 in the 3rd log for some reason. And in the first log, it rounded the doubled value of Z to 2.4 rather than 2.6...

sentences:
Exporting unity features to your game I wonder if it is possible to export Unity features to my game.

For example if I want user to be able to modify scale or rotation of object, do I have to scritp it myself or can i somehow export it ?
Same question about some simple texturing, adding lights, etc.

sentences:
Unity move Vector3 position with transform How can I move a new Vector3 position with a Transform? Like the transform is the parent the vector.

Example if I want to push the x position for example by 10 value and I rotate the transform its push in world coordinate but I want to push by the rotation too.

    void Update () {
    temp = transform.Find("Transform").position;
    temp = new Vector3(temp.x + 10.0f, temp.y, temp.z);

    Debug.DrawLine(transform.Find("Transform").position, temp);
}

sentences:
Proper way to do texture mapping in modern OpenGL? I'm trying to do texture mapping using OpenGL 3.3 and GLSL 150.

The problem is the texture shows but has this weird flicker I can show a video here.

My texcords are in a vertex array. I have my fragment color set to the texture values and texel values. I have my vertex shader sending the texture cords to texture cordinates to be used in the fragment shader. I have my ins and outs setup and I still don't know what I'm missing that could be causing that flicker.

Here is my code:

Fragment shader

#version 150

uniform sampler2D texture;
in vec2 texture_coord;

varying vec3 texture_coordinate;
void main(void) {
    gl_FragColor = texture(texture, texture_coord);
}

Vertex shader

#version 150

in vec4 position;
out vec2 texture_coordinate;
out vec2 texture_coord;
uniform vec3 translations;

void main() {
    texture_coord = (texture_coordinate);
    gl_Position = vec4(position.xyz + translations.xyz, 1.0);
}

Last bit

Here is my vertex array with texture coordinates:

GLfloat vVerts[] = {
   0.5f, 0.5f, 0.0f, 0.0f, 1.0f,
   0.0f, 0.5f, 0.0f, 1.0f, 1.0f,
   0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
   0.5f, 0.0f, 0.0f, 1.0f, 0.0f}; //tex x and y

If you need to see all the code, here is a link to every file.

Thank you for your help.

sentences:
Render error in xna DrawPrimitive for Assimp Mesh I am trying to render the vertices of a scene with a cube I exported as an OBJ from Blender. The 8 vertices become 24 when imported into XNA but when I render it I dont see all faces. This is not an issue of missing meshes because I'm pretty sure this is being stored as the first and only mesh. I suspect this is because of the vectors defined in the Assimp Mesh object but I can't seem to find any help for this.

THIS IS SOLVED! The code shows how to render a 3D model using only Assimp and XNA with vertex and index buffers. oScene is the Scene object imported using Assimp. This code only draws faces in a single color without textures.

Here is the relevant code:

   private void SetUpVertices()
    {
        mMesh = oScene.Meshes[0];
        vertices = new VertexPositionColor[mMesh.VertexCount];
        indices = new  short[mMesh.FaceCount*3];

        int i=0;
        foreach (Vector3D mVec in mMesh.Vertices)
        {
            vertices[i] = new VertexPositionColor(new Vector3(mVec.X, mVec.Y, mVec.Z), Color.Red);
            i++;
        }

        int f = 0;
        Face mFace;
        for (i = 0 ; i < mMesh.FaceCount*3 ; i=i+3)
        {
            mFace = mMesh.Faces[f];
            f++;
            indices[i] = (short)mFace.Indices[0];
            indices[i + 1] = (short)mFace.Indices[1];
            indices[i + 2] = (short)mFace.Indices[2];

        }

        vertexBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
        vertexBuffer.SetData(vertices);

        indexBuffer = new IndexBuffer(device, typeof(short), indices.Length, BufferUsage.None);
        indexBuffer.SetData(indices);

    }

    private void SetUpCamera()
    {
        cameraPos = new Vector3(0, 5, 9);
        viewMatrix = Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f);
    }

    protected override void Draw(GameTime gameTime)
    {
        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
        effect = new BasicEffect(GraphicsDevice);
        effect.VertexColorEnabled = true;

        effect.View = viewMatrix;
        effect.Projection = projectionMatrix;
        effect.World = Matrix.Identity;

        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            pass.Apply();
            device.SetVertexBuffer(vertexBuffer);
            device.Indices = indexBuffer;
            device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes[0].VertexCount, 0, mMesh.FaceCount);
        }

        base.Draw(gameTime);
    }

sentences:
Place tile values over 'chunk' boundries My game has a 'chunk' engine similar to Minecraft's but in 2 dimensions.
Each chunk is a square of 32 by 32 tiles.

What I want to do is generate a defined shape across multiple chunks without breaking the shape.

This is made difficult by the fact that chunks are generated one chunk at a time in unknown intervals of time, so I cannot place a structure after the amount of chunks it needs to fit in are generated, as the player might move into the area before that time.

Another problem is that I cannot simply tile the shape uniformly because the shape needs to be exactly one tile above the surface, which is a heightmap generated using simplex noise, so it is not flat.

Is there any way I can generate this structure from one point of origin placed at random intervals over a heightmap that is known?

Example of what I want:

Grey Lines - chunk bounds

White Tiles - structure generation

Blue Tiles - known 1D heightmap

How can this be done?

sentences:
Game State and Configuration via Events Often "singletons" are problematic for testing, so with my next game I'm trying my best to avoid them. But there is bunch of data (configuration or game state information) that different parts of my game require to function. So far I've used events (publish/subscribe) to pass around for example keyboard/touch actions.

Is it a bad idea to try to do the same with configuration/game state? So for example user changes some configuration parameter and instead of all those that need it doing something like ConfigurationSingleton.getParam("someparam") my event handler would call all those interested in param changes with SomeSubscriber.paramChanged("someparam", "new value").

How do you usually make available this kind of "global state/configuration" data in games?

sentences:
How does one make games playable before they are fully downloaded? Diablo 3 and StarCraft 2 have a nice feature: I can start playing before the full game or update has finished downloading.

I guess Diablo 3 downloads mandatory files like like UI assets and some meshes and textures that are used across several levels first. However, when starting a game, I can choose any level I want, assuming I have appropriate saves. I never experienced any lag from such when playing—starting is always very smooth.

How does this work? How could I implement a similar feature?

sentences:
Ways to manage changing designer data alongside changing player data I have an online game where players get to shape the world in some way - eg. Ultima Online's housing, where you get to build your houses directly onto certain parts of the world map. These are changes that should persist over time as part of the persistent world.

At the same time, the design team are adding new content and amending old content to improve and extend the game for new players. They will do this on a development server first during testing and then later have to merge their work in with the players' "work" on the live server.

Assuming we fix the game design issues - eg. players can only build in designated areas, so they never clash geographically with designer edits - what are good ways to handle the data or arrange the data structures so as to avoid conflicts when new designer data is merged in with new player data?

Example 1: a player crafts a new type of item, and the game assigns the ID 123456 to it. Instances of that item all refer back to 123456. Now imagine the game designers have a similar system, and a designer creates a new item also numbered 123456. How can this be avoided?

Example 2: someone makes a popular mod that gives all your dragons a French accent. It includes a script with a new object called assignFrenchAccent which they use to assign the new voice assets to each dragon object. But you are about to deploy your "Napoleon vs Smaug" DLC which has an object of the same name - how can you do this without a lot of customer service problems?

I've thought of the following strategies:

You can use 2 separate files/directories/databases, but then your read operations are significantly complicated. "Show All Items" has to perform one read on the designer DB and one read on the player DB (and still has to distinguish between the 2, somehow.)
You can use 2 different namespaces within one store, eg. using strings as the primary key and prefixing them with "DESIGN:" or "PLAYER:", but creating those namespaces may be non-trivial and dependencies aren't clear. (eg. In an RDBMS you may not be able to efficiently use strings as primary keys. You could use integers and allocate all the primary keys below a certain number, eg 1 million, to be designer data, and everything above that point to be player data. But that info is invisible to the RDBMS and foreign key links will cross the 'divide', meaning all tooling and scripts need to explicitly work around it.)
You can always work on the same shared database in real-time, but performance may be poor and the risk of damage to player data may be enhanced. It also doesn't extend to games that run on more than 1 server with different world data.
...any other ideas?

It occurs to me that although this is primarily an issue for online games, the concepts may apply to modding too, where the community creates mods at the same time that the developers patch their game. Are any strategies used here to reduce the chance of mod breaking when new patches come out?

I've also tagged this as "version control" because on one level that's what this is - 2 branches of data development that need merging. Perhaps some insights might come from that direction.

EDIT - some examples added above to help clarify the problem. I am starting to think the issue is really one of namespacing, which could be implemented in a store via composite keys. That simplifies the merge strategy, at least. But there may be alternatives I'm not seeing.

sentences:
Camera follow 3D Object OpenGL I'm trying to make my camera follow a 3D object, the X and Y values from the camera position are the same as the 3D object, but the Z axis is not the same, it has an offset of 13.0f so the camera looks to the object from a distance. The problem is that, the more I go up with the object, more the object disappears on the screen, its like the camera is following it slowly, or like, since the camera is far away then the object goes up faster than the camera, so how do I center the object in the middle of the camera?

[my current code for the view matrix of the camera]

view = glm::lookAt(position, position + forward, up);

sentences:
How I randomise a list of audio clips in Unity and remove it from the list once the clip is finished? I have 4 audio clips. When I play a press a certain button in Unity, the data is sent to MAX/MSP and the audio is played. I created a list a signals (As shown below in the code). What I want is that, the signal list is randomised. The user presses a button to listen to the audio (which works fine). Once the clip is finished the user presses Next Trial button. Once the Next Trial is pressed. The previous clip is removed from the list. Once all the clips are finished. A message is displayed in the Debug.Log("All trials finished"). I have the following problems:

One of the audio clips is repeated again. It appears that the audio clips are not removed from the list.

How do I write the audioclip index to a csv file?

Code:
public class SignalToMax : MonoBehaviour { private static int localPort; private string IP; // define in init public int port = 8050; // define in init

 // "connection" things
 IPEndPoint remoteEndPoint;
 UdpClient client;
 // experiment case
 public string experimentCase = "A";
 string strMessage = "";
 public List<int> signals;
 public static int stimIndex;
}

void Start() {

NextTrial = GameObject.FindGameObjectWithTag("NextTrial").GetComponent();

     signals = new List<int> { 1, 2, 3, 4 };
     // define
     IP = "127.0.0.1";
     port = 8050;
     // ----------------------------
     // Senden
     // ----------------------------
     remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);
     client = new UdpClient();
     NextTrial.onClick.AddListener(Advance_Trial);
}

void Advance_Trial() {

     int signalIndex = Random.Range(0, signals.Count);
     int currentSignal = signals[signalIndex];
     stimIndex = currentSignal;
     signals.RemoveAt(signalIndex);
     string text = signalIndex.ToString();
     byte[] data5 = Encoding.ASCII.GetBytes(text);
     client.Send(data5, data5.Length, remoteEndPoint);
     Debug.Log("<color=magenta>Current source signal is:</color>" + currentSignal);

     if (signals.Count > 0)
     {
         Debug.Log("<color=blue>Signal count before removal was:</color>" + signals.Count);
         Debug.Log("<color=yellow>Source signal removed</color>");
     }
     else
     {
         Debug.Log("<color=green>All Trials finished</color>");
     }
 }

sentences: Keyboard input vs character movement encapsulation In our game created with c++ and sdl we are having difficulty delegating how the main character should be controlled.  We have a keyboard class and a sprite class for the main character, but are unsure if the main character should have an instance of the keyboard class or if keyboard input should be done through the game loop.  If you need anymore information I would be happy to provide it, thanks in advance for any help.

sentences:
Raycasting in Unity3D? I have a game object on screen represented by a cube (but say it was a quad or something else all the same).

How do I raycast to check intersections? Keeping in mind I may not be raycasting fora  physical object, just a gameobject of any sort.

Another question I have is, how can you raycast in Unity3D just to check against an intersection against anything in general (say the first gameobject to be hit)?

sentences:
Transform 3d viewport vector to 2d vector I am playing around with 3d transformations and came along an issue.

I have a 3d vector already within the viewport and need to transform it to a 2d vector. (let's say my screen is 10x10)

Does that just straight works like regualar transformation or is something different here?

i.e.: I have the vector a = (2, 1, 0) within the viewport and want the 2d vector.

Does that works like this and if yes how do I handle the "0" within the 3rd component?

sentences:
Sprite Rendering Cost Calculation First of all asking before asking this question I have already read following post for the clearance of my mind.

Sprite Renderer

Texture 2D

I want to change my background texture as per device aspect ratio detection. For this purpose I have following code:

var newSprite : Sprite;

function Start () {
      GetComponent(SpriteRenderer).sprite = newSprite;
}

Or another way to load sprite is :

Sprite myFruit = Resources.Load("fruits_1", typeof(Sprite)) as Sprite;

Using above code I can able to load new sprite as per my requirement. But I want to reduce following disadvantage from this.

At present basically I set background sprite of 960 x 640 for iPhone 4 and its get loaded. After that I change my background sprite to 2048 x 1536 as I detect the device with iPad Retina display. So another texture get loaded. I want this process to happen single time so how to manage sprite texture in correct way.

Also thanks for your attention towards this question.

sentences:
Matching the 3ds max camera view in my game 1:1 I want to match 1:1 the 3ds max camera render with my 3d engine (DirectX 11, C++).

I believe that my mesh exporter (coded with MaxScript) works fine, I see the right shapes.

But something about the perspective, translation (of the camera) and/or rotation is not quite right - the scene looks similar, but not the same:

As you can see:

the window proportion and size is ok,
the mesh looks fine (I'm not interested with the materials or shading now, just the 1:1 match of view & perspective),
to get the better match, I had to translate the window (as you can see on the second image, the corner of one has some offset),
the rotation or rather perspective seems to be a bit wrong (note the smaller teapot on second image).

I guess I've missed something:

My object and camera are places in the same position as in 3ds max (3ds max is set to millimeters, engine don't use any units - e.g. camera is at [20mm, 10mm, 0mm] in 3ds max and [20, 10, 0] in game engine).
Game engine camera uses DirectX::XMMATRIX projection = DirectX::XMMatrixPerspectiveFovLH(DirectX::XM_PIDIV2, screenWidth / (FLOAT)screenHeight, 0.01f, 1000.0f); and the 3ds max camera is set to FOV = 90:

The position and orientation of the object and camera (camera has no rotation applied) are converted from 3ds max right-handed z-up coordinate system to engine's left-handed y-up coordinate system. The orientation is expressed in quaternion and it's transformed from one system to another with:

.

temp = q.z
q.z = q.y
q.y = temp

q.z = -q.z
q.x = -q.x
q.y = -q.y

What did I miss and should take into account when matching game engine view with 3d edition software like 3ds max?

sentences:
Traversing a pre-defined path with a delay in SFML - C++ I want the player to move smoothly & slowly through a vector of co-ordinates that define a path, below is an illustration of what i mean.

[P][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][.][E][ ][ ]

Once the path has been found the player should move between each tile with a visual delay, i have tried to code this behavior in a variety of ways but it seems that this a problem created by running Update/Render on the same thread, i think?

Here is what i tried

 if (pathFound)
 {
    for (auto path : waypoint_queue)
    {
        Move(this->character.getPosition(), path)
    }
    waypoint_queue.clear();
    pathFound = false;
} else {  }

Running this without a delay in an attempt to lerp between the co-ordinates of each "Next Tile" essentially teleports the player to the final node.

Running this with a delay of 1s for 10 tiles halts the program for 10 seconds then teleports the player to the final node.

How do i go about producing C#-like co-routine behavior that can update variables with a timed delay whilst also rendering them?

Thanks

sentences:
Process for converting unity asset to scenekit scene/resource Has anyone successfully figured out a method for converting a unity3d asset to a 3d SceneKit model/scene? I imagine it would require exporting the asset into some third party file type, and then importing into scene kit. If you have any knowledge that can help me, would you kindly explain the process?

Unity3d has a fantastic asset store, and I want to import some of these things to a project that requires scenekit (unfortunately, "just use unity" is not really an answer to my problem-set).

sentences:
Proper way to supply different textures and multiply matrices for thousand of terrain meshes What I have

Terrain chunks of size 64x64 meters in a custom format
PVR textures
OpenGLES2 renderer
GLSL shader

None of the above can be changed in any way, i.e. I can't modify the existing code of shader or change the renderer.

Terrain

Each terrain chunk consists of 64 tiles of size 8x8 meters and are placed in a grid. Each tile has 3 layers of textures so theoretically there can be 192 different textures per chunk.

The way I currently load terrain is via script. I create a mesh for every tile in a chunk, so that's 64 meshes per chunk.

Shader

The shader input consist of:

3 textures and their texture mask
3 matrices
minor stuff

The matrices needed are calculated in every frame in the following way:

var M = _object.transform.localToWorldMatrix;
var V = Camera.main.worldToCameraMatrix;
var P = Camera.main.projectionMatrix;
_material.SetMatrix("WorldViewProjectionMatrix", P * V * M);
_material.SetMatrix("WorldViewT", (V * M).transpose);
_material.SetMatrix("World", M);

What I need

Loading the entire terrain would take a lot of time and resources, so I only load the nearest chunks depending on player position and its a 5x5 chunks area. And still on average I have:

25 chunks
25 * 64 = 1600 tile meshes
25 * 64 = 1600 materials
up to 25 * 192 = 4800 different textures (only theoretically! Currently there is no more than 20-30 per chunk and the average across loaded chunk is about 300 textures)
about 6400 matrix operations

The amount of materials does not seem to have a huge impact on performance, but the matrix calculates make the fps drop from ~80FPS to ~12. I could've reduced the matrix operations down to 100 if I could render single chunk as a single mesh instead of 64 submeshes, but I don't see a way to properly pass the textures to shader.

So basically what I need is an approach that would allow me to render terrain chunk as a single mesh and a way to pass different textures for different tile parts of a mesh. Do I even look in the right direction?

sentences:
Improving an O(N^2) function (all entities iterating over all other entities) A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their traits mutate.

Additionally, performance is fine (60fps no problem) when the game is run in real time, but I want to be able to speed it up significantly to not have to wait 4h to see any significant changes. So I want to get it as fast as possible.

I'm struggling to find an efficient method for creatures to find their food. Each creature is supposed to look for the best food that is close enough to them.

If it wants to eat, the creature pictured in the center is supposed to look around itself in a 149.64 radius (its view distance) and judge which food it should pursue, which is based on nutrition, distance, and type (meat or plant).

The function responsible for finding every creature their food is eating up around 70% of the run-time. Simplifying how its written currently, it goes something like this:

for (creature : all_creatures)
{
  for (food : all_entities_with_food_value)
  {
    // if the food is within the creatures view and it's
    // the best food found yet, it becomes the best food
  }
  // set the best food as the target for creature
  // make the creature chase it (change its state)
}

This function is run every tick for every creature looking for food, until the creature finds food and changes state. It's also run every time new food spawns for creatures already chasing a certain food, to make sure everyone goes after the best food available to them.

I'm open to ideas on how to make this process more efficient. I'd love to reduce the complexity from \$O(N^2)\$, but I don't know if that's even possible.

One way I already improve it is by sorting the all_entities_with_food_value group so that when a creature iterates over food too big for it to eat, it stops there. Any other improvements are more than welcome!

EDIT: Thank you all for the replies! I implemented various things from various answers:

I firstly and simply made it so the guilty function only runs once every five ticks, this made the game around 4x faster, while not visibly changing anything about game.

After that I stored in the food searching system an array with the food spawned in the same tick it runs as. This way I only need to compare the food the creature is chasing with the new foods that appeared.

Lastly, after research into space partitioning and considering BVH and quadtree, I went with the latter, as I feel like it's much simpler and better suited to my case. I implement it pretty quickly and it greatly improved performance, the food search barely takes any time at all!

Now rendering is what's slowing my down, but that's a problem for another day. Thank you all!

sentences:
Getting name fragments for a name generator Back again to ask more about name generation -- this time about the dictionary of syllables which I apparently need to reliably generate a name. For reference, my last question.

I've written a little bit of code which, given a file, uses the first line to determine how long the name can be (with multiple options for variability), then builds one from the syllables given in the rest of it. It works decently enough, given example syllables in an example file. For those wanting to try out a set of syllables of their own, I've made a version on Ideone.com. stdin contains the list of lengths and syllables.

That's where I'm having an issue, though. What should I use for the syllables? I've looked around, but I've been unable to find a good list of names to draw from. Maybe it's just that I'm bad at this or something, but I can't really get a good list of syllables that make  names. To add to that, I have to do it by hand, and I'd much rather make a program to split a list of names into syllables, but I can't get that to work. I'll post the source for my attempt once I'm home.

In short, how can I get a good list of syllables for use in a name generator? Is there pre-existing code I can use or modify and pass it a list of names to chop into syllables, then save those to a file? If not, how would I go about writing my own?

sentences:
Matcap and BRDF Shading I just would like to know what's the difference between the Matcap shaders used in ZBrush for example and the Bidirectional Radiance Distribution Function shader.

Are there two techniques the same ? Is Matcap done using BRDF or are they different ?

sentences:
How can I get the normal vector for a plane from a set of vertices? I'm working on a HLSL / C++ little project to going over my graphics work, and I am unsure how I am to get a facing vector from a vertex polygon. I can't seem to find the formula.

The positions are P1, P2,P3

Let's call them class VertexPoint with P1.x, P1.y, P1.z for example?

sentences:
How to make my characters turn smoothy while walking on a path(list of coordinates)? I have a list with coordinates - output from A* algorithm - and I would like to make my characters smoothly follow this path with rotations.

So I have something like A and I want to get C

How can I do this ?

EDIT

To make myself a little bit more clear:

I am more interested in smooth turning as I already know how to walk from one node to another.

EDIT

As many people find this useful (me too) I am posting link to Daniel Shiffman's "Nature of code" where he discusses a lot of game AI (and physics) problems e.g. steering behaviours http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section8

sentences: No RenderWindow class in SFML? In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no RenderWindow in sf::  . I  copy-pasted the code but it still does not works. What could possibly be the  reason behind this ?

sentences: Is it possible to load asset bundle dependencies manually in Unity 5.0? Is it possible to tell Unity to not load asset bundle dependencies automatically so they can be loaded manually. If so, how can this be done?

sentences: Linux Game Development Resources Do you have any Linux-specific game development resources?

sentences:
Orthographic camera produces strange results I've created a basic orthographic camera using the following view projection matrix:

2 / (right - left), 0, 0, -((right + left) / (right - left)),
0, 2 / (top - bottom), 0, -((top + bottom) / (top - bottom)),
0, 0, -2 / (zFar - zNear), -((zFar + zNear) / (zFar - zNear)),
0, 0, 0, 1

where right = 1280, left = 0, top = 0, bottom = 720, zFar = 1.0 and zNear = -1.0

The matrix gets used in the glsl shader like below:

layout(location = 0) in vec3 a_Position;
layout(location = 1) in vec2 a_TexCoord;

uniform mat4 u_ViewProjection;
uniform mat4 u_Transform;

out vec2 v_TexCoord;

void main()
{
    v_TexCoord =  a_TexCoord;
    gl_Position = u_ViewProjection * u_Transform * vec4(a_Position, 1.0);
}

where the u_Transform uniform is passed a simple identity matrix.

And I have declared a default rectangle that I am trying to get to the middle of my screen:

    float vertices[] = {
        // positions         // texcoords
         0.5f,  0.5f, 0.0f,  1.0f, 1.0f,   // top right
         0.5f, -0.5f, 0.0f,  1.0f, 0.0f,   // bottom right
        -0.5f, -0.5f, 0.0f,  0.0f, 0.0f,   // bottom left
        -0.5f,  0.5f, 0.0f,  0.0f, 1.0f    // top left
    };

This results in the folowing image showing a single diagonal line:

The strange thing is that if I upscale the rectangle coordinates to the following:

        float vertices[] = {
        // positions         // texcoords
         1.0f,  1.0f, 0.0f,  1.0f, 1.0f,   // top right
         1.0f, -1.0f, 0.0f,  1.0f, 0.0f,   // bottom right
        -1.0f, -1.0f, 0.0f,  0.0f, 0.0f,   // bottom left
        -1.0f,  1.0f, 0.0f,  0.0f, 1.0f    // top left

It shows a full rectangle like below:

Expected result: In both cases it should show a rectangle, with the second rectangle being larger.
Actual result: The first case doesnt even produce a rectangle, while the upscaled coordinates do show a rectangle.

My question: Is the problem in the math, and if so, what causes this behavior or should this be the expected result and am I wrong in my understanding of the model view projection matrix.

sentences:
Where would I find C# flocking tutorials? Been looking for a while now and finding it difficult to find a good tutorial...

Where would I find a good tutorial on how to implement flocking in a C# XNA game? Something easy to understand .. for beginners!

Cheers!

sentences:
Game Messaging System Design I'm making a simple game, and have decided to try to implement a messaging system.

The system basically looks like this:

Entity generates message -> message is posted to global message queue -> messageManager notifies every object of the new message through onMessageReceived(Message msg) -> if object wants, it acts on the message.

The way I'm making message objects is like this:

//base message class, never actually instantiated
abstract class Message{
  Entity sender;
}

PlayerDiedMessage extends Message{
  int livesLeft;
}

Now my SoundManagerEntity can do something like this in its onMessageReceived() method

public void messageReceived(Message msg){
  if(msg instanceof PlayerDiedMessage){
     PlayerDiedMessage diedMessage = (PlayerDiedMessage) msg;
     if(diedMessage.livesLeft == 0)
       playSound(SOUND_DEATH);
  }
}

The pros to this approach:

Very simple and easy to implement
The message can contain as much as information as you want, because you can just create a new Message subclass that has whatever info necessary.

The cons:

I can't figure out how I can recycle Message objects to a object pool, unless I have a different pool for each subclass of Message. So I have lots and lots of object creation/memory allocation over time.
Can't send a message to a specific recipient, but I haven't needed that yet in my game so I don't mind it too much.

What am I missing here? There must be a better implementation or some idea that I'm missing.

sentences:
WinAPI SwapBuffers and Threads I'm trying to use a different Thread for the whole WinAPI-Message-Loop stuff, so the window always keeps being responsive. Of course I'm using the main thread as the "window thread", because I need a context before loading textures etc. and I can't just call Get/PeekMessage for a different thread.

Now there are a few things I'm wondering about though:

Can I use the OpenGL context handle from a different thread? I'm relatively sure I can since otherwise there would be no way to do multi-threaded rendering, but maybe there's more to it.
At some point I have to call SwapBuffers() from inside the render loop - that means in this case, from a different thread. Can I just use the HDC I usually use? Is this handle thread-safe? I'm not so sure about that, but I can't really find a definitive answer on the subject.

If the answer is no, what would be a good method to deal with the issue? Maybe I can send a message from the render-thread?

sentences:
Limit position rigidbody How can I limit the position of a rigidbody, between two values if I use this code:

public Vector3 dir;

Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    rb.velocity = new Vector3(0f, 0f, 6f);

    rb.AddForce(dir * 1f, ForceMode.VelocityChange);
}

If I use Vector3.Clamp then the object will shake

sentences:
2D Drag Racing Algorithm What algorithm can I devise for a 2D drag racing game to simulate a race?

The gameplay is 2D and the camera's perspective is from the right side of the cars i.e. cars are seen from their right side in the game. This means that the cars travel in a horizontal line, from left to right till they reach the finish line.

There can be many participants in the race however the algorithm must not be affected by the number of participants in a race. It must work for any and every car given the stats of that car and other race-time driving info e.g. the time of a gear shift, good shift, perfect shift, over rev, etc.

To rephrase my question I am just asking for an algorithm which simulates the car motion/velocity along a straight line according to the stats the car has and according to the way the driver shifts up/down and revs a car.

A car can have many stats. Some I thought of including in the game are:

General stats

Top speed (mph)
Acceleration (can be represented by just a number)
Power (bhp)
Weight (lbs)
Grip (can be represented by just a number)

Tuning stats

Nitrous duration vs. nitrous power (can be represented by just a number)
Final drive (can be represented by just a number)
Gear ratio for each gear (can be represented by just a number)
Tire pressure (can be represented by just a number)

Upgrading a part will usually vary these stats.

Each participant is able to shift up or down but once the race starts acceleration is automatic. Players will be able to choose from automatic and manual acceleration in a later release; for this release the acceleration is automatic. Players must only worry about gear shifting in a race. And outside a race players must worry about changing, upgrading and/or tuning their cars.

Also, the game is multiplayer on a single system and not on a network. That is, the kind of multiplayer we have on consoles with two controllers. No LAN/WiFi networking is involved so we don't have to worry about network lags. Actually, I'm developing the game for Sifteo Cubes.

If a single player plays the game we then have AI opponents. We can have any mix of human and AI players in a race as long as their number is within the capacity supported by that race.

Right now I am trying to build a prototype so this must be all there is to the game. However, the game will keep evolving after the prototype. It will even keep on evolving after its release; in the form of updates and sequels.

Any ideas from the gamedev community to make this game better or add/remove features are gladly welcome.

sentences:
How do I draw a circular portion of a texture within LibGDX using an OpenGL ES shader? What is the simplest way to implement a shader to draw a circular portion of a full screen texture where the circle is dynamically resized as part of an animation using LibGDX?

Is a shader even the best place to do this kind of thing?

I'm sure you could do this in software using a Pixmap but that would be slow. In the end I managed to get something working using the OpenGL depth buffer, a ShapeRenderer to draw a circular mask and a SpriteBatch to draw the texture but it feels messy and awkward.

sentences:
Predictive firing (in a tile-based game) I have a (turn-based) tile-based game, in which you can shoot at entities.

You can move around with mouse and keyboard, it's all tile-based, except that bullets move "freely".

I've got it all working just fine except that when I move, and the creatures shoot towards the player, they shoot towards the previous tiles.. resulting in ugly looking "miss hits" or lag.

I think I need to implement some kind of predictive firing based on the bullet speed and the distance, but I don't quite know how to implement such a thing...

Here's a simplified snip of my firing code.

class Weapon {

public void fire(int x, int y) {
  ...
  ...
  ...
  Creature owner = getOwner();
  Tile targetTile = Zone.getTileAt(x, y);

  float dist = Vector.distance(owner.getCenterPosition(), targetTile.getCenterPosition());

  Bullet b = new Bullet();
  b.setPosition(owner.getCenterPosition());

  // Take dist into account in the duration to get constant speed regardless of distance
  float duration = dist / 600f;

  // Moves the bullet to the centre of the target tile in the given amount of time (in seconds)
  b.moveTo(targetTile.getCenterPosition(), duration);

  // This is what I'm after
  // Vector v = predict the position
  // b.moveTo(v, duration);

  Zone.add(bullet); // Now the bullet gets "ticked" and moveTo will be implemented
  }
}

Movement of creatures is as simple as setting the position variable.

If you need more information, just ask.

sentences:
How to draw connecting lines in plain color? Since there is no option for flat shading in OpenGL ES2, is there a workaround to disable the color interpolation when different color is being passed to each of the vertices?

Update:
I'm working with OpengGL ES 2.0 in android. I'm given with these vertices which I used to draw shapes by connecting them with lines. Now I need to change color of each of these lines individually. I tried passing a color matrix for each vertex through vertex shader to fragment shader but the color gets interpolated (which actually makes sense, since I'm giving different color to two vertices). I did some googling about that and found out glSmoothShader cannot be disabled in OpengGL ES.

Is there a way to color those lines without the colors getting interpolated?

Or is there a way to use multiple triangles to draw a line between two vertices that way i can flat color each of those triangles.

sentences:
Creating a custom collider shape in unity, and performance concerns I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want cone-shaped colliders for point defense to detect and shoot down enemy projectiles in certain areas.

I can do this by creating a custom mesh and importing that for the collider. How much of a performance hit can this cause? If you have 1,000 of these colliders active in a scene with objects flying in and out of them, will I see significant performance reduction compared to just using a spherical collider and dropping the cone idea?

sentences: Would flipping a sprite depending on direction be too inhibitive for modders? For a game I'm making (similar to games like Terraria, Starbound etc.) I want to ensure that the framework is as modder friendly as possible. This leads me to wonder if it would be too inhibitive to modders if I only allowed them to create one sprite, then the game flips the sprite depending on what direction you're walking/facing. The only reason I want to make the game flip sprites is because my file structure is already horrible, and I feel like creating another right/left folder would make the whole think even worse.

sentences:
Why are my Box2D wheels slipping on ground? I have a car, set up in Box2D as a rectangle connected with two wheels using WheelJoints:

The wheels are defined as follows:

    FixtureDef wheelFixtureDef = new FixtureDef();
    wheelFixtureDef.density = 1.f;
    wheelFixtureDef.shape = wheelShape;
    wheelFixtureDef.friction = 0.98f;
    wheelFixtureDef.restitution = 0.3f;

    // wheel joint (only one of the wheels has the motor enabled)
    wheelJointDef.dampingRatio = 0.9f;
    wheelJointDef.frequencyHz = 20.0f;
    wheelJointDef.motorSpeed = 15.4f;
    wheelJointDef.maxMotorTorque = 100.f;

And the ground:

    FixtureDef groundFixtureDef = new FixtureDef();
    groundFixtureDef.density = 0.f;
    groundFixtureDef.friction = 1.0f;

Still, when trying to climb that hill in the picture, the wheels reach a stage where they just keep slipping, and it slides back down.

Why does it slip even though the friction coefficients are set high? How can I make it overcome that hill?

sentences:
Monogames Most efficient way of checking intersections between multiple objects I've created a top-down shooter with multiple objects such as enemy AI (tanks), walls, power-ups etc.

At first I was able to create about 300 AI units which aims to move the player character, checks for collision and shoot a bullet. This bullet also checks for collision on each frame until it encounters an intersection to be destroyed.

I wasn't long after I encountered massive performance issues. I immediately identified that the main performance drop was caused by the collision detection.

Each object's bounds is represented by a rectangle. If this rectangle intersects with any other rectangle the collision event is raised.

I'm currently unsuccessful in deciding what to do to reduce performance, but still maintain all the characters' capabilities. I want to check if the player or AI will collide with any object before it moves to the given location. I also want to check when the bullet collides with any other object.

I'm currently flagging all my objects by using different interfaces. I then created a Dictionary>> (GroupedObjects) Dictionary that filters the objects into different flags where the first type represents the interfaces the object inherited and the second type identifies the object's type. For e.g. I check only the Hostile tanks of type AITank for collision with the bullet. GroupObjects[Hostile][AITank].

I've read that I need to create trees where collision is only checked with all the objects in the current tree.

After a few benchmarks I identified that checking collision between 1 million rectangles uses 38ms on the CPU and checking the distance from a fixed point to 1 million other points take 136ms.

QUESTION

With the benchmarks above in mind, how would I group objects by their range (for e.g. within the screen size) if calculating the distance takes more processing than checking the intersection with a rectangle representing the screen?
What will be the most efficient way to check for collision between objects, meaning the player checks for collision AND the AI tank checks for collision since both of them can't move through the walls? Keep in mind that the AI isn't static and moves on each frame. Also, object A checks for collision between itself and object B and object B checks for collision between itself and object A.
I created an object called CollisionMap that contains points, that represent collision, generated by an image with a specified colour as collision. These points need to be updated every time an object moves and an other object needs to check for collision with this object's CollisionMap (that can contain hundreds of points). I've created this CollisionMap to represent shapes that isn't rectangular or circular so that colliding object will treat each intersection according the shape of the shape. Does this sound possible to process if you have hundreds of objects with hundreds of points representing collision?

I'm new to game dev and I have no idea on what's the most efficient way to check for collision between multiple objects. And for all the algorithms (AABB, Rays) I've seen: it's only for one object or it's still too inefficient...

P.S. I know I typed allot, but I'm trying to explain my problem so that I don't get referenced back to sources I already examined and show what I've tried.

Thanks in advance!

sentences:
Handling a smooth movement over slopes in a worms like game I currently have a worms like game with the worms style pixel perfect terrain destruction. Its working well for pushing things around and watching them fall, but for the players movement it feels like your dragging your butt around rather than sliding around.
The code I use for the moving is the following:

private void tryMove() {

    float travelAngle = getSlopeNormal().angle() + (direction == -1 ? 180 : 0);

    while(travelAngle > 360) travelAngle -= 360;

    Vector2 travelVelocity = new Vector2(1, 1);

    travelVelocity.setAngle(travelAngle);

    Vector2 newPosition = getPosition().add(travelVelocity);

    boolean collision = false;

    for(float r = travelAngle - (float) Math.PI / 2F; r < travelAngle + Math.PI / 2.0F; r += Math.PI / 128){

        int testPosX = (int) (getRadius() * Math.cos(r) + newPosition.x);
        int testPosY = (int) (getRadius() * Math.sin(r) + newPosition.y + getMaximumStepUp());

        if (getMatch().getTerrain().isSolid(testPosX, getMatch().getTerrain().getHeight() - testPosY)) {

            collision = true;

            break;

        }

    }

    if(!collision){
        setPosition(newPosition.x, newPosition.y);
        setVelocity(travelVelocity.scl(3));

    }

}

It works well for 'some' cases but other times feels like the player is always being dragged around and I apply the velocity at the end because otherwise the player can scale down walls 90-degrees. I feel there must be a better solution. I already have multiplayer systems in but with this movement code its causing all sorts of desyncs so I need a more reliable method.

sentences:
Profanity filter for an MMO chat We are developing an MMO using Smartfox Server. The targeted audience is kids from 7 -12 years.

There is a global chat option in this MMO.
Whatever the user types in a textbox get displayed next to users avatar after he/she hits enter.

We would like to filter abusive language / profanities from this chat.
We could capture the chat and read the text. The problem is getting the list of profanities itself.

Our questions are

Where will one get exhaustive list of all profanities?
What method is adopted in similar scenario to filter out these?

sentences:
Hemicube algorithm d3d9 or d3d11, float valued colors The hemicube algorithm renders the scene to 5 sides of a half-cube, from the perspective of each polygon.

Assume you place the hemicube around me and render to the 5 sides.  The idea is, we can see exactly how much of each other polygon in the scene I see, and so determine the amount of light I receive from those respective polygons.

The way I did this before was using DWORD colors, and assign a different (integer) color to each poly, called its id.  This allows for 16M colors using DWORDS.  It worked fine with the fixed function pipeline, because I was able to choose D3DDECLTYPE_D3DCOLOR in the vertex declaration, render to texture, and tally up the polygon coverage counts.

Now that I've switched over to shaders, I can't seem to make DWORD colors work anymore.  All that works is 3x 32-bit float-type colors (I am using Cg, so float4's.)

Is there a way to force D3D9 or D3D11 to use integer colors in a shader, and if not, how can I guarantee the colors I choose as "ids" for the respective polygons will end up being distinct colors in the texture I render to?

sentences:
Quality deterioration on a device I am using Unity. When I try the game out in the IDE everything looks pretty good:

But when I am trying to play the same game on a device the quality becomes a great deal worse and you can see it for yourself:

I am using Xiame Redmi 4X and I do not think that it is because of device.

So, how can I fix it? How can I preserve the quality?

I would like to try out this solution, but there is no Android settings in my Inspector for quality:

I would like to preserve at least colors.

And here are setting for my player sprites:

sentences:
How can I obtain the file size of a Unity build at runtime? I'm wondering if it is possible to obtain the filesize of a game's build at runtime.
Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.

sentences:
Why does my Win32 call, contained in a class method, fail? Using a Direct3D Tutorial, I took the knowledge and encapsulated it into a class. The code builds in MSVC 2010 fine, and I've handled all compiler warnings pertaining to my project with the highest warning levels. When stepping through the code from the entry point, the program fails to RegisterClassEx(&wc). After which, the program is told nicely to exit. Shortly after the unique_ptr's destructor is run (not manually, but after the unique_ptr goes out of scope), the program crashes w/invalid memory access.

My WinMain looks something like this:

std::unique_ptr<Engine> j_engine(new Engine);
j_engine->CreateD3DWindow(title, width, height, fullscreen); //public method of Engine, similar to CreateD3DWindow from the tutorial

while(message looping)
{
// etc
}

//if loop is exited, let j_engine fall out of scope (my program has never reached this point)

The start of my CreateD3DWindow method contains VERY standard window creation code, and does not even contain a shred of a Direct3D call prior to the crash (RegisterClassEx()).

It is essentially:

WNDCLASSEX wc;
hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "SomeName";

RegisterClassEx(&wc); // fails. GetLastError() == "Invalid Parameters". Stepping through WNDCLASSEX struct creation doesn't raise any invalid parameter flags.

I've also tried using ZeroMemory() after declaring WNDCLASSEX wc.

Two things register in my mind as I type this:
1. GetModuleHandle() is being called from inside the class, which exists on the heap and is referenced by a pointer from WinMain. Does this matter? Is it providing a valid handle?
2. WndProc declaration and definition is outside the class and outside the namespace of the class. Does this mean WNDCLASSEX.lpfnWndProc cannot see it? As such:

#includes

LRESULT CALLBACK WndProc()
{
}

namespace xyz
{
class Engine
{
}
}

I'm out of ideas and my problem solving capabilities are waning. Any advice? I will certainly provide more information if necessary.

Specifically, I'd like to know why RegisterClassEx() is failing.

Thank you!

***Mentioned below that GetModuleHandle(NULL) will return a global handle for the given process, so the context of this call in this program should not matter.

sentences:
How is an HTML5 game sold? (I know this site doesn't give legal advice, but what I'm dealing here with isn't anything serious at all. Also, I apologize to JP for being annoying over this.)

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

Now, I'm wondering what to do next.

These are the terms:

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

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

sentences:
Powder games: how do they work? I recently found these two gems:

http://powdertoy.co.uk/

http://dan-ball.jp/en/javagame/dust/

My question is: How are the physics with so many elements efficiently handled? Am I just severely underestimating modern computing power or is it possible to 'just' have a two-dimensional array, each cell of which describes what is placed at the according position and simulate each cell in every step. Or are there more complex things being done like summarising large areas of the same kind into a single data set and separating said set as needed?

Are there any open-source games like this I could look at?

sentences:
Using Delta for a stopwatch, delta too fast than real time seconds I search for methods to create a stopwatch on libgdx and came across with this:

public void trigger(float delta){

    playTime += delta;
    playTimeRounded = ((double)Math.round(playTime * 100) / 100);
    Gdx.app.log("deltaTime", delta + "");
}

But its not accurate and its much faster. How can i create an accurate stopwatch?

sentences:
2D XNA Tile Based Lighting. Ideas and Methods I am currently working on developing a 2D tile based game, similar to the game 'Terraria'. We have the base tile and chunk engine working and are now looking to implement lighting. Instead of the tile based lighting that terraria uses, I want to implement point lights for torches, etc.

I have seen Catalin Zima’s shader based shadows, and this would be perfect for the torches (point lights). My problem here is that the tiles on the surface of the world need to be illuminated, doing this by a big point light is firstly extremely expensive, but also doesn't look right.

What I need help with (overall) is...

To have a surface that is illuminated regardless of torches, etc.
To also have point lights, or smooth tile lighting similar to Catalin Zima’s shader based shadows.

Looking forward to your replies. Any ideas are appreciated.

sentences:
Should I use Coroutines to change variables in inspector smoothly? I want to change the aperture of the depth of field in the camera smoothly by using Mathf.SmoothDamp and a Coroutine, however, since I'm new to game development, I don't know if this is the right way to do it. Any suggestions?

Code:

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;

public class GameStartController : MonoBehaviour {
    public Button startButton;
    public GameObject cubeSpawner;

    // Use this for initialization
    private void Start() {
        startButton = startButton.GetComponent<Button>();
    }

    public void StartGame() {
        EnableCubeSpawner();
        SpawnStartingCubes();
        HideStartMenu();
        StartCoroutine("FocusCamera");
        PlayBackgroundMusic();
    }

    // Enables the cube spawner, so it can start spawning cubes
    private void EnableCubeSpawner() {
        cubeSpawner.SetActive(true);
    }

    private void SpawnStartingCubes() {
        cubeSpawner.GetComponent<CubeSpawner>().GenerateStartingCubes();
    }

    private void PlayBackgroundMusic() {
        var audio = GameObject.FindWithTag("Audio").GetComponent<AudioController>();
        audio.PlayBackgroundMusic();
    }

    private void HideStartMenu() {
        startButton.transform.parent.GetComponent<CanvasGroup>().interactable = false;
        startButton.transform.parent.GetComponent<CanvasGroup>().alpha = 0f;
    }

    private IEnumerator FocusCamera() {
        var camera = GameObject.FindWithTag("MainCamera").GetComponent<Camera>();
        var velocity = 0f;

        while (Mathf.Abs(camera.GetComponent<DepthOfField>().aperture) > 0.001f) {
            Debug.Log(Mathf.Abs(camera.GetComponent<DepthOfField>().aperture));

            camera.GetComponent<DepthOfField>().aperture = Mathf.SmoothDamp(camera.GetComponent<DepthOfField>().aperture, 0f, ref velocity, 0.3f);
            yield return null;
        }

        camera.GetComponent<DepthOfField>().aperture = 0f;
    }
}

sentences: What's the recommended bitrate for Background Music in iPhone Games? What is the recommended bitrate for Background Music in iPhone Games?

sentences:
Hobbyist game dev, want to create async multiplayer game. Are server costs manageable? I want to make the game I want to play, and that game happens to be an asynchronous multiplayer game. Think Hero Academy or Hearthstone, where there are 2 players and each submits moves to a central server. Alternatively (and not ideally), clients connect to each other and play is limited to a fixed window of connection, but still there needs to be a central server to acquire new opponents.

That said, this is very much going to be a hobby type endeavor - I'm just one guy after all. This is not going to commercially support itself. If I have 100 players ever, that would be fantastic.

Given that I'm going to have to eat server costs myself, what are my options for getting a server? I don't need much bandwidth or CPU, due to the nature of async games - only the sending of the gamestate/current move, and perhaps some checking of legal moves. Going to Amazon or getting dedicated hosting seems drastically overkill for what I want.

If it makes a difference, I'm intending to learn and use Unity for this.

sentences:
Would it perform faster to split calculation between vertex and fragment shaders? Assuming the total amount of computation would be the same (at least as far as my code goes), would there be any performance increase in splitting the calculation and using separate vertex and fragment shaders vs. doing all the calculations in just a fragment shader?

In my use case, I would not be using vertex shaders as they are typically intended (so, not processing actual vertices). I just thought if the GPU hardware is set up such that the pipeline is expected to be used, would it be better to take advantage of that, or would it be just as fast to put it all in a fragment shader. Conceptually, it would be simpler to just use the fragment shader.

Note, that I do need a lot of data going to the fragment shader that is updated every frame (eg. texture buffer object).

sentences: Shear transformation in the projection matrix? I am trying to understand what the shear transformation (l+r/r-l & b+t/t-b) is actually doing in the projection matrix? The only thing I got till now is headache :) Can you please help?

sentences:
Which data structure should I use for  dynamically generated platforms? I'm creating a platform type of game with various types of platforms. Platforms that move, shake, rotate, etc. Multiple types and multiple of each type can be on the screen at once. The platforms will be procedural generated.

I'm trying to figure out which of the following would be a better platform system:

Pre-allocate all platforms when the scene loads, storing each platform type into different platform type arrays( i.e. regPlatformArray ), and just getting one when I need one.
The other option is to allocate and load what I need when my code needs it.

The problem with 1 is keeping up with the indices that are in use on screen and which aren't.

The problem with 2 is I'm having a hard time wrapping my head around how I would store these platforms so that I can call the update/draw methods on them and managing that data structure that holds them. The data structure would constantly be growing and shrinking. It seems there could be too much complexity.

I'm using the cocos2d iPhone game engine.

Anyways, which option would be best or is there a better option?

sentences:
How to create custom gravity in unreal engine and only affect specific actors? I am fairly new to unreal engine and I would like to know how to set custom gravity in a specific point or area instead of down. For example I do not want the gravity pull to be down but more to the center of my level (center plane not center point) and that gravity to only affect specific actors. Other actors will be affected by normal gravity or affected by no gravity at all.

How can I do this? (blueprints or c++)

sentences: How forward rendering done using OpenGL? Recently I come across the term forward rendering. I'm kind of curious how this could be done in OpenGL. I have done a lot of search on this, majority of the result I get are on theory but not code implementation. May I know is there any code implementation on OpenGL for this rendering technique?

sentences:
Profiling unity games on Android devices I would like to profile our Unity mobile game on Android devices in a way similar to profiling Unity games on iOS with Instruments.

I am aware of how to do this using Unity's profiler, I would however like to use a third party profiler for the following reasons:

to validate Unity's profiling data
to have more visibility into how the app is running, including Unity's functions, etc.
the largest lag spikes cause unity's profiler to run out of samples. I'm however very interested in precisely these spikes
I'd like to have profile data for longer periods than unity records for
I'd like to do analysis over time (not just detailed data for each frame, but also aggregated over a time span)

Essentially I'd like as much visibility as possible to make Android on-device profiling as comprehensive as possible. As close to Instruments on iOS as possible.

So far I've tried with DDMS, but could only get visibility into Andoid OS functions and seeminly nothing in the actual apk - at least nothing I recognised. I tried with mono2x and il2cpp, with all debug features that I'm aware of in build and player settings enabled.

The game is developed with Unity 5,4 with Mono2x.

All help is appreciated. I've listed my intents above, so even if profiling on device is not possible in this way on Andoid, alternate solutions to the listed intents are still very appreciated. Thanks!

sentences:
Dealing with multiple 2d sprite animations for the same object I am using libGDX for a 2d game. Some of my in-game objects have animations, for example a soldier in top-down view that has a walking animation. That is working fine.

Now, while walking, this soldier could do other things as well, for example firing his gun. So both, walking and firing, can happen at the same time.

My question now is: How does one usually deal with these multiple simultaneous animations for the same object? Do I need different animations (one for just walking, one for just shooting, and one animation for both at the same time), or do I rather split the object into several sprites (eg. the soldier's body separated from his arm with the gun), to animate these parts separately? Or is there even another way to achive this?

sentences:
Movie clip in a button changes on hover I have a button for my game which has a MovieClip in it. It consists of an image of a lock and an image of an item, representing the item being locked and unlocked. I make the button become slightly smaller when the mouse is over it to create the effect of a button slightly down.

For some reason, however, this makes the MovieClip in the button go to the next frame. I have no Actionscript code in the button or any frame except stop() on the first frame of the MovieClip, so I really don't understand why this would happen. It only goes to the next frame when I hover my mouse over the button and then quickly goes back to the first frame (since there's no stop() in the second frame).

After experimenting with stop() in both frames of the movie clip, it does indeed only happen when my mouse enters the button. Leaving the button doesn't do anything and the button left alone doesn't do anything. It just changes the frame when I hover my cursor over it. There's absolutely no script involved aside from stop() in the first frame of the movie clip in the button. What could be the cause of this problem?

sentences:
How to make a 2D Terrain with opengl? I want to make a simple 2d terrain with just a few bumps and height changes:

I thought about just using random numbers to describe the height of a certain vertex, but I don't see how I can make one mesh from this. I'm looking for a way to find the vertex and indices buffers for the terrain.
How do I do this?

sentences:
Image target display in unity Vuforia I am using unity 4.5.1f3 and using the Vuforia sdk 5.0.5.I have downloaded the sample project from the Vuforia site.When I tried to run the sample of Imagetarget project,it asked to add license key.Then I added licensed key to the app.Then when I runned the project again its showing me and error

MissingMethodException: Method not found:   'UnityEngine.Behaviour.get_isActiveAndEnabled'.
Vuforia.VuforiaAbstractBehaviour.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState)
Vuforia.VuforiaAbstractBehaviour.Update ()

The Image marker detection can run but the camera video doesn't show in the background.
can anybody help me solving the issue?

sentences:
Camera Movement Smoothing I am trying to smooth a camera I create in my game, but I can't seem to find a way to actually do this correctly.

What I have :

//Calculate the "current" Forward vector
var cameraForward =
    -Vector3.Cross(-Self.forward, target.up)
    .normalized.Cross(target.up).normalized;
//Rotate the camera on the Y axis of the current target,
// and X Axis based on delta.y and CurrentVerticalLook
cameraForward =
    Quaternion.AngleAxis(delta.y, ViewTarget.transform.up) *
    Quaternion.AngleAxis(CurrentVerticalLook, Self.right) * cameraForward;

var offset = cameraForward * CameraDistance;
var pos = LookAt + offset;
Self.Position = pos;
Self.transform.LookAt(ViewTarget.position)

So what I ahve tried :

I tried Lerping the Vector Position, I tried smoothing the delta.y based on the last N frames.

The Camera I need is something like this :

Rotate on the Around UP Axis of the target and Rotate on Right Axis of the Camera, Camera Up is always = to Target UP.

So this is sort of Orbital Camera, but I am having trouble finding the correct rotation/operations.
The way its set right works, but the camera movement is jaggy, but I can't seem to find a way to add Slerp in there without messing everything.

Thanks!

Edit :
<>

sentences:
How to resolve combat of stacks of units to mitigate numerical advantage I just started designing an strategy game where player's armies consist of stacks of units. For my design I was aiming to reproduce the following behaviour for a full combat of multiple turns (for simplicity assume both stacks are the same unit):

1 vs full stack: the single unit is killed, the full stack hardly notices.
half stack vs full stack: the half stack is killed, the full stack sustain noticeable damage.
almost full stack vs full stack: full stack wins but gets almost wiped out. If randomness is involved, any of both may win, although the bigger one has statistical advantage.

My first approach was to add up the stats and treat each stack as a single unit, resolve the combat and then calculate how many units are killed.

That didn't produced the expected results, as even the slight numerical advantage in one side produced it to win by a huge margin.

The reason is that after each turn, the bigger stack would kill more enemies than the smaller, widening the power difference for the next turn. This different increases exponentially until the smaller stack is quickly obliterated.

As a second approach I treated each unit in a stack individually for the combat (something that I wanted to avoid), which produces much better results. However now I have many choices about how to resolve the combat.

Should it be a series of 1 vs 1 or should I allow units to gang up on others?

Should I pair each evenly or randomly?

Should I leave extra units unpaired as "reserve", or all units should fight at least once?

sentences:
C# XNA4 2D Collision Detection I am working on a 2D engine in Xna and am running in a bit of trouble with Collision implementation.
What I want to do is have an interface ICollidable that I can add to GameObjects that are collidable.
I am trying to get it to work by using this awnser: https://gamedev.stackexchange.com/a/40432/33751

My question is how do I add the objects that use ICollidable to the List in the CollisionManager dynamically?

By case would be that the manager 'sees' what objects use the ICollidable interface and automatically add it to the list.

Second question is, how can I get the properties and stuff from the objects that contain the interface to actually preform the collision detection in CollisionManager? would a simple cast suffice?

ICollidable:

interface ICollidable
{
    void onCollision(ICollidable other);
}

CollisionManager:

class CollisionManager : GameObject
{

    private List<ICollidable> collidables = new List<ICollidable>();

    public CollisionManager(Game game)
        : base(game)
    {
        game.Components.Add(this);
    }

    void addCollidable(ICollidable obj){
        // This function needs to be called when ICollidable is inherited dynamically
        collidables.Add(obj);
    }

    public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
    {
        base.Update(gameTime);

        for (int i = 0; i < collidables.Count; i++)
        {
            for (int a = i + 1; a < collidables.Count; i++)
            {
                if(collision(collidables[i], collidables[a])){
                    collidables[i].onCollision(collidables[a]);
                }
            }
        }

    }

    private bool collision(ICollidable obj)
    {
        // How can i get obj's properties etc for checking collision.

        return false;
    }
}

PS. Never worked with interfaces in c# before, if I am doing it completely wrong, please let me know

Thanks in advance.
Yme-Jan

sentences:
XNA SoundEffect won't stop playing For my HND I've got to re-create Frogger, and everything was going swell until I tried adding some collision detection and sound. Whenever my player intersects a vehicle, the sound file just starts playing with every game update instead of just once.

Here is my code from the update method:

            if (vehicles[count].bbox.Intersects(playerSprites[lives].bbox))
                playerSprites[lives].isDead = true;
        }

        if (playerSprites[lives].isDead)
        {
            deathSound.Play();
        }

The sound is declared as a SoundEffect, loaded as a SoundEffect, and the content processor is set to Sound Effect, and as far as I can tell, Sound Effects in XNA are only meant to be played once.
What am I doing wrong??

sentences:
Boundaries in game development: How do “professionals” do it? How do professionals do boundaries in a 2D game? The way I do is say I don't want the sprite to move into a certain area:

//Example
if ((playerPosX >= 825) && (playerPosX  <= 910)&& (playerPosY >= 170) && (playerPosY <= 255)) {
    //do nothing
}else{
    //move
}

But some games out there have a lot of boundaries so I'm wondering, is there an easier way. I don't think there is any way someone would use the above method throughout a whole game, just to block of movement.

EDIT:
My question is mainly regarding a game where you can walk around, similar to Pokemon or final fantasy

sentences:
What Do I Pass for inputGeometryTransform Parameter of ID2D1Geometry::CompareWithGeometry? I have a list of ID2D1Geometry objects and I'm trying to use CompareWithGeometry to detect collisions in Direct2D; unfortunately, I'm not getting the results I need.  I suspect I am improperly using the inputGeometryTransform parameter.

If I pass in D2D1::Matrix3x2F::Identity() or nullptr for this parameter, I almost always get D2D1_GEOMETRY_RELATION_CONTAINS (3) or D2D1_GEOMETRY_RELATION_IS_CONTAINED (2) results back for the returned D2D1_GEOMETRY_RELATION.  On the other hand, if I try and pass in the product of the scale and translation matrices that I used to generate the primary geometry, then I never get collisions.

Can someone help me understand what I need to pass in for the inputGeometryTransform parameter?

The source code that I believe to be relevant appears below:

// This is Shawn Eary's broken code and it is licensed 2012 under the
// Microsoft Public License (Ms-PL) which is compatible with the
// Open Source Initiative
//
// Shawn Eary is not affiliated with Microsoft.
// He just likes the Ms-PL
void SpaceObject::updateDynamics(
    Microsoft::WRL::ComPtr<ID2D1DeviceContext> const i_d2dContext,
    D2D1::Matrix3x2F const & tranformMatrix)
{
    D2D1_SIZE_F renderTargetSize = i_d2dContext->GetSize();
    float const worldWidth = renderTargetSize.width / 2.0f;
    float const halfWorldWidth = worldWidth / 2.0f;
    float const worldHeight = renderTargetSize.height / 2.0f;
    float const halfWorldHieght = worldHeight / 2.0f;

    // Update the position in ideal coordinates
    double idealX = m_p.x + m_v.x;
    double idealY = m_p.y + m_v.y;

    // Account for wrap around
    m_p.x = getWrappedResult(idealX, worldWidth);
    m_p.y = getWrappedResult(idealY, worldHeight);
    m_p.theta += m_v.theta;

    m_v.x += m_a.x;
    m_v.y += m_a.y;
    m_v.theta += m_a.theta;

    // Compute results of elastic collisions
    for (list<SpaceObject *>::iterator it = m_myObjectWorldP->begin(); it != m_myObjectWorldP->end(); it++) {
        SpaceObject * const SOP = (*it);

        // This eventually needs to be fixed, but for now assume all
        // spaceObjects are GeometrySpaceObjects
        GeometrySpaceObject * thisGSOP = dynamic_cast<GeometrySpaceObject*>(this);
        GeometrySpaceObject * currentGSOP = dynamic_cast<GeometrySpaceObject*>(SOP);

        // Don't compare this SpaceObject with itself
        if (thisGSOP != currentGSOP) {
            ID2D1PathGeometry * const thisGP = thisGSOP->gGeoP();
            ID2D1PathGeometry * const curGP = currentGSOP->gGeoP();
            D2D1_GEOMETRY_RELATION theRelation;
            thisGP->CompareWithGeometry(
                (ID2D1Geometry *)curGP,
                tranformMatrix,
                &theRelation
            );
            if (theRelation != D2D1_GEOMETRY_RELATION_DISJOINT) {
                // A Collision has occured.
                //
                // Use conservation of momentum to update
                // velocities after collission here
                int placeHolder = 0;
            }
        }
    }

    this->updateAcceleration();
}

Note: At the time I asked this question, the documentation I found on the MSDN site was a bit unclear regarding the inputGeometryTransform Parameter.  The documentation I viewed was visible at this URL: http://msdn.microsoft.com/en-us/library/windows/desktop/dd316638(v=vs.85).aspx

sentences:
Is the statement in Scratchapixel about transforming points correct? I am reading this lesson from scratchapixel. To my understanding (and the example given in the same website) M is the matrix that transforms from local to world.

Giong through the paragraph before figure 7, though, I get the following:

  If we know the 4x4 matrix M that transforms a coordinate system A into a coordinate system B ...

Say A is the local coord system and B is the world coord system. Therefore M transforms from local to world.

  ... then if we transform a point whose coordinates are originally defined with respect to A with the inverse of M (...), we get the coordinates of P with respect to B.

We know, A = local coord system. The Plocal = local point coords are (-0.5, 0.5, -0.5). Then, as the quoted text says, we transform Plocal with the inverse of M to get the point w.r.t. to B = woorld coord system

However, this last operation (statement) confuses me, since the example they give the do Pworld = Plocal * M. But from the quoted text I understand that Pworld = inv(M) * Plocal

Can someone help me figuring out what am I missing? Is the wording of the text wrong?

sentences:
Lag compensation in rocket game context I have read a lot of papers recently to understand the lag compensation concept recently. They were all about the same context: shooter game where bullets move in infinite velocity.

The most important thing is checking what was in the crosshair when the client created the fire command. If another player was there at that time, then s/he's damaged. That is done by checking the world state at that time by finding a snapshot and executing commands until the fire command.

How about firing a rocket? That is slow (not to mention other differences: ignition time and area damage). That means, I cannot only check what was on the crosshair of the client at the command creation time.

If I go back and check the world state at that time (with same method above), it wouldn't be enough. I would still need to do the simulation for the next snapshots until the most recent one (server's present).

That would mean, if I have a time step of 15ms (tick rate = 66) and I want to discard a command if it is older than 1.5 seconds, I need to keep the most recent 100 (1500/15) snapshots of the world. And every time a delayed command comes, I have to re-simulate the world from that command's timestamp to present - including reprocessing the commands with timestamps after that one.

This sounds too much work on the CPU to me. Is this the same in the first scenario (infinite speed bullet)?

What about lag compensation for movement commands? Would that be different?

Or did I misunderstand something / many things?

sentences: How to detect collision position and that position's texture color in Unity? I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?

sentences:
Setting up openGL on Linux I am trying to figure out how to set up openGL on Linux based operating systems (Ubuntu 12.10) without using any *GLUT libraries. I don't have much experience with developing on Linux distributions.

To be more precise I'm trying to make a statically linked library that compiles on the three major OS flavours (using some preprocessor macros to figure out the os its being compiled on and switch up renderer code, window creation code etc).

On windows I have successfully created a openGL 4.0 rendering context using wglCreateContextAttribsARB and the GL/gl.h provided by mingw.

On Ubuntu I have managed to create a openGL 2.2 rendering context using glXCreateContextAttribsARB and the GL/gl.h provided by mesa3d. This was however in a VMware Ubuntu VM and so mesa(9.0.2 I believe) would only manage to go that far with a virtual graphics card.

So I decided to go ahead and install Ubuntu on a external HDD to take advantage of the graphics card only to later find out that mesa(9.1) can only go up to openGL 3.1. After  a little bit of research I figured out that the AMD and Nvidia drivers have support for openGL 4.3. So I installed the AMD 13.1 drivers (I have a Sapphire 7970 vapor-x 6GB) but then the openGL header files that come with it are really strange, GL/glATI.h tries to include windows.h, it doesn't define APIENTRY etc.

The question is whats the proper way of setting up openGL (with 4.3 support) for Linux? And even if the GL/glATI.h files were proper, wouldn't they fail if ran on a Nvidia card?

I'm manually creating the window with XCreateWindow and then I'm loading the extensions with glXGetProcAddressARB so I'm not going to use GLUT or any GLUT-like library.

sentences:
Why are shadows not snapping to the objects? I'm using a directional light in Unity to cast shadows. However, the shadows don't appear to be "snapped" to the objects creating them. The object appears to be floating in mid air while it actually isn't.

How do I "snap" the shadow to the objects so it looks like it's actually on the ground?

sentences:
Why are spherical worlds so rare? I remember back in the 90s when X-Com came out, being really impressed by the way its world map was an actual world: a map of Earth drawn on a spherical surface.  That was pretty cool, because I had never seen it before.  And now, thinking back... I can't recall just off the top of my head ever seeing it again, with the obvious exception of X-Com: Terror From The Deep, which used the same engine.

Most games that have an entire-planet world map either use a rectangle that wraps around at the sides but not the top and bottom (a cylinder), or a rectangle that wraps around at all four edges (an impossible geometry that some people call a "torus", even though it can't actually represent a real torus.)  And that makes me wonder why.

What difficulties does attempting to build a spherical world map for a video game raise, that it's so incredibly rare to actually see it done?

sentences:
Calculate point of circle–circle collision between frames I need to find the exact XY coordinate where a circle collides with another circle calculated between frames. This means that I take the coordinate of the moving circle on the previous frame and take its coordinate on the current frame. Then I need to find the position where the circle collides some time along this line segment.

In the diagram below, the blue circle moves from the previous frame (upper) to the current frame (intersecting, lower). During this time it would have hit where the dashed circle is. I need to find the coordinate of the green point.

Also note that it may be possible for the blue circle to entirely pass through the red circle. There would then be two points, so the first must be used.

sentences:
How can I detect that the mouse is over a button so that I can display some UI text? I have a scene, where a panel containing 24 buttons. I need to show some piece of text when hover a mouse cursor over the button. For example, for detecting clicks, I'm using onClick event trigger, but I can't find anything related to something like a onHover event. I have Googled and read the docs, but could not find anything. Can anybody help me with that?

Code:

var button = panel.GetChild(0).GetComponent<Button>();

sentences:
Restrict object movement inside irregular shaped container I want to restrict object movement inside an area. My object follows cursor position.

I have already done that for the area border using Mathf.Champ to the translate because the borders are square shaped (got the idea from Unity: Restrict movement inside a gameobject (2D)). The thing is that inside the box area there can also be other shapes (colliders) which I don't want my object to go over.

I know people suggest using physic collisions, but my game needs a unit perfect positions so I can't use physics due to physics' default contact offset (the one physics use to detect collisions).

Here is a short video of what I have:

https://gfycat.com/cookedsmartannelid

As you can see, movement is restricted (clamped) inside the box area but I want the movement to also be restricted to not go over the black area.

Is there a way to be able to do this with just clamping or do I need a raycast system or something like that?

sentences:
Changing the current state of an entity in the middle of an update step or wait for the end? Let's say that I use a behaviour component that holds a function call to be called every update step assigned to an entity. Inside that function call I'm changing the active state for the entity to activated or deactivated, something like this:

void fun_update() {
 this_entity->set_active(true);
 if (this_entity->is_active()) { // This should return true or false?
  ....
 }
}

What would be more correct? To change the state for the current update iteration or wait for the end of the current update step to update the state of the entities?

I know that, unity3d for example, changes the current state, but when coding my own engine I find easier to update it at the end.

sentences:
Orbiting a camera around the Y axis whilst remaining up I've been having difficulty with a problem which I thought was going to be a simple solution.

I have a camera facing downwards on a character. The can camera be lowered and when it's lowered it remains the same distance away from the character that it was (basically rotating around the X axis of the target). Now what I want it to be able to do is spin around the character on the Y axis as well, but to maintain the same distance and to remain upwards all the time. The problem I'm having is that if I do something similar to the way I did it on the X axis everything becomes a mess. First of all it doesn't remain facing up, as it spins the camera ends up upside down and i'm not really sure how to recalculate the up vector for it. But ontop of that it doesn't maintain the same distance from the character at all times.

This is what I have right now:

        cameraUp = new Vector3(0, 1, 0);
        cameraPosition = new Vector3(cameraOffset.X, cameraOffset.Y, cameraOffset.Z);
        cameraPosition = Vector3.Transform(cameraPosition - cameraTarget, Matrix.CreateFromAxisAngle(Vector3.UnitX, tippingAngle)) + cameraTarget;

//This is the part that I'm having difficulty with, the rest works fine.
        cameraPosition = Vector3.Transform(cameraPosition, Matrix.CreateFromAxisAngle(Vector3.UnitY, rotationAngle));

        view = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUp);

EDIT:

Thank you to everyone, all of your comments helped. The biggest issue was that somehow I let it slip past that the cameraUp value was wrong, I think it happened as a typo when I was tidying the code up. Anyway, after fixing that the code above was exactly what I needed. I had tried that before but because the up vector was wrong I was getting really weird results so thanks to everyone. :)

sentences:
Cross-platform builds with OGRE3D via CMake. Any tips? I've been trying to compile a simple project for both OSX and Windows platforms, using OGRE3D, but I've got some problems on the way.

I'm using CMake to create my platform specific project files (VS solution & Xcode project). Some problems I found are:

OGRE3D source is distributed in 2 flavors, Windows sources and UNIX/OSX sources.
In OSX, compiling dependencies (freetype, FreeImage and specially OIS) is such a pain.
I don't know how to handle precompiled dependencies (they exist for both Win & Mac).

May sound like a noob question, but I would appreciate some tips on this. Resources, forum posts, anything. There exists any "cross-platform base project for OGRE3D" on the net?
Would be really helpful if someone who already managed to do this can bring some light.

Btw, I'm not basing the project on OGRE3D, it's just that is the biggest library I'm probably using, so I depend a lot on it.

sentences:
Drawing an arrow using the LineRenderer in unity I'm trying to draw an arrow using a LineRenderer in Unity, using the code suggested here.

Based on the UI it all seems good, yet it draws a pin needle, rather than the arrow I would expect from the UI. If I understand the UI right, it should thicken 60% into the line and then become thinner again towards the end.

Any idea what might be going wrong?

sentences:
Why does the lighting change the objects color? I have a code that draws a sphere. Without lighting it is white, but if I enable lighting, it's drawn in gray.

I don't know why the sphere changed it's color

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void init(void)
{
    GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat mat_shininess[] = { 50.0 };
    GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glShadeModel (GL_SMOOTH);

    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
}

void display(void)
{
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSolidSphere (1.0, 20, 16);
    glFlush ();
}

void reshape (int w, int h)
{
    glViewport (0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity();
    if (w <= h)
        glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
                 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
    else
        glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
                 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (500, 500);
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
    init ();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMainLoop();
    return 0;
}

sentences:
Implementing The Command Pattern - Undo And Entity References I am trying to implement a replay/undo system for a turn based strategy game I am currently working on. A sample move could go as follows:

1. A players select a pawn and gives it an attack command.
2. The attacked unit dies.
3. The dead unit is removed from the map and the controlling player.
4. The controlling player takes some damage.
5. The attacking unit gains a survivor strength power up for the remainder of the game.

The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities.

Eventually I want to make the game networked, but for now everything is local play.

After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https://gamedev.stackexchange.com/a/37684/41499 but I am confused on some of the implementation details.

Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally?
How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct?
Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played?

Any thoughts?

sentences:
World position into local position I want to understand how I can convert world position of an object into local position. Especially how to deal with a rotation of objects.
I'm testing transform.InverseTransform(...) methods. When parent and child has 0 rotation, this methods easily convert world into local position. I don't know how to deal with a situation, when one of the objects has not zero rotation.
In the example below my parent object has (0,0,10) position and (0,0,0) rotation. Child position (0,0,0) and rotation (90,0,0).
        Debug.Log (string.Format ("World position: {0}\nLocalPosition: {1}\nInverseTransformPoint: {2}\nInverseTransformVector: {3}\nInverseTransformDirection: {4}\nTransformPoint: {5}\nTransformVector: {6}\nTransformDirection: {7}",
        transform.position.ToString (),
        transform.localPosition.ToString (),
        transform.InverseTransformPoint (transform.position).ToString (),
        transform.InverseTransformVector (transform.position).ToString (),
        transform.InverseTransformDirection (transform.position).ToString (),
        transform.TransformPoint (transform.localPosition).ToString (),
        transform.TransformVector (transform.localPosition).ToString (),
        transform.TransformDirection (transform.localPosition).ToString ()));

The example debug result:
World position: (-1.0, -0.7, 10.0)
LocalPosition: (-1.0, -0.7, 0.0)
InverseTransformPoint: (0.0, 0.0, 0.0)
InverseTransformVector: (-1.0, 10.0, 0.7)
InverseTransformDirection: (-1.0, 10.0, 0.7)
TransformPoint: (-2.1, -0.7, 9.3)
TransformVector: (-1.0, 0.0, -0.7)
TransformDirection: (-1.0, 0.0, -0.7)

What should I add to transform.InverseTransformPoint (transform.position) to get transform.localPosition?

sentences:
How to make and correctly use progress bar in cocos2d-iphone? I have a game that uses a progress bar to inform player of level of certain stats of the player. For example hunger, when it starts at zero and slowly adds up to maximum bar. When he eats the hunger reduces.

I tried implementing as progressBar, but it works wrong, as the bar expands both ways, and I need it to grow one side only. Also I had hard time setting the bar, since it uses actions.

Is there an easy way to do it?

sentences:
How to create a grid movement like the oldschool snake game? I got 2 problems with the game,

I don't know how make my GameObject (snake head) move based in a grid for some reason I don't know it moves freely on the screen.
The tail keep instantiating above the head not behind... I tried many things and did not work and didn't find an answer in the forum that helps me.

Now I'm back to the begin and looking if someone can help me.

This is the code I use to generate a grid. If anyone could help me with some code, I appreciate it.

public class LevelManagerTest : MonoBehaviour
{

    public GameObject tile;
    [SerializeField]
    private Transform gridParent;
    [SerializeField]
    public Transform[,] Grid;

    private GameObject[,] grid = new GameObject[12, 7];

    public float TileSize
    {
        get { return tile.GetComponent<SpriteRenderer>().sprite.bounds.size.x; }
    }

    void Start()
    {
        CreateLevel();
    }

    private void CreateLevel()
    {
         Vector3 worldStart = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height));

        for (int y = 0; y < 7; y++)
        {
            for (int x = 0; x < 12; x++)
            {
                PlaceTile(x, y, worldStart);
                grid[x, y] = tile;
            }
        }
    }

    private void PlaceTile(int x, int y, Vector3 worldStart)
    {
        // creates a new tile and makes a reference to that file in new tile variable
        GameObject newTile = Instantiate(tile, gridParent);

        //uses the new tile reference and change the position of the tile
        newTile.transform.position = new Vector3(worldStart.x + (TileSize * x), worldStart.y - (TileSize * y), 0);
    }
}

sentences:
Some maths about camera in 3D So after finishing a 2d game for my school project, I decided to dive into 3d world by using raylib instead of Unity. Raylib does provide a simple implementation of 3d camera without you doing maths, but instead I want to challenge myself to understand trigonometry in 3d.Here, I am trying to make the camera rotate upside down and left right(like it's orbiting). After implementing the math, it seems like it only works when the target is at Vector3{0.0f, 0.0f, 0.0f} position. If the target position gets further and further, the rotation gets weird. Here is the demonstration video that I uploaded to youtube.

https://www.youtube.com/watch?v=MpXkhGy60HA&feature=youtu.be

And below is my code for math:

Vector3 cubePosition = { 0.0f, 0.5f, 0.0f };

Camera3D camera = { 0 };

camera.position = { 0.0f, 10.0f, 10.0f }; // Camera position

camera.target = { 0.0f, 0.0f, 0.0f }; // Camera looking at point

camera.up = { 0.0f,2.0f, 0.0f }; // Camera up vector (rotation towards target)

camera.fovy = 45.0f; // Camera field-of-view Y

float distance = 15.0f; // Set the distance from camera.target to camera.position

float verticalAngle = 45.0f; // The Y/XZ angle

float horizontalAngle = 90.0f; // The X/Z angle, y is considered as 0

float horizontalDistance = distance * cosf(verticalAngle * PI / 180.0f); // Horizontal distance, the magnitude

camera.position.x = horizontalDistance * cosf(horizontalAngle * PI / 180.0f); // Calculate the position of camera.position x based on distance etc..

camera.position.z = horizontalDistance * sinf(horizontalAngle * PI / 180.0f);

camera.position.y = distance * sinf(verticalAngle * PI / 180.0f);

Vector3 selectedTarget = cubePosition;

And for the main loop :

if (IsKeyDown(KEY_A))

{

camera.position.x = horizontalDistance * cosf(horizontalAngle * PI / 180.0f);

camera.position.z = horizontalDistance * sinf(horizontalAngle * PI / 180.0f);

horizontalAngle -= 1.0f;

}

else if (IsKeyDown(KEY_D))

{

camera.position.x = horizontalDistance * cosf(horizontalAngle * PI / 180.0f);

camera.position.z = horizontalDistance * sinf(horizontalAngle * PI / 180.0f);

horizontalAngle += 1.0f;

}

else if (IsKeyDown(KEY_W) && verticalAngle < 88.0f)

{

horizontalDistance = distance * cosf(verticalAngle * PI / 180.0f);

camera.position.x = horizontalDistance * cosf(horizontalAngle * PI / 180.0f);

camera.position.z = horizontalDistance * sinf(horizontalAngle * PI / 180.0f);

camera.position.y = distance * sinf(verticalAngle * PI / 180.0f);

verticalAngle += 1.0f;

}

else if (IsKeyDown(KEY_S) && verticalAngle > 2.0f)

{

horizontalDistance = distance * cosf(verticalAngle * PI / 180.0f);

camera.position.x = horizontalDistance * cosf(horizontalAngle * PI / 180.0f);

camera.position.z = horizontalDistance * sinf(horizontalAngle * PI / 180.0f);

camera.position.y = distance * sinf(verticalAngle * PI / 180.0f);

verticalAngle -= 1.0f;

}

if (IsKeyPressed(KEY_RIGHT))

{

camera.position.x += 1.0f;

selectedTarget.x += 1.0f;

}

else if (IsKeyPressed(KEY_LEFT))

{

camera.position.x -= 1.0f;

selectedTarget.x -= 1.0f;

}

if (IsKeyPressed(KEY_UP))

{

camera.position.z -= 1.0f;

selectedTarget.z -= 1.0f;

}

else if (IsKeyPressed(KEY_DOWN))

{

camera.position.z += 1.0f;

selectedTarget.z += 1.0f;

}

if (IsKeyPressed(KEY_SPACE))

{

cubeList.push_back(selectedTarget);

}

camera.target = selectedTarget;

Since raylib is using opengl so i tried to use the following link and picture to understand the camera system.
https://learnopengl.com/Getting-started/Camera

This is the picture I used to calculate my camera position.
https://uploads.disquscdn.com/images/58fa1f1a3dd8d736a9345b3b168dd55caf0f14d485e9dae7e06b8e185348a42a.png

Any help would be appreciated. Thank you..

sentences:
2d grappling hook for platformer? What are the options and mechanics for creating a grappling hook in a 2D game?

In the prototype for this feature, the person runs around in a platformer world and can throw the hook at any wall, where it sticks and shows a line to the player sprite. So that part (the easy part) is solved. But what options are available now for getting a rather good looking (not necessarily "correct") Tarzan-style grappling hook going, e.g. one allowing some kind of neat-looking swings?

(I understand several different approaches of how the mechanics could work are available; I'm looking for a simple one that may make some compromises and not be entirely physical, e.g. perhaps something which attracts the player to the hook center for a while or so while keeping to a certain rope min distance or such.)

I'm using JavaScript/ ImpactJS, by the way. Thanks!

sentences:
Art style for a character that has frequent visual changes during gameplay I'm creating a game with a bodybuilding/fitness theme. The camera will almost always be focused on an inclined front view of a character who will be evolving very frequently during the game as the player 'levels up' the musculature of each part of the character such as arms, legs, chest, etc.

I've been doing some research trying to figure out the most economical yet effective way to incorporate this visual mechanic of letting individual parts of a character independently increase in size and detail and have come up somewhat short, most likely due to my complete lack of experience when it comes to art (my experience is mostly in programming).

I was thinking 2D would be best for this game, however maybe this one character should be in 3D? Would a low poly style fit these requirements, or should I look towards something akin to sprites or hand drawings? The games interactivity will be purely through menus so that doesn't need to be taken into account when dealing with the problem of this character. I would like this character to have some animations, of course, however I'm not sure if that fits the scope of this single question.

sentences:
How to make natural looking voxel I'm developing a voxel game, but I think I use the wrong technique.
I currently use flat tiles, to make blocks, and I think theres a better and more efficient way.

I have seen a voxel game, which have naturally looking terrain. By that I mean non blocky.
The game have 4*4*4 blocks per cubic meter, and blocks like dirt, sand and stone, have round edges, and kind of melt together (Like in ordinary games). Heres a screenshot

How is this achieved?

sentences:
Implementing game synchronization between clients and server I'm creating a small online multiplayer game where I have multiple thin clients and an authoritative server. Both the client and the server have a fixed game loop.

Now I have a game entity with the following properties:

X position: float
Y position: float
Direction: float

In the client, the entity is in constant velocity changing its direction based on user input and sends an input event to the server.

[LEFT, PRESSED]: Entity moves to the left
[LEFT, RELEASED]: Entity moves to the right

Every event is queued on the server, and simulated the same way as on the client (calculating the new properties based on trigonometric functions) and the event is send to other players in the room. The other players apply the same simulation to that particular entity (keeping track of what key is pressed for each entity).

Now after some time playing, the position and direction start to drift and stop being in sync. I suspect this has to do with floating-point arithmetic(?)

Is this implementation correct, rather than sending its position and direction every step?
How would I solve this problem?
I think I need to make the server the single source of truth and send regular state snapshots to the the clients to correct possible mistakes/drifting? What would be a good interval to keep the clients up to date?
At the moment, I'm broadcasting an event to every player in the room. What would be a nice approach to only send events to players near the entity? Would a quadtree work here (the same I'm using for my collision detection)?

sentences:
Unity - using WWW to download image from web. Not working from my own website, but does from other urls I have this script attached to a RawImage file in my games UI

public class DownloadImage : MonoBehaviour {
     string url = "http://megabrogames.rf.gd/pic.jpg";
     //string url = "https://i.imgur.com/xBSyvRx.jpg";

     IEnumerator Start () {
         WWW www = new WWW(url);
         yield return www;
         GetComponent<RawImage>().texture = www.texture;
     }
 }

Both jpg files are the same. One I uploaded to Imgur, this works. The other is on my own website. The url to my website works fine, I have checked in on two computers and several browsers.

All I get is the red question mark. But if I uncomment the other one instead it all works perfectly.

My problem is that I have hard-coded the url into the game, and I want to change the image each week. It has to be the same URL for that to work, but i think with Imgur it will auto assign whatever url it feels like.

thanks for any help

sentences:
Area attack collision resolving I'm planning to write little 2D go-right-and-swing-your-sword game. When i started to write my ideas on paper i've come across a little problem.
Let's say i'm using magic spell, ex. fireball which technically is a signle projectile flying slowly in a specified direction. As it's defined to be a piercing projectile, I want it to hit every enemy only once, no matter how big their sprites are. And how I do it?
I know i can use the array of already hit enemies and check every frame if projectile collides something new, but is it a correct way? Are there any tried and true ways of resolving problems like this?

sentences:
Correct way to handle A* no pathing? I'm developing a little game for fun and I wrote a pathfinding system based on the A* algorithm. What is the best or correct way to deal with unavailable paths?

A* by default will go through every node on the grid until it either finds the target node or it has exhausted all of them. This can become problematic if certain areas are cut off into "islands" and A* tries to find a path there.

The obvious solution might be to flood fill regions and check in advance, but the problem is that I plan for my world to be a bit dynamic - new areas might appear, some areas which are accessable at one point might not be later, etc.

Another solution I've read about is that I can limit the amount of nodes it's allowed to search before it gives up, but this sounds a bit hacky and something I'd like to avoid if possible if there are better ways, because it means that there could be a very long and complex path to the target but it'll still not find it just because of this limit.

So how should I do it? I appreciate any help here, fellow devs!

sentences:
Unity Android build fails, error : Could not find com.android.tools.build:gradle:x.x.x Can't build for Android, error log:

CommandInvokationFailure: Gradle build failed,

And this is in it's description:

Could not find com.android.tools.build:gradle:3.2.0.

sentences:
Unity C# Microphone input in Android different than on PC? I'm working on a mobile app inside Unity, in which I need to input and repeat microphone input almost immediately..

I've worked it out and it works great when I play it from within the Unity Editor. I get some very strange behavior though when I try it from my Android phone (Galaxy Note 3)..

So I decided to run some tests and noticed quite different behavior..

Using this sample code:

using UnityEngine;
using System.Collections;

public class testingMicScript : MonoBehaviour {

    void Start () {
        audio.loop = true;
        audio.clip = Microphone.Start (null,true,10,44100);
        while(!(Microphone.GetPosition(null)>0)){}
        audio.Play ();
    }
}

and playing it from withing the Editor it works great, I speak and hear myself back after a few milliseconds. I compile the app and run it from my phone and when I speak I get a very strange echo which goes on until the sound is completely distorted and I get a strange hiss, until audio is completely muted..

Why is that? Is there any particular setting I should go through? Or do I have to change something in my code?

sentences:
How can I prevent the following animation frames from affecting the state of the previous animation frames in Unity? 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.

sentences:
LibGdx - How can I correctly handle tile transitions / connected textures? So I am making a tiled game and I need to connect textures correctly based on whats next to it.

With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ie:

x 1 x
8 x 2
x 4 x

But for tiles with more detail I need to have corners too. I have seen people use the 8 bit meathod ie:

1   2  4
128 x  8
64  32 16

But really I can only see 48 different tile combos.

Is there a way I can separate corners and u d l r. Something like this:

x 1 x  8 x 1
8 x 2  x x x
x 4 x  4 x 2

Or is there a better way all together to do this.

This is what I have tried so far but this only uses 32/48 tiles and doesn't work for special corner cases.

public class RockTile extends Tile {

int y;

public RockTile(int id) {
    super(id);
    y = 7;
}

public TextureRegion getTexture(Level level, int xLoc, int yLoc){

    int u = (level.getTile(xLoc, yLoc + 1) != this) ? 1 : 0;
    int r = (level.getTile(xLoc + 1, yLoc) != this) ? 2 : 0;
    int d = (level.getTile(xLoc, yLoc - 1) != this) ? 4 : 0;
    int l = (level.getTile(xLoc - 1, yLoc) != this) ? 8 : 0;

    int bit = u + r + d + l;

    int ur = (level.getTile(xLoc + 1, yLoc + 1) != this) ? 1 : 0;
    int dr = (level.getTile(xLoc + 1, yLoc - 1) != this) ? 2 : 0;
    int dl = (level.getTile(xLoc - 1, yLoc - 1) != this) ? 4 : 0;
    int ul = (level.getTile(xLoc - 1, yLoc + 1) != this) ? 8 : 0;
    int corner = ul + ur + dl + dr;

    if (bit == 0) {
        if (corner != 0)
            return Game.splitTiles[y + 1][corner];
        else
            return Game.splitTiles[y][bit];

    } else {
        if (corner != 0)
            if (dl > 0 && l == 0 && d == 0)
                return Game.splitTiles[y + 2][bit];
            else
                return Game.splitTiles[y][bit];

        else
            return Game.splitTiles[y + 2][bit];
    }

}

}

If you need anything else let me know.

EDIT: Side question because I've seemed to have stumped you guys. If I decided to use the 8 bit method what would be the best and fastest way to make a lookup table for that.

sentences:
collideWith Call Back Method In my class, I extend Sprite class. I override one of the method collideWith(). But my problem was that when current sprite collide with other sprite it does not call the call back method collideWith(). Here is my implementation.

@Override
public boolean collidesWith(IShape pOtherShape) {
    System.out.println("collide with called");
    return true;
}

Any member please help me.

sentences:
Best way to implement Finite State Machine for player character in Unity? I'd like to implement the player in my game as an FSM as described in this guide to programming patterns in games.

What is the best way to accomplish this? Should I implement each state as a monobehaviour with a state interface that can be enabled/disabled when the state transitions? Or would it better to the states as plain classes (with their own Update method) where the main player monobehaviour calls StateName.Update() from its own Update method (.e.g. void Update() { currentState.Update() })

sentences:
How to communicate with LibGDX HTML5 app? I'd like to have a HTML form send data to a LibGDX game deployed as HTML5. Ideally as a form in HTML as part of the same page that contains the LibGDX div/canvas, and use the form to set up some data that I can pass into the game, probably using Javascript.

Is this or any other method of sending data to the LibGDX app (when deployed as HTML5) possible?

sentences:
Calculate the aircraft's movement path in which its side speed is required I am working on an implementation problem in which given an aircraft and the objective of the system is to find the quickest route (optimal in terms of time) from point A (contains the information of the aircraft's 2D position and heading which is looked from top view) to point B (contains the same information as point A). There are several conditions:

The aircraft must use the full speed. By full speed, I mean the engine must use its maximum speed as much as it can provide in the current condition (e.g., if some of the engines are destroyed, the maximum speed decreases). There are three types of the speed:

Forward speed
Side speed
Turning speed

The aircraft doesn't have to use all three types of the speed simultaneously.

The answer of the following post here has answered some of my problems, but there still some of the issues I want to solve, which is if I want to include the side speed of the aircraft to the movement, how will the calculation of the movement path (especially when the aircraft turns) look like?
Please kindly recommend and I would appreciate any ideas for this problem.

sentences:
Problem converting FBX file into XNB I create a Monogame Content Project to convert assets into XNB. For FBX file without texture there is no problem: the file is correctly converted and when I load XNB into my project everything is ok.
The problem occours when i have associated to fbx file a texture map: in this case both FBX and PNG files are converted to XNB but when i try to load these XNB files into my project the following problem occours:

"ContentLoadException: Could not load Models/maze1 asset as a non-content file!"
Note: maze1 is the XNB file that was converted from FBX.

How can I solve this problem?
Thank you in advance

sentences: Ball Physics for Android Game I am starting work on a new Android game and I haven't had any experience implementing physics before. I am trying to steer clear of external libraries such as box2d, not just because I think it is overkill for my project, but I also want to code it myself for the experience. I am more just interested in getting 1 ball to bounce around the screen and bounce off of objects in my world. The game is in 2D and I was just looking for some advice on where to start with ball physics? I know I will need gravity,  x/y velocities... etc. I know I need to calculate how high the ball needs to bounce based on how fast it hit the object, I also know I will need to calculate the correct angle that the ball needs to bounce at. Just hoping to get some ideas on a good place to start and things I will need to take into account.

sentences:
why use Resources.Load() in changing the animator controller? I wanted to change the AnimatorController of a gameobject during runtime, and when I searched for the method, it used this code:
animator.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED") as RuntimeAnimatorController;

My question is, why don't we use a public AnimatorController and assign it from the animations folder, then set this equal to the runtimeAnimatorController ... Why use Resources.load? .. What's wrong with making a public variable rather than loading it from the Resources file?
I am asking cause no one on the forums or any other websites used the public variable method, which suggests that means that the first way is better.
public AnimatorController ac;

anim.runtimeAnimatorController = ac;
```

sentences:
How to draw portion of a sprite in libGDX Let's say i have a sprite like this:

and i want to draw the lower portion of it, only the yellow color..
Initially the sprite has dimensions 10x10, i want it to be drawn 10x3

Do i have to redimension both the sprite and the texture region to mantain proportion between the two?

sentences:
Not able to change Rigidbody 2d gravity scale I have been trying to change the gravity scale of my Rigidbody2d when I click on it. By default it is by 0 and when I click on it, it should change to 1, so that it falls down. I have a square with a boxcollider2d and a Rigidbody2d and a square with just a box collider.

public bool gravity = false;
public bool m_isRunning = false;
public SpriteRenderer m_spriteRenderer;
private Rigidbody2D rb;

private void Update()
{
    if (gravity)
    {
        rb.gravityScale *= -1;
    }
}

private void Start()
{
    m_spriteRenderer = this.GetComponent<SpriteRenderer>();
    rb = GetComponent<Rigidbody2D>();
}

private IEnumerator Changecolor()
{
    yield return new WaitForSeconds(1);
    int random = Random.Range(1, 4);

    if (random == 1)
    {
        m_spriteRenderer.color = Color.blue;
    }
    else if (random == 2)
    {
        m_spriteRenderer.color = Color.red;
    }
    else if (random == 3)
    {
        m_spriteRenderer.color = Color.green;
    }
    else
    {
        m_spriteRenderer.color = Color.yellow;
    }

    this.StartCoroutine("Changecolor", 3f);
}

private void OnMouseDown()
{
    gravity = true;
    m_isRunning = !m_isRunning;

    if (m_isRunning)
    {
        StartCoroutine("Changecolor", 3f);
    }
    else
    {
        StopCoroutine("Changecolor");
    }
}

sentences:
Unity 5.x Network Synchronization Concepts Bear with me, It will be long read^^

I am working on the new Unity Networking system. I was using Photon and old (legacy) unity network API's before. But as it seems there are some good benefits of the new system than the previous ones, so I want to stick with it. (Despite of it being uncompleted)

But there are some points that doesn't make sense to me with the API. Data Sync for example.
So, in the old systems (both in Photon and legacy unet) we had functions called OnPhotonSerializeView or OnSerializeNetworkView depending on which API we use. Both API's are very similar as you may know. So in these functions we could send and recieve data between clients and server. Which makes sense, and was really usefull.

But aperantly they changed this concept, (or it still exists, and i couldn't find it)

There is a new thing called [SyncVar], which syncs the data "ONLY" from server to client automatically. (Which really, literally doesn't make sense, I mean why not sync both server to client AND client to server? That would make everything much easier)

According to the documents, you can ONLY send data from client to server by using [Command]'s. Which is basically (as far as I understand), "one way" version of old good [RPC] calls. Instead of calling function in all other clients, it calls it in the server.

So, you can send data to server with function parameters like the way we did it with the old [RPC]'s before. Which is usefull on point but If this is the only way to send data to server, then it doesn't make any sense to me..

I mean there are variables that needs to be kept synced all the time, back and forth, like position or rotation vectors. And sending them with [Command] calls, contradicts with the concept of network framework in my mind. We used to avoid this kind of situation before, right? Why make it the obligation now?

Or are there simply any other ways to send data from client to server that I couldn't find yet?
There is a custom serialization with the [SyncVar], with OnSerialization and OnDeserializaton functions. Which really looks like the good old OnSerialize functions but apperantly it's diffrent as it does what the [SyncVar] does.
OnSerialization is only called on server, and Deserialization is only called on client. So we can only send from server to client even with it.

If [Command] is the only way to send data to server, please say so. And clarification about why this concept is reasonable would be really nice.

Please enlighten me more with the new concepts of the new UNET framework. Thanks in advance for any help.

sentences:
Transforming normal vector in GLSL I'm looking at a basic diffuse light shader here http://en.wikibooks.org/wiki/GLSL_Programming/Unity/Diffuse_Reflection.

Diffuse light needs the normal vector in eye-space, so that it can dot it with the light position (also in eye-space), and figure out the diffuse contribution. (eye-space not world-space is used, because that simplifies calculating specular contributions).

The code calculates the normal vector in the following way:

        mat4 modelMatrixInverse = _World2Object; // unity_Scale.w
           // is unnecessary because we normalize vectors

        vec3 normalDirection = normalize(
           vec3(vec4(gl_Normal, 0.0) * modelMatrixInverse));

A linear algebra calculation shows that given a matrix M, Transpose(Inverse(M)) transforms normals.  The Wikipedia on normals page contains a derivation of the required formula: http://en.wikipedia.org/wiki/Normal_%28geometry%29#Transforming_normals (I've actually rewritten that section myself, as it was not lucid).

So does this mean that the 'vector * matrix' overload in GLSL is implemented as:

    Transpose(vector) * Matrix

just holding a row-vector instead of a column-vector in the output, i.e.:

    Transpose( Transpose(vector) * matrix )

or more simply:

    Transpose(matrix) * vector

?

I've also found what appears to be alternative: gl_NormalMatrix

But in lines 9-11 here http://pixelsorcery.wordpress.com/2010/07/13/fisheye-vertex-shader/ ) I see the following code:

normal = vec4(gl_NormalMatrix * gl_Normal, 0.0);
vec4 vVertex = gl_ModelViewMatrix * gl_Vertex;
light_dir = gl_LightSource[0].position - vVertex;

Would I be right to assume that gl_NormalMatrix gives a normal in eye-space, and gl_LightSource[0].position gives the light location also in eye-space?

http://www.opengl.org/discussion_boards/showthread.php/172231-gl_NormalMatrix-Replacement suggests gl_NormalMatrix is deprecated.

Does that mean the first implementation is the preferred approach?

EDIT: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-8-basic-shading/#The_Diffuse_part

sentences:
AI for Shogi, dealing with high branching factor due to drop rule I'm writing a Shogi program with a computer player in Java from scratch as my undergradute
dissertation project. Due to the drop rule, when the computer player captures a few pieces, the branching factor increases a lot and the running time becomes infeasible. I haven't manage to find any research or information on drop reduction and my own selection is too slow and not "selective" enough (trying to remove drops that are not safe or not protected and don't have any use like defending or attacking). Does anyone know any heuristics that can be implemented with reasonable time complexity for selecting drops that are worth adding to the game tree ? Cheers.

So, like in (western) Chess a piece can be captured and when a piece is captured the capturing player holds on to it. Now this piece can be dropped on the board anywhere on a free tile in any of the next turns (instead of moving a piece from the board). There are a lot more rules to drops but they are irrelevant. Because of this rule, when a player makes a capture, instead of a decrease in the branching factor like in chess, an increase of the branching factor happens because of the large amount of possible drops that can be made on the next turn. This results in an average branching factor of 80 (much more than Chess which has a average branching factor of 35).

sentences:
Panning value of 2nd GameObject's AudioSource is not initializing I'm making a prototype and stuck in a problem where two GameObjects swap but there values of panStereo of AudioSource is not initializing from a float array which contains all the default values of panStereo of all the GameObjects in a scene:
 panningArray = new float[Inventory.bowlsManager.BowlPanningValues.Length];
    for (int i = 0; i < Inventory.bowlsManager.BowlPanningValues.Length; i++)
    {
        panningArray[i]=Inventory.bowlsManager.BowlPanningValues[i];
    }
    Selectable = false;
    SelectedBowl.GetComponent<AudioSource>().spatialBlend = SelectedBowl2.GetComponent<AudioSource>().spatialBlend = 1;
    iTween.MoveTo(SelectedBowl, iTween.Hash("position", temp2, "time", transitionspeed));
    iTween.MoveTo(SelectedBowl2, iTween.Hash("position", temp, "time", transitionspeed));

    SelectedBowl.GetComponent<Renderer>().material = SubsituteMaterial;
    SelectedBowl2.GetComponent<Renderer>().material = SubsituteMaterial;
    int SelectedBowlIndex = Array.FindIndex(Inventory.allBowls.ToArray(), x => x == SelectedBowl.GetComponent<Bowl>()); ;

    int SelectedBowlIndex2 = Array.FindIndex(Inventory.allBowls.ToArray(), x => x == SelectedBowl2.GetComponent<Bowl>());
    print(Inventory.bowlsManager.BowlPanningValues[SelectedBowlIndex2]);
    print(Inventory.bowlsManager.BowlPanningValues[SelectedBowlIndex]);

   val1=  BowlPanning(SelectedBowl2 , panningArray[SelectedBowlIndex]);
     val2= BowlPanning(SelectedBowl , panningArray[SelectedBowlIndex2] );

Here is my bowl panning function:
 public float BowlPanning(GameObject BowlRequire,float value)
{
    BowlRequire.GetComponent<AudioSource>().panStereo = value;

    return BowlRequire.GetComponent<AudioSource>().panStereo;

}

sentences:
How to determine depth of a pixel perfect collision I am trying to figure out how to determine the depth of a pixel perfect collision in XNA.  I want to know the depth in order to be able to use it in my collision response.

At the moment I have the following code, that provides me with a working pixel perfect collision detection:

public static bool IntersectPixels(Matrix transformA, int widthA, int heightA, Color[] dataA, Matrix transformB, int widthB, int heightB, Color[] dataB)
{
    Matrix transformAToB = transformA * Matrix.Invert(transformB);

    Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, transformAToB);
    Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, transformAToB);

    // Calculate the top left corner of A in B's local space
    // This variable will be reused to keep track of the start of each row
    Vector2 yPosInB = Vector2.Transform(Vector2.Zero, transformAToB);

    // For each row of pixels in A
    for (int yA = 0; yA < heightA; yA++)
    {
        // Start at the beginning of the row
        Vector2 posInB = yPosInB;

        // For each pixel in this row
        for (int xA = 0; xA < widthA; xA++)
        {
            // Round to the nearest pixel
            int xB = (int)Math.Round(posInB.X);
            int yB = (int)Math.Round(posInB.Y);

            // If the pixel lies within the bounds of B
            if (0 <= xB && xB < widthB && 0 <= yB && yB < heightB)
            {
                // Get the colors of the overlapping pixels
                Color colorA = dataA[xA + yA * widthA];
                Color colorB = dataB[xB + yB * widthB];

                // If both pixels are not completely transparent,
                if (colorA.A != 0 && colorB.A != 0)
                {
                    // then an intersection has been found
                    return true;
                }
            }

            // Move to the next pixel in the row
            posInB += stepX;
        }

        // Move to the next row
        yPosInB += stepY;
    }

    // No intersection found
    return false;
}

How would I determine how deep the collision is into the dataB texture data?

sentences:
Orthographic (0,0) center I want to display coordinates from 0 to n, where n is int > 0.
The map is displayed correctly heaving it's center in the middle of the screen pointing top right. I would like to have it pointing bottom right.

My implementation is:

effect.Parameters["wvp"].SetValue(Matrix.Translation(0, 0, 0) *
    Matrix.LookAtLH(Vector3.Zero, Vector3.UnitZ, Vector3.Up) *
    Matrix.OrthoLH(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1));
effect.Techniques[0].Passes[0].Apply();

GraphicsDevice.SetDepthStencilState(GraphicsDevice.DepthStencilStates.None);
GraphicsDevice.SetRasterizerState(GraphicsDevice.RasterizerStates.CullNone);
GraphicsDevice.Clear(Color4.Black);
GraphicsDevice.SetVertexBuffer(layer.Buffer);
GraphicsDevice.SetVertexInputLayout(layer.InputLayout);

GraphicsDevice.Draw(PrimitiveType.TriangleList, layer.Buffer.ElementCount);

And a screenshot of the situation now.

The white area is around coordinate (0, 0). The line is just at X = Y for orientation. The black line should be pointing bottom right as mentioned above. Any Idea how this can be done?

sentences:
Bounding Boxes and XNA So heres some straight up code for you:

BoundingBox b  = new BoundingBox(
  Vector3.Up   + Vector3.Right    + Vector3.Forward,
  Vector3.Down + Vector3.Backward + Vector3.Left);
BoundingBox bb = new BoundingBox(
  Vector3.Up/2   + Vector3.Right/2    + Vector3.Forward/2,
  Vector3.Down/2 + Vector3.Backward/2 + Vector3.Left/2);

Debug.GraphicsManager.DrawLine(b, Color.Purple);
Debug.GraphicsManager.DrawLine(bb, Color.Yellow);

if (bb.Contains(b) == ContainmentType.Disjoint)
  Debug.DisplayVariable("Disjoint", "");
if (bb.Contains(b) == ContainmentType.Contains)
  Debug.DisplayVariable("Contains", "");
if (bb.Contains(b) == ContainmentType.Intersects)
  Debug.DisplayVariable("Intersects", "");

What this does is create two bounding boxes, that /obviously/ intersect.
DrawLine is a function that accepts a bounding box and draws it.
Math and visuals tells us that these intersect and contain.

But all I get is disjoint.

So I started a new blank fresh clean project and only added this to the update code:

BoundingBox b = new BoundingBox(
  Vector3.Up + Vector3.Right + Vector3.Forward,
  Vector3.Backward + Vector3.Left);
BoundingBox bb = new BoundingBox(
  Vector3.Up / 2 + Vector3.Right / 2 + Vector3.Forward / 2,
  Vector3.Backward / 2 + Vector3.Left / 2);

if (bb.Contains(b) == ContainmentType.Disjoint)
  System.Console.WriteLine("Disjoint");
if (bb.Contains(b) == ContainmentType.Contains)
  System.Console.WriteLine("Contains");
if (bb.Contains(b) == ContainmentType.Intersects)
  System.Console.WriteLine("Intersects");

if (bb.Intersects(b))
  System.Console.WriteLine("intersex");

and this has the same problem.

So I'm stumped. Does XNA just not have good bounding box collison code?
Or am I doing something wrong?
should I write my own collison code?

Thanks for reading, no this is not debug for me, I simply don't understand.

edit: I also have mouse picking set up and it can identify and pick
all my "models" based on Ray.Intersects(model.boundingbox) no problem.

sentences:
Is it possible to use a string somehow converted to match name of a bool? I have a Json file holding data for my LineData type i created.

[Serializable]
public class LineData
{
public string lineID;
public string lineDialog;
public float lineDuration;
public string condition;
}

Note the last one, 'condition', that is what I hope to use to hold a name of a specific bool in my code, so that the line can only be spoken when that bool is true.

Is this a decent way to achieve this? Or is it even possible? I've read about making 'custom markup' on my Json things like (!!) and (->) built in the text to mean stuff in my code, but I don't know where to start with it and cannot find any tutorials (I've only seen it on some Youtube GDC lecture style videos from professional game developers working for companies)

But failing the custom markup thing, if I can somehow use the string of the name of the bool, and use that to check the state of it's corresponding bool in the code, that would be enough for me so far.

Any ideas or help is fantastic and very welcome. Many thanks!!!

(PS. The json looks like this  (Im sure you don't need it, but just in case)):

{ "lineDatas":
[
{
    "lineID": "BEDROOM_DAVE_0001",
    "lineDialog": "Yaawwn, up i get for another fun packed day.",
    "lineDuration": 3,
    "condition": ""
},
{
    "lineID": "BEDROOM_DAVE_0002",
    "lineDialog": "Well I think I need a cigarette before I get to work!",
    "lineDuration": 3,
    "condition1": "notSmokedCig"
}
]
}

sentences:
Is it bad form to use singletons in unity I've heard a lot of people say singletons are bad practice and an 'anti-pattern',
like here,
this answer
this article
and here.
However, a lot of the reasons I've read about seem to be to do with dangers in their creation, them not being thread safe, difficult to destroy safely etc. But in unity where there are functions such as awake() and start() which are (as far as I'm aware) guaranteed to only be called once, are they unsafe to use?

sentences: where can I get people to create project with me? I've almost finished my studies. Actually I am looking for job to get experience but besides this I have a lot of free time. Could you tell me where can I (make relationship with ) find new people who also likes create new games or apps in java/c# and work together?

sentences:
Standard Asset package import in unity 2018.3 I am using iMac, I don't see any for import standard package in unity. My working project need to import standard packages. I use unity version unity 2018.3.0f2. Please guide me from where I get the unity standard asset package.

Thanks.

sentences:
As3 Random movieclips from an array to the stage For a game with orders and clients I was trying to create the following situation:

Every half minute, a client should appear at the counter. In this case I have an array with 4 movieclips (4 clients). After 30 seconds I want the first randomly choosed client to appear at the counter (y = 200). This is my solution (wich obviously isn't the right way, forgive me):

    var timer:Timer = new Timer(1000);
    var elapsedTime:Number = 0;

    timer.addEventListener(TimerEvent.TIMER, displaytime);
    timer.start();

    function displaytime(event:TimerEvent):void
        {
            elapsedTime++;
            counterDisplay.text = String(elapsedTime);
        }

    if(elapsedTime == 30){

    for (var i:uint = 0; i < mcArray.length; i++) {

         mcArray[i].x = Math.floor( Math.random()*(stage.stageWidth) );
         mcArray[i].y = 200;
         addChild(mcArray[i]);

    }

    }

My question to you is: What am I doing wrong, and how can I accomplish this?
Thanks in advance!

sentences:
How to correctly reference a texture bound using SetTexture in Direct3D 9 In Direct3D 9, after assigning a few textures to samplers using SetTexture, what is the correct way to access/create the samplers in the relevant pixel shader? Previously I was creating samplers like this:

texture tex : register(r0);
sampler2D sam = sampler_state {
    texture = <tex>;
    minfilter = none;
    magfilter = none;
    mipfilter = none;
};

Which seemed to work fine, however, now that I'm binding multiple textures this doesn't work consistently. However, the following appears to work:

sampler2D sam : register(s0);
sampler2D sam1 : register(s1);

The documentation for SetTexture says:

  Programmable shaders reference textures using the sampler number.

But I'm not sure whether or not this means that the sampler registers should be used to sample textures set with SetTexture, or whether the sampler requires any further initialisation aside from the call to SetTexture.

sentences:
How to move a Box2D body towards a mouse click? In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation part, but cannot figure out the movement.

Every time the screen is touched, the target point (mouse click) is updated:

if (Gdx.input.isTouched())
{
    Vector3 tmp = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
    touch_prev = touch_target;
    touch_target = new Vector2(tmp.x, tmp.y);
}

Here is the Rot2D class:

package com.elsealabs.ghostr;

public class Rot2D {

   public static Rot2D fromDegrees(double angle) {
      return fromRadians(Math.toRadians(angle));
   }

   public static Rot2D fromRadians(double angle) {
      return new Rot2D(Math.cos(angle), Math.sin(angle));
   }

   public static Rot2D fromVector(double dx, double dy) {
      float length = (float) Math.sqrt(dx * dx + dy * dy);
      return new Rot2D(dx / length, dy / length);
   }

   public double getAngle() { // radians
     return Math.atan2(sin, cos); // atan2(y, x)
  }

   public double cos, sin;

   private Rot2D(double cos, double sin) {
      this.cos = cos;
      this.sin = sin;
   }

   public Rot2D load(Rot2D that) {
      this.cos = that.cos;
      this.sin = that.sin;

      return this;
   }

   public Rot2D copy() {
      return new Rot2D(cos, sin);
   }

   public Rot2D rotate(Rot2D that) {
      double cos = (this.cos * that.cos) - (this.sin * that.sin);
      double sin = (this.cos * that.sin) + (this.sin * that.cos);

      this.cos = cos;
      this.sin = sin;

      return this;
   }

   public static double cross(Rot2D a, Rot2D b) {
      return (a.cos * b.sin) - (a.sin * b.cos);
   }
}

(Source)

I am showing these because it may be helpful, but what I need to get working is the movement. I do not want to use setTransform, as it may end up letting the player travel through walls.

Using the vectors below, and any other variables needed, how would I move the player gradually towards a point on mouse click?

private Vector2 touch_prev = new Vector2(0, 0);
private Vector2 touch_target

sentences:
LibGDX - Camera and viewport initialization in show()? I'm reading the book LibGDX game development by example and the author tends to follow a pattern like

 public class MyGame extends Game {
      @Override
      public void create() {
          setScreen(new GameScreen(this));
      }
      ...
 }

 public class GameScreen extends ScreenAdapter {
     private Viewport viewport;
     private Camera camera;
     private final MyGame myGame;

     // code omitted for brevity

     public GameScreen(MyGame myGame) {
         this.myGame = myGame;
     }

     @Override
     public void show() {
         camera = new OrthographicCamera();
         camera.position.set(WORLD_WIDTH / 2, WORLD_HEIGHT / 2, 0);
         camera.update();
         viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT, camera);
         ...
     }

It seems to me that creating a new camera and viewport in the show() method is not correct, as it would create new objects every time the screen becomes active (eg when the game has multiple screen and the user can switch between them). So my questions:

Am I correct in my reasoning? Should the camera and the viewport be created in the GameScreen class constructor?
Would it be possible/advisable to have just a single camera and viewport shared by all screens?

sentences:
Different ways to load/select characters in a RPG game I am brand new here, and have been designing a two player card game where from tens of thousands of cards each player selects up to 80 cards DECK, and then fights with those cards.

For reference Yu Gi Oh

There's a lot of data and a player can have up to 3 instances of a card to play and they select the cards they want before the game starts. How do I load this information when starting the game? Any suggestions on the different ways to do it during game initialization?

Like how this is done in RPG games like League of Legends.

sentences:
Vector2 to 3D world coordinates I think I am almost there, but not quite. I am trying to transform a 2D point, (in the following example (100,100)) into 3D world coordinates, in order to draw my 3D Model named TestModel in XNA/Monogame. Here is my attempt:

Matrix[] transforms = new Matrix[TestModel.Bones.Count];
TestModel.CopyAbsoluteBoneTransformsTo(transforms);
ModelMesh mesh = TestModel.Meshes[0];
BasicEffect effect = (BasicEffect)mesh.Effects[0];
float Scale = 1.2f;

effect.View = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 6115.0f),
     Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
    aspectRatio, 1.0f, 10000.0f);
effect.EnableDefaultLighting();

//here i am using the function to calculate the world coordinates from (100,100) Point
//it gives me modelPosition = {X:284,0316 Y:384,2054 Z:0,9999364} in this example
Vector3 modelPosition = graphics.GraphicsDevice.Viewport.Project(new Vector3(100, 100, 1),
   effect.Projection, effect.View, Matrix.Identity);

effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) *
   Matrix.CreateTranslation(modelPosition);

//finally i draw the model
mesh.Draw();

I suppose this is the correct function to do it graphics.GraphicsDevice.Viewport.Project, so what exactly am I missing here ? Right now the model is drawn around (393, 444) in the 2D world (instead of (100,100) which is where i am trying to draw it)

Edit: I had wrong numbers before
Edit2: I think the correct function is Unproject, but i still can't get it drawn at (100,100)

sentences:
How can I find the difference between rotations represented as angles in [0, 360]? What is the easiest way to find the difference between two 2D rotations/directions?

I want to test if one rotation is within 10° of another. I would just subtract, but there are some problems because I want to keep each rotation between 0 and 359. E.g. 0 is within 10° of 359, but simple subtraction would claim that they're 359 degrees apart.

sentences:
Performance issues with different types of uniform buffer I've tested different buffer layouts, because I'm confused about some performance issues. That are my test buffer (OpenGL 4.1, GLSL 410, GT 750M, MacBook Pro):

Test #1: Using fixed struct buffer with unused variables inside

struct SPerFrameUniformBufferVS
{
    vec4 m_UnusedButPlaned1;
    vec4 m_SometimesInUse2;
    vec4 m_UnusedButPlaned3;
    vec4 m_Used4;
    mat4 m_Used5;
    mat4 m_Used6;
};

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    SPerFrameUniformBufferVS m_PerFrameUniformBufferVS;
};

Test #2: Same buffer without unused variables

struct SPerFrameUniformBufferVS
{
    vec4 m_Used4;
    mat4 m_Used5;
    mat4 m_Used6;
};

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    SPerFrameUniformBufferVS m_PerFrameUniformBufferVS;
};

Test #3: Using fixed buffer with unused variables inside

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    vec4 m_UnusedButPlaned1VS;
    vec4 m_SometimesInUse2VS;
    vec4 m_UnusedButPlaned3VS;
    vec4 m_Used4VS;
    mat4 m_Used5VS;
    mat4 m_Used6VS;
};

Test #4: Same buffer without unused variables

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    vec4 m_Used4VS;
    mat4 m_Used5VS;
    mat4 m_Used6VS;
};

In my case i've the following performance results:

Test #1: 40 FPS
Test #2: 55 FPS
Test #3: 46 FPS
Test #4: >60 FPS

My application do 1558 draw and 2341 glGetUniformBlockIndex calls. glGetUniformBlockIndex seems to be the bottle neck, because it is much higher in Test #1 and Test #3.

sentences:
Load 3D model from external directory I am developing a desktop application that want to load the 3D model from desktop. Using file explorer user wants to choose the 3d model then it want to show in the application scene.I tried to find the object, the path is detecting but if i tried to Instantiate it on unity it showing this error.

  ArgumentException: The Object you want to instantiate is null.

here the code is used

public class ReadData : MonoBehaviour {
string path;
GameObject go;
public void OpenExplorer(){
    path = EditorUtility.OpenFilePanel("Overright with model", "", "dae");
    Debug.Log(path);
    GetObj();
}

void GetObj()
{
    if(path!=null)
    {
        UpdateObject();
    }
}

void UpdateObject()
{
    WWW www = new WWW("file:///" + path);
    go = GameObject.Find(path);
    Instantiate(go);
}}

Anybody please help me to do this. Thanks in Advance.

sentences:
Permanent Adjacency Problem [Gamemaker Studio] Situation: I started work on a pet project recently. It's a bit like Puzzlecraft, or Bejewled, but slightly different. You click one gem, as we'll call it, and if it's the first in the link, then it's added to the link.

That works well enough. However, the problem comes in that after that, in order to link, it must be adjacent to the last link... and somehow, something goes wonky. The first time you click something not adjacent, it doesn't get put on the link...or it at least doesn't highlight. It also doesn't run across any of my show_message popups - aside from "second else".

Yet, somehow, it seems to act as though that one you clicked on was the Last_Link, after that point...permanently...which shouldn't even be possible...

So, if you click adjacent to the one that got to "second else", it will still consider that "adjacent", even if it's across the entire board from the last one that actually highlighted.

And this permanent allocation of Last_Link can happen for every gem on the board. At the same time. (Note: It does deallocate once you restart the program.)

This DOESN'T make sense!

I have no step events (yet). This is also the only left click event in the game at the moment. Every other event is a create or game start event, mostly for initialization purposes. So I have no idea what is doing this. Can someone tell me?

Left Click Event for the Gems

if (obj_Handle_Links.Match_Length = 0) //if this would be the first in the link
{
    show_message("first to link");
    obj_Handle_Links.Match_Length +=1; //because we're increasing the length
    image_index = 1; //this should highlight
    //add to link, later
    show_message( Matrix_Location_y );
    obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
    show_message(obj_Handle_Links.Last_Link.Matrix_Location_y);
}
else
{
    // show_message("first else");
    //check if the target is the same type as the last Link's type
    if(obj_Handle_Links.Last_Link.Type = Type &&
        //check if the last link in the chain is adjacent to the target link
        //includes diagonals
         (obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y-1)
         || obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y+1)
         || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x-1)
         || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x+1)) )
        {

            show_message( Matrix_Location_y );
            //show_message("third if");
            obj_Handle_Links.Match_Length +=1; //because we're increasing the length
            image_index = 1; //this should highlight
            //add to link, later
            obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
           show_message(obj_Handle_Links.Last_Link.Matrix_Location_y);
         }
    else{

        show_message("second else");
        //play sound that link failed
    }
}

sentences:
Dynamically applied texture to GameObject using GUI button In a scene I have multiple different GameObjects (almost 30 kinds) with parent child relationships. At run time (by using a GUI button) I want to change the texture of each clicked GameObject. As the user clicks specific GameObjects, a GUI with a multiple texture button will appear. By clicking on the button, that specific texture will be applied.

Is there a smarter way to do this?

Do I need to apply a script to every object?

I have tried to apply a script with some specific code; it's working but not regularly and correctly.  Additionally, I want different texture options for each kind of GameObject.

sentences:
How to blend multiple normal maps? I want to achieve a distortion effect which distorts the full screen. For that I spawn a couple of images with normal maps. I render their normal map part on some camera facing quads onto a rendertarget which is cleared with the color (127,127,255,255). This color means that there is no distortion whatsoever. Then I want to render some images like this one onto it:
If I draw one somewhere on the screen, then it looks correct because it blends in seamlessly with the background (which is the same color that appears on the edges of this image). If I draw another one on top of it then it will no longer be a seamless transition. For this I created a blendstate in directX 11 that keeps the maximum of two colors, so it is now a seamless transition, but this way, the colors lower than 127 (0.5f normalized) will not contribute. I am not making a simulation and the effect looks quite convincing and nice for a game, but in my spare time I am thinking how I could achieve a nicer or a more correct effect with a blend state, maybe averaging the colors somehow? I I did it with a shader, I would add the colors and then I would normalize them, but I need to combine arbitrary number of images onto a rendertarget.
This is my blend state now which blends them seamlessly but not correctly:
    D3D11_BLEND_DESC bd;
    bd.RenderTarget[0].BlendEnable=true;
    bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
    bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
    bd.RenderTarget[0].BlendOp = D3D11_BLEND_OP_MAX;
    bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
    bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
    bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_MAX;
    bd.RenderTarget[0].RenderTargetWriteMask = 0x0f;

Is there any way of improving upon this?
(PS. I considered rendering each one with a separate shader incementally on top of each other but that would consume a lot of render targets which is unacceptable)

sentences:
Does the quality of a video card connected to a monitor used in play mode with Unreal Engine matter? I have 3 video cards:

inferior onboard vga (not connected to a monitor)
inferior discreate vga (connected to a secondary monitor)
superior discreate vga  (connected to a primary monitor)

When using Unreal Engine in play mode, should the play window be viewed on the   monitor connected to superior vga?

sentences:
Libgdx can't read .ttf file when running Android configuration Firstly, I am aware that a similar question was asked some time ago that went unanswered. Currently, it has multiple upvotes but no answer.

The error

com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/font/font1.ttf (Internal)
...
Caused by: java.io.FileNotFoundException: font/font1.ttf

occurs when I use the class FreeTypeFontGenerator provided by Libgdx as a extension to use freetype fonts(link). This is the line in my project that caused error:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/font1.ttf"));

I can be fairly certain that my path to the .ttf is correct, as the desktop configuration runs perfectly, showing the font as desired.

My guess: I didn't include the freetype extension when creating this libgdx project. When following the tutorial to include it (that is, adding the freetype dependencies in build.gradle), something somehow went wrong. But even this is not convincing enough.

build.gradle:

project(":desktop") {
    apply plugin: "java"

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"

    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"

    }
}

sentences:
Dual Stick Shooter in XNA (trig) Honestly I have never taken a trigonometry class, but I am trying to create a dual stick shooter in XNA, can someone please look at my code and look to see if there are things that can be fixed, The image facing is off? Why?

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace DualStickPC
{

    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //set window size
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
        }

        protected override void Initialize()
        {

            base.Initialize();
        }

        Texture2D mytexture;
        Texture2D curTexture;
        Vector2 sPos = Vector2.Zero;
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            mytexture = Content.Load<Texture2D>("Arrow");
            curTexture = Content.Load<Texture2D>("Cursor");
        }

        protected override void UnloadContent()
        {

        }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                this.Exit();

            sPos.X = GraphicsDevice.Viewport.Width/2;
            sPos.Y = GraphicsDevice.Viewport.Height/2;

            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            int x2 = Mouse.GetState().X;
            int x1 = (int) sPos.X;
            int y2 = Mouse.GetState().Y;
            int y1 = (int) sPos.Y;
            float rotation = (float)Math.Atan2(Mouse.GetState().Y - sPos.Y + (int)mytexture.Height / 2, Mouse.GetState().X - sPos.X + (int)mytexture.Width / 2);
            float slope = 0;
            try
            {
                slope = (y2 - y1) / (x2 - x1);
            }
            catch
            {
                slope = 180;
            }
            double angle = 100 * Math.Tan(slope);
            float radians = MathHelper.ToRadians((float)angle);

            int msX = (int)(Mouse.GetState().X - sPos.X - mytexture.Width/2);
            int msY = (int)(Mouse.GetState().Y - sPos.Y - mytexture.Height / 2);

            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            Vector2 mousePos = Vector2.Zero;
            mousePos.X = Mouse.GetState().X;
            mousePos.Y =Mouse.GetState().Y;
            spriteBatch.Draw(curTexture, mousePos,Color.White);
            spriteBatch.Draw(mytexture, new Rectangle((int)sPos.X, (int)sPos.Y, mytexture.Height, mytexture.Width), null, Color.White, (float) (rotation), new Vector2(mytexture.Width/2, mytexture.Height/2), SpriteEffects.None, 0);

            //Testing projectile
            spriteBatch.Draw(mytexture, new Rectangle((int)sPos.X + msX/2, (int)sPos.Y + msY/2, mytexture.Height, mytexture.Width), null, Color.White, 0, new Vector2(mytexture.Width / 2, mytexture.Height / 2), SpriteEffects.None, 0);

            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}

sentences:
Change texture settings for each object So I'm kinda new to Unity, but I've used it a couple of times before. Here's my issue:

I have two cubes with a random texture applied to them (drag'n'dropped something from the Asset Store). These cubes have different sizes, where one is a square and one is a rectangle. I want to set the tiling size to be different on them (because they are obviously stretched on the rectangle), but when I click on one and change it, the settings changes for both of them.

This is how it looks right now: http://i.imgur.com/JtubBle.png

Is it possible to make these settings unique for each object somehow?

sentences:
How to fix surface normal for mesh I am developing an application that has to take STL files from users. However, some modeling programs seem to invert some of the surface normals. Basically some surface normals will be facing inward rather than outward.

I have to make a component that will correct the surface normals, and write these corrections to file.

Otherwise, later steps with the model will fail.

I have heard that the surface normals can be calculated from the winding information.

What is the best way to go about correcting these surface normals?

I am using OpenGL with QT for Window management.

sentences:
How can I save data in Unity? I'm making a game that's pretty simple and I really only need to save one int for when the game is closed (the scene the payer is at), but all the tutorials and guides I've seen haven't been much help so far.

So basically I want a way to either have the game, resume right where I left off when I quit, have it load a specific scene when you resume playing, or have it save that single int. Having it load a specific scene would work best but I can use any of the options stated above.

sentences:
What are pixel-based path finding algorithms? (path doesn't need to be shortest) I have a canvas of size of approximately 1000x1000 pixels. I also have a matrix that represents that canvas and returns -1 if that 'pixel' is walk-able. I need to find a path between one of my objects and some endpoint that DOESN'T necessarily need to be shortest. I just need a path.
What algorithm should I use?

sentences:
Deleting a game object causing an access violation I tried doing this but it cause an access violation.

void GameObjectFactory::Update()
{
     for( std::list<GameObject*>::iterator it=gameObjectList.begin() .....
          (*it)->Update();
}

void Bomb::Update()
{
     if( time == 2.0f )
     {
         gameObjectFactory->Remove( this );
     }
}

void GameObjectFactory::Remove( ... )
{
     gameObjectList.remove( ... );
}

My thoughts would be to mark the object to be dead then let the factory handle it the on next frame for deletion. Is it the best and fastest way? What do you think?

sentences:
Rotate on one axis, but visibly keep the other axes stable and editable It's been a long two weeks. Quaternions are freaking complicated. I've managed to make a few baby steps towards finishing my project, but I've hit a brick wall and could use a few of your beautiful minds to help me past it.

I'm making an asset for Unity that will automatically rotate/shift objects to make them appear 2.5D. What I'm having trouble with is the rotation part. I go through a trigonometric process to get a calculation of how much, between 0 and 180 degrees (typically), that the object should rotate on its x-axis.

The rotation of this object should be locked between 0 and 180 degrees. Think of it this way: my trigonometric calculation is telling me whether the object should be flipped right-side-up or upside-down

So, we've got the angle it should rotate. Just plop it in a
Quaternion.Euler(MyNewXValue, prevEulerY, prevEulerZ) and we should be good, right? WRONG.

There are a number of things wrong with this.

The previous eulers can come back a bit wonky since they can correspond to multiple values in the -360 to +360 degree range, so we have to "normalize" them a bit.
Due to the rotation order, it ends up "swirling" in 3D space and altering the other two rotations instead of maintaining a stable x-axis rotation change.

With that said, here is my code:

// C#

if (current_euler.z < 180f)
{
   rot = Quaternion.Euler(rotation_angle.x, current_euler.y, current_euler.z);
} else
{
   rot = Quaternion.Euler(rotation_angle.x, current_euler.y-180, current_euler.z-180);
}

Ignore the (if < 180). That's just so I can get this test running and working. I'll find a proper way to normalize it later.

Anyway, this snippet works, but has one problem: It twirls in 3D space and doesn't remain locked on its x-axis. I've tried numerous other solutions, but they either spin out of control or... they all spun out of control.

My question: Is there a way to set the rotation by rotating on one axis, while allowing the other rotations to change at the user's command without it "swirling" in 3D space?

EDIT: SOLUTION

For my use case I was able to use transform.localScale and modify it's Y-scale as a solution to my issue. It has the exact effect as I was looking for, and is definitely more stable. I accepted @Lunin's answer, however, as it seems to be another possible solution, and is written on this forum :).

To clarify, my wish was to rotate a 2D object on its x-axis, which would cause it to rotate vertically. At the same time, I wanted to allow the other axes to be editable at any given time. I can mimic a vertical rotation by changing the y-scale of the 2D object. +1 y-scale is normal, -1 y-scale is flipped upside down. Since I only needed that one axis to change, this workaround worked perfectly.

sentences:
Where can I find good designers/animators for the graphics of a 2d game? Possible Duplicate:
  Where to hire 2D sprite artists?

I've got a little bit of experience in this field already, and I noticed that it's way better to look for animators than graphic designers, because games need explosions, looping sprite sheets, etc. But it would be even better if I could go somewhere and find people with experience in making graphic assets FOR GAMES, not for general markets. Is there some specialized site or something?

sentences: Why are Monogame models tied to effects? When I load a model in Monogame using ContentManager, the model contains effects on each mesh (mesh.Effects). This is confusing to me since models seem to be directly tied to their rendering, rather than existing as standalone 3D models. Further, this makes applying custom effects more difficult in code, since I have loop through each ModelMeshPart and assign effects. The comparison to 2D would be a Texture2D containing its own SpriteBatch settings, which wouldn't make sense. Why are models tied to effects, and how can I separate them?

sentences:
Array textures on Pixel shader I'm developing on D3D11 and D3D12 in parallel. D3D12 is really difficult, but I learn it gradually. I faced a problem such as passing an array of textures to a vertex Shader. The method Textures2DArray was interesting in D3D11 , but it had disadvantages (size of texture, width and height must be the same, the same levels of MipMaps etc). As a result: I'm looking for a way to transfer a dimensionless ( if it is possible ) texture array, or at least an array of fixed size, but with different textures (*.dds (mipmaps, *.jpg etc). Why is it so necessary? Let's imagine that a model has been loaded. It has 50 textures. I loaded all 50 textures on the CPU, built an array from it, created the necessary descriptors and sent it to the Shader. I get the right texture in the Shader using the index. Thus, there will be one call to the GPU, instead of multiple calls = = number of textures in the model. Thank you for any information.

P.S.: I know about texture atlases, but in ordinary geometry I do not see any benefit from it

sentences:
Monster attack is not randomising right I have a code that I've been messing around with and the monster attack (monster.ma)
isn't randomising after the first time it's called upon (elif statement). I've tried to make it a tuple since they are immutable but it doesn't randomise after the first time. I was told to make a class and that's what I have done but it still doesnt work right. My attack variable (att) works right, but monsters' attack gets stuck. I know I can code the monster's attack into the elif statement, but I want to be able to just call upon it when needed.

import random

class monster():
    hp=50
    ma=random.randint(5, 20)
    xp=random.randint(15, 30)
a=1
exp=0
while a==1:
    if monster.hp<=0:
        exp+=monster.xp
        print"you have killed the monster"
        print("you get, "+str(monster.xp)+" exp from monster"
              "you now have, "+str(exp)+" exp")
        break
    elif monster.hp>=0:
        print"swing your sword"
        att=random.randint(5, 15)
        monster.hp-=att
        print"you do, "+str(att)+" damage to monster"
        print"monster does, "+str(monster.ma)+" damage to you" #<----------------here

sentences:
How can I achieve smooth animation of sprites between discrete tiles? I'm currently learning game development with C# and XNA and my current assignment is to create a Pac-Man clone.

The game is partially tile based, which means that the level itself is built out of an array of tiles, but Pac-Man and the ghost just have a position to be drawn at.
I've got the basic functionality down, such as building the level with a string and drawing Pac-Man and the ghost on the screen.

Pac-Man is currently represented by two positions: one is where he is in relation to the array of tiles (a Point, for example 9, 11), and one where the sprite is drawn (which is a Vector2).
However, when trying to make the player be able to move Pac-Man (and Pac-Man is supposed to "glide" between tiles, not jump between them) it seems that his graphical position can not keep up with his tile position. It sort of lags behind.

This is hard to describe but here's some code to look over:

public PacMan(): base()
    {
        texture = Game1.pacManTexture;
        tilePosition = new Point(9, 11);
        position = new Vector2(tilePosition.X * spriteSize.X, tilePosition.Y * spriteSize.Y);

That is the constructor for Pac-Man.

else if (tileManager.playArea[tilePosition.X, tilePosition.Y - 1] is Tile) // if the  tile above Pac-Man is of the type Tile...
                {
                    tilePosition.Y -= 1; // decrement tilePosition by 1
                }

That is what happens if the player presses the Up key.

Vector2 tilePos = new Vector2(tilePosition.X * spriteSize.X, tilePosition.Y * spriteSize.Y);
        Vector2 direction = tilePos - position;
        if (direction.Length() != 0)
            direction.Normalize();
        position += direction;

And that is where the faulty magic happens. The graphical position of Pac-Man (the sprite) is being updated.

Rectangle pacManRectangle = new Rectangle((int)position.X, (int)position.Y, spriteSize.X, spriteSize.Y);
        Game1.spriteBatch.Draw(texture, pacManRectangle, new Rectangle(currentFrame.X * spriteSize.X, currentFrame.Y * spriteSize.Y, spriteSize.X, spriteSize.Y), Color.White);

And lastly, that happens in the Draw method.

If you need more information, just say so.

sentences:
Running a WindowsGL MonoGame release on end Machine Can anyone tell me what is required of a PC to run a released MonoGame.
I mean what software the PC needs to have installed to run the games.
I have some problems running my released games on other PC's than my developer machine. They simply stops responding when I try to run them.

sentences:
Giving one controler button two functions I'm currently working on a game that allows the player to do some different actions.

Dodge (X button)
Attack (A button)
Use Item (Y Button)
Block (BButton)

I would like to be able to use the "Y" button to both use items and pick items up. This dual functionality would be determined by how long the player held the button and if the player was standing next to an item. I'm sure there have been studies on this and how long the player expects for a delay to use the second functionality but I'm worried that I have become biased in my testing and I can't find anything online.

My question is: Is there some sort of standard for this type of a time delay for the button? If so where can I learn more about it?

sentences:
OpenGL & SDL textures... game shuts down I'm going to create a game in C++ with SDL & openGL but adding textures won't work.
the code is in some different classes.
here's the main file

//==============================================================================
#include "ZOMBOX.h"

//==============================================================================
ZOMBOX::ZOMBOX() {

    isRunning = true;
}

//------------------------------------------------------------------------------
int ZOMBOX::Execute() {
    Init();

    bool mainloop = false;

    SDL_Event event;

    //Create an texture
    unsigned int Ball_texture = 0;
    //Load the image into the texture using the function
    Ball_texture = loadTexture("Smile.png");
    std::cout << "OpenGL is running\n";

    while(isRunning) {
        while(SDL_PollEvent(&event)) {
            Event(&event);
        }
        if(mainloop == false){
            std::cout << "Main loop has started\n";
            mainloop = true;
        }
        Logic();
        Render();
        }

    //Clear();

    SDL_Quit();

    return 0;
}

//==============================================================================
int main(int argc, char* argv[]) {
    ZOMBOX theApp;

    return theApp.Execute();
}

//==============================================================================

Ok, now the rendering;

//==============================================================================
    #include "ZOMBOX.h"

//==============================================================================
void ZOMBOX::Render() {

    extern float ballX;
    extern float ballY;
    extern float ballWH;
    extern int vellX;
    extern int vellY;
    extern unsigned int Ball_texture;
    Ball_texture = loadTexture("Smile.png");

    //RENDERING to the screen
    //Enable textures when we are going to blend an texture
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix(); //Start rendering phase
    glOrtho(0,800,600,0,-1,1); //Set the matrix
    glColor4ub(0,0,0,255); //White color
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, Ball_texture);

    glBegin(GL_QUADS); //Start drawing the pad
    //We set the corners of the texture using glTexCoord2d
    glTexCoord2d(0,0); glVertex2f(ballX,ballY); //Upper-left corner
    glTexCoord2d(1,0); glVertex2f(ballX+ballWH,ballY); //Upper-right corner
    glTexCoord2d(1,1); glVertex2f(ballX+ballWH,ballY+ballWH); //Down-right corner
    glTexCoord2d(0,1); glVertex2f(ballX,ballY+ballWH); //Down-left corner
    glEnd(); //End drawing
    //Disable textures when we are done using them
    glDisable(GL_TEXTURE_2D);

    glPopMatrix(); //End rendering phase
    SDL_GL_SwapBuffers();

    SDL_Delay(1);
}

//==============================================================================

i know the comments are not right but i understand it...

now the texture; here's the fault i think

//==============================================================================
#include "ZOMBOX.h"
//==============================================================================
//Function for loading an image into an texture
GLuint ZOMBOX::loadTexture( const std::string &fileName )
{
    SDL_Surface* image = IMG_Load( fileName.c_str() );

    SDL_DisplayFormatAlpha(image);

    unsigned object(0);

    glGenTextures(1, &object);

    glBindTexture(GL_TEXTURE_2D, object);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image->w, image->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);

    //Free surface
    SDL_FreeSurface(image);

return object;
}
//==============================================================================

I use variables you cant see but that's no problem thus they are not nessecary(i think).

Sorry for my bad English im just a dutch highschool student.

sentences:
Looping OpenAL sounds with one buffer - or how to do it correctly? I require to implement a statically played sound class which supports looping of the audio data - and requires this to be changed at runtime (e.g., turning off looping).

Maybe I understand something horribly wrong, but this is how I understood how to implement looping at all, and came to the following solution:

I have exactly one buffer containing all the audio data.
If looping is enabled, ensure that the source playing the sound has this buffer queued twice, so it replays the sound when the end of the current buffer has been reached:

if (Loop && _source.BuffersQueued == 1)
{
    _source.QueueBuffers(_buffer);
}

If a buffer has been processed (e.g. right after the sound audibly loops), it is unqueued and dismissed.

if (_source.BuffersProcessed > 0)
{
    _source.UnqueueBuffers(_source.BuffersProcessed); // Unqueue outdated buffers
}

Here I ran into the first problem: If the user sets the sound to not loop anymore, I cannot unqueue the upcoming buffer (to make it not loop over another time while looping has already been turned off).

This is because I only found methods to unqueue by the handle of the buffer, but since I queue the same buffer twice, the handle is always the same to the one currently playing. OpenAL tries to unqueue the currently played buffer then, which obviously fails.

Unqueuing by the number of processed buffers also doesn't help, as no buffer has been marked as processed yet.

Do I really need to completely duplicate the buffer with all the audio data, keep it stored twice in memory, just to have two different buffer handles to unqueue the second buffer if looping gets disabled?

sentences:
Does there exist a library of animations for easing, skewing, bouncing, and squishing? I'm specifically referring to the types of animations that are typical in 2D hand held games on the Nintendo platform, where menus slide in, bounce, squish, etc.

I'm looking for something that is somewhat canned but allows for tweaks. Does something like this exist in any form (don't really care what language or for what targeted platform, I'm just looking for the pure math behind it).

sentences:
Make Windows game appear in Games Explorer (Start Menu - Games) How can I make my game (right now just a C# Console Application) appear in the Start Menu under Games??

I mean is it possible for any program to register as a Game in Windows Vista / 7?

sentences:
Low Res Atlas Texture vs. Many different materials without textures So I have recently started to look into optimizing a medium complex 3D scene, more specifically i am looking to improve the performance i get from a fairly realistic bus. I am currently using the Unity3D standard shader. There are a lot of different objects within the scene, most of which are repeated and instanced. While many individual objects require only limited color variance often enough just a solid color and no texture at all.

I have read a lot about batching and atlasing but can't quite find an answer on the trade-off of using textures when no textures are required. I understand that reusing the same material allows for batching and can greatly reduce the amount of draw-calls, however how does this compare to the complexity of texture mapping if this could be avoided entirely? Is it still good practice to atlas solid colors on very low resolution atlas-textures and thus combine materials together? How does it look if i intend to use metallic and smoothness maps as well? Does it all come down to scene complexity and a number game or is there a straight answer?

I have the same uncertainty when it comes to objects which are made up of an arbitrary single digit number of solid colors; given supporting geometry, is it better to assign different materials with solid colors to regions of the object or create low-resolution textures?

In general; what is the point at which atlasing becomes the worse choice?

Thanks in advance!

sentences:
Activate and Deactivate Collider with Click I'm having some trouble working with this, it's basically a sword that points toward your mouse position, and when you Left-Click, a Trigger Collider is activated and then deactivated, but I can't get it to work.

Here is my code :

void Attack()
{
    //Activates the Sword Collider
    polygonCollider2D.enabled = true;
    //Debug Line
    Debug.Log("Collider Active");
    StartCoroutine(Wait(0.1f));
    polygonCollider2D.enabled = false;
}

IEnumerator Wait(float seconds)
{
    yield return new WaitForSeconds(seconds);
}

I did it this way hoping that the Wait method would give the game enough time to react to an active collider, and using some Debug.Log(). I know that the collider actually activates, but it does not react to other colliders.

I keep wondering if this is the proper way of working with this. If it's not, do let me know.

sentences:
Procedural Dungeon Generation: Is there a simple algorithm to make sure all of these rooms get connected using minimal corridors? Is it possible to get a hive-like structure, connecting all the rooms without having too many corridors? (Too many being 3-4+ corridors coming from a single room)

Below is the output of how my rooms look, basically they randomly placed.

What I'm hoping to get corridor-wise.

sentences:
Roguelike Map Structure I'm working on a roguelike and would like to know how to structure my map data. I suppose this question could also be extended to any sort of top down 2d game. Anyways! My game will contain object types like terrain, doors, switches, monsters, and items. How should the objects be stored within a map?

Some ideas I've gathered online:

The map is a 2d array. Each cell in the array can store multiple references to objects occupying it.
The map contains several layers of 2d arrays, and each layer stores references to objects of a specific type.
Like 1. but only store static terrain information in the 2d array. The rest of the objects are dynamic and stored in lists for each type.

sentences:
Basics of drawing in 2d with OpenGL 3 shaders I am new to OpenGL 3 and graphics programming, and want to create some basic 2d graphics.  I have the following scenario of how I might go about drawing a basic (but general) 2d rectangle.  I'm not sure if this is the correct way to think about it, or, if it is, how to implement it.

In my head, here's how I imagine doing it:

t = make_rectangle(width, height)

build general VBO, centered at 0, 0

optionally: t.set_scale(2)
optionally: t.set_angle(30)
t.draw_at(x, y)

calculates some sort of scale/rotate/translate matrix (or matrices), passes the VBO and the matrix to a shader program

Something happens to clip the world to the view visible on screen.

I'm really unclear on how 4 and 5 will work.  The main problem is that all the tutorials I find either: use fixed function pipeline, are for 3d, or are unclear how to do something this "simple".

Can someone provide me with either a better way to think of / do this, or some concrete code detailing performing the transformations in a shader and constructing and passing the data required for this shader transformation?

sentences:
Best practice/way for client to speak with server I'm making a multiplayer game in HTML5 Canvas and Node using Express and Socket.io. It's a platformer style game and so far the players are able to see each other and move around on the screen. It works pretty well, but most of my game logic is client side which I believe might become a problem. The movement of other players at the moment isn't very smooth at all. So far, the only thing the server does is recieve the position and velocity of the players, and then broadcast it out to all the other players so they can see each other. I was wondering if there was a smarter way to go about this? Everything like collision detection, movement, key inputs etc is all used client side. Should this be server side instead? I could imagine that if I calculated things like collision detection and movement server sided, then there would be no way for the player to do things like edit their position via the browser console and change their size etc.

I hope it's not too complicated. I haven't written much code yet since I would like to make sure I do it the correct way from the start without having to change and rewrite a lot of code. Let me know if you'd like to see my code.

sentences:
Determine if the player should be able to interact with a door You know the drill, standard first person door mechanics. How do they do it?

My most noticeable and frustrating problem is when there is a door within range and in view, but the closest door is actually behind the player.

I'm aware of the "dot product trick" but say the player position is point 1, what is point 2? The center of the doors bounding box? The center of the open door way?

Any insight would be gold.

sentences:
Variable-step update() in game loop is falling behind, how can I get around this? I'm working on a minimal game engine for my next game. I'm using the delta update method like shown:

void update(double delta) {
    // Update code that uses `delta` goes here
}

I have a deep hierarchy of updatable objects, with a root updatable that contains several updatables, each of which contains more updatables, etc. Normally I'd just iterate through each of the root's children and update each one, which would then do the same for its children, and so on. However, passing a fixed value of delta to the root means that by the time the leaf updatables are reached, it's been longer since delta seconds that have elapsed. This is causing noticable desyncing in my game, and time synchronization is very important in my case (I'm working on a rhythm game).

Any ideas on how I should tackle this? I've considered using StopWatches and a global readable timer, but any advice would be helpful. I'm also open to moving to fixed timesteps as opposed to variable.

sentences:
Does pixels per unit property affect performance of the game in Unity? The Sprite import inspector has a Pixels Per Unit setting that controls the size of the sprite objects when they're added to the scene:

Will Unity resize the sprite at run time or will it be resized after me changing the property and saved for the future?

sentences:
Collision bug with gravity in slick2D I have fixed some of the previous problem. The collision when running into a corner(a wall on two sides) however is still not working. When the player runs into a corner he just falls down and out of the map. Not sure what is happening.

manageWallCollision Method:

@Override
public void manageWallCollision(Scene currScene) {
    for(int i = 0; i < currScene.getMapManager().getWalls().size(); i++){
        MapTile currTile = currScene.getMapManager().getWalls().get(i);

        if(currTile.isCollidable()){
            if(this.getBounds().intersects(currTile.getBounds())){
                //down
                if(vy > 0 && y2 > currTile.getY() && y2 < currTile.getY2()&& y < currTile.getY() && y < currTile.getY2() ){
                    setY((currTile.getY() - getHEIGHT()) - 7);
                    break;
                }
                //up
                else if(vy < 0 && y < currTile.getY2() && y > currTile.getY() && y2 > currTile.getY2() && y2 > currTile.getY()){
                    setY(currTile.getY2() + 7);
                    break;
                }
                //right
                else if(vx > 0 && x2 > currTile.getX() && x2 < currTile.getX2() && x < currTile.getX() && x < currTile.getX2() ){
                    setX((currTile.getX() - getHEIGHT()) - 7);
                    break;
                }
                //left
                else if(vx < 0 && x < currTile.getX2() && x > currTile.getX() && x2 > currTile.getX2() && x2 > currTile.getX()){
                    setX(currTile.getX2() + 7);
                    break;
                }
                break;

            }
        }
    }
}

If you need any more code or info just ask. Any help is appreciated.

bump

sentences: Avoid double compression of resources I am using .pngs for my textures and am using a virtual file system in a .zip file for my game project. This means my textures are compressed and decompressed twice. What are the solutions to this double compression problem? One solution I've heard about is to use .tgas for textures, but it seems ages ago, since I've heard that. Another solution is to implement decompression on the GPU and, since that is fast, forget about the overhead.

sentences:
Should I share classes on the server with the client? I am fortunate being able to use the same programming language on both the server and client (javascript). I would therefore like to share my code and classes between server and client, like Half-Life (and possibly others) did.

To make things simple, suppose I have an MMO with a Player and an Enemy class, with a position, velocity, and health.

var Player = function() {
    this.health = 100;
    this.x = 0;
    this.y = 0;
}

var Enemy = function() {
    this.health = 100;
    this.x = 0;
    this.y = 0;
}

I know ideally these should inherit from each other (or use a CES system). But my question is as follows:

Since these classes will be used on the client and server (since both client and server needs to know about these entities) with some but not all shared logic, would it not be crazy to define two separate classes on both the server and client?

What are the advantages and disadvantages of sharing classes between server and client?

Are there any helpful websites with tips/tricks for this approach?

sentences:
Making a master server in Photon Unity Network? I am trying to make a game that requires a dedicated server running 24/7 and I would like to use Photon Networking but can Photon Network handle/do a dedicated server setup?

The reason I ask is because every tutorial I watch/read is talking about client hosting and not server to client.

Another question I have is that if PUN can handle dedicated servers will I have to make separate applications, one for the server and one for the client? To me that seems to make the most sense.

The third question is that if I do have to make a server and client application how do I connect to my server application with my client application?

Does PUN provide a URL which I can connect to or is there something else that I have to do?

If you guys have any tutorials you could point me to working with PUN and dedicated servers that would be awesome and if you guys have any information you are willing to bestow upon me that would be greatly appreciated!

sentences:
How to mitigate this strange pattern shown in Phong lighting? I am creating an entire lighting scene in OpenGL. The entire scene consist of only one point light. I noticed some strange z-fighting like pattern. This flickers when I move the camera.

Can anyone tell me what is the potential cause of the problem? How should I mitigate this problem? Thank you.

===

EDIT: The problem is solved. It was primarily caused by normal transform computation error and my ill made model might have been aggravated this speckle flickering effect.

sentences:
Jerky motion when standing on hovering object In a level of a 3D FPS I'm making, I have several floating pillars that move up and down (the x and z positions are always the same). When the player stands on one of the pillars, the motion is incredibly jerky going up, but smooth going down. I think the player is sinking into the pillar slightly and then catching up.

I've tried different colliders, all sorts of combinations with rigidbodys and character controllers. I've tried setting the pillar as a parent of the character and then having the player hover slightly. I've just hit a brick wall and would appreciate an outside perspective. Here's my code just in case the issue is in there.

Player movement

 public float walkSpeed = 6.0F;
 public float runSpeed = 10.0F;
 public float jumpSpeed = 8.0F;
 public float gravity = 20.0F;
 private Vector3 moveDirection = Vector3.zero;

 void FixedUpdate(){
     CharacterController controller = GetComponent<CharacterController>();

         moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
         moveDirection = transform.TransformDirection(moveDirection);
         moveDirection *= walkSpeed;
         if (Input.GetButtonDown("Jump")){
             moveDirection.y = jumpSpeed;
         }

         if (Input.GetButton("Sprint")){
             walkSpeed = runSpeed;
         }
         else{
             walkSpeed = 6.0F;
         }

     moveDirection.y -= gravity * Time.deltaTime;
     controller.Move(moveDirection * Time.deltaTime);
 }

 void OnCollisionStay(Collision hit) {
     if (hit.gameObject.tag == "Column") {
         transform.parent = hit.transform;
     } else {
         transform.parent = null;
     }
 }

Pillar movement

 float height;
 float speed;
 Vector3 start;
 Vector3 end;
 Vector3 startOrEnd;
 void Start(){
     speed = 0.01F;
     start = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
 }

 void Update () {
     motionControl(speed);
 }

 float randomNumber(float min, float max){
     float number = Random.Range(min, max);
     return number;
 }

 void motionControl(float speed){
     if (gameObject.transform.position == start) {
         end = new Vector3(gameObject.transform.position.x, randomNumber(0, 10), gameObject.transform.position.z);
         startOrEnd = end;
     }else if (gameObject.transform.position == end) {
         startOrEnd = start;
     }
     gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, startOrEnd, speed);
 }

sentences:
Why is there such a difference in between my scene and game? Here I have 2 screenshots of my problem:

By the way my water shader works with Screen position and Scene Depth.
I can include them here if needed.
Here is my shader(GoogleDrive)
Added
Now it looks like that when I move window "game" to the side:

Added
Here's graph's screenshoots:

P.S. I think it's something in unity's settings but not in shaders(not sure).

sentences:
Updating connected states in a "build the pipeline" puzzle game I'm trying to make the pulse system in a "build the pipeline" puzzle game to check if tiles are connected to the starting tile.

There is a weird bug that prevents tiles on the right and tiles on the top of any powered up tile (including starting one) to change state, but it works fine with tiles on the left and bottom.

I tried to log this and it happened that the cycle is going trough these tiles, but their state doesn't change. Here is an example:

Here is the code. If I remove this bit:

 else
              p.GetComponent<piece>().ConnectedToStart = false;

then it is changing the state as it should, but I have no idea how to disable tiles that should be unpowered in any other way. Also, the question is still there - why does it only work for the tiles on the left and bottom?

    public class Puzzle
    {

        public int winValue;
        public int curValue;

        public int width;
        public int height;
        public piece[,] pieces;

    }

        public Puzzle puzzle;

        GameObject[] pieces;
    void Start()
    {
        pieces = GameObject.FindGameObjectsWithTag("Piece");
    }

    void Update()
    {
        CheckForStartConnections();
    }

    public void CheckForStartConnections()
    {

        foreach (var p in pieces)
        {
            if (p.GetComponent<piece>().StartPiece)
                Pulse((int)p.transform.position.x, (int)p.transform.position.y);
            else
              p.GetComponent<piece>().ConnectedToStart = false;
        }
    }

    void Pulse(int w, int h)
    {
        puzzle.pieces[w, h].GetComponent<piece>().ConnectedToStart = true;
        //compares left
        if (w != 0)
            if (puzzle.pieces[w, h].values[3] == 1 && puzzle.pieces[w - 1, h].values[1] == 1)
            {
                if (!puzzle.pieces[w - 1, h].GetComponent<piece>().ConnectedToStart)
                    Pulse((int)puzzle.pieces[w - 1, h].transform.position.x, (int)puzzle.pieces[w - 1, h].transform.position.y);
            }
        //compares bottom
        if (h != 0)
            if (puzzle.pieces[w, h].values[2] == 1 && puzzle.pieces[w, h - 1].values[0] == 1)
            {
                if (!puzzle.pieces[w, h - 1].GetComponent<piece>().ConnectedToStart)
                    Pulse((int)puzzle.pieces[w, h - 1].transform.position.x, (int)puzzle.pieces[w, h - 1].transform.position.y);
            }
        //compares top
        if (h != puzzle.height - 1)
            if ((puzzle.pieces[w, h].values[0] == 1 && puzzle.pieces[w, h + 1].values[2] == 1))
            {
                if (!puzzle.pieces[w, h + 1].GetComponent<piece>().ConnectedToStart)
                {
                    Pulse((int)puzzle.pieces[w, h + 1].transform.position.x, (int)puzzle.pieces[w, h + 1].transform.position.y);
                }
            }
        //compares right
        if (w != puzzle.width - 1)
            if (puzzle.pieces[w, h].values[1] == 1 && puzzle.pieces[w + 1, h].values[3] == 1)
            {
                if (!puzzle.pieces[w + 1, h].GetComponent<piece>().ConnectedToStart)
                {
                    Pulse((int)puzzle.pieces[w + 1, h].transform.position.x, (int)puzzle.pieces[w + 1, h].transform.position.y);
                }
            }
}
```

sentences:
How is software rendering done? I would like to explore realtime software based rasterization. I know everything is going towards the GPU these days but there are a few games where it still makes sense to use a software renderer.

For example: Voxeltron

  Voxatron is an arena shooter that takes place in a world made of
  voxels (little cubes, kind of). Everything in the game is displayed in
  a virtual 128x128x64 voxel display, including the menus and player
  inventory. If you look closely, you can sometimes see the inventory
  (score/life/ammo) casting a shadow on some of the objects on the
  ground.

  I've been working on voxel rendering and modeling tools for a long
  time now, with the ultimate goal of making a large explorey adventure
  game. About half a year ago it fused with work I was doing on arena
  shooters for Conflux, and this is the result.

  It's quite a simple game at heart -- mostly just Robotron set in a 3d
  destructible world with goofy creatures. I'm unsure how major the
  implications of destructibility will be for gameplay, but it sure is
  fun to blast away pieces of wall. I've also added an experimental
  wall-building pickup you can use to construct barriers to hide from
  scary monsters.

  The game takes place in a small set of arenas. Some of them feature
  rooms with set action pieces, somewhere between Knightlore and Smash
  TV. This is some of the original adventure based design sneaking back
  in, and an excuse to create thematic environments.

  Features:

  Custom software rendering with soft shadows.
  Built-in sound and music    synthesizer (also used to make the
  trailer music).
  Playback & post game recording.

sentences:
How can I achieve a zoom-like camera effect? I have a top down 3D camera:

view = Matrix.CreateLookAt(new Vector3(0,0,20), Vector3.Zero, Vector3.Up);

Now I want to achieve the effect like when I zoom in the scene and only show a section at the middle of my actual scene. When I now move an object via CreateTranslation it looks more like moving an object in 2D.

What I have now is:

What I want is more like this:

sentences:
Accessing vertex Input in surf directly without vert's out parameter In Tessellation Shader I can get the vertex Input in vertex shader as follows:

   o.worldPos = v.vertex.xyz;

But how do I get the worldPos directly without filling the out parameter in the vert function. Asking this because the shader is a DX11 Tessellation one and out parameter in vert function is not available at all.

basically I want Initialize my Input shader and pass It to surface shader In vertex shader.I can do It but It's different In Tessellation shader so I need to Accessing vertex position in surf directly without vert's out parameter.

Shader "Tessellation Sample" {
        Properties {
            _EdgeLength ("Edge length", Range(2,50)) = 15
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _DispTex ("Disp Texture", 2D) = "gray" {}
            _NormalMap ("Normalmap", 2D) = "bump" {}
            _Displacement ("Displacement", Range(0, 1.0)) = 0.3
            _Color ("Color", color) = (1,1,1,0)
            _SpecColor ("Spec color", color) = (0.5,0.5,0.5,0.5)
        }
        SubShader {
            Tags { "RenderType"="Opaque" }
            LOD 300

            CGPROGRAM
            #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap
            #pragma target 4.6
            #include "Tessellation.cginc"

            float _EdgeLength;

            float4 tessEdge (appdata_full v0, appdata_full v1, appdata_full v2)
            {
                return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
            }

            float _Displacement;

            struct Input {
                float4 position  : POSITION;
                float3 worldPos  : TEXCOORD2;   // Used to calculate the texture UVs and world view vector
                float4 proj0     : TEXCOORD3;   // Used for depth and reflection textures
                float4 proj1     : TEXCOORD4;   // Used for the refraction texture
            };

            void disp (inout appdata_full v, out Input o){
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.worldPos = v.vertex.xyz;
            o.position = UnityObjectToClipPos(v.vertex);
            o.proj0 = ComputeScreenPos(o.position);
            COMPUTE_EYEDEPTH(o.proj0.z);

            o.proj1 = o.proj0;
            #if UNITY_UV_STARTS_AT_TOP
            o.proj1.y = (o.position.w - o.position.y) * 0.5;
            #endif
            }

            sampler2D _MainTex;
            sampler2D _NormalMap;
            fixed4 _Color;

            void surf (Input IN, inout SurfaceOutput o) {
                o.Albedo = float3(0,0,0);
            }
            ENDCG
        }
        FallBack "Diffuse"
    }

but I have error:

Shader error in 'Tessellation Sample': 'disp': no matching 1 parameter function at line 173 (on d3d11)

sentences: Artificial player evaluation I have a problem concerning a board game I'm creating. I plan on making an artificial player for the game using MiniMax with AlphaBeta prunning, but I'm not sure how to evaluate ir the player is good at the game. Since it's a new game I can't get a player who is good to give feedback. So I'd like to know if there is any technique to determine objectively if the artificial player is actually good. Thank you in advance.

sentences:
What is the advantage of wrapping D3D in a class versus a namespace? Almost all the tutorials and books use a class wrapper for Direct3D. But I haven't found any scenario in which using more than one instance of Direct3D system (the "device" and state, et cetera) is required.

Is there any advantage to using a class instead of a namespace? Is there ever a case where using more than one is required?

sentences:
Rectangle touch sides of another rectangle I am making a platformer game and im trying to make the player collide with all the blocks, here's a picture:

The blocks is stored in List and im trying to get the side's of the block usin

static class RectangleHelper
{
    public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Bottom >= r2.Top &&
                r1.Bottom <= r2.Top + (r2.Height / 2) &&
                r1.Right >= r2.Left + r2.Width / 4 &&
                r1.Left <= r2.Right - r2.Width / 4);
    }

    public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Top >= r2.Bottom &&
                r1.Top <= r2.Bottom + (r2.Height / 2) &&
                r1.Right >= r2.Left + (r2.Width / 4) &&
                r1.Left <= r2.Right - (r2.Width / 4));
    }

    public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Right <= r2.Right &&
                r1.Right >= r2.Right - r2.Width  &&
                r1.Top <= r2.Bottom - (r2.Width / 4) &&
                r1.Bottom >= r2.Top + (r2.Width / 4));
    }

    public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
    {

        return (r1.Right >= r2.Right &&
               r1.Right <= r2.Right + r2.Width &&
               r1.Top <= r2.Bottom - (r2.Width / 4) &&
               r1.Bottom >= r2.Top + (r2.Width / 4));
    }
}

I got this code from a Youtube video and i changed it a little bit.. (the original code didnt work well)

the problem im having is:
the TouchBottomOf & TouchRightOf functions doesn't work well...(The collision occur randomly, sometimes on top of the block, sometimes little below it (TouchBottomOf), same with TouchRightOf)

Is there a better way to check it?
thanks.

sentences:
OpenGL doesn't draw (3.3+) Brief:
I've been following this tutorial about OpenGL for 2 days, and I still can't have a triangle drawn, so I'm asking for help here. The tutorial is turned to OpenGL version 3.3 programing, using vertex arrays, buffers, etc. The libraries are: GLFW3 and GLEW, and I setted them by myself. The screen keeps black all the time.

Full code:

link here
(It's just like a Hello World opengl program)

Further Details:

I get no errors at all.
I downloaded a software to test my video card, and it supports OpenGL 4.1+
Standard OpenGL code for drawing (from earlier version) such as this one works normally.
I'm using Microsoft Visual Studio 10.0
I presume all the OpenGL implementation was dune right: I added Additional Dependences  to the linker as glew32.lib, opengl32.lib, glfw3.lib. The glew.dll was placed at SysWOW64 - because I'm running window 64bits, and glew is 32.

Notes: I've been working hard to find out what this is, but I can't find. I would appreciate if anyone could test this code for me, so I can know if I implemented something wrong, and that its not my code.

sentences:
Game class and main function I have a Game class with my main game functions and instances of game objects like screen, etc. My game is made using C++ and SDL.

I was wondering, though, should main be a function of my class? Or should I do "Game game;" from "int main();" and have the loop inside main?

My doubt is - if I do it from an outside-main, then most of my stuff will have to be public, and that is kinda bad, isn't it?

Any ideas? Thank you!

sentences: Implementing an enum from an abstract class Both my Player class and Enemy class should have an enum called State. (The values inside of that enum would be different in each class.) I'd like to have the Player class and Enemy class inherit from an abstract base class that would require those two classes to have that enum. Is this possible?

sentences:
C++&SFML Moving Sprites Smoothly in Tiles As a student, I've always wanted to become a game developer. So far I've managed to learn the basics of C++ and SFML 2.1

For my first project, upon deciding to make a 2D RPG-ish game, I encountered a problem that the game loop refreshes so quickly that if I move them by 1 pixel per frame, the sprite will move more quick than I intended to.

I implemented a frame-determined movement system(not sure what it's called) that whatever the fps is, the character moves at same speed.

However, I couldn't solve the problem(which is what I'm asking) that the sprite won't move smoothly. What's happening in my build is that the player will move about 1px per frame, and can be interrupted by other inputs. What I want the sprite to do is move horizontally 32px per second. How can I do this?

Edit: wasn't being clear enough. What I want the program to do is when I press 'Right' key once, sprite moves towards the positive side of x-axis, for 32px. What's currently functioning in my program is the sprite will move only once, 1px

TL;DR : I want to move my sprite like old-school RPG games, moving predetermined pixels(or tiles) smoothly.

sentences:
How to trigger poison effects efficiently I'm trying to trigger poison effects at the end of each turn in a turn based game. Each Actor in battle has a list of active effects, each of which could be a poison. I simply want to Execute() all of those Poisons.

See my code below; is there a way I can combine my two queries or make them more efficient so that the moment a Poison is found, that Poison executes?

var poisonedActors =
            from Actor actor in ins.BattleParticipants
            where actor.ActiveEffects.Any(activeEffect => activeEffect is Poison)
            select actor;
var poisons =
            from ActiveEffect activeEffect in poisonedActors
            where activeEffect is Poison
            select activeEffect;
foreach (Poison poison in poisons)
            poison.Execute();

EDIT: Is this more efficient? Is there a better way to do things?

    foreach (Actor actor in ins.BattleParticipants)
        foreach (ActiveEffect activeEffect in actor.ActiveEffects)
            if (activeEffect is Poison)
                activeEffect.Execute();

sentences:
How to model an Attack( ) action? How to model combat? In general, how objects communicate? I never understood how would you elegantly describe two people talking in OO. I think this question extends to how similar objects communicate in general. I am designing a game now and Units have to attack each other.

My first idea was something along the lines:

public class Unit {
   public void attack(Unit targetUnit) {
      //calculates damage base on this unit stats
      targetUnit.takeDamage(damage);
  }

  public void takeDamage(int damage) {
    this.health = health - damage;
  }

}

And then later:

Unit whiteKnight = new Unit();
Unit blackKnight = new Unit();

//a possible combat interaction
whiteKnight.attack(blackKnight);
blackKnight.attack(whiteKnight);

Is this acceptable? Is this the standard?

sentences:
UNET Performance of (many) Kinematic Rigidbodies I am building a game in Unity in C# using the UNET networking elements.

I am trying to figure out what is the performance cost of kinematic rigidbodies?

My understanding is that, when kinematic, rigidbodies are outside the physics system and therefore are not as resource-heavy as non-kinematic rigidbodies.

For my game, I will need to use a lot of kinematic rigidbodies in the scene, because they are used to detect collisions between player-placed objects (with box colliders) and the rigidbodies. All the objects instantiated in the scene will therefore need a kinematic rigidbody to allow this collision checking to take place.

Thanks very much for your help.

sentences:
How to create a dynamic Map in Unity (Augmented Reality) I created a dynamic map with a LineRenderer. The LineRenderer gets a new position assigned, for each movement my 'character' does. It works good, but I expect it to get a really bad performance at some point. Could you recommend a better solution to create a dynamic map with the free version of Unity.
My code looks like this at the moment :

        if (lastPosition != target.transform.position) {
            path.SetVertexCount(positionCounter + 1); //Path is the LineRenderer
            lastPosition = target.transform.position;
            path.SetPosition(positionCounter++,new Vector3(lastPosition.x,0,lastPosition.z));
        }

The LineRenderer lies on a layer, which can only be seen by my orthographic mini map camera.
Btw. I need it in a dynamic way, because it's an augmented reality app, which has no terrain which I could display on the map or stuff like this. I have to create the stuff which should be displayed.

sentences:
How do I order sprites by depth in Java, when their objects are of different classes? I'm developing a game to learn more about Java, and I've run into a problem: My character (the guy) moves, but I can not figure out how to automatically change the order of how the sprites are drawn. Each sprite has a depth, which is just the y value of the bottom of the sprite. If a sprite has a higher depth, then it is displayed in front of a sprite with a lower depth. Here are a few pictures of the problem:

As you can see the first picture, the guy should be in front of the girl.

I was thinking about putting them into an array list, and ordering them based upon their depth, but they are different object types. The guy is an object of class character, and the girl is an object of class NPC. Is there a way to put both of these object types into one array list, or is there a better solution?

sentences: Drawing at floating point position The library I am using (SDL2) only supports drawing to int positions. I am currently storing my objects positions as double, and would like to render them. Should I round the value to int, i.e. 0.5 => 1, or simply cast it to int, i.e. 0.5 => 0?

sentences: What do I need to develop for the Playstation 3? I made a game, and I want to port it to the Playstation 3. What do I need in terms of hardware, money, licenses and such?

sentences:
Secure login for a game that is open source I am making a game which i will be open sourcing. Its a simple arcade like game but requires a network connection because it is meant to be played with other people.

The thing i am worrying about is how would i be sure that the client is the one that i put out for the end user to play with? Kind of a like of sv_pure for Team Fortress 2.

I was thinking of different ways to combat this such as the server requesting the client's version or even it's md5 hash but people with simple java knowledge could just force a method to always return what the server wants.

sentences:
Camera Touch Zoom and Pan with world - 2D I am doing my first unity2d game and im in need of a little optimization for my camera.

I have a camera which could pan and zoom with the speed i have defined. The problem with that is the speed i defined for panning will be too fast when zoomed in and soo slow when zoomed out. Maybe it could be achieved by having varying speed with zoom level. I dont want that.

Instead, i would like to have the camera used in Clash of Clans (i have seen it only in that).

The camera pans/zooms async with the world.
That is, at any zoom level, if we placed our finger on an object X and started moving, the object X will be right below our fingers all the way. That means the world moves relatively.

Its the same with the zooming.
If we placed two fingers on object X & on object Y and started 'zooming' in or out,
Those two objects will be there right below the fingers all the way.

That is what i would like.

For panning, i tried this and failed :
(Unity C#)

Touch t = Input.getTouch(0); //when touchcount = 1 only

Vector2 prev_touch_position = t.position - t.deltaPosition;

Vector3 resultant_unitvector = (prev_touch_position - t.position) / (prev_touch_position - t.position).magnitude;

float resultant_magnitude = Info.half_height / camera.orthographicSize * (prev_touch_position - t.position).magnitude;
//Info.half_height is calculated during change in orthographic size and is a static variable.

camera.transform.position += resultant_unitvector * resultant_magnitude;

The above code doesnt work as expected on debugging.

It would be a great help for the community if someone could solve this cuz that is some pretty good camera :)
(Include damping after touch release if you could ? :) )
Im just a student by the way :)

Thanks in advance :)

sentences:
Creating a delay by using Invoke Is it possible to delay the effects of a script that is attached to a game object?

I have 2 characters in a scene, both receiving live motion capture data, so they are both animated identically. I have rotated one by 180 degrees and placed it in front of the other one, to create the impression that they are copying/mirroring each other.

Each has several scripts attached to them, of course...

Now, I would like to be able to delay one character a bit (e.g. 1 sec) to make it look more realistic, as if one character is observing the other character and then copying its exact movements.

Is it possible to do this by somehow using the Invoke method on the other character's Update perhaps? Or any other possibilities to achieve what I described?

EDIT :: I used a buffering mechanism, as suggested by all the helpful comments and answers, instead of delaying, because delaying would have resulted in the same network data being used, except after a delay, but I needed the same old data being used to animate a second character to create the impression of a delayed copying...

private Queue<Vector3[]> posQueue;
private Queue<Quaternion[]> rotQueue;
int delayedFrames = 30;

void Start()
{
    posQueue = new Queue<Vector3[]>();
    rotQueue = new Queue<Quaternion[]>();
}

void Update()
{
    Vector3[] latestPositions;
    Quaternion[] latestOrientations;

    if (mvnActors.getLatestPose(actorID-1, out latestPositions, out latestOrientations))
    {
        posQueue.Enqueue(latestPositions);
        rotQueue.Enqueue(latestOrientations);

        if ((posQueue.Count > delayedFrames) && (rotQueue.Count > delayedFrames))
        {
            Vector3[] delayedPos = posQueue.Dequeue();
            Quaternion[] delayedRot = rotQueue.Dequeue();

            updateMvnActor(currentPose, delayedPos, delayedRot);
            updateModel(currentPose, targetModel);
        }
    }
}

sentences:
How to update "dynamicVertexBuffer" correctly with "setdata" on XNA? I developed a small 3d games xna and uses a "DynamicVertexBuffer" and "DynamicIndexBuffer" to store and draw my vertices. Everything works fine, but my problem is the "Update" function where I update my buffer.
Each apel update I have to reset my buffer using the keyword "new DynamicVertexBuffer (...." It goes down the performance and reduce the frames per second of my games.

Do I have to initialize my buffer each time in my function "Update ()"? Is it okay to reset every time my buffer to each call / frame

I can not find a solution to update correctly my Dynamicbuffer with "setData ()" function without having to initialize whenever my buffer just before. Am I obliged to Reset-"DynamicVertexBuffer" and "DynamicIndexBuffer" before the update? If I call "setData ()" before reset it, I throw an exception:

Works well but I have initialized every time "dynamicIndexBuffer" and "dynamicVertexBuffer" before update! (Consumes more resources?)

    public override void Update(GameTime gameTime)
    {
                foreach (Octree.Node node in regions[regionIndex].Nodes.Where(n => n.ItemGroup == a).Where(m => arcadia.camera.Frustum.Contains(m.boundingBox) != ContainmentType.Disjoint))
                {
                    //build indices
                    node.Cube.SetUpIndices(indexIndiceBuild);
                    //Add indices tho the collectionList
                    foreach (int indice in node.Cube.Indices)
                    {
                        list_structure_indices.Add(indice);
                    }
                    //Add vertex to the collectionList
                    foreach (VertexPositionTexture posText in node.Cube.Vertices)
                    {
                        vertexPositionStructureCube.Add(posText);
                    }
                    //Add vertexBuffer to the collectionList
                    indexIndiceBuild += 24;
                }
                    //Declare and initialize new buffers
                    //VertexBuffer Initialize again
                    vertexBuffer_cube = new DynamicVertexBuffer(
                    arcadia.Game.GraphicsDevice,
                    VertexPositionTexture.VertexDeclaration,
                    vertexPositionStructureCube.Count,
                    BufferUsage.WriteOnly);

                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());
                    //IndexBuffer Initialize again
                    indexBuffer_cube = new DynamicIndexBuffer(Game.GraphicsDevice, IndexElementSize.ThirtyTwoBits, list_structure_indices.Count, BufferUsage.WriteOnly);
                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());
                    .........
}

I'm just trying to update with "SetData" with new vertices and indices but i throws the exception:
    "The array is not the proper size for the Amount of data requested."

    public override void Update(GameTime gameTime)
    {
                    .........
                    //Only "setdata()" without initialize buffer again ??
                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());

                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());

                    .........
}

sentences:
Java Slick2d lighting using Raycasting I am trying to make a top down view game in java using the Slick2d library, for lighting I wanted to do something like this : http://www.redblobgames.com/articles/visibility/.
I was wondering if there was a way to tint or light places on the screen in Slick. I would have my map rendering in the background and a lightmap in front.

Solution :
https://github.com/ariejan/slick2d/blob/master/src/org/newdawn/slick/tests/AlphaMapTest.java

sentences:
XNA Load/Unload logic (contentmanager?) I am trying to make a point-and-click adventure game with XNA, starting off simple. My experience with XNA is about a month old now, know how the classes and inheritance works (basic stuff).

I have a problem where I cannot understand how I should load and unload the textures and game objects in the game, when the player transitions to another level. I've googled this >10 times, but all I find is hard coding while I don't even understand the basics of unloading yet.

All I want, is transitioning to another level (replacing all the sprites with new ones).

Thanks in advance

sentences:
Chamfered cube geometry generator I'm trying to create a geometry generator for a "Chamfered Cube". I've got the vertices working, but I'm stuck with creating the faces. I don't really know how I could re-arrange my algorithm to create the vertices in the right order for a triangle list / strip / fan / whatever.

This is what I've done so far: starting from the 8 vertices of a normal cube, I "push" out vertices in the shape of an eight of a sphere:

//start 0,0,0
var width = 8;
var radius = 3;
var segments = 16;

var half = width / 2;
var segmentStepSize = Math.PI / 2 / segments;

//displacement
var w = Math.sqrt(Math.pow((half-radius),2)*2);

// the 8 original vertex vectors
var startPoints = [
    [ 1,  1,  1],
    [ 1,  1, -1],
    [ 1, -1,  1],
    [ 1, -1, -1],
    [-1,  1,  1],
    [-1,  1, -1],
    [-1, -1,  1],
    [-1, -1, -1]
]

var x, y, z, v, x1, y1, z1, j, k;

var points = [];

for(var i = 0; i < 8; i++) {
    v = startPoints[i];
    x = w * v[0];
    y = w * v[1];
    z = w * v[2];

    for(j = 0; j < segments +1; j++) {

        for(k = 0; k < segments+1; k++) {

            x1 = x + radius * Math.cos(k*segmentStepSize) * Math.sin(j*segmentStepSize) * v[0];
            y1 = y + radius * Math.sin(k*segmentStepSize) * Math.sin(j*segmentStepSize) * v[1];
            z1 = z + radius * Math.cos(j*segmentStepSize) * v[2];
            points.push(x1);
            points.push(y1);
            points.push(z1);

        }
    }
}

module.exports = points;

This code results in this: http://requirebin.com/?gist=fdea95e3bfe069d7f363

Edit

for anyone who's interested: I've shared the code here: https://github.com/ToastCommunicationLab/mesh-primitive-chamfercube

sentences:
How to stop an animation on last frame until condition is met in Unity? I have an animation (fishing) I want to play backwards when the player catches something or cancels the action.

Playing the animation backwards is as simple as setting the speed to -1, ie:

anim.SetFloat("direction", -1.0f);

However, my fishing animation keeps playing until I have caught something, or cancel the animation. This means that the last frame of the animation is showing, but the time of the animation is still going.

So

the animation reaches the last frame
then I stand there for 8 seconds,
I catch something, so I change anim speed to -1
anim will now reverse those 8 seconds I was "standing still" first, before it even reaches the actual animation.

I need to stop the animation time on the last frame (without leaving the animation), so that reverse will be instant. And to not exit the animation until the reverse is finished. Maybe there is some other way to do it, but I can't figure it out.

I could create a seperate animation for when I want it to go backwards, but that seems sloppy.

sentences:
Render on other render targets starting from one already rendered on I have to perform a double pass convolution on a texture that is actually the color attachment of another render target, and store it in the color attachment of ANOTHER render target.  This must be done multiple time, but using the same texture as starting point

What I do now is (a bit abstracted, but what I have abstract is guaranteed to work singularly)

renderOnRT(firstTarget); // This is working.

for each other RT currRT{
    glBindFramebuffer(GL_FRAMEBUFFER, currRT.frameBufferID);
    programX.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, firstTarget.colorAttachmentID);
    programX.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, firstTarget.depthAttachmentID);
    programX.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID); // quadBuffID is a VBO for a screen aligned quad. It is fine.
    programX.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS,0,4);

    programY.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, currRT.colorAttachmentID); // The second pass is done on the previous pass
    programY.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, currRT.depthAttachmentID);
    programY.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID);
    programY.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS, 0, 4);
}

The problem is that I end up with black textures and not the wanted result.

The GLSL programs program(X,Y) works fine, already tested on single targets.

Is there something stupid I am missing?

Even an hint is much appreciated, thanks!

sentences:
Doom 3 codebase release details Does anyone know when the source code for Doom 3 is to be released?
I've heard a lot of things but nothing conclusive.

Thanks
Adam

Edit any info is appreciated

sentences:
Movement Issues: jumping to another GameObject My code can make a GameObject jump while simulating gravity. Now I want my GameObject to jump. The purpose of this is to always have a nice "touchdown".

Instead of the parabola, I want to use my jump script but I want it to jump using this relation with the other GameObject. I also need it to work while the target point is moving.

Could anyone solve this problem? An answer would be greatly appreciated. If you've got any questions, do not hesitate to reply (I understand that it's hard to understand...).

sentences:
Premultiplied Alpha And Alpha Testing I have a shader that is supposed to work with either alpha blending or alpha testing, but the color values being passed in are premultiplied alpha values.

Is there an easy/standard way to have it produce the "correct" results for both alpha blending and alpha testing when using premultiplied alpha?

For example, if the final result of my shader is RGBA(1,0,0,0.75) straight alpha and therefore RGBA(0.75,0,0,0.75) premultiplied alpha, the result should be remain RGBA(1,0,0,0.75) when alpha testing.

Perhaps one option is "dividing out" the alpha channel if we are alpha testing, i.e. divide the R by A above so that we get 0.75/0.75 = 1.0, our original red value.  But this becomes non-deterministic when the alpha goes to 0.

Maybe I can clarify with an example:

Say the back buffer is RGBA(1,1,1,1), and i am rendering with a partially transparent green color RGBA(0,1,0,0.75) (straight alpha).  The color is passed in as premultiplied alpha as RGBA(0,0.75,0,0.75).  When alpha blending, i blend using one + invsrcalpha and get a final color of RGBA(0.25,1,0.25,1). So my green channel stays at 100%, because the back buffer had green at 100%, and so did my original green color, so no way to get less than 100% on the green channel.

When Alpha testing, there is no blending going on. Instead, my green color will be rendered straight to the back buffer as RGBA(0,0.75,0,1).  But the color I wanted was RGBA(0,1,0,1).

sentences:
How to find path in graph without crossing the walls? I would like to know how to find path in a graph while having the edges "double-sided". Consider this scenario:

I have list of the line segments. These represents "walls" or rather impassable edges (in a game). I then plan in a next step to build a connected graphs (where possible). I'm trying to determine the feasibility at this point. If there's even a solution to this (it should in my opinion).

I don't need to know about A* or other algorithms per se, but rather how to not walk through the walls as seen in figure B. Any ideas?

I was wondering if I could turn segments to polygons (by adding width). Then make an union of these polygons and then treat them rather as polygons. But I would like to know whether there is a way to do it without this hassle. Also I'm not sure I want to add any width to the lines necessarily.

sentences:
Why can´t this boolean stop the sound from playing 60 times a second? The code:
local dontPlayMoreThanOnceDammit = false

function Behavior:Awake()
    local sound = CraftStudio.FindAsset( "motorbuson1" )
    self.mySoundInstance = sound:CreateInstance()
    self.mySoundVolume = 1.0
    self.mySoundInstance:SetLoop( true )
    self.mySoundInstance:SetVolume( 1.0 )
 end

function Behavior:Update()
    if dontPlayMoreThanOnceDammit == false and CraftStudio.Input.WasButtonJustPressed( "on" ) then
        self.mySoundVolume = 1.0
        self.mySoundInstance:Play()
        dontPlayMoreThanOnceDammit = true
    end
    if CraftStudio.Input.IsButtonDown( "off" ) then
        self.mySoundInstance:Stop()
        dontPlayMoreThanOnceDammit = false
    end
end

Error it gives:

sentences:
In A star, what is the point of recalculating the best path? In A* after the finding the next node with the lowest F value, you have to search the adjacent nodes again. When you find a node that was already in the open list, you're supposed to check if the g score for that node would be lower if you went through the current node to get there. My question is, what is the point of this? Won't it always be the same? If you take G = 14 for diagonal and G = 10 for horizontal/vertical wouldn't the G always be more if you went through 2 nodes instead of one?

Say the last node on the closed list's G value was 50. It has an adjacent square to the right with a G value of 60. Your current node has a G value of 64. If you went through the current node to get to the node adjacent to the one with the G value of 50, the G would be 74. You could switch the numbers all you want but the recalculated G would always be higher so what is the point of recalculating it?

sentences: Distance function on a pacman plane I am making a game, where if you go through the right wall, you pop up on the left. I want to have a function that calculates the distance between two objects, where we can have a line that goes through the wall. For example, if the screen width is 100 and one object was at (0, 90) and another at (0, 10), the distance between them would be 20.

sentences:
Where should collision detection logic be placed? I am developing a small 2D game engine. The characters have a paint method which currently does the following:

Calculate the new position of the character as per its speed, etc.
Update the collision grid cell **
Draw the character at the new position

** I have created a collision grid to reduce the number of intersection checks

Now the basic algorithm which I have thought for detecting collision is:

For Each Character
    Check intersection with characters in surrounding 8 cells

I can simply place this code in the paint method. But here is the problem I anticipate.

Suppose two characters A and B lie in adjacent cells in the collision grid. Now as per the above algorithm in the iteration of character A it will detect that it has collided with B. In the iteration for character B it will detect that it has collided with A.

But I have an idea that when A detects that it has collided with B, it should inform B that it has collided with A. This would save lot of comparisons when there are more than 2 actors colliding. But I am not sure how to handle this. I think instead of every character checking for its collision, I should check for the collision inside the game loop.

Would this approach be correct? How have you handled this kind of problem? I thought of the collision grid thing myself. Are there any alternatives to collision grid logic?

sentences:
Line segment / circle intersection - X value seems wrong? Major Edit

I'm making a Breakout clone, and having difficulty with collision detection between a circle and line segment.

Apologies, my earlier question was a result of frustration and no sleep :)

Having read this post on collision detection I've re-written my collision code to the following:

    // Takes 2 points on a line, a circle centre, and a circle radius
    // Returns true is collision, false otherwise
    public Boolean DoesCollide(Vector2 a, Vector2 b, Vector2 c, float rad)
    {
        // First up, let's normalise our vectors so the circle is on the origin
        Vector2 normA = a - c;
        Vector2 normB = b - c;

        Vector2 d = normB - normA;

        // Want to solve as a quadratic equation, need 'a','b','c' components
        float aa = Vector2.Dot(d, d);
        float bb = 2 * (Vector2.Dot(normA, d));
        float cc = Vector2.Dot(normA,normA)-(rad*rad);

        // Get determinant to see if LINE intersects
        double deter = Math.Pow(bb, 2.0) - 4 * aa * cc;
        if (deter > 0)
        {
            // Get t values (solve equation) to see if LINE SEGMENT intersects
            double t = (-bb - Math.Sqrt(deter)) / (2 * aa);
            double t2 = (-bb + Math.Sqrt(deter)) / (2 * aa);
            Boolean match = false;

            if (0.0 <= t && t <= 1.0)
            {
                // Interpolate to get collision point
                Vector2 collisionPoint = c + Vector2.Lerp(normA, normB, (float)t);
                match = true;
            }
            if (0.0 <= t2 && t2 <= 1.0)
            {
                Vector2 collisionPoint2 = c + Vector2.Lerp(normA, normB, (float)t2);
                match = true;
            }
            return match;
        }
        else
            return false;
    }

However, I'm getting strange results for the X components of the collision points found 'on hit' - see the following debug output:

Coll at {X:1033.931 Y:620}, t1 = 0.203759334390812, Normalised = {X:0.8576241    Y:0.5142772}
Coll2 at {X:1052.069 Y:620}, t2 = 0.409877029245551, Normalised = {X:0.8615275 Y:0.5077109}
Circ cent = {X:1043 Y:610}, rad = 13.5

As you can see, the X components are 10px either side of the circle centre, but the Y component (620) is the very topmost pixel of the top of the Breakout paddle. Surely here the X points can't be 20 pixels apart, given the location of the Y point?

sentences:
Shader Maker version 130 is not supported I am trying to compile a vertex shader with Shader Maker and if I try to use the version 130 it says:

  Compiling Vertex Shader
  ERROR: 0:3: '' :  version '130' is not supported

  Compiling Fragment Shader

I need to use the version 130. Now I installed Shader Maker from it's site. I wonder if there is a way to use the version 130, what should I do?

sentences:
How to do pixel perfect movement with Unity3D? How would you be able to make sprites move pixel by pixel in Unity3D? I've tried the following things.

int x = (int) transform.position.x;
int x = Mathf.FloorToInt(transform.position.x);
int x = Mathf.RoundToInt(transform.position.x);

I don't know what else to try

Because I'm making an SNES looking game, and when things move, there is very bad pixel crawl in the sprites.

sentences:
Camera rotation - First Person Camera using GLM I've just switched from deprecated opengl functions to using shaders and GLM math library and i'm having a few problems setting up my camera rotations (first person camera). I'll show what i've got setup so far.

I'm setting up my ViewMatrix using the glm::lookAt function which takes an eye position, target and up vector

// arbitrary pos and target values
pos = glm::vec3(0.0f, 0.0f, 10.0f);
target = glm::vec3(0.0f, 0.0f, 0.0f);
up = glm::vec3(0.0f, 1.0f, 0.0f);

m_view = glm::lookAt(pos, target, up);

i'm using glm::perspective for my projection and the model matrix is just identity

m_projection = glm::perspective(m_fov, m_aspectRatio, m_near, m_far);

model = glm::mat4(1.0);

I send the MVP matrix to my shader to multiply the vertex position

glm::mat4 MVP = camera->getProjection() * camera->getView() * model;
// in shader
gl_Position = MVP * vec4(vertexPos, 1.0);

My camera class has standard rotate and translate functions which call glm::rotate and glm::translate respectively

void camera::rotate(float amount, glm::vec3 axis)
{
    m_view = glm::rotate(m_view, amount, axis);
}
void camera::translate(glm::vec3 dir)
{
    m_view = glm::translate(m_view, dir);
}

and i usually just use the mouse delta position as the amount for rotation

Now normally in my previous opengl applications i'd just setup the yaw and pitch angles and have a sin and cos to change the direction vector using (gluLookAt) but i'd like to be able to do this using GLM and matrices.

So at the moment i have my camera set 10 units away from the origin facing that direction. I can see my geometry fine, it renders perfectly. When i use my rotation function...

camera->rotate(mouseDeltaX, glm::vec3(0, 1, 0));

What i want is for me to look to the right and left (like i would with manipulating the lookAt vector with gluLookAt) but what's happening is
It just rotates the model i'm looking at around the origin, like im just doing a full circle around it. Because i've translated my view matrix, shouldn't i need to translate it to the centre, do the rotation then translate back away for it to be rotating around the origin? Also, i've tried using the rotate function around the x axis to get pitch working, but as soon as i rotate the model about 90 degrees, it starts to roll instead of pitch (gimbal lock?).

Thanks for your help guys,

and if i've not explained it well, basically i'm trying to get a first person camera working with matrix multiplication and rotating my view matrix is just rotating the model around the origin.

sentences:
Missing texture coordinates for channel 0 Fbx and XNA 4.0 I'm getting this error while trying to load a model in XNA 4.0 :
Error   2   The mesh "transform1", using SkinnedEffect, contains geometry that is missing texture coordinates for channel 0.
The model was dxf format then I upload it to maya then I added some skeleton and some texture (viewed it on the UV) but I still get this error.

this is the load function.

    protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("myModel");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["Take 001"];

        animationPlayer.StartClip(clip);
    }

this is the draw function :

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice device = graphics.GraphicsDevice;

        device.Clear(Color.CornflowerBlue);

        Matrix[] bones = animationPlayer.GetSkinTransforms();

        // Compute camera matrices.
        Matrix view = Matrix.CreateTranslation(0, -40, 0) * // x, y, z
                      Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) * //rotate y
                      Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) * //rotate x
                      Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance),
                                          new Vector3(0, 0, 0), Vector3.Up);

        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                device.Viewport.AspectRatio,
                                                                1,
                                                                10000);

        // Render the skinned mesh.
        foreach (ModelMesh mesh in currentModel.Meshes)
        {
            foreach (SkinnedEffect effect in mesh.Effects)
            {
                effect.SetBoneTransforms(bones);

                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();

                effect.SpecularColor = new Vector3(0.25f);
                effect.SpecularPower = 16;

            }

            mesh.Draw();
        }

        base.Draw(gameTime);
    }

PS : 1-My knowledge with Maya & XNA is very limited cause I used to use OpenGL/C++ for some time.

2-Also I change my Content Processor to SkinnedModelProcessor not Model - XNA Framework.
thanks in advance.

sentences:
How i can control button input android? i am android programmer and i want control button input in android
for example i made a game that when you press back button in android mobile
nothing happens but i want quite from game.

This is how you can use the android back button in Unity games.

In C#

void Update()
{
   if (Application.platform == RuntimePlatform.Android)
   {
    if (Input.GetKeyDown(KeyCode.Escape))
        Application.Quit();
   }
}

or in JS

function Update()
{
   if (Application.platform == RuntimePlatform.Android)
   {
    if (Input.GetKeyDown(KeyCode.Escape))
        Application.Quit();
   }
}

but how i can contorl other buttons

sentences: How come changing the speed of an animation isnt making the animation speed up? I made an animation of a bow string being pulled and another animation of the string being released but my issue is that I need the string to snap back quickly. I changed the speed of the release animation which is what makes the string go back to being straight (as if you had just released it). However, changing the speed isn't making the animation happen any faster... Any ideas why this might be happening?

sentences:
SDL2 SDL_CreateTexture returns pointer to existing texture I have an initialized renderer in SDL2 that works fine.
I create some textures from images using SDL_CreateTextureFromSurface  and store them in a vector.

Afterwards, I create an empty texture so as to render to it a background texture and some text:
SDL_Texture * container = SDL_CreateTexture(Renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,size.first,size.second);

The problem is that the returned memory address in container is the address of the first texture that was created with renderer as shown in the image below.
Textures is a vector< SDL_Texture * > , container is the pointer above.

The textures field is a field in the renderer thatI presume is set to the address of the last texture created. Before running the command above, it pointed to the last texture created (0x222b70)

After the call, the texture in the vector is of course overwritten, which is a problem.
There are no errors from SDL_GetError().

What's going on?

sentences:
Is there any public in-game data mining/knowledge discovery repository? I'm taking an Introduction to Data Mining course at the university and we have to work on a final project.

As you may already know, it's difficult to collect this kind of data manually (specially when you're not working for a company of have the proper contacts).

Is there any public collection of in-game data in order to apply data mining algorithms? The kind of data I'm looking for is the sort of data they used in this paper "Predicting Player Behavior in Tomb Raider Underworld".

Characteristics: playing time, number of deaths, causes of death, rewards, treasures. Other kind of in-game data (possible an MMORPG): race, level, equipment, guild, items usage, hp/mp rate, level-up mean time, hours played by day/week/month, log-in/log-off time, etc.

The kind of problems I'd like to tackle could be represented as questions like:

What are the chances a player is likely to pass the game [in X seconds]?
What are the best X guilds to be with in order to meet my expectations as a player and not end up being expelled?
What is the best world area in order to level-up faster now while minimizing death possibilities?

sentences:
SDL2 and density-independent pixel I'm currently using SDL2 on Android and that's my first experience with that library (to be honest, mainly chosen because I'd like to learn it).
What is puzzling me is how to deal with different resolutions and density-independent pixels, for I cannot figure out which is the recommended approach to create images and let them look decently on screen on the most of the devices.

Unfortunately, googling around I've not been able to find a decent example or a bunch of information sufficient to clarify the doubts.
It seems that the most common suggestion is to choose a fixed size virtual resolution for the content rectangle, thus draw on top of it and finally resize it to the actual one, but it would be appreciated to know if this one is really a widely used approach and if there are some others that are more suitable.

Thank you.

sentences:
Unity run-time creating material has performance impact? Just found creating a material in a script for the first time would have performance impact.
(Using Unity 5.6.5f)

A very simple script for testing is to create a game object with MeshRenderer in Start(), assign a new material each time in Update(),

gameObj.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Standard"));

From Unity Profiler the first function call took much longer than following calls, the first one took 100ms and others less then 1ms.

Can someone give it an explanation? Thanks.

sentences:
Can I use trilinear filtering for my sprites, but keep their outlines unfiltered? Suppose that I have two images of equal size. They both contain a square:

https://i.stack.imgur.com/BI62X.png
https://i.stack.imgur.com/Nev5Z.png

When overlapped, both squares will appear next to each other.

If both images use Point (no filter), they will contact without issues regardless of the amount of zoom or scale:

If you use either Bilinear or Trilinear, there will be an artifact visible in certain zoom/scale levels:

Of course, that is to be expected from the very nature of the filters. As much as I would like to just leave it at Point (no filter), my game looks far better using Trilinear instead - except of course, for the "borders" or points of contact.

The ideal scenario for me as bizarre as it may sound, is to be able to use Trilinear filtering generally, but force the "outlines" of my sprites to stay as if they were Point (no filter). This way, my game looks painterly when zoomed in/out (the game isn't pixel art), and I also avoid the "glitch" in specific contacts.

Yes, the glitch is only noticeable if you use a scale/zoom that is higher than 100%. Unfortunately, due to the nature of the game, the player should be able to zoom in/out if they desire, so I can't just pick "the" ideal camera size or sprite scale because it can't be constant.
I've tried using Canvas and its Pixel Perfect checkbox to no avail. I didn't really expect that to work though.

What can I do to achieve the desired effect, then?

sentences:
How do I triangulate non-planar polygons correctly? I've got a super simple octagonal mesh with a bevel around the circumference. When I triangulate for export, the cuts form a valley (proper term here?) – which is to say, they transform a level quad into a pair of tris with some degree of concavity.

The resulting normal bake is horrific, as you might expect. Is this a nefarious rookie mistake I've tumbled into?

PS: For reference, here's before:

And here's after:

sentences:
How can I extract the RGB color data from a TGA image? I am working in OpenGL, and I am trying to create terrains using height maps.

I am using my own functions to load a TGA image, and in order to pass data to heightmap vertex shader I need to retrieve RGB components from the TGA image.

I am not quite sure how to do that, I saw in one tutorial that SDL library can be used to retrieve RGB component from a TGA image, but I do not want to use any such libraries because I am already able to load a TGA.

So, how do I recover RGB information per pixel from a TGA that we loaded?

sentences:
How do I load an asset bundle? I am trying to load a bunch of prefabs from an asset bundle.  I am building the asset bundles for StandaloneWindows64:

BuildPipeline.BuildAssetBundles(BuildPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);

I load my asset bundle using Unity's new web request system:

var www = UnityWebRequest.GetAssetBundle(Url);
yield return www.Send();
if (www.isError)
{
    Debug.LogError(www.error);
    yield break;
}
var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;

However, my bundle does not have my asset bundle in it.  It only has the manifest:

//Output:  "1 asset: bundlemanifest"
Debug.Log(bundle.GetAllAssetNames().Length + " asset: " + bundle.GetAllAssetNames()[0]);

If I look at my manifest, I can see my asset bundle names "structures" does exist:

ManifestFileVersion: 0
CRC: 3317959940
AssetBundleManifest:
  AssetBundleInfos:
    Info_0:
      Name: structures
      Dependencies: {}

I tried retrieving it from my AssetBundleManifest:

var manifest = bundle.LoadAsset<AssetBundleManifest>("assetbundlemanifest");

But the AssetBundleManifest only has functions which return strings and Hash128s.

How can I instantiate the prefabs in my asset bundle named "structures"?

sentences:
Stuck at tile seams using 2D collision I'm making a little top down 2D dungeon crawler, and have pretty much fallen over at collision detection with my dungeon walls. I have figured out how to stop my player sprite at the walls, but I'm having trouble with the seams of the vertical walls. Horizontal walls, for some reason, are giving me absolutely no issue.

I store a bunch of rectangles representing the dungeon walls, and for each entity that is of the type RigidBody.Type.Moving, I collision check using a projection of where the entity will be based on its current X & Y velocity (against all rectangles, at the moment).

Here is my collision detection code:

var dt = (float) gameTime.ElapsedGameTime.TotalSeconds;
var rb = entity.GetComponent<RigidBody>();
var body = rb.Body;

// We only want to do collision checks for bodies that are moving.
if (rb.Type != RigidBody.Type.Moving) return;

// Don't collision check against itself!
var rectangles = CollisionWorld.Instance.Bodies.Where(b => b != body);
foreach (var rectangle in rectangles)
{
    // Work out where the entity is going to be next with its current velocity
    // and store it as a rectangle to collision check on.
    var projectedBody = new Rectangle(
        (int)(rb.Position.X + rb.Velocity.X * dt),
        (int)(rb.Position.Y + rb.Velocity.Y * dt),
        body.Width, body.Height);

    // If we have a collision, continue. Otherwise move on.
    if (!Collision.DoesCollide(projectedBody, rectangle)) continue;
    var side = Collision.CalulateCollisionSide(projectedBody, rectangle);

    if (side == Collision.Side.Top || side == Collision.Side.Bottom)
    {
        rb.Velocity.Y = 0;
    }
    if (side == Collision.Side.Left || side == Collision.Side.Right)
    {
        rb.Velocity.X = 0;
    }
}

I have tried finding the collision intersection, and using it to offset the player's position. by that and that kinda works, but then the sprite is all jittery whenever it collides. I've been bashing my head against this for a couple of days, now.

Why would the seams between each vertical tile be causing my sprite to get stuck?

sentences:
Why do companies still use really old versions of Visual Studio? I understand why C++ is used. That is not what this question is about.

When I install games, commonly Steam (I pretty much only use Steam these days) will install the C++ 2005 Runtime distributable.

My question is why is this the case? What is the reason a runtime released over 8 years ago is still prevalent? Some of the games I've installed recently are slightly older, so assuming a couple of years dev time you could make the case it was the tried and tested standard at the time.

Why do game companies not use a newer version of the VC++ runtime?

sentences:
Is there a purpose behind the tediousness of most MMO RPGs? As most of you probably know a lot, if not all, MMO RPG games have some element of "tediousness" in them.

By "tediousness" I mean elements in the gameplay that feel both unpleasant and needlessly complicated or long (note that grinding is simply unpleasant and therefore I do not include it in this question).

For example - introductory quests.
I don't mean the idea of introductory quests, which I think good. I mean their implementation.

For example in some games, where you can have several characters per account, each time you create a new character you have to go though the same introduction. You are not offered the option to skip it, regardless that you might already have a high leveled character. Surely there must a point to this?

For another example in some games the introduction is needlessly long. It could take an average player a few days to get past it, it doesn't add anything storywise and the game concepts have long been explained by the time the player reaches even half.

What is the rationale behind putting the player through all this, instead of giving him the option to skip the intro and/or making it only as long as it needs to be, etc.?

sentences:
How to scale image at runtime in GameMaker? I use this code to create a new enemy and preset some values:

It runs in the step event of the player object.

var inst_inst = instance_create_layer(newX, newY, "Instances_Enemies", obj_Asteroid01);
inst_inst.image_index.image_xscale = 0.1;
inst_inst.speed = 4;

The speed is set correctly but the code scales the image of the player sprite and not the sprite of obj_Asteroid01

Edit after getting the answer

My fault was to trust the autocomplete and the fact, that there were no compile errors.

This is something you need to get used to :)

sentences: How to make player instantly move to the right or left when entering a box collider I have a box collider and right now when I walk into it it says "you can't go there yet" I would like it for it to also move the player like 3 steps to the right or something. How would I do thatr?

sentences:
Using Box2D in LibGDX, is there a reason a fixture set to be a sensor would only -sometimes- detect a collision? I am working on a 2D game in LibGDX. Currently, I am testing interactions between a player's weapon and enemies - in particular, a sword and an enemy monster.

The player has a hurtbox and the sword has a hitbox. The player's hitbox and hurtbox are filtered so that they do not interact with each other. However, the p
layer's hitbox and hurtbox are supposed to interact with the monster. However, a collision between the sword and the monster is only registered sometimes - specifically, four times when I launch the application, and then no more collisions will register. However, if the player bumps into the monster so that the monster gains some velocity, collisions will register again until the enemy stops moving.

Is there a reason for this / is there a pattern here for when collisions are registering and when they're not that I'm missing?

Note: I have tried both creating the hitbox only when the player is attacking, and having the hitbox be inactive until the player is attacking, then making it active, then setting it to be inactive again. Both cases result in the same failure to register all collisions.

This is the general code for the creation of the hitbox fixture:

    CircleShape shape = new CircleShape();
    shape.setRadius(25f * Constants.MPP);
    shape.setPosition(new Vector2(0f, 0f).scl(Constants.MPP));

    FixtureDef fixture = new FixtureDef();
    fixture.filter.categoryBits = Constants.CATEGORY_PLAYER_WEAPON;
    fixture.filter.maskBits = (short) (Constants.CATEGORY_MONSTER);
    fixture.isSensor = true;
    fixture.shape = shape;
    f = hitbox.createFixture(fHitbox);

    hitboxShape.dispose();

Thanks in advance!

sentences:
Box collider has different behavior in 2 clients I'm new to Unity.
I am making my first Game and faced with problem.
I have a plane and 4 gameobject that has box collider surrounded this plane. there are a few spheres as players inside of the plane.I built the game.
I run 2 instances of the game and add force to a sphere and send this force to other client through node server. But border reflection angle differs in 2 clients. I checked value of the force in 2 clients and that is the same.
Any help would be appreciated.

sentences:
Rotating image around a given point Im trying to simulate shadows in a 2d RPG, So far I can make the shadows but i cant blit them properly, Im trying to rotate them according to where the "sun" is (just a position)

I have looked at other questions, they say to move the center of the image to the point rotate it then move it back so that what I'm trying to do

here is my code to rotate it:

def rotate(self, shadow, rect):
    copy = rect.copy() #get copy of rect
    angle = degrees(atan2(self.center[0]-self.sun[0], self.center[1]-self.sun[1]))-180 #get angle from "sun" to center of screen

    if angle < -180:
        angle += 360

    angle /= -5

    rect.center = copy.midbottom #move rect to rotation point
    shadow = rotate(shadow, -15) #rotate -15 as a test
    rect.center = copy.center # move it back

    return shadow, rect #return the image and rect to blit them

when the angle is negative it seem like its working and I get this result (which isnt really what I want):

but when I rotate it positively:

so I think I'm doing this totally wrong! I've been trying to figure it out for awhile now, I think I'm blitting it wrong, or not at the right state

sentences:
How to blend the surface with HTML5 canvas? I can simply blend the surface in GameMaker using these codes:

//colour with which to blend the surface.
draw_surface_ext(index, x, y, xscale, yscale, rot, colour, alpha);

or set "the Fade to a Color" property, it will looks like this:

For now I want to do the same thing with HTML5 canvas, but I don't know where to start, is there any canvas API that could do that?

sentences:
Creating a steady rhythm for music-based game in XNA I'm looking to develop a game for Windows Phone which involves the user building notes into a sequencer while playing a puzzle game.

While my implementation is very close to being on-beat there is an occasional pause between beats, which makes the whole thing sound sloppy. I'm not sure how to get around this using XNA's infrastructure.

Currently I'm running this code in the Update method of my GameBoard:

public void Update(GameTime gameTime)
{
    onBeat = IsOnBeat(gameTime);
    [...]
    if (onBeat)
        BeatUpdate();
}

private bool IsOnBeat(GameTime gameTime)
{
    beatTime += gameTime.ElapsedGameTime.TotalSeconds;
    if (Math.Abs(beatTime - beatLength) < 0.0166666)
    {
        beatTime -= beatLength;
        return true;
    }
    return false;
}

private void BeatUpdate()
{
    cursor.BeatUpdate();
    board.CursorPass((int)cursor.CursorPosition % Board.GRID_WIDTH);
}

Update checks to see if the time is on beat. If so, it calls the BeatUpdate method which moves the cursor over the board (sequencer). The cursor reports its X position to the board, which then plays any notes that are in that position on the sequencer. Notes are SoundEffectInstances, pre-loaded and ready to play. TargetElapsedTime is set to 166666, or 60FPS target.

Obviously totaling up the time and then subtracting isn't the most accurate or stable way to go. This current system is just horribly unstable. Beats lag and fire too early and it's obvious. I thought about perhaps some sort of threaded solution but I'm not familiar enough with multithreading to figure out how that would work. How could I fix this?

sentences:
How can I support direct P2P for mobile devices? I'm Interested in two or more player co-op in Godot, via direct P2P without connection to a central server.
I have this idea that would utilize two smartphones in proximity to one another. I don't know an awful lot about Bluetooth or networking so please explain simply.

sentences:
Can I set multiple animations to run at the same time with Unity's animator (some animated properties would overlap) I am creating a vehicle in Unity and I am currently trying to set up lights for it. I need to be able to press one button to turn on the parking lights. But the parking lights share the same bulb as the turn signals. So when a turn signal is turned on, I need that parking light bulb to now flash, while the others remain on. This is just one example of several I am coming across.

Now, I could create an animation for every single scenario, but I believe there should be a simpler way to do this. I thought perhaps using the layers would handle it, but I'm fairly new to animations and I'm not sure I'm understanding them right. I put each animation on a different layer, and then ordered them in a way that made sense to me, and set them to additive. The right turn signal is on top and it works, but the left turn signal right below it does not.

Is there something else I can do to make this work? Or a tweak I can do to fix what I have now, something I'm missing maybe? Thanks for the help!

sentences:
How do I render text in a view in SFML 2.5.1 without artifacts? I'm using the following code to render text in a letterboxed view.

#include <iostream>
#include <random>
#include <math.h>
#include <cstring>
#include <ostream>

#include <SFML/Graphics.hpp>

const float FIXED_UPDATE_TIME = 16.67f;//60fps

const unsigned int DEFAULT_CAMERA_WIDTH = 1280;
const unsigned int DEFAULT_CAMERA_HEIGHT = 720;

sf::View get_letterbox_view(sf::View view, int window_width, int window_height) {

    // Compares the aspect ratio of the window to the aspect ratio of the view,
    // and sets the view's viewport accordingly in order to archieve a letterbox effect.
    // A new view (with a new viewport set) is returned.

    float window_ratio = window_width / (float) window_height;
    float view_ratio = view.getSize().x / (float) view.getSize().y;
    float sizeX = 1;
    float sizeY = 1;
    float posX = 0;
    float posY = 0;

    bool horizontal_spacing = true;
    if (window_ratio < view_ratio)
        horizontal_spacing = false;

    // If horizontal_spacing is true, the black bars will appear on the left and right side.
    // Otherwise, the black bars will appear on the top and bottom.

    if (horizontal_spacing) {
        sizeX = view_ratio / window_ratio;
        posX = (1 - sizeX) / 2.f;
    }

    else {
        sizeY = window_ratio / view_ratio;
        posY = (1 - sizeY) / 2.f;
    }

    view.setViewport( sf::FloatRect(posX, posY, sizeX, sizeY) );

    return view;
}

int main() {
    sf::RenderWindow window(sf::VideoMode(DEFAULT_CAMERA_WIDTH, DEFAULT_CAMERA_HEIGHT), "Adventure of Jaggy Font Edges");
    window.setMouseCursorVisible(false);

    // Set up resource
    sf::Font fnt;
    fnt.loadFromFile("res/fnt/Ruda-Regular.ttf");

    // Set up text
    sf::Text text;
    text.setFont(fnt);
    text.setString("TEXT RENDERING");
    text.setCharacterSize(128);
    text.setFillColor(sf::Color::White);
    text.setOutlineColor(sf::Color::Black);
    text.setOutlineThickness(3.f);

    // Center text (in world space, I believe?)
    sf::FloatRect text_rect = text.getLocalBounds();
    text.setOrigin(
        floorf(text_rect.left + text_rect.width/2),
        floorf(text_rect.top + text_rect.height/2)
    );
    text.setPosition(0, 0);

    // Set up view, and center it on the text
    sf::View camera_view(sf::FloatRect(0.f, 0.f, DEFAULT_CAMERA_WIDTH, DEFAULT_CAMERA_HEIGHT));
    camera_view.setCenter(0, 0);

    sf::Clock clock;

    while (window.isOpen()) {
        // only update 60fps
        sf::Time elapsed_time = clock.getElapsedTime();
        if (elapsed_time.asMilliseconds() < FIXED_UPDATE_TIME) {
            continue;
        }

        // handle events
        sf::Event event;
        while (window.pollEvent(event)) {
            // window closed event
            if (event.type == sf::Event::Closed) {
                window.close();
            } // window resized event/*
            else if (event.type == sf::Event::Resized) {
                camera_view = get_letterbox_view(camera_view, event.size.width, event.size.height);
            }
        }
        window.clear(sf::Color(255, 255, 255, 255));

        window.setView(camera_view);
        window.draw(text);

        window.display();
    }
    return EXIT_SUCCESS;
}

At the default resolution, it looks like this:

However, the moment I change the window size, we get artifacts:

sentences:
Public Static vs. Instanced Classes I've seen a lot of rhetoric over the year about not using a Public Static class to store global variables or methods that are used across an application.

I understand the philosophy about code maintenance issues that this might present in business software with a number of developers but is there any real performance issues this introduces?

Specifically if the items that have been made public static are used from most classes in the game and prevent multiple instances of a given class from being created. e.g. collision detection, playing audio samples etc.

sentences:
Can we implement google play game services Multiplayer games with Facebook and not just Google+? Basically, I want to make Multiplayer games but found Google Play Game Services only works with Google+ Login:
https://developers.google.com/games/services/android/turnbasedMultiplayer

How does one implement this with Facebook login so people can play with their facebook friends, etc.

sentences:
SDL2 doesn't render a window A tutorial's code from LazyFoo wonderful place's 01_hello_SDL page doesn't show a white form, but a desktop's screen, like a screenshot. Something like:

The code:

//Using SDL and standard IO
#include <SDL2/SDL.h>
#include <stdio.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int main( int argc, char* args[] )
{
    //The window we'll be rendering to
    SDL_Window* window = NULL;

    //The surface contained by the window
    SDL_Surface* screenSurface = NULL;

    //Initialize SDL
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
    }
    else
    {
        //Create window
        window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( window == NULL )
        {
            printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
        }
        else
        {
            //Get window surface
            screenSurface = SDL_GetWindowSurface( window );

            //Fill the surface white
            SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );

            //Update the surface
            SDL_UpdateWindowSurface( window );

            //Wait two seconds
            SDL_Delay( 2000 );
        }
    }

    //Destroy window
    SDL_DestroyWindow( window );

    //Quit SDL subsystems
    SDL_Quit();

    return 0;
}

Putting PumpEvents(); or while(SDL_PollEvent(&event))... didn't work, unfortunately.

The machine's characteristics:

CPU: i7 M620
GPU: Intel Core Processor Integrated Graphics Controller
GPU Driver: i915
RAM: 8GB
OS: KDE Neon 5.15.4 64bit, 4.15.0-47 Kernel, fully updated

sentences:
DirectX11: Drawing multiple objects How can I draw many different objects on screen at once, with multiple vertex buffers, using DrawIndexed()? (Drawing the same object is simple, and I'm not looking to instance)

...but I am looking to transform two different vertex buffers. (Yes I am using indexed vertices)

sentences:
General directions on developing a server side control system for JS/Canvas Action RPG Well, yesterday I asked on anti-cheat JS, and confirmed what I kind of already knew that it's just not possible.

Now I wanna measure roughly how hard it is to implement a server side checking that is agnostic to client input, that does not mess with the game experience so much.

I don't wanna waste to much resource on this matter, since it's going to be initially a single player game, that I may or would like to introduce some kind of ranking, trading system later on. I'd rather deliver better more cool game features instead.

I don't wanna have to guarantee super fast server response to keep the game going lag free. I'd rather go with more loose discrete control of key variables and instances. Like store user's action on a fifo buffer on the client, and push that actions to the server gradually.

I'd love to see a elegant, generic solution that I could plug into my client game logic root (not having to scatter treatments everywhere in my client js) - and have few classes on Node.js server that could handle that - without having to mirror/describe all of my game entities a second time on the server.

sentences: Why do GPUs require game specific drivers? PC GPU driver updates often cite improvements made to performance of specific, recently released games. Why is this game-specific updating needed? How do the game-specific changes interact with the game code?

sentences:
Libgdx OrthogonalTiledMapRenderer not rendering map properly I'm using a little hack to change the coordinate system to the one i'm accustomed to (left and up is negative and right and down is positive) but this causes the tiled map renderer to render the map incorrectly, as shown below

Whereas it looks like this in the Tiled map editor

This is the "hack" I'm using to change the coordinate system:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

Camera = new OrthographicCamera(w, h);
Camera.setToOrtho(true, w, h);

My render code

renderer.setView(Camera);
renderer.render();

So is there a workaround to this? Or perhaps a better way to change the coordinate system that doesn't screw up everything?

Edit: The rendered tiles are correct now but the map and everything rendering is still flipped along the y-axis. If I was drawing sprite and stuff, I could always draw them flipped but I don't know how to do it with the tiled map renderer.

sentences:
How to layer two textures in a cylinder without Z-fighting? In the documentation of ShaderLab culling and depth testing you have the following:

Offset

Offset Factor, Units

Allows you specify a depth offset with two parameters. factor and units. Factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scale the minimum resolvable depth buffer value. This allows you to force one polygon to be drawn on top of another although they are actually in the same position. For example Offset 0, -1 pulls the polygon closer to the camera
ignoring the polygon’s slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle.

I have the following scenery, it's two cylinders of the same size, one being the sky, one being the horizon on the floor, it is shown exactly how it is expected to render:

This is how it actually looks without playing with the offset factor and units, lots of Z-fighting:

I had to put a fairly high value to Factor so Z-fighting stops, around 15.
And setting the value of Units has absolutely no effect.
So I'm a bit at a loss as on how to correctly use both of these parameters.
Question:
Can you explain how shall one understand the meaning and correctly use Factor and Units?

sentences: 2d Tower Defense - Projectile Prediction For my map, it's very curvy and the node sizes aren't consistent. I have everything finished so that projectiles will actually fly at an enemy, however if a projectile is going too slow it will miss. I am wondering if I should just go the easy route, and just make the projectile homing, or if I could get help here on where to start. The enemy is changing directions, and moving around, although never changes speed.

sentences:
Tetris style game in java (for now) will I need to use threads? I'm looking at developing a puzzle game, it might be like tetris or something similar, perhaps more like bejewelled in that the player will select objects with the mouse to manipulate them.

I've been studying java part-time in college for the past year, really beginner stuff, but I've decided to build a game over the summer to keep the brain active :-D

So far I've animated some primitive shapes moving around the screen using the timer from the utilities package. This is all good, they're behaving the way I want.
So now I've decided to try manipulate the shapes with the mouse. Just some really simple stuff, maybe change the colour of an object when I click on it.

To test the mouse functions I've successfully completed the MouseEvent and MouseListener tutorials on The New Boston.
However, I can't get these events working in my code. I suspect I'm going to have to re-write my classes.

Will I need separate threads within the game, for example, one thread to animate the objects and another to listen for and handle mouse events.

My understanding is that I should implement runnable on my classes when using threads in Java games.
Am I thinking on the right lines?

sentences:
XNA 4.0 storage framework not being recognized This may be a silly question but, im unable to do any save game data because for some reason, this following namespace is unrecognizable:

 using Microsoft.Xna.Framework.Storage;

All the normal XNA namespaces work but not this one. Im ade sure to uninstall XNA 3.1, and the windows phone 7 SDK. Then i un-installed XNA 4.0 and reinstalled it. Im not sure whats wrong, but i would really enjoy some help so could get to saving some games.

sentences:
Can DDS be used in OpenGL in Linux without license/patent issue? Is there a 'standard' for OpenGL game creation intended for both Windows and Linux? I understand DDS is the DirectX standard (or, at least, it appears to be). Is there one that does not have potential patent/license issue or does it really not matter?

I am asking as I would like to avoid focusing on DDS as the format to use, only to have that kick me in the teeth later when some license/patent/??? issue requires me to remove and replace DDS with [texture format here]. This is not about what is better or an opinion post, but what is (relatively) safe from the constraints mentioned earlier?

sentences:
Simplifying Camera Strafing I have a camera that follows the position and direction of the player. These are updated using spin and velocity. The velocity is updated like so:

auto velocity = get_velocity();
velocity += get_acceleration().x * get_right();
velocity += get_acceleration().y * get_up();
velocity -= get_acceleration().z * get_forward();

set_velocity(velocity);

... where acceleration is relative to the object, not the world. This is the first time I have used OpenGL and I am not sure if this is the best solution, but it does what I want. I was wondering if there is a better way to do this using OpenGL Mathematics (GLM).

Additionally, this method works like a rocket, which is good for what I am trying to do, but if I want something more like a human, I have to change it to:

auto velocity = get_velocity();
auto const y = velocity.y + get_acceleration().y;
velocity += get_acceleration().x * get_right();
velocity -= get_acceleration().z * get_forward();
velocity.y = y;

set_velocity(velocity);

... to prevent the player from being able to fly by looking up. Is there a way of simplifying this case, too?

Acceleration is defined as:

switch (dir) {
    case left:  return glm::vec3(-1,  0,  0);
    case right: return glm::vec3( 1,  0,  0);
    case front: return glm::vec3( 0,  0, -1);
    case back:  return glm::vec3( 0,  0,  1);
    case up:    return glm::vec3( 0,  1,  0);
    case down:  return glm::vec3( 0, -1,  0);
    default: assert(false);
}

sentences:
How to snap a 2D Quad to the mouse cursor using OpenGL 3.0? I've been having issues trying to snap a 2D Quad to the mouse cursor position I'm able :

1.) To get values into posX, posY, posZ

2.) Translate with the values from those 3 variables

But the quad positioning I'm not able to do correctly in such a way that the 2D Quad is near the mouse cursor using those values from those 3 variables eg."posX, posY, posZ"

I need the mouse cursor in the center of the 2D Quad.

I'm hoping someone can help me achieve this.

I've tried searching around with no avail.

Heres the function that is ment to do the snapping but instead creates weird flicker or shows nothing at all only the 3d models show up :

void display()
{
  glClearColor(0.0,0.0,0.0,1.0);
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

  for(std::vector<GLuint>::iterator I = cube.begin(); I != cube.end(); ++I)
  {
      glCallList(*I);

       }

     if(DrawArea == true)
     {

    glReadPixels(winX, winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);

cerr << winZ << endl;

glGetDoublev(GL_MODELVIEW_MATRIX, modelview);

glGetDoublev(GL_PROJECTION_MATRIX, projection);

glGetIntegerv(GL_VIEWPORT, viewport);

gluUnProject(winX, winY, winZ , modelview, projection, viewport, &posX, &posY, & posZ);

    glBindTexture(GL_TEXTURE_2D, DrawAreaTexture);

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

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

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

    glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, DrawAreaSurface->w, DrawAreaSurface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, DrawAreaSurface->pixels);

    glEnable(GL_TEXTURE_2D);

    glBindTexture(GL_TEXTURE_2D, DrawAreaTexture);

glTranslatef(posX , posY, posZ);

     glBegin(GL_QUADS);

     glTexCoord2f (0.0, 0.0);
     glVertex3f(0.5, 0.5, 0);

     glTexCoord2f (1.0, 0.0);
     glVertex3f(0, 0.5, 0);

     glTexCoord2f (1.0, 1.0);
     glVertex3f(0, 0, 0);

     glTexCoord2f (0.0, 1.0);
     glVertex3f(0.5, 0, 0);

     glEnd();

        }

      SwapBuffers(hDC);
}

I'm using :

OpenGL 3.0
WIN32 API
C++
GLSL

if you really want the full source here it is -> http://pastebin.com/1Ncm9HNf , Its pretty messy.

sentences: How to make collisionshape2D work from other scene in Godot? I have created a scene which contains Area2D, CollisionShape2D & AnimatedSprite. Then I imported that scene into a level. At this moment the player should collide with the object taking it as a obstacle. But it doesn't collide with the coin. How can I make collision work from other scene?

sentences:
Manually writing a dx11 tessellation shader I am looking for resources on what are the steps of manually implementing tessellation (I happen to be using Unity CG, but any help is appreciated).

Today it seems that it is all the rage to hide most of the gpu code far away and use rather rigid simplifications such as unity's SURFace shaders. And it seems useless unless you're doing supeficial stuff.

A little background: I have procedurally generated meshes (using marching cubes) which have quality normals but no UVs and no Tangents. I have successfully written a custom vertex and fragment shader to do triplanar texture and bumpmap projection as well as some custom stuff (custom lighting, procedurally warping the texture for variation etc).

I am using the GPU Gems book as reference. Now I need to implement tessellation, but It seems I must calculate the tangents at runtime by swizzling normals (ctrl+f this in gems: <normal.z, normal.y, -normal.x>) before the tessellator gets them (during some sort of per-triangle geometry pass, which comes before vert and frag).

And I also need to keep my custom vert+frag setup (with my custom parameters/textures being passed between them) - so apparently I cannot use surface shaders.

Can anyone provide some guidence?

sentences:
OpenGL behaviour depending on the graphics card? This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc...

I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly.

I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

Edit #1: The graphics cards are NVIDIA Quadro GX7300 (in which my code works OK) and NVIDIA GeForce GTX 560 Ti (in which the results changes / fails)

Edit #2 I have commented out a lot of my code, and apparently the strange behaviour has nothing to do with texture handling. A simple chessboard-like floor looks differents. The diagonal white lines did not appear using the old NVIDIA Quadro GX7300. Any guess what OpenGL related thing could be causing this?

Figure 1

Edit #3 I have now fixed the issue commented on the previous edit, regarding the weird unwanted diagonal thin whit lines. As I commented below, I had to remove the glEnable(GL_POLYGON_SMOOTH);, which was affecting the NVIDIA GeForce GTX 560 for whatever reason (probably due to reasons explained by mh01 in his answer.

However, I am still facing a "texture blending" problem when using the NVIDIA GeForce GTX 560. I have a 3D model that is being textured using a shader that blends 8 different images to compute the right texture, depending on where the camera is at that particular moment. The resulting texture is then a combination of different images, and ideally they were blended nicely, using a set of blending weights computed each time the camera moves. The blending weights are still well computed, but the resulting texture is wrong. I am guessing that the GL_BLEND function is somehow behaving different, but I have checked it in both graphics cards and it is actually the same one. I have no idea what else can be involved in getting this wrong result:

As you can imagine, the black line is where two original textures are being blended in order to get a seamless texture. If I use the exact some code and a NVIDIA Quadro GX730, the shader works as expected. However, when I use the NVIDIA GeForce GTX 560, the texture blending goes wrong. Any guess?

This is the GLSL shader I am using.

sentences:
2D Polygon Triangulation I am creating a game engine using the JBox2D physics engine. It only allows you to create polygon fixtures up to 8 vertices, To create a body with more than 8 vertices, you need to  create multiple fixtures for the body.

My question is, How can I split the polygons a user creates into smaller polygons for JBox2D?

Also, what topology should I use when splitting the polygons and why?
(If JBox2D can have up to 8 vertices, why not split polygons into 8 per polygon)

sentences:
Looking for a good actionscript 3 book I've been looking for a book on actionscript3 development, but while there's tons of books out there, nobody seems to want to recommend any specific one.

One book I've been pointed towards is the cookbook by o'reilly, but it, like most books out there, seems to be based on the assumption that I'm using flexbuilder or flash. Instead, I'm "just" using flashdevelop, or the free SDK directly.

I've also been told to just go with the api reference and live with it. I could do that, I suppose, but I'd rather have a book that gives me the big picture. Kind of like with cocoa, there's the hillegrass' book, or the red book of OpenGL.

So, what would be the actionscript3 book out there?

sentences:
Cocos2D-JS Windows App in fullscreen mode (Win32) I've been looking for a way to make my Cocos2D-JS app go into fullscreen mode, but there doesn't seem to be much documentation on Cocos2D-JS (or Cocos2D-x-js as some seem to call it.)
This app is to be exported into a Windows Desktop platform (Win32), and so fullscreen mode should work there as well.

I checked the Cocos2D-JS Online API and found cc.screen, which has a method called requestFullScreen, so I tried this:

cc.screen.requestFullScreen(document.documentElement, function() { cc.log('Requesting full screen...'); } );

However, this didn't work on either of the platforms I tested it on (web browser and win32). Since document does not exist when you export the app into win32, I then tried changing it for cc._canvas:

cc.screen.requestFullScreen(cc._canvas, function() { cc.log('Requesting full screen...'); } );

But this did not work either. Is there a way to make the app run in fullscreen mode?

PD: My apologies for any wrong tags I may have included to this question. I added the ones I thought were related to this problem.

sentences:
Problem in multiplayer game lobby trying to pass map name to MasterServer.RegisterHost I'm working on an online multiplayer game, so I have lobby where users can see the hosts list. Every host in the hosts list has some information like "host user name" and "map name".

I'm using this code to register the host and  load "host user name":

public void something()
{
    var useNet = !Network.HavePublicAddress ();
    Network.InitializeServer (6, 25000, useNet);
    MasterServer.RegisterHost ("roomname", hostUserName , "unity");
}

public void btn_Refresh()
{
    MasterServer.RequestHostList ("roomname");
    data = MasterServer.PollHostList ();

    for (int i=0; i<data.Length; i++)
    {
        ButtonRoom [i].gameObject.SetActive(true);
        TextNameRoom [i].text = data [i].gameName;
    }
}

I also need "map name", exactly like "host user name", so I added another value to MasterServer.RegisterHost() like this:

public void something()
{
    var useNet = !Network.HavePublicAddress ();
    Network.InitializeServer (6, 25000, useNet);
    MasterServer.RegisterHost ("roomname", hostUserName, mapName, "unity");
}

but now I have an error that RegisterHost() can't have 4 arguments:

  No overload for method RegisterHost takes 4 arguments

What other way could I pass the map name? Thank you.

sentences:
Is localisation important for a mobile game with little text? Let's say it's a physics puzzle (Cut the Rope, Angry Birds) or a runner (Crossy Road, Subway Surfers) clone with some gameplay twists. Assume it puts text on some of the few controls: 'Play', 'Sound Volume', 'Level 15' etc. Most labels are accompanied with "standard" icons. Story is communicated with a text-free comic strip. Tutorial is also text-free.

can I publish it to Apple App Store and Google Play Store to every market while using English labels or it will be rejected?
will sales be affected a lot or negligibly when going:

freemium
premium.

Most articles I have seen are either PR of localisation companies or dealing with large/medium story-rich games.

PS: recommendations like "just remove all the text and use only icons" and "just localize it" are not something I am looking for.

sentences:
Why does the projection matrix transform object points into a unit cube in computer graphics? This semester I both took a computer vision and a computer graphics seminar. But only now before the exams I realize that there seems to be a fundamental difference between projection in both topics.

In computer vision we learned the math to map an object point from 3D to a plane using a 4x3 matrix, which seems logical to me:

|u|   |p_11 p_12 p_13 p_14|   |X|
|v| = |p_21 p_22 p_23 p_24| x |Y|
|w|   |p_31 p_32 p_33 p_34|   |Z|
                              |1|

However in computer graphics one usually uses a 4x4-matrix. The very nice explanation on Coding Labs has a picture depicting the outcome of said transformation: it depicts a unit-cube containing the transformed objects (distorted according to the projection).

But a unit-cube certainly isn't what is rendered on to the flat 2D screen. Is there something going on internally that just isn't mentioned? Why is this done?

sentences:
Why does my tile palette not arrange nicely? I made my own Hex Point Top Tile sprite sheet, ensuring it's pixel perfect and align well. Slicing in Sprite Editor has no problem too. However, when I drag the sprite sheet to a new Palette in the Tile Palette panel, the tiles show up with random spaces. See screenshot below:

What did I miss?

The sprite sheet is here, 30 x 30px offset, 24 x 24px padding, 66 x 66px tile size:

I'm using Unity 2019.3.10f1.

sentences:
Can I have a scene graph translation node with multiple parent nodes? I am trying to write a C++ scene graph structure. While designing the node classes I am facing the below issue.

I have a scene graph to represent a house.

I would like to have another house next to the one I have but I would like to reuse the nodes from the existing graph. In order to do that, I create another house (House 2) as a child of the original house (House 1). Although this leads to a situation where the base node in the following graph has 2 parent nodes.

I would like to know, is it a good idea to have a scene graph node (intermediate translation node) to have multiple parents?
I would like to reuse my sub-graph as much as possible.

sentences:
Please help with bounding box/sprite collision in darkBASIC pro So I just recently learned BASIC and figured I would try making a clone of pong on my own in darkBASIC pro, and I made everything else work just fine except for the part that makes the ball bounce off the paddle. And yes I'm aware that the game is not yet finished. The error is on lines 39-51
EVERYTHING IS 2D.
The problem i am having is that when the ball hits the paddle it gets like stuck(itll move away like 3 pixels and the back onto the paddle), and will move up or down until it
finally gets to the edge of the paddle, or it gets sucked into the inside of the paddle, or it does the same thing where it gets stuck on the paddle, but it does it from behind.

  ///////////////////////////////////////////////////////////
  //
  //     Project: Pong
  //     Created: Friday, August 31, 2012
  //     Code: Brandon Spaulding
  //     Art: Brandon Spaulding
  //     Made in CIS lab at CPAVTS
  //     Pong art and code © Brandon Spaulding 2012-2013
  //
  //////////////////////////////////////////////////////////
y=150
x=0
ay=150
ax=612
ballx=300
bally=200
ballx_DIR=1
bally_DIR=1
hide mouse
set global collision on
//objectnumber=10
//make object box objectnumber,5,150,0
do
load image "media\paddle1.png",1
load image "media\paddle2.png",2
load image "media\ball.png",3
sprite 1,x,y,1
     sprite 2,ax,ay,2
     sprite 3,ballx,bally,3
     if upkey()=1 then y = y - 4
     if downkey()=1 then y = y + 4

    //num_1 = sprite collision(1,0)
    //num_2 = sprite collision(2,0)
      num_3 = sprite collision(3,0)

for t=1 to 2

//ball&paddle collision
if num_3 > 0
    if bally_DIR=1
        bally_DIR=0
    else
        bally_DIR=1
    endif
    if ballx_DIR=0
        ballx_DIR=1
    else
        ballx_DIR=0
    endif
endif

//if bally > 1 and bally < 500 then bally=bally + 2.5
if bally_DIR=1
    bally=bally-2.5
        if bally<-2.5
            bally_DIR=0
        endif
else
    bally=bally+2.5
        if bally>452.5
            bally_DIR=1
        endif

endif
if ballx_DIR=1
    ballx=ballx-2.5
        if ballx<-2.5
            ballx_DIR=0
        endif
else
    ballx=ballx+2.5
        if ballx>612
            ballx_DIR=1
        endif

endif
//bally = bally + t
//if bally < 600 or bally > 1 then bally = bally - 2.5
//if ballx < 400 or ballx > 1 then ballx = ballx + 2.5
//move sprite 3,1

   next t
   if escapekey()=1 then exit
   loop
   end

Thank you in advance for the help.

sentences:
How do I efficiently render the tiles of a tile map? I've been working on a game, and I've been using Python with Pyglet to create it. I had an issue on how I could do effective tile based rendering. I tried cocos2d, however the API is very efficient and doesn't support maps which are larger than 1000x1000 tiles. I did some further research, and found you could make it so when you triggered an update, only sprites on the edge of the screen would update, however it is still buggy (it's not fully working).

Here is my code, and here's some relevant rendering code:

self.camera[0]-=amount
for a in range(self.window.height//self.block_size):
    self.sprites[(self.camera[0]//self.block_size)-1][a+(self.camera[1]//self.block_size)].batch = render
    self.sprites[self.window.width//self.block_size+(self.camera[0]//self.block_size)+1][a+(self.camera[1]//self.block_size)].batch = None

What approach should I use to render maps larger than 1000x1000 tiles?

sentences:
Concurrent touches not being detected I have pretty much the same controls on the race example of the engine. A AnalogOnScreenControl and a button defined by a Sprite.

The problem is, when I'm using the analog directional, touching the button does not trigger onAreaTouched on the button sprite.

I even tried adding the button to the child scene (controller scene) but it doesn't register the secondary touch on the button.

Am I doing something wrong or is this a bug?

UPDATE

I am doing some debugging and apparently if I touch the control base, it triggers it's onAreaTouched, and if I keep touching the controls and then touch the button (on the other side of the screen) the same onAreaTouched from the control base is triggered. He's the only one receiving the touch event.

I really can't understand why this is happening.

sentences:
Derive a algorithm to match best position I have pieces in my game which have stats and cost assigned to them and they can only be placed at a certain location.

Lets say I have 50 pieces.

e.g.
Piece1 = 100 stats, 10 cost, Position A.
Piece2 = 120 stats, 5 cost, Position B.
Piece3 = 500 stats, 50 cost, Position C.
Piece4 = 200 stats, 25 cost, Position A.
and so on..

I have a board on which 12 pieces have to be allocated and have to remain inside the board cost.
e.g. A board has A,B,C ... J,K,L positions and X Cost assigned to it.

I have to figure out a way to place best possible piece in the correct position and should remain within the cost specified by the board.

Any help would be appreciated.

sentences:
Keeping everything within one Activity Overview

My game is currently based on a single activity (rather than multiple activities) and I would like to keep it that way.

At the moment, it goes straight into the game at level 1. I will shortly be adding an options menu and another 20 or so levels. (As well as a high-score screen, help screen etc).

The thing I'm not sure about is, how do I tell the app/renderer what screen/part of the game to render?

It's an openGL ES 2.0 app so at the moment, the method I have in my mind is something like this:

Code Snippets

int level = 0;  //0 means menu, 1 means level 1 etc

in onDrawFrame(); have something like this:

@Override
public void onDrawFrame(GL10 gl) {

switch (level){

case 0:renderMenu();break;
case 1:renderLevel1();break
case 2............

And so on.

I would also do the same with the logic updating.

Is this the way to go? I'm just not sure it's very efficient but I can't really see what the alternatives are - another way I was looking into was having a separate GLRenderer for each 'screen / level' but this seems much more over-kill.

Would appreciate some guidance as to how to display the correct screen / level at the right time.

Edit This is the current structure of my code:

Activity class

public class MainActivity extends Activity {

//Various pieces of code here

    class MyGLSurfaceView extends GLSurfaceView {

    //Various pieces of code here

    @Override
    public boolean onTouchEvent(MotionEvent event) {

    //Touch events handles here

}

GL Renderer class

onDrawFrame(){

    render();
    update();
}

sentences:
OnMouseOver not registering collisions I'm working on a UI-heavy game and I'd like to add sound effects for when the player mouses over a UI button (using TMP, if that matters). I've tried OnMouseOver and its siblings OnMouseEnter and OnMouseStay, I've tried with and without 2D Box Colliders, but so far nothing I've tried seems to register that the mouse is over the button: i.e. nothing happens. If a collision or Raycast hit were registered, all that I'm asking right now is for it to run the line Debug.Log("Collision detected");
I know that Unity is able to register hits on the UI element I'm testing on, because mousing over it engages the Sprite Swap function that's part of the Button component, which it would not do if it were not accepting Raycast hits.
I'm sure there's some very simple solution to this, like a check-box I haven't ticked, but I could really use some help here.
Many thanks!

sentences: Can I use xna tutorials to learn monogame? Can I use xna tutorials to learn monogame? I can't find any good monogame tutorials but there are tons of xna tutorials available and from what I have seen they are pretty much the same thing.

sentences:
How to orient a surface normal to a cubic surface The immediate question is: in HLSL, how can I orient a surface normal generated in UV space so that I can apply it to a cube face?

The overall project is that I'm trying to build a procedural planet generator.  I'm using a cube projected to a sphere where each face is a quad-tree.  The intermediate project is that I want to generate a normal map for the terrain.  I think the best way for me to do this (and understand what I'm doing) is to generate the normals for the cube version first, then work out the transformations to warp those normals to the sphere.

Ideally the method would not involve branching code based on which face I'm working on (i.e., if we're on the top side of the cube, then U = X and V = Y).  In other words, what I'm hoping for is some math-magic like "Oh, just cross multiply the terrain normal by the dot product of the cube face normal and blah blah blah".

9/20/10 ETA:

I know how to calculate normals for a flat surface.  My subsequent problem is two-fold:

How do I rotate the normal map so it is oriented correctly on each of the cube faces?
how do I warp the flat normal map so that it wraps the sphere?

I've found one solution that uses a Jacobian matrix, but I can't get it to work.  Even when all of the normals are pointing straight up (i.e. a flat surface), the HLSL code involving the Jacobian totally messes up the lighting--so it makes me not trust my implementation of the solution.

sentences:
Things disappear in front of Canvas I'm trying to add some text to my Canvas but it seems to disappear in front of it? So does particle systems and other things?

It is a child object of the canvas.

sentences: Nvidia Cg 3.0 Manual/Documentation? I can only find a user's manual for Cg 1.4 from Sept 2005, and the Cg Tutorial from earlier than that. Cg is now on version 3 and I'm wondering about all the new profiles and tech that must be in it... Anyone got some links?

sentences:
glVertexAttribPointer stride ambiguity As a hobbyist junior game programmer, I have done multiple small OpenGL projects just to have fun with 3D. I've tested VBOs in C++ and in Java and I found something or rather understood Java tutorials differently than the C++ ones. When using the glVertexAttribPointer function in Java, it is told that the parameter stride (second from the end) is the size of an entire vertex.

void glVertexAttribPointer( GLuint index,
                            GLint size,
                            GLenum type,
                            GLboolean normalized,
                            GLsizei stride,
                            const GLvoid * pointer);

Considering the following my interpretation of the Java/OpenGL tutorial, this is what should be done (as example) in C++:

glVertexAttribPointer(vertexLoc, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(0));
glVertexAttribPointer(normalLoc, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(sizeof(float)*3));
glVertexAttribPointer(texCoord0Loc, 2, GL_FLOAT, GL_FALSE, sizeof(MyVertex), BUFFER_OFFSET(sizeof(float)*6));

struct MyVertex
{
    float x, y, z;
    float nx, ny, nz;
    float s0, t0;
};

Now I'm really confused because this works in my Java code. However, in my old C++ code, I was something like this:

glVertexAttribPointer(vertexLoc, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex) - sizeof(aPosition), BUFFER_OFFSET(0));
glVertexAttribPointer(normalLoc, 3, GL_FLOAT, GL_FALSE, sizeof(MyVertex) - sizeof(aNormal), BUFFER_OFFSET(sizeof(float)*3));
glVertexAttribPointer(texCoord0Loc, 2, GL_FLOAT, GL_FALSE, sizeof(MyVertex) - sizeof(aTextCoord), BUFFER_OFFSET(sizeof(float)*6));

My question is: should the stride parameter be the size of an entire vertex in bytes or should it be the number of bytes separating another vertex attribute of the same type, i.e. the size between two normals, positions, texture coordinates, ect?

sentences:
Where to find passive advertisements? Imagine a soccer game. While the player is playing a match, he is seeing the billboards all the time.

I want to include that kind of advertisements in my game (obviouly, making profit). Just a brand logo, not a banner the user has to click.

Does this even exist? Is there any AdMob like which allows this kind of advertisement?

sentences:
Wrong Second position of LineRenderer I'm drawing some kind of bullet trace effect with LineRenderer in my 2D Game Project with Unity. At some position, setting position of LineRender result weird:

In the above screenshot, you can see two types of lines are exists. Pure red lines are result of Debug.DrawRay which is only renders in Scene view, not actual game play, and another lines which has yellow to red gradient are actual line renders I want to draw.

I used exactly same code for rendering both two, Debug.DrawRay() and LineRenderer.SetPosition(), but as you can see only DrawRay works as I expected and LineRenderers are cutted and pointing wrong direction.

Here's the code I'm trying:

void Fire() {
    Vector3 shootDirection = m_ShootPoint.right;

    RaycastHit2D hit = Physics2D.Raycast(m_ShootPoint.position, shootDirection, m_Range);
    Debug.DrawRay(m_ShootPoint.position, shootDirection.normalized * m_Range, Color.red, 20);

    // On Hit, set end position where it hits
    if (hit) {
        CreateBulletTrace(m_ShootPoint.position, hit.point);
    }
    // Otherwise, render straight until it's range
    else {
        CreateBulletTrace(m_ShootPoint.position, shootDirection.normalized * m_Range);
    }
}

void CreateBulletTrace(Vector3 startPos, Vector3 endPos) {
    GameObject bulletTraceObj = Instantiate(m_BulletTraceLineRendererPrefab);
    LineRenderer bulletTraceLineRenderer = bulletTraceObj.GetComponent<LineRenderer>();
    bulletTraceLineRenderer.useWorldSpace = true;

    bulletTraceLineRenderer.SetPosition(0, startPos);
    bulletTraceLineRenderer.SetPosition(1, endPos);

    // Destroy(bulletTraceObj, 0.1f);
}

Note that LineRenderer checked use world space to true. What am I missing?

Using Unity 2019.1.0f2.

sentences: Rotate final image with projection matrix I'm trying to use space in my shadow (depth) maps in a more efficient way. If I could freely rotate the final image I get with projection matrix I could save a lot of pixels, but I don't know if it is possible to do so. Is it?

sentences:
Rotate a bitmap and bitmap is getting blur in android I am developing an android game. and in this I want to move an object along a Bezier path.

my object is rotating with some angle on this curve.

I used this piece of code:

public void update() {

        // check collision with bottom wall if heading down
        if (droid.getSpeed().getyDirection() == Speed.DIRECTION_DOWN
                && droid.getY() + droid.getBitmap().getHeight() / 2 >= getHeight()/2 &&
                droid.getY() + droid.getBitmap().getHeight() / 2 <= getHeight()/2+ 100 ) {

            int pointX[], pointY[];
            pointX = new int[4];
            pointY = new int[4];
            int  X , Y;

                pointX[0] = getWidth()/2;
                pointX[1] = getWidth()/2 + 50;
                pointX[2] = getWidth()/2 + 25;
                pointX[3] = getWidth()/2;
                pointY[0] = getHeight()/2;
                pointY[1] = getHeight()/2 + 25;
                pointY[2] = getHeight()/2 + 50;
                pointY[3] = getHeight()/2 + 100;

                Log.i(TAG, "In the While Zone of Last Half Zone");
                X = (int) ((pointX[3] * u * u * u) + (3 * pointX[2] * u * u * (1-u)) + (3 * pointX[1] * u * (1-u) * (1-u)) +
                    (pointX[0] * (1-u) * (1-u) * (1-u)));

                Y = (int) ((pointY[3] * u * u * u) + (3 * pointY[2] * u * u * (1-u)) + (3 * pointY[1] * u * (1-u) * (1-u)) +
                        (pointY[0] * (1-u) * (1-u) * (1-u)));

                Log.i(TAG+" Value of X: ", Double.toString(X));
                Log.i(TAG+" Value of Y: ", Double.toString(Y));

                double deltaX = X - droid.getX();
                double deltaY = Y - droid.getY();

                Log.i("deltaX :", Double.toString(deltaX));
                Log.i("deltaY :", Double.toString(deltaY));

                double angle = Math.atan2(deltaY, deltaX)  ;
                Log.i(TAG+" Angle: ", Double.toString(angle));
                Matrix mtx = new Matrix();
                mtx.preRotate((float) angle);
                mtx.postScale(1, 1);

                Bitmap rotatedBMP = Bitmap.createBitmap(droid.getBitmap(), droid.getX(), droid.getY(),  X - droid.getX(), Y - droid.getY(), mtx, true);
                droid.setBitmap(rotatedBMP);
                droid.curveUpdate(X, Y);
                u = u + 0.001;
                Log.i(TAG+" Value of U: ", Double.toString(u));

        }
        // check collision with top wall if heading up

        // Update the lone droid
        else{
            droid.update();
        }

    }

my object is moving and rotating as i supposed but image is getting blur. am not getting why is so.

Please suggest what can be the problem.

Thanks.

sentences: How to add scene after build and deployed in Unity? I want to be able to make new levels after build. I could use a map tool and script but I rather just add scene with all the resource packed with it. But what is the best practice forward?

sentences:
How irregularly shaped rooms should be placed in a dungeon I have made a procedurally generated dungeon that places every room successfully so it is accessible via at least one other room. A 'successfully' placed room is a room who's wall cells are right net to another room's wall cells. This is because there are no corridors in my dungeon, but doorways, 2 cells thick:

       ###########
       #.........#     // Where '[]' is the Doorway.
########.........#
#.....[].........#
#.....############
#.....#
#######

However I have now moved on to procedurally generate irregular shaped rooms, such as 'L' shaped rooms, 'T' shaped rooms, and so on.

I am wondering how I can place, for example, a square room next to an 'L' shaped room, without wasting any space: i.e.:

     ##########
     #........#
######........#
#...[]........#
#...###########
#...#
#...#######
#.........#
#.........#
###########

This is not possible with my previous algorithm because it only took into account the room's bounds, where as now an 'L' shaped room's bounds contains empty space that a square room could possibly fit.

sentences:
Camera movement in Super Hexagon I do realize there is no camera in OpenGL ES 2, but from my understanding you can simulate one using view and projection matrices. I'm using Android, by the way. Here's a video of the game, in case you are not familiar with it: https://www.youtube.com/watch?v=5mDjFdetU28

I am trying to understand how the world/camera is rotated and tilted. Is that done purely by rotating and tilting the view matrix? So you'd have a tilt and rotationSpeed fields that you'd use each frame in something like rotate(viewMatrix, angle + rotationSpeed) followed by rotate(viewMatrix, tilt)? How would you achieve a similar effect?

sentences:
Highlighting shader but using touch points/mouse I have done the following highlighting shader using GLSL.
What I want to do is getting the mouse coordinates and "start" the highlighting from that point. is that possible ? What's the math or the idea behind doing that ?
https://youtu.be/8etJho4agpg

sentences:
Why is the timer not calling the function? I am trying to call a function every 30 seconds. I have used this before without issues so I'm not sure why it isn't working now. Any ideas? Has something changed in 4.24 maybe?

.h I have tried both public and private

UFUNCTION()
void Ping();

And the .cpp I see both logs in the output so I know its getting there. Also the ensure passes. I have also tried GetWorld which is null in a UObject and GWorld which also works but has the same problem of the ping function not being called at all.

UE_LOG(LogTemp, Warning, TEXT("start ping"))
if (ensure(GEngine))
{
    UWorld* World = GEngine->GetWorldContexts()[0].World();
    UE_LOG(LogTemp, Warning, TEXT("start ping has gworld"))
    World->GetTimerManager().SetTimer(PingTimerHandle, this, &UGameJoltApi::Ping, 30, true, 30);
}

And here is the ping function. Its not called even once. I never see the log in the output.

UE_LOG(LogTemp, Warning, TEXT("ping"))
FString Url = URLBaseApi + URLSessions + "ping/?game_id=460364&username=" + Username + "&user_token=" + UserToken;

TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetVerb("POST");
Request->SetHeader("Content-Type", "application/json");
Request->SetURL(GenerateUrl(Url));
Request->OnProcessRequestComplete().BindUObject(this, &UGameJoltApi::OnStartSessionResponse);
Request->ProcessRequest();

sentences:
What is a reasonable terminal size across Linux distributions? I'm working on a Curses-based roguelike; it should (and does) work in both Linux and Windows (various flavours of each).

Currently, I'm enforcing a hard requirement of "your terminal size must be 80x25 to play. Please fix it and come back" to ensure I have a consistent UI.

This works on Windows. But not on Linux; it seems that Ubuntu, at least, uses a terminal size of 80x24 instead.

Since Google is not useful, what can I reasonably expect as far as terminal size support across various Linux distros?

(If it is 80x24 or even as low as 80x20, I can probably work with that.)

sentences:
Drawing graphics in Java game I am quite new to game development, so here is a question (maybe a stupid one):

In my sidescroller i have a bunch of different graphics objects that i need to draw (player, background tiles, creatures, projectiles etc). Most tutorials i've read so far show that each object has its own draw method, which is then called from some other method.

What if I had one method that does all the drawing? Lets say i keep all my objects in an array or queue (or multiple arrays) and then go through each of them, get an image and draw it.

So basically would it be better (and why) to have each object have its own draw method or one method that does all the drawing? Or does it matter at all? I feel like the second option is more comfortable, because then all the stuff to do with drawing would be in one place...

sentences:
Load large quantities of data in Unity3D I'm building an Android app using Unity3D where users can visualize data immersively.

The data is immutable and stored using a MySQL database hosted on cPanel.

When the user clicks a button in the environment, it starts the creation of a chart. First, contacts a .php file present in the server responsible to query the database, fetching the data and make it available to the Unity controller which then adds the points to the chart. This works fine for small quantities of data.

To increase performance, thought of exporting from MySQL as CSV and transform to one JSON, instead of querying a database or try to make MySQL transform to JSON, but I'm afraid this won't be enough.

Could also extract as CSV and use a 3rd party for reading it.

How would you load the data in such case to have the best performance?

sentences: Which image format is more memory-efficient: PNG, JPEG, or GIF? Which image format is more efficient to save memory? PNG, JPEG, or GIF?

sentences:
How to create a hover effect on image I am trying to make it so that when a user hovers over an image on my JPanel, the image turns into a different image. I have 2 classes, one for the JPanel and the other is for the gameplay (snake game). How do I implement the mouseListener to make it so that the image changes on hover?

snake.java (main):

public class snake {

    public static int mouseX;
    public static int mouseY;

    public static void main(String[] args) {

        // JFrame
        JFrame obj = new JFrame("Snake");
        gameplay Gameplay = new gameplay();
        obj.setBounds(10, 10, 905, 700);
        obj.setBackground(Color.DARK_GRAY);
        obj.setResizable(false);
        obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        obj.add(Gameplay);
        obj.setVisible(true);

        obj.addMouseMotionListener(new MouseAdapter() {
            @Override
            public void mouseMoved(MouseEvent e) {
                mouseX = e.getX();
                mouseY = e.getY();
            }
        });

    }
}

Image I want to change:

    settingsImage = new ImageIcon(getClass().getResource("/assets/settings.png"));
    settingsImage.paintIcon(this, g, 700, 23);

If you need to see any of my other code please tell me!

sentences:
Box2d Body to follow mouse movement I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean.

The red and blue circles are current point of the mouse and the body (of corresponding color) moving/rotating to follow it. Basically the rectangle should rotate with its one end pointed towards where the mouse pointer is.

Here's my code so far,

 World world;
    Body body, bullet;
    Box2DDebugRenderer debugRenderer;
    OrthographicCamera camera;

    @Override
    public void create() {

        world = new World(new Vector2(0, 0f), true);
        debugRenderer = new Box2DDebugRenderer();
        float w = Gdx.graphics.getWidth();
        float h = Gdx.graphics.getHeight();

        BodyDef bodyDef = new BodyDef();
        bodyDef.type = BodyDef.BodyType.DynamicBody;
        bodyDef.position.set(10, 10);
        body = world.createBody(bodyDef);

        PolygonShape shape = new PolygonShape();
        shape.setAsBox(2, 5);
        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = shape;
        fixtureDef.density = 1f;
        Fixture fixture = body.createFixture(fixtureDef);

        shape.dispose();

        Gdx.input.setInputProcessor(this);

        camera = new OrthographicCamera(200, 100 * (h / w));
        camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);
        camera.update();

    }
 @Override
    public void render() {

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(Gdx.graphics.getDeltaTime(), 6, 2);
        camera.update();
        debugRenderer.render(world, camera.combined);
    }

  @Override
    public boolean mouseMoved(int screenX, int screenY) {
        int mouseX = screenX;
        int mouseY = Gdx.graphics.getHeight() - screenY;
        float rotateAngle = MathUtils.radiansToDegrees * MathUtils.atan2((float) mouseY - (float) body.getPosition().y, (float) mouseX - (float) body.getPosition().x);
        body.setTransform(body.getPosition(), rotateAngle / 57.2957795f);
        return true;
    }

And here's a gif of how it appears now.

as you can see the body gets skewed and also doesn't rotate properly. What am I missing?

sentences:
Selective Collision Resolution While Rolling I am working on a 2D action platformer in Pygame, though my question is a general one.

The question concerns selective collision resolution. In short, I want certain collisions to be ignored while my player sprite is rolling.

My player sprite has a roll state during which a controlled force is applied, moving the sprite forward until the roll animation finishes and the sprite's state changes to idle.

The sprite's bounding box doesn't change during this animation, since, as a rule, you don't want a sprite's bounding box to change size from frame to frame (see this answer).

My sprite is 64 pixels tall and I want him to be able to roll through 32 pixel gaps. Here's a diagram:

Currently, I do collision resolution during updates to my sprite's position. I first change his y-position according to his y-velocity,  then check if there is rectangular overlap between my sprite and objects of a wall class. If there is, I place him flush with the wall. Then I update his x-position according to his x-velocity and do a similar collision check and resolution.

I was thinking I might be able to achieve my desired goal (rolling under walls)  by flagging certain walls as "passable_while_rolling". The wall under which I'm rolling could be thus flagged. In my collision code, these walls would be ignored if the sprite was in the rolling state.

A problem would occur, however, if the sprite finished rolling while intersecting one of these walls. In that case, the collision code would kick in and resolve the sprite to one side of the wall in an unattractive manner.

Another option would be to just keep the sprite in the rolling state until he no longer intersects any flagged wall (similar to how you can't shift out of morph ball until you have overhead space in Metroid). I don't want to do this since I think looping the roll animation is ugly and unrealistic.

So, my questions are:  What are my other options? How do other games deal with collision while rolling under walls?

I am open to drastically changing my collision resolution system.

sentences:
numeric identifiers associative array edit: clarified my question. I also realized that I didn't pick a very conclusive question title, which unfortunately I cannot change anymore, sorry.

Hey everyone,

to improve my programming skills a little and getting familiar with good design patterns, I'm trying to program a litte turn based strategy game, and I am at the point to choose a good data structure for the configuration of different terraintypes and unittypes etc. which do exist.

What I have implemented so far is a big "Game Object" with knowledge about everything in the game, and many of its properties are big associative arrays (I'm using PHP, but my question doesn't really have to do much with the language), for example an arrays of units, a map array.... What my array structure is comparable to is the type object pattern mentioned here.

Example: A single unit is of a certain type, say 'Infantry', and shares many data with all the other infantry untis on the field. Instead of copying all these values, I give every unit a "type" so it can look up the details there. Similar with terraintypes. Example:

terraintypes = array()
terraintypes[0] = array()
terraintypes[0]['name'] = 'Forest'
terraintypes[0]['capturable'] = false

unittypes = array()
unittypes[0] = array()
unittypes[0]['name'] = 'Infantry'
unittypes[0]['movecost'] = array()
unittypes[0]['movecost'][0] = 5 //Movementpoints needed for forest
unittypes[0]['movecost'][1] = 7 //Movementpoints needed for terraintype 1

A specific unit or tile on the map wouldn't know its movement costs or name, but would be able to look that up in the unittypes array. Example:

sometile = array();
sometile['owner'] = whatever
sometile['type'] = 0; //this tile is a forest

someunit = array()
someunit['type'] = 0 //This is an "Infantry".

The problem is that getting any kind of information will produce very verbose code, for example finding out how much it costs for a unit to move onto a tile will be

unittypes[unit['type']]['movecost'][tile['type']]

I am trying right now to move to using more objects and classes, so if I give a unit a reference to its unittype, it can lookup information itself, for example

terraintypes[0] = new Terraintype('Forest')
unittypes[0] = new Unittype('Infantry')
someunit = new Unit(unittypes[0])

Now, if I ask a unit something only its unittype would now, the unit can look it up itself, e.g. someunit.getName() will be implemented in the unit like this.unittype.getName().

So far so good. However, how could a unittype store its movecost on the different terrains? Basically I would need an array indexed with terraintypes, but as that is not possible, I will have to swhich back to translate everything to numeric keys, and have a movecost value for every pair (terraintype, unittype).

Who assigns these numeric keys and where? Will every single unittype need to store some kind of identifier which is unique among all the unittypes?
Should I use some constants like const FOREST = 0; const ROAD = 1; const INFANTRY = 0; const VEHICLES = 1 etc?

Another of my problems for finding a good data structure is that if I don't give the game all the data directly, but break everything down to smaller parts, then many parts will need to know about the same objects.

For example, if the Map object knows about all tiles of the map and the units on it, then the game doesn't really know anything about the units, it only knows about the map, and every command in the game which affects a unit needs to be passed to the map, even though its not actually a "map task", like healing units.

This seems like breaking the single responsibility pattern. However, storing references to all the units in several places (so both the Map and something else store references to units) seems to be troublesome with bookkeeping.

To sum it up a little, can you hint me to data structure which are suitable to represent what I am describing? Thanks in advance!

sentences:
XNA 4.0 - Purple/Pink Tint Over All Sprites After Viewing in FullScreen I'm a noob to the game dev world and recently finished the 2D XNA tutorial from http://www.pluralsight.com.

Everything was perfect until I decided to try the game in Fullscreen mode.  The following code was added to the Game1 constructor.

        graphics.PreferredBackBufferWidth = 800;
        graphics.PreferredBackBufferHeight = 480;
        graphics.IsFullScreen = true;

As soon as it launched in Fullscreen, I noticed that the entire game was tinted.  None of the colours were appearing as they should.  That code was removed, the game then launched in the 800x480 window, however the tint remained.

I commented out all my Draw code so that all that was left was

        GraphicsDevice.Clear(Color.CornflowerBlue);

        //spriteBatch.Begin();
        //gameState.Draw(spriteBatch, false);
        //spriteBatch.End();

        //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
        //gameState.Draw(spriteBatch, true);
        //spriteBatch.End();

        base.Draw(gameTime);

The result was an empty window that was tinted Purple, not Blue.  I changed the GraphicsDevice.Clear colour to Color.White and the window was tinted Pink.  Color.Transparent gave a Black window.

Even tried rebooting my PC but the 'tint' still remains.  I'm at a loss here.

sentences:
Calculate the displacement of device in unity I'm making a 3D game in unity where the object should move forward and backward as the android device moves/accelerates in the Z axes. ie. When the player moves the devise in the direction of the +ve Z axis, the object should move forward, and when the player moves the devise in the direction of the -ve Z axis, the object should move backward.

This game is a multiplayer game, and the players will move in a large football field.

My idea to do this is using the accelerometer to calculate the acceleration of the device, then integrate the data of acceleration to get the device speed in the Z axis. and use the speed to move the device.

Using this equation

  V2=V1 + ΔA . ΔT
  Where
  V2 : final velocity.
  V1 : initial velocity.
  ΔA : difference between the initial and final acceleration.
  ΔT : difference between the initial and final time.

At first I tried to use kinematic equations to calculate the final speed, but I realized then that it can be only used when acceleration is constant. So a friend of me who studies physics differentiated this equation for me to use it when acceleration is variable.

I know that there will be some error in calculating the accurate displacement, and that the error will increase after the integration of acceleration, but this small percentage of error is okay for my application; I thought at first in using GPS instead of accelerometer but I found that GPS accuracy will be less than the sensors.

I know also that the error will be incredibly high after some time, so I reset the values of acceleration and velocity every 10 seconds. I'm also using a low-pass filter to reduce the noise of the sensor.

public class scriptMove : MonoBehaviour
{
    const float kFilteringFactor = 0.1f;

    public Vector3 A1;
    public Vector3 A2;
    public Vector3 A2ramping; // for the low-pass filter
    public Vector3 V1;
    public Vector3 V2;

    public int SpeedFactor=1000; //this factor is for increasing acceleration to move in unity world

    void resetAll()
    {
        Input.gyro.enabled = true;
        A2 = Vector3.zero;
        V1 = Vector3.zero;
        V2 = Vector3.zero;
        A2ramping = Vector3.zero;
    }
    // Use this for initialization
    void Start()
    {
        InvokeRepeating("resetAll", 0, 10);
    }

    //http://stackoverflow.com/a/1736623
    Vector3 ramping(Vector3 A)
    {
        A2ramping = A * kFilteringFactor + A2ramping * (1.0f - kFilteringFactor);
        return A - A2ramping;
    }

    void getAcceleration(float deltaTime)
    {
        Input.gyro.enabled = true;

        A1 = A2;
        A2 = ramping(Input.gyro.userAcceleration) * SpeedFactor;

        V2 = V1 + (A2 - A1) * deltaTime;

        V1 = V2;
    }

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

        getAcceleration(Time.deltaTime);

        float distance = -1f;
        Vector3 newPos = transform.position;

        transform.Translate(Vector3.forward * Time.deltaTime * V2.z * distance);
    }
}

The problem:

My code doesn't work always as expected when I move with the device;

Sometimes when I move forward (in the +ve Z axis of the device) the object moves forward also, but sometimes it doesn't move at all.
Sometimes when I'm still in my position the object moves alone by itself.
Sometimes when I move forward and suddenly stop, the object does not stop.

My questions:

Are those strange behaviors because of the accuracy of the device, or is there something I'm missing in my code.
If I'm missing something in my code, What is it?
I searched a lot about methods to get the most accurate position of the device, and I found that I can integrate GPS with accelerometer, how can I do this with my code in unity?

sentences:
What is the name of the balancing technique that reduces the incremental value of bonuses? Some games, including Dungeon Crawl (example), use a balancing technique that attempts to prevent certain values (stats, damage, etc.) from being excessively high. The algorithm looks like this:

if value > 20:
  value = 20 + (value - 20)/2
#70 → 45

...and can be applied multiple times:

if value > 20:
  value = 20 + (value - 20)/2
if value > 40:
  value = 40 + (value - 40)/2
# 70 → 45 → 37.5

sentences: How to flip a box2d body when it can't move forward? LibGDX I'm attempting to create a simple enemy for a platformer. It should move forward constantly until it hits something like a wall, and then it should flip and move forward the other direction. How might I accomplish this?

sentences:
android multitouch problem Im aware that there a a couple of posts on this matter, but Ive tried all of them and none of them gets rid of my problem.

Im starting to get close to the end of my game so I bought a cabel to try it on a real phone, and as I expected my multitouch dosnt work. I use 2 joysticks, one to move my character and one to change his direction so he can shoot while walking backwards etc.

my local variable:

public void update(MotionEvent event) {
    if (event == null && lastEvent == null) {
        return;
    } else if (event == null && lastEvent != null) {
        event = lastEvent;
    } else {
        lastEvent = event;
    }

    int index = event.getActionIndex();
    int pointerId = event.getPointerId(index);

statement for left Joystick:

if (pointerId == 0 && event.getAction() == MotionEvent.ACTION_DOWN && (int) event.getX() > steeringxMesh - 50 && (int) event.getX() < steeringxMesh + 50 && (int) event.getY() > yMesh - 50 && (int) event.getY() < yMesh + 50) {
    dragging = true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
    dragging = false;
}

if (dragging) {
     touchingPoint.x = (int) event.getX(); //used to calculate angle of sprites movement
     touchingPoint.y = (int) event.getY();

     //code for moving my character

statement for my right joystick:

if (pointerId == 1 && event.getAction() == MotionEvent.ACTION_DOWN && (int) event.getX() > shootingxMesh - 50 && (int) event.getX() < shootingxMesh + 50 && (int) event.getY() > yMesh - 50 && (int) event.getY() < yMesh + 50) {
    shooting = true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
    shooting = false;
}

if (shooting) {

    touchingPoint2.x = (int) event.getX(); //used to calculate sprites angle and get the correct direction
    touchingPoint2.y = (int) event.getY();
    // code for aiming
}

This class is my main-Views onTouchListener and is called in a update-method that gets called in my game-loop, so its called every frame.

Im really at a loss here, I've done a couple of tutorials and Ive tried all relevant solutions to similar posts.
Can post entire Class if necessary but I think this is all the relevant code. Just hope someone can make some sence out of this.

EDIT: both shooting and dragging joysticks work fine, but only when I press them one at a time, so I cant drag and shoot at the same time. I've looked around for a bit more and have understood that you need a MotionEvent.ACTION_POINTER_UP and MotionEvent.ACTION_POINTER_DOWN , but still dont know a way to implement it, some people use loops that goes through event.getPointerCount. Also with this Code my pointerId is always 0. To sum up: I want to be able to use both joysticks at the same time.

sentences:
Storing Player Location/Data in an Online Game I know this question has been asked and answered in some threads, but I'd like a more beginner dumbed down explanation.

So player information, specifically direction and position, need to be updated constantly, for tons of players at the same time.

Let's just say 10 players in the same room move an inch in some direction. All of the other players need to see that instantly, obviously. I realize that saving the location to the database, and getting the location for everyone to see is a horrible idea.

So I guess my question is... how does this work? What happens if a player alt-f4's or kills the game process without saving or doing a "normal" exit? How often should I save the location to the database?

Thanks

sentences:
How to render a model that consists of individually transformable parts? Consider a 3D model for a spider that consists of a body and eight legs. The legs can be transformed (rotated) relative to the body. I am not sure what the common ways of rendering such a scene are, at a low level. Two ways I could think of:

Render the body and legs separately, using different VBOs (or different indices) (one for the body, one for the leg) and separate draw calls.
Encode in each vertex which body part it belongs to, and decide based on this information how to transform the vertex in the vertex shader.

I searched a bit and could find some tutorials on skeletal animation and similar techniques, but they still boil down to this question.

sentences:
In XNA, how should I organize content shared between projects? I have an XNA library using several custom effects.  They need to be accessed by:

a content pipeline project (models are built with the effect), and
projects that use my game library (they should be able to load a standalone instance of the effect).

Where should I put the .fx files for the custom effects?  How do I access them from separate projects?

sentences:
Should I link GLFW and GLEW into my engine directly? I want to write my own (simple) game engine with OpenGL.
I use GLEW and GLFW and so far linked it successfully.

Should the engine or the respective game (which depends on the engine) include GLFW and GLEW?

Ultimately I would like to create a library out off my engine and include it into my game, but I'm not quite sure if that is possible, if its the case, that the engine should depend on GLFW and GLEW. Would I have to link all the libraries that are neccessary for GLEW and GLFW into the game plus the engine-lib itself?

sentences:
Unproject considering parallax depth How can I take screen coordinates (or alternatively world coordinates on the 'primary' parallax plane) and find out what world coordinates they translate into when taking parallax depth into account?

I want to be able to tell if a rectangle is under the mouse cursor. I'm using libGDX and the ParallaxCamera class from the tests module. This means depth is modelled in two dimensions, where 1 == primary plane, 0 == pinned to the screen, 0,5 == scrolls at half the rate of the primary plane.

This is trivial in the primary parallax plane, as libGDX's camera has a handy unproject method. However, I can't find any examples that use the 'parallax matrix', as this is typically passed into a SpriteBatch#setProjectionMatrix rather than being used in internal camera calculations.

I don't understand the mathematics enough to figure this out. If anyone reading this can link to any very basic explanations of the mathematics behind projecting things with parallax depth into screen space and vice versa, I'd be really grateful to read it.

sentences:
Game window systems and internal frames I don't know if this is a valid question, but: What kind of window manager do games use which have internal frames (Frames inside frames)? Does this differ between the programming languages (Are e.g. in Java the AWT/Swing libraries used to manage these and other graphical elements, such as buttons,or is this to restrictive (speed, graphical possibilities?))

A special example would be EVE Online, where the client can use the ingame windows like on a normal desktop.

sentences:
Unable Compile Unreal Project into .Exe File I'm new to Unreal Engine and I've been looking for an answer online but I don't understand why the project I just started on is unable to compile. I only used the default blueprints. The error logs are below.
UATHelper: Packaging (Windows (64-bit)): Running AutomationTool...
UATHelper: Packaging (Windows (64-bit)): Parsing command line: -ScriptsForProject=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDarkSide.uproject BuildCookRun -nocompileeditor -installed -nop4 -project=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDa
rkSide.uproject -cook -stage -archive -archivedirectory=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide -package -ue4exe="C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -clientconfig=Development -utf8
output
UATHelper: Packaging (Windows (64-bit)): Setting up ProjectParams for C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ********** COOK COMMAND STARTED **********
UATHelper: Packaging (Windows (64-bit)): Running UE4Editor Cook for project C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ERROR: Cook failed.
UATHelper: Packaging (Windows (64-bit)):        (see C:\Users\belmo\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.26\Log.txt for full exception trace)
PackagingResults: Error: Cook failed.
UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults: Error: Unknown Cook Failure
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)
LogSlate: Window 'Output Log' being destroyed
LogSlate: Window 'Output Log' being destroyed
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)

sentences:
How to design a turn-based game which is easy for humans but difficult for AI? Until recently, Go used to be of the last bastions of turn-based no information-hiding games where world-class human players could not be defeated by computers. But now this bastion has fallen, as the program AlphaGo managed to beat one of the world top players.

However, Go was never designed as a game which is hard for AI. It was developed thousands of years ago. Being hard for computers was an unintentional side-effect of the game design, not a stated design goal.

What game mechanics make a turn-based strategy game without information hiding hard for AI, yet still playable for humans?

In case someone wonders "Why is this question also relevant for video game developers"?

because it shows us how to design competitive multiplayer games where players can not cheat by using an AI assistant.
For single player games it shows us what to avoid when we plan to add an AI opponent later.

sentences:
Getting ip address of connected network I have two scripts, a server script and a client script.
I built two parts of the app, one with the client script and another one with the server script.
I put both apps on devices, connected two devices with the local network and run the server.
First I wrote this line in the client to get the IP of the server device:

NetworkManager.singleton.networkAddress

But it gives me the IP of the client device.
Do you have any solution to this problem?

Thanks.

sentences:
A scriptManager (singleton) not storing a variable (in the same scene) The script below is called every time I pickup an item and stores an instance of it in the array "mainInventory".

The problem is when I access the array after picking up another item its empty.

The script is on the MainCamera.

public class InventoryManager : MonoBehaviour
{
public static InventoryManager instance = null;
public Image inventoryPanel0;
public Image inventoryPanel1;
public Image inventoryPanel2;
public Image inventoryPanel3;
public Image inventoryPanel4;
public Image inventoryPanel5;
public Image inventoryPanel6;

private Item[] mainInventory;

// Use this for initialization
void Awake ()
{
    //Singleton
    if (instance == null)
        instance = this;
    else if (instance != this)
        Destroy(gameObject);

    mainInventory = new Item[7];
}

public void pickedUp(Item item)
{
    //Below checks which slot item belongs in
    bool positionFound = false;
    int currentPositionCheck = 0;

    while (!positionFound)
    {
        if (mainInventory[currentPositionCheck] == null)
            positionFound = true;
        else
            currentPositionCheck++;
    }

    //Adds item to slot
    mainInventory[currentPositionCheck] = item;

    //Adds image to inventory panel
    switch (currentPositionCheck)
    {
        case 0:
            inventoryPanel0.sprite = item.icon;
            break;
        case 1:
            inventoryPanel1.sprite = item.icon;
            break;
        case 2:
            inventoryPanel2.sprite = item.icon;
            break;
        case 3:
            inventoryPanel3.sprite = item.icon;
            break;
        case 4:
            inventoryPanel4.sprite = item.icon;
            break;
        case 5:
            inventoryPanel5.sprite = item.icon;
            break;
        case 6:
            inventoryPanel6.sprite = item.icon;
            break;
        default:
            Debug.LogError("Expand inventory", this);
            break;
    }

}
}

Item:

public class Item : MonoBehaviour {

public string name;
public Sprite icon;

private MessageManager messageManagerScript;
private InventoryManager inventoryManagerScript;
private bool inRange;

private void Start()
{
    //Gets managers
    GameObject managerContainer = GameObject.FindWithTag("MainCamera");
    if (managerContainer != null)
    {
        inventoryManagerScript = managerContainer.GetComponent<InventoryManager>();
        messageManagerScript = managerContainer.GetComponent<MessageManager>();
    }
    else
    {
        Debug.Log("Can't find camera containing maangers");
    }
}

// Update is called once per frame
void Update()
{
    //If in range and player presses key
    if (inRange && Input.GetKeyDown(KeyCode.F))
    {
        Destroy(gameObject);
        OnTriggerExit(new Collider());

        //Pickup item
        inventoryManagerScript.pickedUp(this);
    }

}

private void OnTriggerEnter(Collider other)
{
    inRange = true;

    //Displays pickup message
    if (other.gameObject.tag == "Player")
    {
        messageManagerScript.displayPickupMessage(name);
    }
}

private void OnTriggerExit(Collider other)
{
    //Removes pickup message
    messageManagerScript.removeDisplayMessage();

    inRange = false;
}

}

sentences:
Show the tooltip when mouse over at the object unity3d i wanted to show the tooltip like this when the mouse over at the object, here is the example image:

and

i already tried this below code, but the message on the debug.log didn't showed up when i am hovering my mouse to the object, the object i give the name same like this:

void Update()
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hit;

    if (Physics.Raycast(ray,out hit) && hit.collider.gameObject.name == "Yify")
    {

        Debug.Log("Yify");

    }

}

And here is my object (i use List to multiple the objects and each object i gave the name), (The object's name "Yify" is on the right side, dark green color):

Please help. Thank you!

Update:

i already got the script that hold movement and attack logic like the image that shown below sir @Korchkidu:

sentences:
Unity / Passing an array in a shader I want to pass my array (which is inside my c# code) to my shader.

Shader "custom/shader4"
{
    Properties
    {
        _myArray("Array", Float[256]) = []
    }

    SubShader
    {
        Pass
        {
            CGPROGRAM
            public float _myArray[256];

//code...

^this is obviously not working. Is anyone here who knows how to solve this?

(also in c#:)

myMaterial.MyArray = anotherArray;

It has to be something like this- right?
Or do I need a workaround?

sentences:
How to properly give Image source for multiple sources? I'm writing a script to change the image on the button based on previous selection.
Another script is giving the CurrentAvatar variable once previous button is pressed.

My problem is i can't seem to load an image for the button using:

AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");

Could someone please enlighten me on the proper code?

All from assets, or is it even possible?

Also looking to have multiple options in if statements, don't know a better method.

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

public class SelectedAvatar : MonoBehaviour {

    Button CurrentHeroSprite;
    static Sprite AvatarSprite;
    public static string CurrentAvatar;

    // Use this for initialization
    void Start () {
        CurrentHeroSprite = GetComponent<Button>();
    }

    // Update is called once per frame
    void Update () {
        if (CurrentAvatar == "Lamor") {
            AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");
            CurrentHeroSprite.image.sprite = AvatarSprite;
            Debug.Log ("loaded sprite for Lamor");
        }
        //if etc etc etc
    }
}

sentences:
Distance between two 3D objects' faces I'm really newbie on programming and I'm making some tests. I couldn't find nowhere on Internet how could I calculate the distance between two 3D objects' faces. Is there anyway?

Detailing, as an example, I have two 3D cubes. Each one has a vector3 position designating it's center on the 3D space and an orientation matrix. And each cube has a size (float width, float height and float length).

I could get a simple distance between them by calling Vector3.Distance(), but it doesn't consider its sizes, just the position. Then the distance would be between its centers.

Is there any way to calculate the distance between the faces? Thanks for any reply.

sentences:
Unity UI Animation Transition So I'm fine with gameplay coding, but menus are something I'm still very new to.

I was watching Unity's own video on how to deal with Buttons and I thought I'd try mock up my own button animation much like they had. It works wonderfully, there's just one minor issue.

So a Button can go from 'any state', so either pressed, highlighted or normal (or disabled but I'm not using that). When I hover it works but it'll go straight back to normal once it's 'time'/'cycle' has completed. I figured that to fix this, I ought to add a transition between Highlighted and Normal.

This does work, providing I say that 'Normal' must be true before transitioning between the 2. Here's my issue however - when I click, the button hits pressed fine, then goes back to highlighted, and won't go back to normal unless I just click the background/anything that isn't the Button.

How can I get it to go straight to normal once the mouse is no longer on the button? I thought maybe a trigger collider with OnExitTrigger type function but that seems messy, isn't there a way to do this IN animator?

sentences:
Local avoidance together with any-angle types of A* Pathfinding Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do not know exactly how to handle the problem of local avoidance between the NPCs moving at the same time in the same scene.

So, my question is this: what is the best method to implement local avoidance with any-angle path-finding? Just testing for LOS and steering to the tangent of the predicted encounter is a good enough solution or should a specific AI implementation be included within the pathfinding routine?

I would highly appreciate references (academical or not) with state-of-the-art implementations of local avoidance for me to explore the most recent developments in that field.

Many thanks.

sentences:
Using an objects velocity to determine if it falling on a player will kill it I've been attempting to make a falling object kill a player, but i still want to make sure the player can touch and interact with the object to move it around without dying. The code i've made so far somewhat works as it wont kill the player when they move it will kill the player when it falls and hits them, but the problem is it only works if they have not moved yet from their spawn position (could also be true for when they have stood still for a second). Here is my code

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

public class BoxyKill : MonoBehaviour
{
    public Rigidbody2D rgbd;
    public CharacterController2D character;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            Debug.Log("Hit player");
            if (rgbd.velocity.y <= -5f) {
                character.Damage(10);
                Debug.Log("Hit player 2");
            }
        }
    }
}

Note - the 'rgbd' is the boxs and this script is attatched to the object

Thanks!

UPDATE

So as of DMGregorys suggestions i have updated the code and while it works i have encountered the same problem (however a lot more controlable this time)

Here is my current code

    public Rigidbody2D _body;
    private float minimumDamageThreshold=10;
    private float collisionDamageScale=.0001f;

    void OnCollisionEnter2D(Collision2D collision)
    {

        Vector2 normal = collision.GetContact(0).normal;
        Vector2 impulse = ComputeTotalImpulse(collision);

        Vector2 myIncidentVelocity = _body.velocity - (impulse / _body.mass);

        Vector2 otherIncidentVelocity = Vector2.zero;
        var otherBody = collision.rigidbody;
        if (otherBody != null)
        {
            otherIncidentVelocity = otherBody.velocity;
            if (!otherBody.isKinematic)
                otherIncidentVelocity += impulse / otherBody.mass;
        }

        // Compute how fast each one was moving along the collision normal,
        // Or zero if we were moving against the normal.
        float myApproach = Mathf.Max(0f, Vector3.Dot(myIncidentVelocity, normal));
        float otherApproach = Mathf.Max(0f, Vector3.Dot(otherIncidentVelocity, normal));

        float damage = otherApproach - myApproach;
        Debug.Log(damage);
        character.Damage(damage);
    }
    static Vector2 ComputeTotalImpulse(Collision2D collision)
    {
        Vector2 impulse = Vector2.zero;

        int contactCount = collision.contactCount;
        for (int i = 0; i < contactCount; i++)
        {
            var contact = collision.GetContact(0);
            impulse += contact.normal * contact.normalImpulse;
            impulse.x += contact.tangentImpulse * contact.normal.y;
            impulse.y -= contact.tangentImpulse * contact.normal.x;
        }

        return impulse;
    }
}

It now works and will kill the player, and i have it printing out the damage in the debug for the character script damage function. The only problem is, it will constantly damage the player if it touches the box at all, and the player needs to be able to move the box around so this will slowly kill it.
This could be a problem with the variable amounts that i have configured due to a lack of understanding (and a lot of mindless fideling to be honest).

sentences:
Texture mapping artifacts at triangle edge (for thin triangles?) I'm working on generating programmatic textures for 3d models and showing them in WebGL using Threejs. To do this I generate a texture image (PNG) that contains per-triangle textures (a rectangle on the image, that is a rasterization of the 3d triangle), and an associated uv map. To prevent bleeding I generate a 2 pixel border around each triangle's texture rectangle in the resulting PNG. The rest of the texture image is black.
This results in visible artifact lines when rendering:

The texture sampler is set to use NearestFilter for magnification and minification, and the texture's wrapping is ClampToEdge for both S and T, which makes things even more confusing. I've also tried with bigger per-triangle image borders and the problem still persists.

This is the texture I generate:

These lines seem to overlap with thin triangles, which are rasterized to 2 pixels along the shortest axis.

I'm sure there is no physical gap in the model, because it renders fine as a solid, so it must be a texture sampling related thing, which is also confirmed by the fact that the color of the lines is affected by color of the "empty" parts of the texture. If I change those, then the line colors also change. I've also tried offsetting UVs by 0.5 / tex_size and the same thing is rendered.

Any help would be useful.

Thanks!

sentences:
iOS cocos2d - sprite gets stuck in collision detection I'm developing a top down game in cocos2d and I have collision code that checks collisions between enemies and the player so that they don't go through each other. The code seems to work but the problem is that when one of the enemies colides with an enemy or the player then they just freeze and don't continue their movement. Any help would be appreciated.

Collision detection between enemies:

-(void)checkCollisionWithPosition:(CGPoint)position OldPos:(CGPoint)oldPos tileMap:(CCTMXTiledMap *)map andLayer:(CCTMXLayer *)metaLayer andEnemies:(NSArray *)enemies {
CGPoint tileCoord = [self tileCoordForPosition:position withMap:map];
int tileGrid = [metaLayer tileGIDAt:tileCoord];
if (tileGrid) {
    NSDictionary *properties = [map propertiesForGID:tileGrid];
    if (properties) {
        NSString *collision = [properties valueForKey:@"Colidable"];
        if (collision && [collision compare:@"True"] == NSOrderedSame) {
            self.position = oldPos;
            [self changeStateWithState:enemIdle];
            //[self setViewpointCenter:player.position];
            return;
        }
    }
}

for (BasicEnemy *enemy in enemies) {
    if (enemy != self && CGRectIntersectsRect([enemy boundingBox], [self boundingBox]) && CGPointEqualToPoint(_facingDir, [enemy getDirectionInRelationToPlayer:enemy.position])) {
        self.position = oldPos;

        return;
    }
}

self.position = position;
}

sentences:
Issues with depth calculation in HLSL shader I'm currently trying to implement shadow maps in my graphics framework.
I ran into an issue with depth calculations I wasn't able to solve myself (yet). I did a lot of testing and debugging and think I finally localized the problem.

To get the position in light-projection space I do this in the vertex shader:

float4 worldPosition = mul(input.position, worldMatrix)
output.lightPosition = mul(worldPosition, lightViewProjectionMatrix);

Note that I premultiplied the view and projection matrix on CPU.

To calculate the corresponding uv coordinates I'm doing the following in the pixel shader:

float2 shadowCoords;
shadowCoords.x =  input.lightPosition.x / input.lightPosition.w / 2.0f + 0.5f;
shadowCoords.y = -input.lightPosition.y / input.lightPosition.w / 2.0f + 0.5f;

This appears correct too, as I used the sampled value as surface colors and it went exactly as expected.

Now I want to calculate the depth (in relation to the light of course) of the current pixel. The corresponding code:

float depth = input.lightPosition.z / input.lightPosition.w;

(input.lightPosition is the float4 I output in the vertex shader as shown above)
However, this apparently gives wrong results. If I use this depth as surface color (disabling any lighting) I get
,
which is obviously wrong. Note that the point light is right above the black line.

Now, if I use input.position (which is calculated by multiplying the camera viewprojection-matrix with the world position) to calculate the depth, I get correct results.

I figured this has to be caused by semantics. input.position is using SV_POSITION, while input.lightPosition used POSITION0 (I also tried TEXCOORD0 without success). I verified this by modifying the DepthmapShader and got different results when using SV_POSITION instead of POSITION0. If you need more information I'll happily post them.

Now for the final question: What semantic do I have to use to properly calculate the depth? As SV_POSITION is already in use for the actual screen position I can't use that. Or do I have some general missconception? I just can't wrap my head around what's happening and would be glad if someone could help me out.

For the sake of completeness, here's my Depthmap-Shader:

struct VertexInputType {
    float4 position : POSITION;
};

struct PixelInputType {
    float4 position : SV_POSITION;
    float4 depthPosition : POSITION0;
};

PixelInputType DepthmapVertexShader(VertexInputType input)
{
    PixelInputType output;

    input.position.w = 1.0f;

    float4 worldPosition = mul(input.position, worldMatrix);
    output.position = mul(worldPosition, viewProjectionMatrix);
    output.depthPosition = output.position;

    return output;
}

float4 DepthmapPixelShader(PixelInputType input) : SV_TARGET
{
    float depth = input.depthPosition.z / input.depthPosition.w;
    float4 color = {depth, depth, depth, depth };
    return color;
}

Edit: I'm constructing the view-projection matrix like that (in response to Tim's answer) (Snippet is located inside of the PointLight class):

XMVECTOR dir = XMLoadFloat3(&XMFLOAT3(0, 0, 1));
XMVECTOR up = XMLoadFloat3(&XMFLOAT3(0, 1, 0));
XMVECTOR pos = XMLoadFloat3(&Location);

XMMATRIX proj = XMMatrixPerspectiveFovLH(XM_PIDIV2, 1.f, 0.1f, 1000.f);
XMMATRIX view = XMMatrixLookToLH(pos, dir, up);

return view*proj;

Is this valid? Or do I have to do something else? As Tim mentioned it projects on a plane. How should I setup the matrix (and how would I write the depth information to texture for the case that this procedure changes?)? (Bonus question: Is there a way to do a 360° shadow map with a single matrix?)

sentences:
The steps in implementing Bézier triangle patches What are the steps in creating a Bézier triangle patches. What steps would you do in order to create this in directx 11?

Say I just input 3 vertices and create a simple triangle. Is this enough? Or should I create a triangle with 9 vertices, all of them in different heights so it would make a bumpy triangle, then I apply berstein's formulas and make them smooth. so I get like a smooth triangle, not all bumpy.

A triangle like

My book says
Research and implement Bézier triangle patches.

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 11901). Mercury Learning and Information. Kindle Edition.

So what are the steps you would do in order to accomplish it? Please no "coulds"

sentences:
Making abilities (Programming FFG's boardgame Descent) I am trying to program Fantasy Flights boardgame "Descent - Journeys in the Dark", but I have hit a wall when dealing with implementing abilities, which are a crucial part of the game.

Abilities are used alot of different places, but are similar most of the time.

For a hero an ability could be:
At the start of his turn, Varikas the Dead recovers 1 fatigue

I have written monsters with abilities like this: Damage 2/Command

Equipment/Treasures look like this: When(TakingDamage):Exhaust&CancelDamage:2, When(MakingAttack(Type=Magic)):Gain:Surge 1 and When(Equipped(State=StartOfTurn))):Discard&Hero.Healt=Hero.HealthMax&Hero.Fatigue=Hero.FatigueMax

My idea is to maybe have some ability factory that will build an ability by reading the string formats, but I do not know how to implement them as a whole, and I am therefor turning to you.

Do any of you have any experience doing stuff like this, maybe when making D&D, Magic the Gathering, or maybe Descent?

Kind Regards
Thediabloman

sentences:
How to use 16/32 square pixel tiles in tilemap on arbitrarily sized canvas in Phaser My question is about Phaser and Tiled but I'm not quite sure how to ask it so please bear with me.

Do I need to make the size of the canvas or area on which I want to display my tilemap a multiple of the size in pixels of an individual tile in my tileset?  Or is there a way of scaling a tilemap to fit a particular screen area?

I'm not really sure how to explain my question better so I will give an example of what I'm talking about.  Because I'm using only freely available game art (such as that found on opengameart.org), most tilesets come with tiles sized 16x16 or 32x32 pixels.  Does the game area I want to display the tiles in have to be a multiple of 16 or 32, respectively?

Or put another way, if I wanted to have a grid of 32x32 tiles fit inside of a canvas of say, 900x900 dimension, must I have to draw/design my tiles to be of size ~28x~28 pixels?

And if I want to use a tileset with tiles of size 32x32 must I make the canvas a multiple of 32, like 1024x1024 for example?

Thanks for bearing with me and for any help.

sentences:
In JBox2d when dragging a Body, why is the direction is flipped vertically? Why is it when I drag a JBox2d Body with the mouse, the vertical component is flipped?

e.g. If I drag down-right, the Body moves up-right.

Is this expected behaviour, a bug in JBox2D, a Mac incompatibility or something else?

I'm on a Mac (10.9.3) with Java 1.7.60, JBox2d 2.2.1.1.  I thought it might be Mac's "natural scrolling" but changing that setting didn't have any effect.

sentences:
How to generate mesh at runtime using raycast points? I'm trying to make a clone of the trail/line renderer with the difference that everything is perfectly flat, i.e. the faces are not designed to face the camera. I'm using two raycasts to get the position of the edges of where I want those faces but now I'm struggling to generate the mesh...I've gone through the mesh docs but I don't really understand it. Could someone help me do this?

Here is my code so far:

    public Transform[] probes;
    public float probeDistance;

    public Vector3[] newVertices;
    public Vector2[] newUV;
    public int[] newTriangles;

    void Update () {
        //Generating the mesh
        Mesh mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        mesh.vertices = newVertices;
        mesh.uv = newUV;
        mesh.triangles = newTriangles;

        //Defining the rays
        Ray l_ray = new Ray(probes[0].position, -probes[0].forward * probeDistance);
        Ray r_ray = new Ray(probes[1].position, -probes[1].forward * probeDistance);

        RaycastHit l_hit;
        RaycastHit r_hit;

        Debug.DrawRay(probes[0].position, -probes[0].forward * probeDistance, Color.blue);
        Debug.DrawRay(probes[1].position, -probes[1].forward * probeDistance, Color.red);

        //Getting the position of the left ray point
        if(Physics.Raycast(l_ray, out l_hit)){
            print (l_hit.point);
        }

        //Getting the position of the right ray point
        if(Physics.Raycast(r_ray, out r_hit)){
            print (r_hit.point);
        }
    }

sentences:
Fbx animation without bones or single skeleton SkinnedModel sample nicely shows how to import single root bone skeleton and run in XNA.

My question are:

Is it possible to have animations played in XNA if there no bones are used in model (which can easily be done in 3dmax with auto key frames)?
Is it possible to have multiple independent bones laying around, connected to independent meshes and animated, all played in XNA?
Can SkinnedModelProcessor be downgraded to this level ?

sentences:
Move a ball horizontally left and right but restricting forwards and backwards motion unity 2d I am trying to develop an endless runner where there is a sphere as the player and it is moving left and right following the position of a finger on a touch screen. However, when I try to do this I cannot get the player to lock on the Y-axis. I want a constant force that speeds up overtime which I have using the constant force 2d supplied by unity. I have two versions of code, the first follows the finger but the player is able to move up and down as well:

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour
{
    public GameObject character;
    public float speed = 500.0f;

    void Start()
    {
        Input.multiTouchEnabled = false;
    }

    void Update()
    {
        if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved)
        {
            Vector2 target = Camera.main.ScreenToWorldPoint(
                              new Vector2(Input.mousePosition.x, Input.mousePosition.y));
            character.transform.Translate(Vector3.MoveTowards(character.transform.position,
                              target, speed * Time.deltaTime) - character.transform.position);
    }
}

The second code I have allows the player to move left and right by tapping rather than following but is still sloppy:

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

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody2D rb;

    public float sidewaysForce = 500f;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        {
            foreach (Touch touch in Input.touches)
            {
                if (touch.position.x < Screen.width / 2)
                {
                    rb.velocity = new Vector2(sidewaysForce * -1, rb.velocity.y);
                }
                if (touch.position.x > Screen.width / 2)
                {
                    rb.velocity = new Vector2(sidewaysForce * +1, rb.velocity.y);
                }
            }
        }
    }
}

Any help on this would be awesome Thanks!!!

sentences:
Story dialogues: user controlled or script driven? I'm currently working on the animations that present the story.

Right now my animations are scripted. They allow me to dictate the pace of the scene. My dialogue bubbles expire on a simple "time per char" system or scripted time where needed.

I was wondering that maybe i should let the user control the flow with a click for each major frame. This gives him the time he needs to read and process the dialogue.

But that breaks the flow.
For example: when i want to create agitation, dialogues are really fast, barely readable etc.. Important stuff on the other hand is slow.

So my question is, what would your approach and why? Generally speaking. What do users prefer in these cases?

Platform is phones, scenes are presented in the same env as game engine, with characters only walking and talking.

sentences:
Trouble rigging rotating head to pivoting arm I've got a 3ds max model and I'm trying to rig it. I followed some tutorials, but I got stuck. I've got my rotating head, and the arm that holds it and pivots up and down, but the two don't "connect" well.

Here's my rigging set up:

The leftmost dummy should move up and down and control the height of the miner head (the jagged-edge wheel) and the arm that holds it.

But, when I move my dummy up vertically to test, the arm works perfectly, but the miner head ... uh, doesn't. This is from the same angle as the first shot and you can see that the miner head tilts, instead of moving straight up and down.

I tried playing with the miner head's pivot points, but they seemed perfectly centered. Is there a way to make my miner head only go straight up and down (that will still work with my rotation constraint? ) instead of doing this strange sideways tilting motion? Maybe that's not the right thing to do, I could really use some hints in where to go from here to fix this strange tilting motion..

sentences:
In XNA, how do I dynamically load parts of a large 2D world map? I want to develop a huge world map; at least 8000×6000 pixels in size. I have broken it into a 10×10 grid of 800×600-pixel PNG images. To avoid loading everything into memory, the images should be loaded and unloaded depending on the player's position in the grid.

For example, here is the player at position (3,3):

As he moves to the right to (4,3), the three images at the far left are deallocated while the three images at the right are allocated:

There should probably be a threshold inside each cell of the grid triggering the loading and unloading. The loading should probably happen in a separate thread.

How do I design such a system?

sentences:
Simple Orbital transfer and intercept equation I'm working on a game which has a game board made up of objects orbiting the center of the board.  You can think of it as our solar system, but greatly simplified in terms of physics.  All objects have a mass and gravity of 1.0.  Their orbital speeds are simply a linear function of their radius from the center (Sun).

The player has a base, which in terms of our solar system would be Earth.  The player needs to send a spaceship to another planet in a different orbit.  The spaceship has a constant acceleration (or deceleration), and unlimited fuel.

I need to figure out an equation to get this spaceship going towards one of the planets and intercept it.  I've looked at some orbital mechanics web pages, but this is a little beyond my math skills and I think too complex for what I'm trying to achieve.  Any help would be much appreciated.

NOTE:  If this is better suited for SE.Mathmatica, please feel free to move.

sentences:
Separate shaders from HTML file in WebGL I'm ramping up on WebGL and was wondering what is the best way to specify my vertex and fragment shaders.

Looking at some tutorials, the shaders are embedded directly in the HTML. (And referenced via an ID.) For example:

<script id="shader_1-fs" type="x-shader/x-fragment">
  precision highp float;
  void main(void) {
    // ...
  }
</script>

<script id="shader_1-vs" type="x-shader/x-vertex">
  attribute vec3 aVertexPosition;

  uniform mat4 uMVMatrix;
  // ...

My question is, is it possible to have my shaders referenced in a separate file? (Ideally as plain text.) I presume this is straight forward in JavaScript. Is there essentially a way to do this:

var shaderText = LoadRemoteFileOnSever('/shaders/shader_1.txt');

sentences:
accelerometer not working unity why is the cube moving when I use a controller, but not with the accelerometer?

void Update () {
    text.text = "X: " + Input.acceleration.x + "; Z: " + Input.acceleration.z;
    //transform.position = new Vector3(10* Input.acceleration.y, 0, 10* Input.acceleration.z);

    transform.Translate(Input.acceleration.x, 0, Input.acceleration.z);

    //transform.position = new Vector3(10* Input.GetAxis("Horizontal"), 0, 10* Input.GetAxis("Vertical"));

    transform.Translate(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}

(I'm on a Xperia Z3 compact by the way)

sentences:
Unity Gameobject turned grayed I accidently pressed some key combination which turned all the gameobjects in Unity engine gray and now I cannot restore them to the original form. Any suggestions?
Below is the link of what I am talking about: https://ibb.co/izAVRo

sentences:
Combining Minecraft and Dwarf Fortress: Simulating autoplay in a pseudo-infinite procedurally generated world? One of the interesting things about Dwarf Fortress (and other procedurally generated games like Civilization) is that the game simulates multiple AI factions interacting with each other over time (what might be termed "autoplay") to generate an evolving world which changes over time, even whilst the player is playing the game.

On the other hand, simulating all the factions simultaneously is surely going to become a bottleneck as the map grows. With a bigger map and more factions, the performance requirements become exorbitant. Minecraft gets around this problem by simply storing the inactive chunk in memory as-is as soon as the player leaves the area. The minecraft world is a static, never-changing place. When a player comes back from a trip, the chunk is exactly as he left it. No world evolution occurs. Everything is always the same.

The most straightforward approach to this, which is to just to make chunks remain loaded in memory even after the player is no longer in them, has the same performance issues as mentioned earlier - as the player moves across thousands of blocks, you will sooner or later run into computation limits. Moreover, this does not solve the general problem of faction simulation - factions can expand or contract through many chunks, whereas keeping one chunk loaded in memory would not affect its neighboring chunks, so that doesn't quite achieve the same effect as autoplay.

The "solution" that I thought of is to come up with a closed form formula that simulates autoplay somehow. That is, a function f(time,coordinates), such that given the time and and coordinates of a block, will tell you what state that block should be in. The problem with this is that this assumes a truly predeterministic world evolution, in which players have control over only their local chunk and no others. In other words, no butterfly effect. Furthermore, when a player leaves a chunk, he has made some changes to it, but the function cannot take those changes into account when computing the state of the block the next time the player enters it, in other words all changes that the player made to the block are lost as soon as he leaves. This is obviously not ideal.

Am I asking for something impossible?

sentences: Get screen bounds of 3D object I'm trying to draw a 2D plane that has minimum dimensions to contain a 3D model (a sphere). How do I calculate the minimum size and position of the rectangle to completely cover a 3D model on screen?

sentences:
Player moving back and forth when moving with camera LIBGDX I have a problem. When in libGDX my player moves across the screen and the camera is moving after him the player jumps back and forth a bit. Player still moves forward but it looks goofy

I'm moving left-up

package com.qookie.miner;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.audio.*;
import com.badlogic.gdx.Input.Keys;

public class MinerMain extends ApplicationAdapter {
SpriteBatch batch;
SpriteBatch b;
private OrthographicCamera camera;
private float timer;
private int rand;
Texture img;
Texture map;
FreeTypeFontGenerator generator;
FreeTypeFontParameter parameter;
BitmapFont font;
private int speed = 250;
GameObject player;

@Override
public void create () {
    batch = new SpriteBatch();
    b = new SpriteBatch();
    img = new Texture("images/player.png ");
    map = new Texture("map1_fixed.png");
    generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/VCR_OSD_MONO_1.001.ttf"));
    parameter = new FreeTypeFontParameter();
    parameter.size = 10;
    parameter.color = Color.WHITE;
    font =  generator.generateFont(parameter);
    generator.dispose();
    player = new GameObject(img);
    camera = new OrthographicCamera(800,480);

}

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

    //Normal rendering(map, player, objects, enemies)
    batch.begin();
        batch.draw(map,0,0);
        batch.draw(player.getTexture(),player.x,player.y);
    batch.end();

    // GUI rendering(always in the same spot on the screen)
    b.begin();
        font.draw(b,"0_01a",4,476);
    b.end();
}

public void update() {
    //batch.setProjectionMatrix(camera.combined);
    //camera.position.set(player.x+player.width/2,player.y+player.height/2,0);
    //camera.update();
    if(Gdx.input.isKeyPressed(Keys.W)){
        player.y += speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.A)){
        player.x -= speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.S)){
        player.y -= speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.D)){
        player.x += speed * Gdx.graphics.getDeltaTime();
    }

    if(Gdx.input.isKeyPressed(Keys.ESCAPE)){
        Gdx.app.exit();
    }

    timer += Gdx.graphics.getDeltaTime();

    rand = MathUtils.random(10);
    batch.setProjectionMatrix(camera.combined);
    camera.position.set(player.x+player.width/2,player.y+player.height/2,0);
    camera.update();
}
@Override
public void dispose() {
    font.dispose();
    batch.dispose();
    img.dispose();
    b.dispose();
}
}

GameObject.java file:

package com.qookie.miner;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.math.*;

public class GameObject extends Rectangle {
private Texture txt;
public Texture getTexture() {
return txt;
}
public GameObject(Texture t) {
this.txt = t;
this.width = t.getWidth(); this.height = t.getWidth();
  }

}

sentences:
How to make use of resizable BAR? From what I understand, resizable BAR (aka. Smart Access Memory) makes it possible to access the whole GPU memory from CPU code. But how can a programmer make use of that?
Is there an example or code snippet somewhere, that makes use of that feature? Or is that just an automatic that improves the performance of staging resources?
I'd also be happy if you can recommend further search terms that I can look up.

sentences:
2D Game dev and Java. Other possibilities than OpenGL? I recently started to program some basic OpenGL stuff in Java, but OpenGL and DirectX is too much to handle and to understand for me and I'm getting bored really fast.

Now I am wondering if there are other possibilities than OpenGL (or DirectX) to make simple 2D graphics and to get started in Game Development, even if its limited. I will probably use OpenGL anyway when I am more experienced.

sentences:
Strange issue with bool comparing ToString always false - unity c# I have another problem with my code that I can't fix :\

Basically i have an enum called 'type' in my Item class, which tells me if the item is consumable, or equipment, etc.
In the database script I have made, it sets the type for each item (5 in total). So basically I have an inventory UI, with 5 items (inc. 2x consumables, 3x Equip)

After much debugging/checking things, I've found that the boolean prior to "sortedItems.Add(i);" is always FALSE. But it shouldnt be, BOTH VALUES ARE THE SAME as per the console log.
I have input a print() line to check whats going on because my items are'nt sorting by type when I expect them to.

public void SortItemsByType(string type)
{
    sortedItems.Clear();
    foreach (Item i in allItems)
    {
        print("is the following true or false" + i.type.ToString() == type);
        print("this is iToString= " + i.type.ToString());
        print("and this is type: " + type);
        if (i.type.ToString() == type)
            sortedItems.Add(i);
    }
}

and (please note the 3 print lines, here is their output in the console:
(sorry but the dumb IDE won't let me copy-paste the console, here is image):

Im still very much a noob to this, so I am sure there is something I have missed. But for the life of me i cannot figure out why that bool is always resulting in FALSE?

Any help is massively appreciated. Thanks

sentences:
What would be the easiest way to keep objects at a constant point on a 2D map, even when off-screen? Like in Starcraft, where your army units stay put even though your view is moving around the map.

I have a static tiled map that I made using Mappy and I can display that fine, I just want my off-screen objects to stay put while I am moving my view around. At the moment everything is drawn relative to my view instead of at a global (x, y) position and I would like to change this but I am not sure how.

Would I need another array aside from the one to create my map? That seems like a terrible idea to me.

sentences:
Jumping on meshes in Babylon.js So I want to make it possible for players to jump on objects (meshes) that are somewhat lower than the players camera.

I have set the checkCollisions to true but i can't seem to jump on any objects

(I'm using Babylon.js)

Here is my jump function

//Object i wanna jump on
var cube = BABYLON.Mesh.CreateBox("box", 10, scene);
cube.checkCollisions = true;
cube.position.y = - 4.5 ;

//Jump function
_playerJump : function(){
        $this = this;

        if($this.isJumping == false && $this.energy - 30 >= 0){
            var
                camera = $this.camera,
                jumpAnim = new BABYLON.Animation("jumpAnim", "position.y", 20, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE),
                keys = [],
                jumpStep;

            camera.animations = [];

            for(jumpStep = 0; jumpStep < 23; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + jumpStep / 5});

            for(jumpStep = 24; jumpStep < 46; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + 4.8 - (jumpStep - 24) / 5});

            jumpAnim.setKeys(keys);

            var easingFunction = new BABYLON.BezierCurveEase(.13,.01,.63,1.41);
            easingFunction.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEIN);
            jumpAnim.setEasingFunction(easingFunction);

            camera.animations.push(jumpAnim);

            $this.isJumping = true;

            $this._setEnergy(-30);

            $this.scene.beginAnimation(camera, 0, 46, false, 4, function(){
                $this.isJumping = false;
                $this.isCrouching = false;
            });
        }
    }

sentences:
How do I make a MoveToward() GameObject jump without Rigidbody, CharacterController or Raycast? I have a prefab that is moving from one point to another thanks to  MoveTowards().

Currently, I am having trouble with a functionality where the player can press a button and make the object jump, affecting only the Y coordinate.

I tried doing the following before putting the MoveTowards() code down:

void Start()
{
    playerInstance = Instantiate(playerPrefab, startPos.position, Quaternion.LookRotation(endPos.position), null);
    speed = Random.Range(2f, 8f);

    currentPlayerInstancePositionY = playerInstance.transform.position.y;
    isGrounded = true;
}

void Update()
{
    if (isGrounded)
    {
        if (Input.anyKeyDown)
        {
            playerInstancePositionY = jumpForce;
        }
        else
        {
            playerInstancePositionY = currentPlayerInstancePositionY;
        }
    }
    else
    {
        playerInstancePositionY -= gravity * Time.deltaTime;
    }

    currentPlayerInstancePositionY = playerInstancePositionY;

    playerInstance.transform.position = Vector3.MoveTowards(playerInstance.transform.position, endPos.position, speed * Time.deltaTime);

I just used custom gravity to decide when the object falls. But the problem I found was that MoveTowards() takes a Start Position, an End Position and a Float in its method. But it cannot change individual coordinate values.

As the only control you have over the object is making it jump, I was wondering if there was another way to implement this since the Y value is not being inserted into the prefab before it is given the MoveTowards() function. I am trying to implement the jump mechanic without any RigidBodies, CharacterControllers or Raycasts.

Any help would be appreciated.

sentences: How can I make it not possible to type after reaching a max number of lines in my textarea? I have a EditorGUI.TextArea that is 300x100 in size. How can I make it impossible to type after reaching a max number of lines in my textarea (no wrapping)?

sentences: How can I change the splash screen for a standalone game in Unity3D? I want to change the normal Unity splash screen to be customized for my game and every time I change the splash image in the player setting it does not appear. So how can I do that please?

sentences:
Applying Forces to Box2D Bodies In full disclosure, I am VERY new to box2D let alone the Java version of it.

I have a box (here of type Hero) that I am trying to move. I did this by trying to apply a force as follows...

private void itterate() {
  Vec2 vec = hero.getPosition();
  hero.applyForce(new Vec2(0, 100), hero.getPosition());
  Vec2 vec2 = hero.getPosition();
  String test = "TEst";
}

The problem I am seeing is this doesn't change the poistion so vec == vec2. I also tried this....

private void itterate() {
  Vec2 vec = hero.getPosition();
  hero.applyForce(new Vec2(0, 100), hero.getWorldCenter());
  Vec2 vec2 = hero.getPosition();
  String test = "TEst";
}

Neither seemed to do what I am wanting. How can I "push" the object toward the bottom of the screen (Increase y)?

UPDATE I tried this as well...

private void itterate(int count) {
    Vec2 vec = hero.getPosition();
    Vec2 vec1 = hero.getLinearVelocity();

    int velocityIterations = 6;
    int positionIterations = 2;

    world.setContinuousPhysics(true);

    hero.applyForce(new Vec2(0, 10000), hero.getWorldCenter());
    world.step(timeStep, velocityIterations, positionIterations);
    Vec2 vec2 = hero.getPosition();
    String test = "TEst";
}

sentences:
Colliders for moving inside a spaceship when the whole spaceship is made of a single mesh (in Unity) I've begun to study a unity engine in one purpose: I have a great multi player game idea!
The main essence: In space there are two (or even more) huge spaceships with crew consisted of players (all real humans). Ships are very powerful dreadnoughts with a lot of features (radar system, many weapons, missals, refinery factory, gravity generator, indoor light system, shields generators, engines and so on), but all systems are broken at the beginning of the game. Crew should decide, which systems are more important in battle and repair it. They should extract materials from asteroids and revive their spaceship. Then, they should locate second ship, and try to destroy it. Whose spaceship will be in a whole skin during one minute after destroying another, will be the winners. If there are more then two spaceships, surviving crew from destroyed ship can move to another alive ship.

I've already draw detailed 3d model of spaceship, but I faced with a problem during importing model to unity. The problem with mesh collider. Players should get into a ship and walking in it, HOW can I do that? I can't use non-convex mesh collider in unity 5, and I cannot put one collider to another. It would solve the problem, if I draw ship piece by piece, but not as entire. But ship is really complex, to assembly it from prepared parts take really long time and ship will be messily. Is there another way to solve my problem?

sentences:
Manually creating cycles in planar, procedural trees? I am creating a procedural map using delaunay triangulation and an MST. I'd like to have a bit more control over my final graph. Like when i was looking looking at the MST I wondered how I can connect specific points of the MST? The following image shows the MST in green and the points I want to connect in red.

I was thinking about traversing from a dead end and counting the steps. When it gets within a certain treshhold add a connection. But this might add a connection when there is still a room closer to it. So I have to check for that as well.

Same goes for entrance, exit and perhaps other important places on the graph. I want to end up with a random yet fun and playable dungeon. There must be proven concepts about controlling a graph for procedural dungeons and I would love to learn from it.

sentences:
Calculate target angle to a certain Vector I'm developing a 3D game in LWJGL.
I have a player class and a monster class and I need the monster class to chase the player when the player is within a certain distance.
For that I have the monster directional vector (let's call it monDirVector) and the directional vector that points from the monster to the player (let's call it dirToPlayer)

So the way my monster class works is that it increments its current rotation to match a target angle (this way I can simulate the walking + turning animation). Given this I need to calculate the target angle so that the monDirVector overlaps the dirToPlayer making the monster walk right towards the player.

How would I go about this?

Here's a diagram for better understanding of what I need.

I pretty much need to get the cº angle and assign it as the target angle for the monster.
The aº is the monster current rotation and the bº is the angle between the two vectors. Both of these are known.
Please notice that the monster can be oriented any way and the player can be in any quadrant relative to the monster. This stands for a problem because I can't simply subtract the angle towards the player to the current rotation of the monster.

I would really apreciate if someone helped me.

sentences:
Perspective Projection - Drawing Lines So I sort of understand the math behind projecting 3d points onto a 2d plane. It's just some simple dividing and multiplication of distances. However I can't seem to wrap my head around projecting lines from 3d space onto a 2d plane.

Demonstration:

Just to make this a little more simple, I'm going to be talking in terms of 2d projection onto a 1d line, because it's the same concept for 3d to 2d. So my issue is that if I want to project the line AB onto the viewing window which has a set focal length, I can just project both of the points of the line (A and B) onto the perspective line, and then draw the line between those two on the viewing window. However the difficulty comes when trying to project the line CD onto the line. The second point (D) of the line is behind the viewing window, and therefore cannot be projected onto the line. So how would one go about drawing line CD in the perspective window?

sentences:
Nearest neighbor search in 2D to find circles that interacts with point I need to store big number of object that every object have range, then I need to find objects that the point are in their range.
So basically I need to store circles and then check who interacts with some point.

R*-tree is very slow at the insert (again I need huge number of objects).
kd-tree and quadtree doesn't allow to store shapes.
another problem with quadtree is that there are no bounds.

There is another algorithms that meet the requirements?

sentences:
Viewport Pixels trouble - Intel XDK I'm creating a game in Intel XDK, and using their API to get the viewport width and height.  These are coming back at 1122 pixels and 746 pixels, respectively.

When adding my text at 150 pixels down and 100 pixels across its being placed in the center at the bottom.

var canvas= document.getElementById('game');
var ctx = canvas.getContext('2d');
var width = 1122,height = 746;

ctx.fillText(window.innerWidth+' - '+window.innerHeight,100, 150);

That is writing on the screen 1122 - 748, but it's placed at the bottom of the screen. Not 100 pixels down by 150 pixels across. - It's directly in the middle.

sentences:
Unity - Quaternion - Rotate / Unrotate Error I'm trying to un-rotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally.
But with every iteration it seems to lose precision and just after 20 iterations the rotation disappears.
Here is an example, which is a simplification of my code:

Quaternion rotation = Quaternion.Euler (0f, 90f, 0f);
Debug.Log ("Before: " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

int iterations = 1;
for (int i = 0; i < iterations; i++) {
    var currentRotation = rotation;
    rotation = Quaternion.Inverse (currentRotation) * rotation;
    rotation = currentRotation * rotation;
}

Debug.Log ("After:  " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

With 1 iteration the output is:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071067, 0.0000000, 0.7071067) / Euler: (0.0, 90.0, 0.0)

With 5 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071019, 0.0000000, 0.7071019) / Euler: (0.0, 90.0, 0.0)

With 10 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7059279, 0.0000000, 0.7059279) / Euler: (0.0, 90.0, 0.0)

With 15 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.4714038, 0.0000000, 0.4714038) / Euler: (0.0, 90.0, 0.0)

And finally with 19 iterations

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.0000000, 0.0000000, 0.0000000) / Euler: (0.0, 0.0, 0.0)

At the 19th iteration the euler angles becomes zero, and at previous iterations altough the euler angles are still correct, if I rotate a vector with the quaternion its magnitude is changed.

I hope you can help me and sorry for my bad english!

sentences:
How do I avoid writing Manager classes? I seem to keep reading it's a bad idea to use XxxManager style classes in game engine programming, yet even when I try to avoid their use I always end up with something that holds all the actors/entities/game world locations and acts upon them, which ends up being a Manager if by another name.

Is this really a bad pattern to follow? If so, what are the alternatives?

sentences:
How can I standardize ping? I hear pros playing Fortnite that have 20-50 ping complain that they cannot perform as well as pros with 0 ping due to wall taking, etc. It's easy to think that a 20ms ping difference is negligible but it is not in competitive situations.

It seems to me that it should be possible to standardize a lobby's ping to the current maximum player's ping at any given moment. Obviously in a competitive game like Fortnite, the worst ping a pro player can have is generally 50-60 ping.

This solution would involve psuedo latency. For example, in competitive Fortnite, if the worst ping among the players is 50, then all players will be forced to also have 50 ping by inducing an artificial server response delay. This would allow no single player to have an advantage based on internet connection.

How could I implement a feature like this, to provide a level playing field?

sentences:
How do I create a color picker with variable hue and saturation? I am trying to create a Color Picker similar to that of MS Paint.

Unfortunately, I can't figure out the algorithm for saturation.

This is what my current algorithm creates.
Anytime I try to perform a saturated effect going down on the Y axis, it just makes everything after the first line completely red or black.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML;
using SFML.Graphics;
using SFML.Window;

namespace Source
{
class ColorWheel : IGameObject
{
    Image image = new Image(255*6,355);
    Color color = new Color(255,0,0);
    int brightness = 255;
    public Sprite sprite = new Sprite();

    public ColorWheel()
    {
        for (int y = 0; y < 255; y++)
        {
            for (int x = 0; x < 255 * 6; x++)
            {
                //Red 255 - Green 0-254
                if (color.R == brightness && color.G < brightness && color.B == 0)
                {
                    color.G += 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Red 255-0
                else if (color.R > 0 && color.G == brightness && color.B == 0)
                {
                    color.R -= 1;

                    //color.R -= (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Blue 0-255
                else if (color.R == 0 && color.G == brightness && color.B < brightness)
                {
                    color.B += 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Blue 255 - Green 255-0
                else if (color.R == 0 && color.G > 0 && color.B == brightness)
                {
                    color.G -= 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B -= (byte)y;
                }
                //Blue 255 - Red 0-255
                else if (color.R < brightness && color.G == 0 && color.B == brightness)
                {
                    color.R += 1;

                    //color.R += (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }
                //Red 255 - Blue 255-0
                else if (color.R == brightness && color.G == 0 && color.B > 0)
                {
                    color.B -= 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }

                image.SetPixel((uint)x, (uint)y, color);
            }

                //brightness--;
        }

        Texture texture = new Texture(image);
        sprite.Texture = texture;
    }

    public void Update(double dt)
    {
    }

    public void Render(RenderWindow rWindow)
    {
        rWindow.Draw(sprite);
    }

}

}

sentences:
Creating the nodes for path finding during run time - more like path making and more I'm making my 1st game. I'm using javascript as I currently want to learn to make games without needing to learn another language but this is more of a general game dev question.

It's a 2d turn-based tile/grid game. You can check it here http://www.patinterotest.tk/
it creates a movable area when you hover a player and it implements the A* algorithm for moving the player.

The Problem: I want to make the 'dynamic movable area creation' already implement a limited number of steps for a player.

The Questions:

What is a good way to do this?
Is there another algorithm to use for this?
The A* algorithm needs a start and destination, with what I want to do I don't have a destination
Or should I just limit the iteration of the A* algorithm to the steps variable?

sentences:
Rotating on a slanted surface? I want to rotate (change it's yaw) an object when its sitting on slanted ground. Pretty much I want to rotate around the ground's normal.

Right now I ray cast down, get the ground's normal.
Then I do:

Tick(deltaTime)
{
  Quaternion rotationDelta = QuatFromAxisAngle(groundNormal, rotationRate * deltaTime);
  ObjectRotation = rotationDelta * ObjectRotation;
}

But this isn't giving me quite the right results. Any suggestions?

Before Rotation:

A rotation of 90 degrees:

sentences:
Animate multiple entities I'm trying to animate multiple(3) entities using one model(IQM format).

It's working but performance is really bad because I'm calling animate function for each entity in my game loop (I think problem is there).

What's the best way to animate multiple entities (with different animation ofc) in OpenGL? I think I can try build one VBO / entity for better performances but I don't think it's the best way to do it.

sentences:
libGDX using Stage and Actor produces different camera angles on desktop and Android Phone libGDX using Stage and Actor produces different camera angles on desktop and Android Phone.

Here are pictures demonstrating the problem: http://brandonyuh.minus.com/mFpdTSgN17VUq

On the desktop version, the image takes up most all the screen. On the Android phone it only takes up a bit of the screen.

Here's the code (not my actual project but I isolated the problem):

package com.me.mygdxgame2;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.*;
public class MyGdxGame2 implements ApplicationListener {
    private Stage stage;
    public void create() {
        stage = new Stage();
        stage.addActor(new ActorHi());
    }
    public void render() {
        Gdx.gl.glClearColor(0, 1, 0, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        stage.draw();
    }
    public void dispose() {}
    public void resize(int width, int height) {}
    public void pause() {}
    public void resume() {}
    public class ActorHi extends Actor {
        private Sprite sprite;
        public ActorHi() {
            Texture texture = new Texture(Gdx.files.internal("data/hi.png"));
            texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
            sprite = new Sprite(new TextureRegion(texture, 0, 0, 128, 128));
            sprite.setBounds(0, 0, 300.0f, 300.0f);
        }
        public void draw(SpriteBatch batch, float parentAlpha) {
            sprite.draw(batch);
        }
    }
}

Why does this happen?

sentences:
OpenGL Colour Issues I am using a single VBO to store vertices in the follow format:

v1X, v1Y, v1Z, v1R, v1G, v1B, v2A,
v2X, ...

Vertex positioning is fine, shapes show up where expected, however instead of using the colour provided, all shapes show up red.

The code given below simply draws two triangles to form one square ground shape.

Buffer data preparation method

public void prepare(float[] data) {
    glBindBuffer(GL_ARRAY_BUFFER, vboID);
    FloatBuffer dataBuffer = RenderUtils.fArrayToBuffer(data);
    if(dataLength != data.length) {
        glBufferData(GL_ARRAY_BUFFER, dataBuffer, GL_STATIC_DRAW);
        dataLength = data.length;
    } else {
        glBufferSubData(GL_ARRAY_BUFFER, 0, dataBuffer);
    }
    glVertexAttribPointer(0, 3, GL_FLOAT, false, 7*4, 0);
    glVertexAttribPointer(3, 4, GL_FLOAT, false, 7*4, 3*4);
}

Render code

floorObj.prepare(new float[]{
    -5, 0, -5,   1, 0, 0, 1,
    5, 0, -5,   0, 1, 0, 1,
    -5, 0, 5,   0, 0, 1, 1,

    5, 0, -5,   1, 0, 0, 1,
    5, 0, 5,   0, 1, 0, 1,
    -5, 0, 5,   0, 0, 1, 1,
});
glDrawArrays(GL_TRIANGLES, 0, 6);

Vertex shader

#version 330 core

in vec3 position;
in vec4 i_color;
out vec4 color;

uniform mat4 transform;

void main(){
    gl_Position = transform * vec4(position, 1);
    color = i_color;
}

Fragment shader

#version 330 core

in vec4 color;
out vec4 f_color;

void main(){
    f_color = color;
}

As previously stated, vertex positions work fine, however colour does not.
Just ask if any other code would be useful to determine the problem.

Thanks, - Jasper

sentences:
HD video capture gameplay? Possible Duplicate:
  Tools to make a trailer…

I've developed some 3d experiences using unity3d and they are pretty much experimental at this level. Now the problem is that I need to make video captures in HD to showcase them.
I've tried Camtasia 7 with divx compression, and still the quality is not Up to standard and number of dropframes are quite high. I'm running on a Core i7 cpu with geforce GT240. So I was thinking If it's possible to capturing the video remotely so one pc is in charge of capturing and one running the application.
Or is there any better way to get the highest quality with least dropframes?
Number of draw calls are around 2k(I know sounds crazy, but I can't make changes right now.)

Grazies.

sentences:
First Person Camera Target I have a camera at position P, and a normalized direction vector D (where the camera is facing). I want the target of the camera to be 5 units forward from the position. Here's my attempt:

F = (0, 0, 5) // forward
target = P + (D * F)

The obvious problem is that D * F can eventually reach (0, 0, 0), which would cause the target to be equal to the initial position. I feel like I'm missing something even more obvious than the problem here but, how would I properly have the target be 5 units forward?

sentences:
Round position to center of current grid position The title may not make sense, nor may the question - I'll try nevertheless.
I'm attempting to make a game similar to The Powder Toy.
Essentially, this is a physics simulation game, where the users create various structures using the provided materials.
As of now, I've created the grid, and given the user the ability to draw with grey cells (or, Stone).
Of course, this may seem like what I would want - however, all the cells are stored in a two dimensional array. When the user clicks on the screen, the program round the x and y of the cursor to the grid, and adds to the array like that.
What I want to happen is for the cell to change in the place of the cursor, instead of rounding it to the nearest cell.
I've attempted to explain it in this image:

In this image, the green large dots are the mouse position, and the place at which the arrows are pointing are examples of where the cell could be.
Green represents what I want to happen but in most cases doesn't, and red is what does happen, but what I don't want.

Here's part of my function to set the cells:

public void handleInput () {
    if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
        mouse_x = Gdx.input.getX();
        mouse_y = Gdx.input.getY();

        rou_mouse = new Vector2(round2px(mouse_x), round2px(mouse_y));

        set_px (rou_mouse, new Element_stone());
}

Where set_px sets a certain item, this is used to draw to the screen.
I hope this is enough information, but if you would need anymore to solve it, I'd be happy to update the post to include more code.

Oh, and I should probable mention I'm using LibGDX.

sentences:
How do I load chunks of data from an assest manager during a loading screen? I'm developing an Android game.  Basically I want to pre-load all graphics/sounds when the app is first loaded.  But I also would like to show a progress bar as this is happening.  Here is a snippet of Java/Android code to display a progress bar while doing some work:

public class LoadingScreen extends Activity {

private static int progress = 0;
private ProgressBar progressBar;
private int progressStatus = 0;
private Handler handler = new Handler();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.loadingscreen);

    progressBar = (ProgressBar) findViewById(R.id.progress);

    //---do some work in background thread---
    new Thread(new Runnable()
    {
        public void run()
        {
            while (progressStatus < 100)
            {
                progressStatus = doSomeWork();

                //---Update the progress bar---
                handler.post(new Runnable()
                {
                    public void run() {
                        progressBar.setProgress(progressStatus);
                    }
                });

            }
            //---hides the progress bar---
            handler.post(new Runnable()
            {
                public void run() {
                    progressBar.setVisibility(8);
                }
            });
        }

        private int doSomeWork()
        {
            try
            {
                //---simulate doing some work---
                Thread.sleep(50);
            } catch (InterruptedException e)
            {

            }
            return ++progress;
        }

    }).start();

}

My question is: how do I design my Asset Manager to load "chunks" of data (bitmaps and sounds/music) in the doSomeWork() function?  Would it be some sort of stack that I keep popping off the next asset to load?  How do I determine how much of the progress bar I should increment after loading a "chunk" of data?

Is there a better way to approach this or is this the correct way?

sentences:
Am I allowed to make my Minecraft clone open source? I'm developing in my spare time a game like Minecraft. In fact, it isn't "like Minecraft", because I'm trying to make it a close as possible copy of it (meant as exercise for myself at the age of 16 and simply because of it is fun to me). Of course, I'm not copying the code using the Minecraft Coder Pack (MCP). I started the game from scratch in Java using OpenGL.

So, my question is: am I allowed to put my source code online on a public source code versioning host like GitHub, Google Code, et cetera (which makes my code open source, because I don't want to pay to use a private host)? Of course, I don't want to sell the game, because the game is from Notch.

A detail which might be important is that I'm using a custom texture pack (so, not the one that is shipped with the real Minecraft).

If it is allowed, are there any rules? I took a look to this page, but it seems that he doesn't say anything about this: http://www.minecraft.net/terms

Edit: There is the game called Terasology (started under the name Blockmania) from Begla. That is a nice project, but it is not meant to be as close as possible to Minecraft. That project is open source.

sentences:
Ray->triangle collision math seems to not work? First time asking, pardon any mistakes I make :)

I am programming a game from scratch, and the collision detection is giving me issues. I have AABB in place to check proximity, and if that reacts, the two models are checked by having each vertex in the moving model be a line going from the vertex' current position to its intended position. That line then gets checked against each triangle polygon in the 'obstacle' model.

My (current...) problem is that the math seems to react wrongly in the early part of that ray-triangle check (code below). I try simply to see if the two ends of the ray (vertex origin and vertex destination) are on opposite sides of the polygon plane (if they are not, the ray could not possibly be going through the polygon). I do this by getting a (not yet normalized) normal from the polygon via cross product. Then I dot the ray ends' positions with that. If it's one positive and one negative dot product, they should be on either side. Problem is, that never happens, even when i run models right through each other in tests. Never a 'positive & negative' result.

Can anyone spot my mistake(s)??

Code:

double Dot(Vec3 *a, Vec3 *b)
{
    double d = a->v[0] * b->v[0] + a->v[1] * b->v[1] + a->v[2] * b->v[2];
    return d;
}

Vec3 CrossProduct(Vec3 *a, Vec3 *b)
{
    Vec3 v;
    v.set(
        a->v[1]*b->v[2] - a->v[2]*b->v[1],
        a->v[2]*b->v[0] - a->v[0]*b->v[2],
        a->v[0]*b->v[1] - a->v[1]*b->v[0]
    );
    return v;
}

bool Collide(Vec3 *a, Vec3 *b, int target, int p)
{
    // a and b are the ray points in global space
    // target is the index number of the obstacle model
    /// p is the triangle polygon being checked (in a loop not included here)
    Vec3 poly_vert[3] = {entities[target].vertex[entities[target].poly[p].vertex[0]].pos
                    ,entities[target].vertex[entities[target].poly[p].vertex[1]].pos
                   ,entities[target].vertex[entities[target].poly[p].vertex[2]].pos};
    // poly_vert is the three vertices of the triangle polygon
    // Subtractions so poly_vert[0] essentially becomes the 0,0,0 center of the universe
    Subtract(&poly_vert[2],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(&poly_vert[1],&poly_vert[0]);// Essentially, the vector from
                                             polyvertex 0 to polyvertex 2
    Subtract(a,&poly_vert[0]);
    Subtract(a,&entities[target].pos);// Make it relative to the obstacle model
    Subtract(b,&poly_vert[0]);
    Subtract(b,&entities[target].pos);// Make it relative to the obstacle model

    Vec3 poly_cross;
    poly_cross = CrossProduct(&poly_vert[1],&poly_vert[2]);
    double da = Dot(a,&poly_cross);
    double db = Dot(b,&poly_cross);

    if (da*db >= 0){return false;}
    return true;
}

sentences:
How to add energy ball which disappears when touched by player in UDK? I am new to UDK and learning game development. I want to know about how to add a ball to the game world with the following effects/actions:

Glowing effect
Physics-like object (just having gravity)
Particles when touched by player-avatar
Disappears in 1-2 seconds after touch
Score updates based on different colors of ball

I know little about this can be done by kismet, cascade and content creation, but do not know where to start. Please tell me the steps for this. I am trying this weekend in depth.

sentences:
bug in webgl phong shader: lighting rotates with object I'm working on a simple phong shader in webgl, and I think I'm getting close but something is still wrong. Dead give away: if I have a billboard and have it roll (so it spins like a wheel), the part of the billboard that is lit up spins with it :(.  This confuses me, because it seems like a problem with the model matrix, but the transform makes all the positions & rotations correct, and lighting math is done entirely in world-coordinates , just the lighting wrong.  Ditto with the view matrix, I can move around and look freely and everything is located in its proper place, just lit wrong.

Here are my shaders (minus the definitions for space, and with the lighting in the model matrix moved into GPU for clarity)  {if you prefer reading in github: https://github.com/nickgeorge/quantum/blob/master/index.html#L41}

<script id="fragment-shader" type="x-shader/x-fragment">
  void main(void) {
    vec3 lightWeighting;
    if (!uUseLighting) {
      lightWeighting = vec3(1.0, 1.0, 1.0);
    } else {
      vec3 lightDirection = normalize(vLightPosition.xyz - vPosition.xyz);

      float directionalLightWeighting = max(0.0, dot(
          normalize(vTransformedNormal),
          lightDirection));
      lightWeighting = uAmbientColor + uPointLightingColor * directionalLightWeighting;
    }

    vec4 fragmentColor;
    if (uUseTexture) {
      fragmentColor = texture2D(uSampler,
          vec2(vTextureCoord.s, vTextureCoord.t));
    } else {
      fragmentColor = uColor;
    }
    gl_FragColor = vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);
  }
</script>

<script id="vertex-shader" type="x-shader/x-vertex">
  void main(void) {
    vPosition = uModelMatrix * vec4(aVertexPosition, 1.0);

    // TODO: Move back to CPU
    vLightPosition = uModelMatrix * vec4(uPointLightingLocation, 1.0);

    gl_Position = uPerspectiveMatrix * uViewMatrix * vPosition;
    vTextureCoord = aTextureCoord;
    vTransformedNormal = normalize(uNormalMatrix * aVertexNormal);
  }
</script>

Thanks a lot, and let me know if there's anything else useful to add.

sentences:
How to achieve this sprite/mesh tile splitting like in Peggle? Everyone knows Peggle. Here's a simple screenshot from one of their 'shapes':

On the first look, it looks so simple.
It's a circle made of identical tiles:

It's easy to make a circle like this, even programatically.

But then I realised that I can't make bigger/smaller circles with this single tile. For instance, the shape above has 17 tiles. If I want to make a circle with 9 tiles, I need to make a tile more curved, so it can close the entire shape with 9 elements.

Here's a sample of a shape which cannot be constructed using the above tile:

As you can see, it's probably made dynamically. Each tile has different size and it's warped differently and I don't think so that they've used 30000 types of tiles with multiple angles. They did actually, in the first version of the game coded in Lua, but there were 3-5 types of tiles. In their latest game, they've created more exotic shapes, and that would be so inefficient, especially for mobiles.

Are there any algorithms for filling an oval or circle with irregular tiles like this?

I assume I'd need to split some meshes dynamically for that, or at least sprites.

I'll be thankful for pointing me a right direction!

sentences:
Errors when baking lights in unity3d So, i'm developing a game in unity and avoided baking lightmaps untill now ( i just assembled my new workstation setup wich is capable of baking the lightmaps and not the computer ). And now i have opened my project, imported it nicely and all, went to the lightning tab and clicked generate lightning ( naturallly i had auto-bake disabled). And everytime i do that i get a billion errors, and they do not stop popping up even after i force stop & cancel, i have to clear baking data in order to do anything ( of course unity is laggy as hell when it's spitting out these errors ). I even tried just a simple scene with just a plane on it. It's the same.

I checked and it works fine on another empty project, wich lead me to the conclusion that some texture in my assets folder is causing the error even though it's not on the scene at all. In this case i'm kina doomed, i have absolutely 0 idea wich texture could this be ( i have quite a lot of them) and why would it even cause problems. Any way to check that? Or maybe does somebody know another possible reason for this problem? I tried to do research but found literally nothing. No thread about the issue, nothing. Not even the same errors.

Thanks in advance.

PS: i have baked & realtime GI disabled

sentences:
how to check a condition for too many objects in a list that you dont know count of them I'm working on a defense game that I need a way of knowing if every enemy in a wave is dead. I wanted to use a counter for it:

foreach (GameObject g in group1)
{
    if(g == dead) {
        deadCount++;
    }
}
if(deadCount == allEnemiesInWave)
{
    goToNextWave();
}

but I think it's not a safe or accurate way. Is there any better way?

Edit:
This question is not like Check if all gameobjects are destroyed. In my question, I wanted to make a condition on many objects, in the other one, OP wanted to check if such objects existed.

sentences:
Can you move items made in the Skyrim Creation Kit on PC to the Xbox version? I'm a pretty technically illiterate gamer but after several annoying glitches I finally went out and got the PC version of Skyrim. After a little bit of practice I got the hang of transferring my Xbox 360 saves to the PC and vice versa. I've really been enjoying using the console commands and lately after fixing the crashes associated with the DLC have begun to explore the Creation Kit.

I've created several items with custom weight, value, armor rating and multiple custom enchantments. I'd really like to use them on the Xbox, and I know some people will just say to play it on the PC but I just don't enjoy using the keyboard compared to my controller and flat screen TV.

I haven't changed the mesh, design or texture of any of the items just their names and enchantments. Considering Bethesda said they used the Creation Kit to make the game I don't think my custom items are anything the Xbox can't handle. To me it seems like just a matter of getting them over there... Can I do that?

If you know of a video that will show how, that would be awesome. It should be mentioned I'm not willing to do anything to void my Xbox's warranty.

sentences:
How to deal with events in a game with multiple players, in Unity? As I'm developing our game I have asked myself a couple times "When we have more than 1 player, how will I ensure events from player A do not crossover to player B?"

As an example, lets say player A clicks on a unit. This publishes an event with data on the click location, the type of object it is, and the player that clicked. This can be received by lets say a selection manager script that just keeps track of what is currently selected for that player.

The problem now, is that this event is received by every player. Every player will receive this event and try and select that object, and perform various tasks along the way.

Is there a method of programming in unity to ensure that an event is only subscribed to by classes that have the same player component referenced (only the appropriate players methods will be added to the invocation list of delegates under the player)? Or will I just need to create a check at the subscribers to these events to only accept the event data if it's the same player?

ie.

if ( RClickEventArgs.Player.GetInstanceID() == player.GetInstanceID()) {}

Edit: For clarity. Here is an example event.

public delegate void RightClickHandler(string clickType, RClickEventArgs e);
public static event RightClickHandler RightClickEvent;
private void RightClick()
{
    if(Input.GetMouseButtonDown(1))
    {
        if (userInput.isMouseOnScreen && !EventSystem.current.IsPointerOverGameObject())
        {
            GameObject hitObject = inputValidations.FindHitObject();
            Vector3 hitPoint = inputValidations.FindHitPoint();
            hitPoint.z = -1;

            if (hitObject && hitPoint != ResourceManager.InvalidPosition && hitObject.name != "Ground")
            {
                RightClickEvent("Object", new RClickEventArgs(hitObject, hitPoint, player));
            }
            else if (hitObject.name == "Ground")
            {
                RightClickEvent("Ground", new RClickEventArgs(hitPoint, player));
            }
        }
    }
}

When an object is clicked an event is published with relevant info on what was clicked. There are subscribers to this event using "MouseClickEvents += YourMethodNameHere;". This works as intended. However, since two players will have the same scripts as components this creates an issue where the 2nd player's scripts also add themselves to the invocation list of player 1's delegates, and vice versa (as far as I know, I don't know how to check what is in the invocation lists). So each player receives their own events, and the events of the other player.

If I have a fundamental misunderstanding of a concept here, please let me know.

sentences:
Run FSX (Flight Simulator) on remote desktop Obviously I cannot run FSX in a remote desktop session. When I try to start it appears the message: Flight Simulator cannot run during a Remote Desktop session and will now quit

Especially for development (coding on a second machine) a RDP session would be handy. Any workarounds for this?

sentences:
How to prevent object from moving when it's mesh/collider is being updated? So I a made a script that lets the player grab a vertex, move it, and then update the mesh. To help prevent the player from trying to clip it through other objects I made it so the mesh/collider is constantly being updated. It works however there is an issue where it keeps falling into itself. So I tried updating the constraints to prevent this but it doesn't seem to help anything.

Visualization...

With the mesh being updated after the LMB is released: http://gifyu.com/images/withnocollisionprevetnion.gif (SE doesn't like non-imgur links apparently and they are too big for imgur).

With the mesh being updated in real time: http://gifyu.com/images/withcollisionprevetnion.gif

Also here is a gif showing how constraints on the RB don't solve the problem
 (I've tried freezing on different axes but those still cause issues too): http://gifyu.com/images/constprob.gif

So basically what can I do to prevent the object from moving when it's mesh/collider is being updated?

sentences: Should I go to a University or Trade school to be a Game artist? Im a senior this year and I'm seriously looking at colleges that can help me get into the game in the Game industry. I've been told countless times it's better if I go to a University(Usc, Becker college, etc) than go to somewhere like Digipen or Full Sail. I'm just really confused about how I should tackle this path. I'd appreciate some help and advice please?

sentences:
Download Progress bar from Firebase Storage Im trying to make a progress bar based on downloaded images from Firebase storage, now firebase does provide a snipper which works per image
// Create local filesystem URL
string localUrl = "file:///local/images/island.jpg";

// Start downloading a file
Task task = reference.GetFileAsync(localFile,
    new StorageProgress<DownloadState>(state => {
        // called periodically during the download
        Debug.Log(String.Format(
            "Progress: {0} of {1} bytes transferred.",
            state.BytesTransferred,
            state.TotalByteCount
        ));
    }), CancellationToken.None);

task.ContinueWithOnMainThread(resultTask => {
    if (!resultTask.IsFaulted && !resultTask.IsCanceled) {
        Debug.Log("Download finished.");
    }
});

but i would like to make that appear on a UI text based on the percentage of the Bytes downloaded like starting from 0 to 100%.Now i have come to this function so far which does work in the sense of downloading from storage and i do get the percentage in the console but im not sure how to convert that to a percentage to show on UI.
        if (CheckConnectivity) //if the device is connected to the internet, initiate download.
        {
           // Debug.Log("Initiating download of: " + platform + _file);
            if (!File.Exists(localPath))
            {
            Task task = storageRef.GetFileAsync(localPath,
            new StorageProgress<DownloadState>(state => {
                    // called periodically during the download
                    Debug.Log(String.Format(
                "Progress: {0} of {1} bytes transferred.",
                state.BytesTransferred,
                state.TotalByteCount
            ));
            }), CancellationToken.None);

                await storageRef.Child(_child).Child(_file).GetFileAsync(localPath).ContinueWithOnMainThread(files =>
                {
                    if (!files.IsFaulted && !files.IsCanceled) //if download is successful.
                    {
                        Debug.Log("file saved as " + localPath);

                    }
                    else //otherwise report error.
                    {
                        Debug.Log(files.Exception.ToString());
                    }
                });
            }
            else
            {
                Debug.Log("files Exist");
            }

        }
        else //otherwise don't bother.
        {
            Debug.Log("Cannot Download file due to lack of connectivity!");
        }
    }

in which case my debug is this
Progress: 1731 of 52804 bytes transferred.

Which i would like to say 0 % and counting up to 100!
Thanks!

sentences:
Tank bullet shooting Ok, I'm having a lot of trouble understanding using Matrices for Movement in a 2D game. I currently have a Tank object that has a Matrix3 globalTransform managing the direction Scale and Rotation. That Object is the Parent to a gun Object that rotates around the centre of the Tank.

That uses a localTransform that is multiplied by its parents globalTransform to get its own globalTransform. The Update Method is:

localTransform = localTransform * rotation;
globalTransform = tank->globalTransform * localTransform;

How would I go about implementing a bullet being shot from the Gun? Should I create a Bullet Object? What would be the math be to fire in a linear direction the way the gun is facing?

sentences:
How can I limit the y-rotation of a cinemachine POV camera based on the player's direction? I'm using Unity (2019.4.11.f1, HDRP).
My goal is to create a first-person POV camera.
To this purpose, I tied a Cinemachine (2.7.3) Virtual Camera to the head of a third person player character (one from the Basic Locomotion demo of this asset).
The Body of the camera is set to 'Hard Lock to Target', Aim to 'POV', and Recenter Target to 'Follow Target Forward'. This works fine.
The camera has a Horizontal Axis Value Range (-# to #), that limits the rotation of the camera, but I cannot figure out how to tie this to the rotation of the Follow component (the head of the avatar).
When I walk my character around, the camera can only rotate within the set Value Range angle that has it's 0-point in one absolute direction (let's say north), independent of the player's orientation.
It seems to use World Orientation, but I don't know and wasn't able to find out where to change that.
Does anyone know how I can change this behaviour?

sentences:
Need help with my on collision restart program I tried using the program

using UnityEngine;

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "setting_object_tag")
    {
        Application.LoadLevel(Application.loadedLevel);
    }
}

But the OnTriggerEnter command came up with an error saying "a namespace cannot directly contain members such as fields or methods".

And the Application.LoadLevel(Application.loadedLevel); program had an error saying "application.loadedLevel is obsolete, use sceneManager to determine what scenes have been loaded".

sentences:
How to load and display an image in OpenGL ES 3.0 using C++ I'm trying to make a simple app on Android Studio using the NDK, JNI to call C++ code that load and display an image. I have managed to create the surface and draw a simple Triangle already.

Now, I'm looking for a way to load and display an image in OpenGL ES 3.0 using C++. I have done the search around but all of them is either missing some important function or written in Java. It would be great if someone could guide me with a simple example, thanks in advanced :) .

sentences: Should I use Async & Await, instead of Coroutines, in Unity? Should I use Async & Await in Unity?  Or should I keep using Coroutines?  If I should use Async & Await, how can I do so in a manner comparable to Coroutines?

sentences:
Good practices while working with multiple game engines, porting a game to a new engine I have to work with multiple game engines, like

Cocos2d
Unity3d
Galaxy

While working with multiple game engines, what practices should I follow?

For instance, we made a game with Cocos2d and released it on the AppStore. Now we want to port it to other platforms using Unity.

What would be the course of actions to follow?

sentences:
How to handle Multiple-accounts creation and cheating? I am developing a game that is running as a web application. The fact is that the game lose sense if one player creates several accounts. Imagine that is a turn-based strategy game, and if you play against yourself (with another account) you can earn tons of points easily.

At first, I thought about logging every single user action, and then comparing the users IP to detect if there is any clue of cheating. But then I noticed that different users could be running under the same IP, for example if they are in the school and all them share the same IP using a proxy. Using this way innocent people could result banned.

Is there any better approach that I'm missing?

sentences:
Self-illumination vs luminance I'm using a graphics format reading library which has an enum called "MaterialLuminanceMode". There are three luminance modes for materials available:

Self-illumination, which I interpret to mean "glow", as in a glowing light bulb,
Color emission, which I interpret to be using the diffuse color mask for the lumination,
Luminance, which I interpret to be the exact same as self-illumination.

Does anybody know what the difference between the first and third enum value is?

The best resource I could find seems to suggest that self-illumination is a superset of luminance, but I'm still not certain what exactly separates the two! Note this is from 3ds, which i also an Autodesk product - although not the exact format I'm reading (which is DWG)

sentences:
Getting Rendered Sprite Size I need the rendered dimensions of a sprite, I'm calling Draw in the class below:
public class Ship
{
    public Ship(Texture2D texture)
    {
        Width = texture.Width;
        Height = texture.Height;

        Texture = texture;
    }

    public int Width { get; set; }

    public int Height { get; set; }

    public float Scale { get; set; }

    public Vector2 Position { get; set; }

    public Texture2D Texture { get; }

    public Rectangle Rectangle => new Rectangle((int)Position.X, (int) Position.Y, Width, Height);

    public void Draw(SpriteBatch batch)
    {
        var origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
        var scale = new Vector2(Scale, Scale);
        var rotation = GetRotationInRadians();

        batch.Draw(Texture, Position, null, Color.White,
            rotation,
            origin,
            scale,
            SpriteEffects.None, 0f);
    }
}

The problem is Width and Height are based off the source (see the constructor) Texture size, so after drawing they are not actual dimensions. Is there away to determine the scaled sprite size?
Side note: I'm using these dimension to detect if an sprite was clicked on by the mouse. Maybe there is a better way to detect clicks?

sentences:
HLSL - Voxel texturing I'm currently trying to develop a Voxel Engine using Direct3D 9 and C++.
To keep the memory usage low, i'm only passing the position, the orientation and the offset of the current voxels texture in the texture atlas of each vertex to the vertex shader.

The vertex shader then calculates the normal and passes it to the pixel shader. I found this article which covers, how to texture voxels with just their position and normal in glsl.

This is the part that calculates the texture coordinates in my pixel shader (SM3):

float2 tileUV = float2(dot(input.normal.zxy, input.pos3D),
    dot(input.normal.yzx, input.pos3D));
float2 texcoord = input.texOffset + tileSize * frac(tileUV);

This code works fine for faces that point in negative z-direction (normal [0,0,-1]), however, the back is flipped by 180° and the sides and top/bottom squares are flipped by 90°/270°.

I am not sure, if this is correctly translated from glsl, because this behaviour should be the expected one in hlsl, if I calculate it by hand. Is there anything that I have overseen or should I aim for a different approach?

Edit:

I have now managed to successfully texture the faces by replacing the previous calculation with the following:

if(input.normal.y != 0.0f) // handle top/bottom surfaces as front/back faces
{
    input.pos3D.y = input.pos3D.z;
    input.normal.z = -input.normal.y;
    input.normal.y = 0.0f;
}
texcoord.x = input.texOffset.x + tileSize * frac(float3(1.0f, 1.0f, 1.0f) +   cross(frac(input.pos3D), input.normal)).y;
texcoord.y = input.texOffset.y + tileSize * (1.0f - frac(input.pos3D.y));

Is there any way that I can simplify/optimize the equation? I may also mention that the voxels are all axis aligned and clamped to integer coordinates.

Edit2:

This is the modified formula of zogi's answer which works as expected.

float3 n = abs(normal.xyz);
float2 texcoord = float2(input.texOffset.x + tileSize * dot(n, frac(input.pos3D.zxx)),
    input.texOffset.y + tileSize + tileSize * dot(-n, frac(input.pos3D.yzy)));

sentences:
Find point along x axis where yz plane flips to back facing after perspective projection. Have a solution but don't know why it works I am trying to find the point along the x axis where a plane with normal pointing along the x axis would flip to back facing after perspective projection. Essentially the red line in this image.
My first attempt to find it I just sampled along the x axis checking if a triangle there was back facing after projection. This only gave me an approximation but I could make the approximation as accurate as I wanted by just sampling more planes so I used this as a baseline to verify other solutions.
I then tried the following:
vec4 center = projection.inverse()*vec4(0,0,0,1);
center /= center.w;
float d = dot(center.xyz, vec3(1,0,0));
vec3 point = vec3(1,0,0)*d;

But this did not work, it was close but not right. See this image, the red line is the sampled point and the blue is the one calculated from that.
I then tried changing the calculation for center to projection.inverse()*vec4(0,0,-1,1) to see what that would look like. With the the sampled point in red, the blue line being the previous version and the green the new version. I got the following image which as you can see is still not correct.
But I noticed that the green was always directly between the blue and the red so I tried the following.
vec4 c1 = projection.inverse()*vec4(0,0,0,1);
c1 /= c1.w;
float d1 = dot(c1.xyz, vec3(1,0,0));
vec4 c2 = projection.inverse()*vec4(0,0,-1,1);
c2 /= c2.w;
float d2 = dot(c2.xyz, vec3(1,0,0));
float d = (d2-d1)*2 + d1;
vec3 point = vec3(1,0,0)*d;

Which seems to be correct but I have no idea why that works. It is always extremely close to the sampled point so I assume it is correct.
My question is why does this work?

sentences: VSCode doesn't open the specified Unity script I have downloaded Visual Studio Code to edit Unity scripts. When I double click on a script in Unity, VSCode opens but it doesn't open the script, only an empty file called Unity appears. Anyone knows how to solve this?

sentences: How to disable static friction in Box2D? I'm making a 2D platformer. One of the issues is that when the character hits the ground, there's an initial pause and then the character finally slows down to a halt. I believe the initial pause is because the coefficient of static friction is higher than the coefficient of kinetic friction. How can I set the coefficients to be equal or disable static friction?

sentences:
How to get a large quantity of photographs in an app while being memory efficient?? There have been a lot of word games (apps) lately and some use graphics but others use photographs and I was hoping that someone could explain how these games manage to get so many photos in an app without taking up huge amounts of memory?

The easiest example I can give is an app called '4 pics 1 word' it has over 350 levels and obviously 4 pics on each level and the photos are good quality on retina screens but the memory of the app is less than 40mb, if I have remembered correctly. I was curious as to how this works, is it each photo being optimized in photoshop (save for web and devices) (png or jpeg) or is it something to do with the code or something else?

I know this question is quite broad but any answers, help, links to anything would be greatly appreciated.

sentences:
Push and damage player pawn when hit by rotating pawn? (UDK) I'm working on a game in which the player runs around a level themed as a pinball machine.  There are flippers that react to the presence of pinballs by flipping (as one would expect pinball flippers to do).  The problem that I'm having is that if the player is in the path of the flipper as it rotates, the player is instantly killed.  The desired behavior is that the player is damaged and pushed away from the moving flipper.

I've tried all sorts of things to make this stop happening.  Currently, in the flipper, I have the following code to handle the collision:

event Bump(Actor other, PrimitiveComponent otherComp, Object.Vector hitNormal)
{
    local vector pushVelocity;

    if(/*If Flipper is moving and is bump()ing the Player*/)
    {
        pushVelocity = hitNormal * CalcLinearVelocity(vsize(location - other.location));
        player.TakeDamage(playerDamage, none, player.Location, pushVelocity * 2.1f, class'DamageType', , self);
    }
}

By using all sorts of logging, I can determine that the code in question is being called when the flipper hits the player and the player is being killed on the first frame this collision occurs--logging within the if() block only appears once.  And yes, playerDamage is a value low enough that it would take many hits to kill the player.

Does anyone have any insight as to why the player is immediately dying instead of being damaged and pushed away?  Or what sorts of things I should try to get my intended behavior?

sentences:
PBR Graph option not showing up in Unity I downloaded the URP render pipeline into an existing project of mine (created using the 3D template) to try out shader graphs. All of the guides and tutorials I'm following use an option called the "PBR Graph". However, I can not find that option in Unity. Did they change the name of the graph? How can I get access to it?
When I open up a new project using the URP template, I have the option to choose the PBR graph, but not in my original project, so do I have to create the project with the URP template to begin with?
The version I am using is 2020.2.3.

sentences:
Textures do not render on ATI graphics cards? I'm rendering textured quads to an orthographic view in XNA through hardware instancing. On Nvidia graphics cards, this all works, tested on 3 machines. On ATI cards, it doesn't work at all, tested on 2 machines.

How come? Culling perhaps?

My orthographic view is set up like this:

Matrix projection = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, -graphicsDevice.Viewport.Height, 0, 0, 1);

And my elements are rendered with the Z-coordinate 0.

Edit:

I just figured out something weird.

If I do not call this spritebatch code above doing my textured quad rendering code, then it won't work on Nvidia cards either. Could that be due to culling information or something like that?

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
        ...
        spriteBatch.End();

Edit 2:

Here's the full code for my instancing call.

    public void DrawTextures()
    {

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, textureEffect);
        while (texturesToDraw.Count > 0)
        {
            TextureJob texture = texturesToDraw.Dequeue();
            spriteBatch.Draw(texture.Texture, texture.DestinationRectangle, texture.TintingColor);
        }
        spriteBatch.End();

#if !NOTEXTUREINSTANCING
        // no work to do
        if (positionInBufferTextured > 0)
        {

            device.BlendState = BlendState.Opaque;

            textureEffect.CurrentTechnique = textureEffect.Techniques["Technique1"];
            textureEffect.Parameters["Texture"].SetValue(darkTexture);
            textureEffect.CurrentTechnique.Passes[0].Apply();

            if ((textureInstanceBuffer == null) ||
                (positionInBufferTextured > textureInstanceBuffer.VertexCount))
            {
                if (textureInstanceBuffer != null)
                    textureInstanceBuffer.Dispose();

                textureInstanceBuffer = new DynamicVertexBuffer(device, texturedInstanceVertexDeclaration, positionInBufferTextured, BufferUsage.WriteOnly);
            }

            if (positionInBufferTextured > 0)
            {
                textureInstanceBuffer.SetData(texturedInstances, 0, positionInBufferTextured, SetDataOptions.Discard);
            }

            device.Indices = textureIndexBuffer;
            device.SetVertexBuffers(textureGeometryBuffer, new VertexBufferBinding(textureInstanceBuffer, 0, 1));

            device.DrawInstancedPrimitives(PrimitiveType.TriangleStrip, 0, 0, textureGeometryBuffer.VertexCount, 0, 2, positionInBufferTextured);

            // now that we've drawn, it's ok to reset positionInBuffer back to zero,
            // and write over any vertices that may have been set previously.
            positionInBufferTextured = 0;

        }
#endif
    }

sentences:
Civilization 4: time in own scenario runs up too quickly In Civilization 4 (Beyond the Sword) I started making a scenario that focuses on the colonization of North America. For added realism, I set the StartYear=1780.
Everytime I run the scenario, the time runs up far too quickly–probably because I set Era=ERA_ANCIENT and GameTurn=0–so that after just twenty turns the clock nears present day.

I'm not really sure how to go fix this, other than by playing an actual marathon game from the start up to the year 1780 and copy over the values.

Is there any way to calculate/know the right values for my scenario?

sentences:
Bilinear filtering: Selecting pixels to interpolate between When looking for implementations of bilinear filtering online, all the ones I can find seem to just pick the current pixel, and the three pixels to the bottom and right side of the current pixel.

However, is this even correct, or do you actually have to get the nearest neighbors to the current pixel (from the 8 surrounding pixels) depending on the texture coordinate?

Also, how would I select between the 8 options as efficiently as possible in shaders?

sentences:
How to rotate an object based on the movement and angles of Lifters I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include:

Supporting 1-4 Lifters at any side of the Object (e.g., both on one side, opposite, so on - can't make any guarantees about their positions relative to the object)
Supporting any orientation of the Object (e.g. the Object could be flipped on its side, sideways, or upside down; can't make guarantees that Forward is always facing forward, etc)

As such I implemented this by having the object move by setting its velocity to the average of the Lifters' velocity.
Now, if not all of them move (or if there's a disparity in their velocities), I want the object to rotate, like so:

This is done by keeping track of how much an individual lifter has moved in a frame from the Object's position, and calculating the angle via
m_Angle += Vector3.SignedAngle(lastPos - transform.position, currentPos - transform.position).

This "movement angle" I add up for every Lifter and then at the end, Rotate the Object via Transform.Rotate(Vector3.up, m_Angle).
However, this approach has some problems:

Calculations are done along the Y axis and therefore does not angle the Object up or down if the Lifters have different vertical positions,
m_Angle actually overshoots, but I found simply dividing m_Angle by the number of Lifters made it perfectly accurate. I do not know why this works.

Because I want this to rotate the object in "3 dimensions", I have attempted to calculate the "euler angles" of each Lifters' movement via:
Vector3 oldDisplacement = lastPos - transform.position;
Vector3 newDisplacement = currentPos - transform.position;
Quaternion rotation = Quaternion.FromToRotation(oldDisplacement, newDisplacement);
m_EulerAngles += rotation.eulerAngles;

And then at the end, I rotate the Object based on these "movement angles":
transform.Rotate(m_EulerAngles, Space.World);

This works in three dimensions, however it is off in the same way that m_Angle was before I divided it. It rotates the object too far. On top of that it seems to produce rotations along axes that have no displacement.

I want the object to only rotate exactly by the angle created by the Lifter's movement. This should keep it "synced" to Blue instead of rotating past as you see here.
When I check how much rotation Blue is adding per frame, I get an output like so:
Blue is adding (0.000, 359.507, 0.066); on movement (-0.015, 0.000, 0.000)

Despite moving solely on the x-axis, there is a z-euler angle being created, and the y-euler angle of 0.493 degrees is too much for -0.015f movement. I do not know why rotation.eulerAngles is inaccurate in my usage.
The only issue I can perceive is that since the Object's position is also moved at the end, the angle calculation assumes it is not moving and generates a larger angle (e.g., perhaps newDisplacement should be something like currentPos - (transform.position - m_Body.velocity * Time.deltaTime) ). However, removing the Object's movement from the finalPosition of the Lifter seemingly has no effect.
Or perhaps there is some finite precision in Quaternion.FromToRotation? Or my math is incorrect in some way?
I'd love a sanity check on the code or approach or if I should approach this problem from a different perspective.
EDIT: Here's an example gif of the functionality with m_EulerAngles code (so the rotation overshoots, but works in 3D - also I recorded the gif at lower fps that's not the game's framerate)

sentences:
Pixel Buffer Object (PBO) does not work correctly I've written a very simple OpenGL application. Its goal is to load a texture and draw it on a plane using a PBO. If I use the function 'glTexSubImage2D' the plane is not textured and the function 'glGetError' returns the error '1281' (invalid value). However if I use the function 'glTexImage2D' my plane plane is textured correctly (and I have no error).

Here's the code for the texture loading :

#define OFFSET_BUFFER(offset) ((char*)NULL + offset)

void core::RootDevice::LoadTexture(char const *pFileName)
{
    SDL_Surface *pSurface = IMG_Load(pFileName);
    char *pPixels = reinterpret_cast<char*>(pSurface->pixels);
    uint32_t bytePerPixel = pSurface->format->BitsPerPixel;

    glGenTextures(1, &textureId);
    glBindTexture(GL_TEXTURE_2D, textureId);
    {
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

        glGenBuffers(1, &pboID);
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboID);
        {
            unsigned int bufferSize = pSurface->w * pSurface->h * 3 * sizeof(unsigned char);

            glBufferData(GL_PIXEL_UNPACK_BUFFER, bufferSize, 0, GL_STATIC_DRAW);
            glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufferSize, pPixels);

            glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, pSurface->w,                //NOT OK : ERROR 1281
                pSurface->h, GL_RGB, GL_UNSIGNED_BYTE, OFFSET_BUFFER(0));

            /*glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pSurface->w,               //OK : NO ERROR
                pSurface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, OFFSET_BUFFER(0));*/
        }
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
    }
    glBindTexture(GL_TEXTURE_2D, 0);
}

And the rendering code :

void core::RootDevice::Render(void)
{
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textureId);
    {
        glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 0.0f);
            glVertex3f(-1.0f, -1.0f, 0.0f);
            glTexCoord2f(1.0f, 0.0f);
            glVertex3f(1.0f, -1.0f, 0.0f);
            glTexCoord2f(1.0f, 1.0f);
            glVertex3f(1.0f, 1.0f, 0.0f);
            glTexCoord2f(0.0f, 1.0f);
            glVertex3f(-1.0f, 1.0f, 0.0f);
        glEnd();
    }
    glBindTexture(GL_TEXTURE_2D, 0);
}

And the result is the followings:

I'm really lost. Does anyone can help me, please ?

Thanks a lot in advance for your help.

sentences:
Crash on creating pipeline state - "the parameter is incorrect" - HRESULT 0x80070057 All input appears valid, although the DirectX12.ShaderByteCode() pointer is null - I don't know if that's indicative of anything; the buffer does contain data.

Edit: Diagnostic hub output:

Profiling of 'Graphics Frame Capture' started.
Graphics Frame Capture has exited.
Profiling of 'Graphics Frame Capture' stopped.

Edit2: Debug output:

Exception thrown: 'System.Runtime.InteropServices.SEHException' in SharpDX.Direct3D12
An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in SharpDX.Direct3D12
External component has thrown an exception.

Code:

var pipelineStateDesc =
    new GraphicsPipelineStateDescription
    {
        BlendState =
            BlendStateDescription.Default(),
        DepthStencilFormat = SharpDX.DXGI.Format.D32_Float,
        DepthStencilState =
            new DepthStencilStateDescription
            {
                IsDepthEnabled = false,
                IsStencilEnabled = false
            },
        Flags = PipelineStateFlags.None,
        InputLayout = inputLayout,
        PixelShader =
            new ShaderBytecode(pShader),
        PrimitiveTopologyType =
            PrimitiveTopologyType.Triangle,
        RasterizerState =
            RasterizerStateDescription
            .Default(),
        RenderTargetCount = 1,
        RootSignature = rootSignature,
        SampleDescription =
            new SharpDX.DXGI.SampleDescription(1, 0),
        StreamOutput =
            new StreamOutputDescription(),
        SampleMask = int.MaxValue,
        VertexShader =
            new ShaderBytecode(vShader)
    };

pipelineStateDesc.RenderTargetFormats[0] =
    SharpDX.DXGI.Format.R8G8B8A8_UNorm;

// Crash happens here.
// Pointer-to-implementation.
// .GetDevice returns the SharpDX.Direct3D12.Device.
pipelineState =
    graphicsDevice
        .ImplAs<GraphicsDeviceInternal.GraphicsDeviceImpl>()
        .GetDevice.CreateGraphicsPipelineState(
            pipelineStateDesc
            );

sentences:
Physically-based BRDFs I'm starting to implement a real-time PBR shading pipeline in one of my projects and had a few questions that I thought folks around here could help clarify.

1) Is it fair to say that in a PBR shading model, you'd typically have two separate BRDFs - one for specular and one for diffuse? So far, I've been using a simple Lambertian diffuse term and a more complicated BRDF for specular (i.e. one that uses a normal distribution function, a geometric shadowing term, and fresnel attenuation). At the end of my shading routine, I simply add these two terms together.

2) Why do so many diffuse models ignore surface roughness? I don't understand why the microfacet model wouldn't drastically change the way light is refracted, scattered, and re-emitted through a surface (i.e. the diffuse term).

3) People often parameterize this material model with three variables: roughness, metallic, and specular. In my current model, I use 'roughness' for various calculations in the specular BRDF. Obviously, the Lambertian diffuse model doesn't take into account the surface roughness, but I may adopt a more advanced shading model later (i.e. Oren-Nayar). I use 'metallic' to blend between the diffuse and specular terms. It also controls the color of the specular highlight - a higher 'metallic' value will result in highlights that are tinted towards the diffuse color of the material, while lower values result in highlights that are white. Finally, 'specular' just controls the final intensity of the specular highlight. Does this make sense?

4) I'm confused where environment maps, irradiance maps, and pre-filtered cube maps fit into this model. Is it fair to say that irradiance maps are used for indirect diffuse lighting, pre-filtered cube maps are used for indirect specular lighting, and environment maps are used for reflections (based on how 'metallic' a material is)? The relationship between direct and indirect lighting in a PBR material model is confusing to me.

Any help would be greatly appreciated. Thanks all

sentences:
Vibration causing lag on OnePlus 6 has anyone experienced vibration causing lag on OnePlus 6 (or other device)? I'm developing a mobile game on unity and lately I have been Integrating Nice Vibrations to our game which is basically a wrapper for both Android and iOS vibration.

Basically whenever vibrations become too rapid, like 10 vibration patterns/second , my OP6 drops framerate from 60 to 20.
This lagging happens with any game that uses a lot vibration so it can't be caused by any bug in our codebase.

Has anyone else faced similar behaviour and managed to fix it?

sentences:
How do you deal with transparent fonts that you want to be white? I'm a bit of a total amateur, but I thought I would learn how to make a simple game during quarantine.
However, I stumbled into a problem with fonts. I'm thinking about using the free font "Pixelmania" to show a score at the top of the screen. But the font is transparent! How do I make the inner part of the font white? Do I have to manually edit the font file myself? Or is there an easier way?

sentences:
Design of a camera system Thinking about a common game, doesn't matter the type of the game, it's very likely that we need some camera type. For example:

Debug camera: controlled by keyboard and mouse, with that we are able to move around in any place of our scene.
Scripted camera: with that we can instruct the camera to move around, following a determinate path.
Player camera.
...

Each of these camera types has its own update function.
The easiest (and bad) system,is to have a camera manager class with a generic update function and specialized update functions for every camera type. Inside the generic update function we have a switch statement that, based on the camera type, calls the proper update function.

Instead of this I've thought to another approach: strategy pattern. We move each camera behavior (update method) in an appropriate class that implements a common interface. In the camera manager we have a member to that interface, and we can set dinamically any behavior we want.

What do you think about that? What other systems do you suggest me?
Thanks.

Additional info: there is the are real possibility that I need more than one camera active, for example for reflections. In short, I must take account also of that.

sentences:
DirectX11 without window attached? I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window.
My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)

sentences:
Java code for client-server game on Android I have developed a game on Android. Now I want to play it on wifi or 3G. I have game packets which I want to send form client (mobile) to server then to another client (mobile).

I don't know how to write code in Java to send the playPackets continuously to server and receive the playPacket continuously from the server to the clients.

I guess I have to use two thread one for sending and one for receiving.

Can someone help me with the code, or the procedure to write code for it?

sentences:
How to resize 2D Java game without “squeezing” it? I am trying to make my second java game (2D) but i have run in a problem: The game will be in fullscreen, but how can i make it so it is scaled properly for each screen? While researching i found out that (almost) everyone is saying the same thing: render it on a Buffered image first and then render the image on the screen resolution, which i understund how to do ( BufferedImage i = new BufferedImage(width, height, 1); BufferStrategy bs = this.getBufferStrategy();

Graphics2D g2 = i.createGraphics();
if(bs == null){
    this.createBufferStrategy(3);
    return;
}

Graphics g = bs.getDrawGraphics();
//g2.draw....

g.dispose();
bs.show();

) but wont that make everything look squeezed or streched? P.s. if you know any way of making it scale only by keeping the starting resolution (leaving black on both sides) i would accept it

P.s.Sorry for my english.Hope i explained it good enough (if not ask me to clarify)

sentences:
Trying to create a '2D 8 Ball Pool' game - Trajectory Prediction I am trying to create a game similar to (Pocket Run Pool) https://www.youtube.com/watch?v=ewlAE6NQnsI&t=215s a 2D pool game that is much simpler than a 3D one I need help with creating code for trajectory prediction something similar to this https://docs.unity3d.com/Manual/physics-multi-scene.html
How do I go about doing this?

sentences:
How can I add a batch of sprites to a list in Unity's inspector? I have a C# script with a public property:

List<Sprite> someSprites;

I would like to add 20 sprites to it, from the inspector window. However, it seems like the only way to do so is to drag one by one. Is there a simpler way to batch fill lists in Unity?

sentences:
Calculating the intersection of a fast moving circle and a line Inside of my game, I am in need of a way to test the collision between a line segment and a fast-moving circle. I would say I need a line v capsule collision however the problem is I need the collision point. None of the existing formulas I can find can do quite what I need. I have tried line x line intersection and just moving the lines by the radius of the capsule sort of work however then the collision point found around the edges is off. Additionally, I can't find a way to work back from the collision point to the point that the circle first collided at.

Above is sort of a picture of what I am hoping to achieve. The green capsule represents the circle's path.

So really the problem here is finding that collision point because a yes or no answer is trivial here. There are formulas for ray capsule or box capsule however none of them will get me this collision point.

Does anyone have any ideas on how I can figure this out?

sentences: How does my GPU know what game is running? I am trying to understand how game ready drivers work. How does my gpu know what application i am running and which application to use a specific driver optimization. For example the new nvidia driver makes some improvements to devil may cry 5 . how does my gpu know that I am running DMC 5. Is there a code in that application the driver recognizes? or does it not care what application i am using and treats every application the same.

sentences:
How to save variables into a file unity I've wanted to save progress of my game (i don't have the code , sorry)
without using PlayerPrefs.
If it's possible ; with UnityEngine.

sentences:
Percentage of object inside a moving rect The idea is that I want to get a percentage of the position of Rect2 in relation to Rect1. In the picture, it would be about 75/80%. Rect2 never leaves Rect1. I move Rect1 around all the time, so it should work regardless of Rect1's position.

I had something like this, but it didn't work as intended:
((Rect2.X + Rect1.X) / (Rect1.Width + Rect1.X)) * 100

Rect1.X would work as an offset so the calculation would "ignore" the moving around of Rect1. Or that was the idea...

sentences:
Javascript - How and where to put game initialization data I'm new to JS game programming. In the past, when coding games (in Java), I tend to make separate files for configuration and game data (maps, character stats, etc). This is for separation of code and data. How can I effectively implement this on JS?

EDIT: This is for browsers only.

sentences:
Dynamic thruster balancing of space ship The space ships in my game a meant to be player-built with an arbitrary amount of thrusters attached anywhere with any rotation. I currently have some dirty code to rotate the ship to a given angle (accelerating and decelerating).

Here's an example of a symmetrical ship facing where the red line points, being told to rotate left.

However, as you would imagine, depending on where the player has put the thrusters, sometimes undesired linear forces are affecting the ship. In this case, the ship starts moving forward.

I'm elaborating on whether it's possible to find the maximum thrust a thruster can apply to cause no linear velocity. (In the above case that would be none since there's nothing to counteract the forces from the rear thrusters, and the front ones kill eachother).

What I've come up with so far is a formula to determinate the "turn efficiency" e.g. how much rotation is caused in relation to linear movement.

a - position vector to thruster a
b - position vector to thruster b
v1 - force from thruster a
v2 - force from thruster b

efficiencyDelta = a.cross(v1) / |v1|  -  ( a.cross(v1) + b.cross(v2) ) / |v1 + v2|

, basically "a.cross(v1 * t) / |v1|" is supposed to be the turn efficiency. And then we subtract it by the turn efficiency of the thrusters combined, to see if firing the new thruster is worth it.

Problem arises when I realize that thrusters aren't surposed to be on/off, but can vary their thrust from 0 to 1. And how to go about when the player wants the ship to go forward. Ofcourse, there would need to be a balance of how much to rotate/move.

I'm no rocket scientist so I'm hoping there's someone who can tell me if it's even possible to calculate the throttle of each thruster this way and give me a push in the right direction.

Thank you for taking the time! / Kim

sentences:
What are some standard stair dimensions for good level navigation? I am trying to establish some scale standards for a level. I have been following this guide: http://www.worldofleveldesign.com/categories/ue4/ue4-guide-to-scale-dimensions.php

So far I have walls at 3m high, doors at 2.1m by 1.1m, with the character standing at 1.82m by 0.6m. I am now trying to work out a "good" staircase size. I have tried the above guide's suggestion of 0.15m high by 0.3m deep for each step. To reach 3m however would require 20 steps with these dimensions, which means a single staircase would be 6m long! Visually this looks quite silly in my opinion. If I compare this to real life using the following calculator: http://www.calculator.net/stair-calculator.html,
using realistic step heights and depths the same staircase can be achieved at less than 4m length. This seems more realistic to me.

My main concern is not simply the visual appearance of the staircase, but how much space it will take up in a given building. If in each smaller building the staircase is taking up the majority of the floor space, this won't leave much for the more important elements. At the same time, I am concerned that if I make the staircase too steep it will have a negative effect on the gameplay and navigation. I understand that each level is different, however is there a good rule of thumb for getting started with this?

sentences:
I create a 3D character in Blender and animated it. How do I use it in my Game with LWJGL I have a character and he is animated with the Skeleton or Bone Structure but I don't know how to animate him in my game from scratch.

I am using Java with LWJGL.

I am loading static Objects with the Obj file format but obj does not support bone animation.

sentences: Game development equivalent of Movie Director Is there a job in game development that is equivalent to being a movie director?

sentences:
How can I use ParallaxBackground in AndEngine? I'm new to game development with  AndEngine. I want to add ParallaxBackground but I don't know how to change the background when the player moves. I'm using arrows for moving a player.

Now my question is where I write the code parallaxBackground.setParallaxValue(5);?

I have written this line in onAreaTouched method of arrow but it does not work.

Code

private Camera mCamera;
private static  int CAMERA_WIDTH = 800;
private static  int CAMERA_HEIGHT = 480;

private BitmapTextureAtlas bgTexture;
private ITextureRegion bgTextureRegion;

@Override
protected void onCreateResources() {

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    bgTexture = new BitmapTextureAtlas(getTextureManager(),2160,480,TextureOptions.REPEATING_BILINEAR);
    bgTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(bgTexture, this, "background.png", 0, 0);
    bgTexture.load();
}
@Override
protected Scene onCreateScene() {

    this.getEngine().registerUpdateHandler(new FPSLogger());

    Scene scene = new Scene();
    scene.setBackground(new Background(Color.BLACK));

    final ParallaxBackground parallaxBackground = new ParallaxBackground(0, 0, 0);
    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();

    parallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, CAMERA_HEIGHT - this.bgTextureRegion.getHeight(), this.bgTextureRegion, vertexBufferObjectManager)));
    scene.setBackground(parallaxBackground);

Robot robot = new Robot();

    // add Player
    final AnimatedSprite animatedRobotSprite = new AnimatedSprite(robot.centerX, robot.centerY, 122, 126, (ITiledTextureRegion) robotTextureRegion, getVertexBufferObjectManager());
    scene.attachChild(animatedRobotSprite);
    animatedRobotSprite.animate(new long[]{1250,50,50});

    // add right arrow button
    Sprite rightArrowSprite = new Sprite(0, CAMERA_HEIGHT-70, rightArrowTextureRegion, getVertexBufferObjectManager()){

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,float pTouchAreaLocalX, float pTouchAreaLocalY) {

            switch (pSceneTouchEvent.getAction()) {

            case TouchEvent.ACTION_DOWN:
                moveRight = true;
                parallaxBackground.setParallaxValue(5);
                break;

            case TouchEvent.ACTION_MOVE:
                moveRight = true;
                break;

            case TouchEvent.ACTION_UP:
                moveRight = false;
                break;

            default:
                break;
            }
            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    scene.attachChild(rightArrowSprite);

    scene.registerTouchArea(rightArrowSprite);

    scene.setTouchAreaBindingOnActionDownEnabled(true);

    scene.setTouchAreaBindingOnActionMoveEnabled(true);

    scene.registerUpdateHandler(new IUpdateHandler() {

        @Override
        public void reset() {

        }

        @Override
        public void onUpdate(float pSecondsElapsed) {

            if ( moveRight ){
                animatedRobotSprite.setPosition(animatedRobotSprite.getX()+speedX, animatedRobotSprite.getY());

            }
        }
    });

    return scene;
}

sentences:
How to play somersault animation during jumping at top point like in Contra games in 2D game (godot, gdscript)? Here is my jumping code:
if is_on_floor():
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.2)
else:
    if motion.y < 0:
        $Sprite.play("Jump")
    else:
        $Sprite.play("Fall")
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.05)

But I want also add the somersault animation at top point like in Contra games from NES. How can I detect moment where I should play and stop this animation. Should it be related to animation frames count and play speed?

sentences:
ConstantBuffer in HLSL file While programming and not being able to compile because of a missing Template struct or class in a hlsl file, i tried to search for ConstantBuffer but had no luck.
Is there any light to be shed about it. Ive dug for a while and cannot find anything.
Im in Directx 12 C++
example snippet...
    #define HLSL
#include "RaytracingHlslCompat.h"
#include "RaytracingShaderHelper.hlsli"
#include "RTAO/Shaders/RTAO.hlsli"

Texture2D<float> g_inValue : register(t0);
RWTexture2D<float2> g_outMeanVariance : register(u0);

RWTexture2D<float4> g_outDebug1 : register(u3);
RWTexture2D<float4> g_outDebug2 : register(u4);

ConstantBuffer<CalculateMeanVarianceConstantBuffer> cb: register(b0);

sentences:
Game 30% done on HTML5. Maybe it was a bad idea. Should I change to Unity3d? I'm creating a 3d game on HTML5. It's 30% complete and the hard part is already coded. The server is on node.js.Now I'm realizing that maybe it was not a wise choice. This is because I realized:

Three.js still has many bugs. I don't see the same thing on every machine. Each browser, OS, can give different results. I'm afraid my clients will have a great stress installing my game properly.
I have tons of sprites and models on my game. I wonder if my clients will have to load all them again everytime they want to play?
I wonder if a Node.js server will be fast enough to handle it, and I'm afraid it won't be scalable.

What would you advise me? Should I continue and finish the game on HTML5 or is it better to remake it on something else, like Unity3d for the client and (what?) for the server?

sentences:
How can I stop my Jitter physics meshes being offset? I'm developing a C# game engine and have hit a snag trying to add physics. I'm using XNA for graphics and Jitter for physics. I am trying to split the XNA model into it's meshes, then create a ConvexHull for each mesh. I then attempt to combine those into a CompoundObject, this however isn't working and depending upon the model the meshes are offset by different amounts.

This is the code I'm currently using and it gives me:

Any ideas?

sentences:
How can I procedurally render irregularly shaped health bars? The issue of the traditional rectangular or heart-based health bar is something well-understood and easily solved. But what is the accepted solution for more "creatively-shaped" health bars, like the mockup I've made below?

The obvious way to do this would be to have "in-between" sprites, so the third image would be its own sprite, along with many other transitions for different levels of health. But that seems really inelegant and the number of in-betweens needed to create a smooth transition between health states would be large.

The only other idea I can come up with is to overlay the "full health" sprite on top of the "empty health" sprite and pre-bake sets of pixel coordinates to represent each tick of health and then make them opaque or transparent as health goes up or down.

I intend this question to be language and platform agnostic but feel free to provide a concrete sample in any language/library/framework if it helps the answer.

sentences:
Light levels - How to determine if a character should be spotted Our team is trying to develop a stealth system with the UDK. Part of this will involve lighting.

The idea being that if you're hiding in a dark corner of the room, the armed goons will not start attacking you.

I've been looking for a few hours now. And while I can't say I have no leads it seems that now is a good time to start asking for help.

At the simplest level, I'm looking for a way to determine how brightly lit an actor is (primarily the player right now).

A bit beyond that, what they are wearing might also be a factor. Someone wearing solid dark clothing is going to be harder to spot than someone in a loud Hawaiin t-shirt covered in (given the stealth context probably stolen) diamonds.

The lighting will be dynamic, so the solution needs to be dynamic. As an example, a guard might get rather upset, grab a torch on the wall and throw it in your direction.

sentences: How can I stop and resume a coroutine over and over again? I want a coroutine to enter by default and then to stop when any input is given to it but then after some code to return again as active. So basically to start and stop a coroutine as many times as it's needed.

sentences: Unity, manual culling Is there a way to for example in vertex shader cull current vertex? I have my own grass system and I would like to cull straws that are further away than some distance but I can't use camera culling because grass is drawn in chunks and it hides a whole chunk.

sentences:
How do I change a shape without affecting the rest of the screen? I have drawn a shape like this in OpenGL:

 glColor4f(red,green,blue);
        glBegin(GL_QUADS);
            glVertex2f(x1,y1);
            glVertex2f(x2,y2);
            glVertex2f(x3,y3);
            glVertex2f(x4,y4);
        glEnd();
glFlush();

and I want change one the vertices like

glVertex2f(x_delta,y_delta);

But how do I redraw the shape without altering the other components of the screen?

sentences:
How can I handle collision detection between many objects efficiently? I have made a game that runs poorly. I suspect that the way that I programmed the collision detection in the game loop could be the problem.

My game has two player-controlled tanks which fire missiles; there are also power-ups, "gifts", that tanks can collect from the field. At every iteration of my game loop, I detect collisions like this:

Loop through all the missiles on the screen, and update their location (move them).
Loop through all of tank 1's missiles, and for every one check if collides with tank 2.
Loop through all of tank 2's missiles, and for every one check if collide with tank 1.
Loop through all the missiles on the screen, and check if collide with screen boundaries.
Check if the two tanks collide with each other.
Loop through all of the four "gifts" on the screen, and check if they touch a tank.

This method is presumably inefficient. How can I implement collision detection for all of these objects in a better fashion?

sentences:
Mesh getting offset on combine because of worldmatrix When I try to combine my mesh, it get offset to an other position, but the collider is still at the same place (because i dont delete and add it again). I saw a fix on internet that is to do:

Matrix4x4 myTransform = transform.worldToLocalMatrix;
combine[i].transform = myTransform*meshFilters[i].transform.localToWorldMatrix;

which worked in one of my script, but I just cant get it to work in this one. How can it be fixed ?

Vector3 cb = Vector3.zero;
Vector3 n = hit.normal;
Vector3 p = hit.point;

if(n == new Vector3(1.0f,0.0f,0.0f) | n == new Vector3(-1.0f,0.0f,0.0f))
{
    cb = new Vector3((n.x*0.5f)+p.x,Mathf.Round(p.y),Mathf.Round(p.z));
}
if(n == new Vector3(0.0f,1.0f,0.0f) | n == new Vector3(0.0f,-1.0f,0.0f))
{
    cb = new Vector3(Mathf.Round(p.x),(n.y*0.5f)+p.y,Mathf.Round(p.z));
}
if(n == new Vector3(0.0f,0.0f,1.0f) | n == new Vector3(0.0f,0.0f,-1.0f))
{
    cb = new Vector3(Mathf.Round(p.x),Mathf.Round(p.y),(n.z*0.5f)+p.z);
}
GameObject cub = Instantiate(cube,cb,Quaternion.identity);
GameObject dupli = Instantiate(hit.collider.gameObject,hit.collider.gameObject.transform.position,Quaternion.identity);
MeshFilter[] meshFilters = new MeshFilter[]{cub.GetComponent<MeshFilter>(),hit.collider.gameObject.GetComponent<MeshFilter>(),dupli.GetComponent<MeshFilter>()};
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
Matrix4x4 myTransform = meshFilters[2].transform.localToWorldMatrix;
combine[0].mesh = meshFilters[0].sharedMesh;
combine[1].mesh = meshFilters[1].sharedMesh;
combine[2].mesh = meshFilters[2].sharedMesh;
combine[0].transform = meshFilters[0].transform.localToWorldMatrix;
combine[1].transform = meshFilters[1].transform.localToWorldMatrix;
combine[2].transform = meshFilters[2].transform.localToWorldMatrix;
meshFilters[2].mesh = new Mesh();
Vector3 sP = meshFilters[2].gameObject.transform.position;
meshFilters[2].gameObject.transform.position = Vector3.zero;
meshFilters[2].mesh.CombineMeshes(combine);
meshFilters[2].gameObject.transform.position = sP;
Destroy(meshFilters[0].gameObject);
Destroy(meshFilters[1].gameObject);

sentences:
Showing keyboard on SKScene and performing action on a sprite node based on key tapped I am trying to learn SpriteKit and play with some simple sample apps.

Currently I am trying to achieve below things:

Show keyboard over SKScene
If user taps 'A', perform some action on a sprite node, if user taps 'B' perform some other action on other sprite nodes

I tried to google 'Showing keyboard over SKScene' but could not get any suitable answer :(

Any clues or suggestions?

sentences:
What's the most efficient way to find the position of a point in relation to corners of a rectangle despite rectangle's scale I am struggling to achieve the following with C# (in Unity). I need to find the position of the points that lay at a given distance (let's say 1m) from the corners of a rectangle, in a way that the segment between these points and the given rectangle corners form 135 degrees with the corresponding sides the of rectangle - no matter where the rectangle goes, what is its rotation or what is its size. Like the following:

So, using the picture above as reference, it means that the red dotted line has always the same length and divides the angle ABC in the middle. So, the angle of the line with AB is 135 and with BC is also 135.

One of the ways to achieve that is the following code:

    Vector3 dotpos = rectangle.transform.TransformPoint(rectangle.transform.localPosition.x+1.5F,0,rectangle.transform.localPosition.z+1.5F);
    bluedot.transform.position = dotpos ;

The problem is that in such solution the distance between the blue dot and the corner of the rectangle is not independent of the scale of the rectangle. It means, the greater the rectangle, the blue dot goes more distant from the corner.

Can anybody tell what is the most efficient way to achieve what I want, i.e. so the position of the blue dot is always at the same distance from the corner no matter the scale, position or rotation of the rectangle?

PS: blue dot is not an object that can be made child of the rectangle.

sentences:
Unity VR player not moving when running in device I am following Udemy tutorials for learning VR using Unity and making a game named Ninja Slash. Everything seems to be working fine in the Unity Editor Play mode but when I run my app in a real device, my player doesn't move at all.
I can't figure out what is the problem here.
Here is my Player script.

public class Player : MonoBehaviour {

public GameObject sword;
public float speed = 4.5f;
public float walkingAmplitude = 0.25f;
public float walkingFrequency = 2.0f;
public float swordRange = 1.75f;
public float swordCooldown = 0.25f;

public bool isDead = false;
public bool hasCrossedFinishLine = false;

private float cooldownTimer;
private Vector3 swordTargetPosition;

// Use this for initialization
void Start () {
    swordTargetPosition = sword.transform.localPosition;
}

// Update is called once per frame
void Update () {
    if (isDead) {
        return;
    }

    transform.position += Vector3.forward * speed * Time.deltaTime;
    transform.position = new Vector3(
        transform.position.x,
        1.7f + Mathf.Cos(transform.position.z * walkingFrequency) * walkingAmplitude,
        transform.position.z
    );

    cooldownTimer -= Time.deltaTime;

    if (GvrViewer.Instance.Triggered ) {
        RaycastHit hit;

        if (cooldownTimer <= 0f && Physics.Raycast(transform.position, transform.forward, out hit)) {
            cooldownTimer = swordCooldown;

            if (hit.transform.GetComponent<Enemy> () != null && hit.transform.position.z - this.transform.position.z < swordRange) {
                Destroy (hit.transform.gameObject);
                swordTargetPosition = new Vector3 (-swordTargetPosition.x, swordTargetPosition.y, swordTargetPosition.z);
            }
        }
    }

    sword.transform.localPosition = Vector3.Lerp (sword.transform.localPosition, swordTargetPosition, Time.deltaTime * 15f);
}

void OnTriggerEnter (Collider collider) {
    if (collider.GetComponent<Enemy> () != null) {
        isDead = true;
    } else if (collider.tag == "FinishLine") {
        hasCrossedFinishLine = true;
    }
}}

Here is the screenshot for hierarchy view.

sentences:
Static evaluation function for Checkers using Minimax I have correctly implemented Minimax for my checkers AI till depth of 3 ( well at least that is what I think ). However I am confused on evaluating my game boards at depth 3 with heuristics. Currently I just check ( no of blacks - no of reds ) for my heuristics but then it gives duplicate values ( Tie Breaker ) for most of the game boards. I researched and found that in that case we can assign values to each position on the game board ( found on this link here here  and add it to the heuristic. But how is it implemented exactly and how are those board values chosen? And do I have to apply it for each of my recursion or just at the top level for all the branch nodes?

here is my code.

    int MaxMove(TreeNode currNode, int depth, List<TreeNode> pathNodes)
    {
        if (depth == 0)
        {
            return StaticEvaluationFunction(currNode,depth);
        }
        else
        {
            depth--;
            int v = -10000;
            List<TreeNode> allPossRedMoveNodes = gameBoardScript.createNewRedBoardsFromCurrent(currNode.getCurrentBoard());
            TreeNode bestNode = null;
            foreach (TreeNode RedNode in allPossRedMoveNodes)
            {
                int v1 = MinMove(RedNode, depth, pathNodes);
                if (v1 > v)
                {
                    v = v1;
                    bestNode = RedNode;
                }
                //if the heuristic is equal then add the board piece values to the current heuristic ( I AM NOT SURE IF THIS IS CORRECT )
                else if( v1 == v)
                {
                    v1 += RedNode.getBoardMove().getMovedToPiece().getTieBreakerValue();
                    v = v1;
                }
            }
            return v;
        }
    }

    int MinMove(TreeNode currNode, int depth, List<TreeNode> pathNodes)
    {
        if (depth == 0)
        {
            return StaticEvaluationFunction(currNode, depth);
        }
        else
        {
            depth--;
            int v = 10000;
            List<TreeNode> allPossBlackMoveNodes = gameBoardScript.createNewBlackBoardsFromCurrent(currNode.getCurrentBoard());
            TreeNode bestNode = null;
            foreach (TreeNode BlackNode in allPossBlackMoveNodes)
            {
                int v1 = MaxMove(BlackNode, depth,pathNodes);
                if (v1 < v)
                {
                    v = v1;
                    bestNode = BlackNode;
                }
                //when priorities are equal
                else if (v1 == v)
                {
                    v1 += BlackNode.getBoardMove().getMovedToPiece().getTieBreakerValue();
                    v = v1;
                }
            }
            return v;
        }
    }

    private int StaticEvaluationFunction(TreeNode node, int depth)
    {
        return node.getHeuristic(); // Black - Red count at the last depth
    }

sentences:
Resize rigidbody in runtime, Box collider OnTriggerEnter not work Scene setting:

Object A:
Rigidbody, kinmeatic
Box collider, is trigger true.

Object B:
Box collider, is trigger true.

Script is on Object A:

void FixedUpdate()
{
    if(increaseScale)
    {
        transform.localScale += transform.forward* speed;

        // when to stop
        if ((AEForward * transform.localScale.z).sqrMagnitude >= range * range)
            increaseScale = false;
    }
}

void OnTriggerEnter(Collider other)
{
    Debug.Log(other.transform);
}

No log message when part of object A is inside B.

And the funny part is if I use it on a sphere collider, it works. (use                       transform.localScale += new vector3(1,1,1)* speed; instead )

sentences: Procedurally generate with different sized cubes I am trying to procedurally generate my world like in Minecraft with tons of blocks. I have watched lots of videos about this but they all use a single fixed size cube. I would like to achieve the same as in Minecraft but with different sized cubed for example. How could this be done? I am using Perlin Noise for generation.

sentences:
How to have an object follow the mouse, even if not clicked in Unity? I have this object. I want to click on it and drag it around. Also if I click anywhere on the screen, I want the object to move but keep the distance.

In the script below I made the object follow the mouse, but I can't do the second part.

I have a couple rays for debugging. Any ideas?

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

public class Player : MonoBehaviour
{
    Vector3 playerPosition;
    Vector3 mouseF;
    Vector3 mouseN;

    void FixedUpdate()
    {
        if (Input.GetMouseButton(0))
        {
            setMouseF();
            setMouseN();

            Debug.DrawRay(mouseN, mouseF - mouseN, Color.green);
            Debug.DrawRay(mouseN, (playerPosition - mouseN), Color.red);

            // move the player base on mouse position
            transform.position = mouseF;
        }

        if (Input.GetMouseButtonUp(0))
        {

            // on mouse release, set the new player position
            playerPosition = mouseF;
        }

    }

    void setMouseF()
    {
        Vector3 mouseFar = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10f);
        mouseF = Camera.main.ScreenToWorldPoint(mouseFar);
    }

    void setMouseN()
    {
        Vector3 mouseNear = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane);
        mouseN = Camera.main.ScreenToWorldPoint(mouseNear);
    }
}

sentences:
GPU instancing vs combining meshes for performance I have a relatively low poly procedurally generated scene in which I reuse a bunch of the same objects (walls, floors, etc). I've been writing some code to combine a room's floor tiles into one mesh, its wall tiles into another mesh, etc. However I came across this tutorial (http://www.habrador.com/tutorials/unity-mesh-combining-tutorial/) in which the author says that GPU instancing is essentially the same as mesh combining, but in fewer lines of code. Is this accurate? I tried GPU instancing and got a massive reduction on the GPU, but the CPU still spends a lot of time drawing. Will mesh combining provide more balanced performance for the CPU? I haven't finished my implementation yet and don't want to bother if it's effectively the same.

Thanks for the help!

sentences:
How do I determine the slope of a curve? I am making a 2D game where the character rides on the curve of a graph. I need to find out whether the player is going uphill or downhill and calculate speed accordingly.

The problem is that I am not sure how to determine the slope of the curve on the point that the character is at.

Here is an example of what some of the curves look like:

sentences:
How can I edit .qvm (Quake Virtual Machine) files? I was browsing through how to mod a game (Urban Terror, a Quake 3 mod). I found that it can be done by editing .qvm files in the game. Under the file named zpak000.pk3. That file contains other files named

ui.qvm
qagame.qvm
cgame.qvm

But I can't find a way in which I can edit these files.

sentences:
Mathf.Hermite not available in Mathf I see here that Hermite should be function in the class Mathf.

However, when I try to use it, the compiler tells me that Mathf doesn't contain a definition for Hermite.

This is an example:

    float fNewDistance = Mathf.Hermite(_initialDistance, _GoalDistance, fTime);

What am I doing wrong here?

Thank you!

sentences:
How to detect collision in C# script not attached to any game object I have public variables which I populate through the inspector. One script is attached to a single object and the other script has a gameObject array property. Please see below:

public class GamePlayScript : MonoBehaviour {

public BallScript ballScript;
public BrickGroupsScript brickGroupsScript;

// Use this for initialization
void Start () {

}

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

}
}

BrickGroupsScript contains an array of bricks which has a isBroken bool property. Also the above code is attached to an empty game object.
How can I detect when the ball game object is in contact/collided with a brick with isBroken = true?

sentences:
How to unit test XNA Game object I'm doing a hobby game project using Visual Studio 2015 and XNA, via the MonoGame implementation. I wanted to do some unit testing, as I recently discovered this feature in Visual Studio, and want to get a feel for how it can be used.

The problem is, I can't get it to work with the XNA Game object, or anything derived from it.

This is a simple instantiation test I made:

[TestMethod()]
public void MyTest()
{
    try
    {
        MyObject Test = new MyObject();
    }
    catch
    {
        // Fail the test if any exception occurs in the constructor.
        Assert.Fail();
    }
}

Whenever I use my own object in place of MyObject, the test passes.  When I use MyGame (derived from Game and with my own properties/methods), the test fails.  I've tested the same object in the debugger, and it doesn't throw an exception.

Any idea what I'm doing wrong, or is the Game class just incompatible with Visual Studio unit testing?

sentences:
Should have one device per application or per form when doing MDI Forms work with XNA? I am just making a simple editor for a project I am working on and as part of this I need to add a few different MDI forms within a larger container form.

Now the XNA (4.0) example Windows Forms projects use a shared graphics device for all controls, however I was assuming I would have a graphics device per control (assuming we have an XNA-specific panel/control element).

So is there any reasons that you should share the same graphics device? As I can imagine there being problems if you are changing render states in one panel but do not want it to effect the other panels...

It would make sense to share it if the GraphicsDevice object is literally a representation of the underlying graphics card, but thats what the GraphicsAdapter is, so I wasn't sure if there would be any problems with isolating a graphics device per control.

sentences:
Not able to find the constraints option in the Rigidbody component I am working on a game tutorial right now and I need to freeze constraints for a model prefab. I add a Rigidbody component and I want to freeze rotations on the x and z axes. However, I am not able to find the option in the component. Is there another way to access rotation constraints (I do not want to code the constraints at the moment)? Or is there something I am missing in the new version. Please do let me know. Thanks

I am using Unity 5.6.7f1 Personal

sentences: What model file formats are supported in XNA? What model extensions are valid in XNA? I know it supports .fbx, for example.

sentences:
Batch/Combine multiple Graphics.DrawProcedural-Calls in Unity I have multiple calls to Graphics.DrawProcedural in my Unity-project.
E.g. I'm drawing 1000 procedural geometries that share the same material and get their positions/meshes from a ComputeBuffer.

At some place in my code I'm doing something like this

foreach(ProceduralGeometry pG in proceduralGeometries)
{
    pG.Draw();
}

Where draw sets the Materials buffer accordingly and calls Graphics.DrawProcedural.

Is there anything I can do to batch all these geometries together? Currently I perform over 1000 DrawCalls (seen in the frame inspector) which happen to be very expensive performancewise.

Thanks in advance!

sentences:
Unity Editor: Get Mouse coordinates on left click on Scene Editor I need a simple script which does the following:

When I left-click somewhere in the Editor-Scene:

(doesnt matter if there is an object under the cursor- or not)

Do NOT deselect the current selection in the Inspector.
Do not select the object under the cursor.
and

Just print the mouse X and Z interception with the Y-Plane in the Debug.Log();

i stumbled on many solutions but somehow i couldnt get this to work.

i tried:

HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));

and

Tools.current = Tool.None;

both seem to do nothing ..... X.x

EDIT:

Happens that
"HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));"
needs to be inside:
public void OnSceneGUI()
and called every frame - to "block" the mouse clicks on the editor.
i thought it toggles it off.

still the problem of the mouse coordinates persists.

sentences:
Why does WorldToScreenPoint return "strange" results? I would like to show a menu to the right side and at the same y coordinate as a certain gameobject (shown as a green cube in the screenshot).

Therefore I'm trying to get the screen coordinates of the object in my scene using WorldToScreenPoint.

The code I'm using is this:

Vector3 nPos = new Vector3(GlowCube.position.x + GlowCube.localScale.x, GlowCube.position.y, GlowCube.position.z);
Vector3 nOff = Camera.main.WorldToScreenPoint(nPos);

The resulting values however don't look right to me.
I have created a red rectangle in order to demonstrate where the coordinates "nOff" would actually be in the screen:

At first I thought I get these strange results because the GlowCube is parented to the case, but since I use GlowCube's world coordinates (GlowCube.postion...) and not its local coordinates (GlowCube.localPosition...), I thought that this wouldn't matter.

What am I forgetting here?

Thank you!

sentences:
Check if body is on the ground In my game I have an quite irregular terrain at the bottom and a round ball which can be controlled by the keyboard. Is there any way to check, if the ball is currently on the terrain? This is very important to know because the ball should only be able to be controlled when it is on the ground.

I tried to use the OnCollision event of the ball body, but it only gets fired on the first occurrence.... For my problem a continuous type of collision-detection is needed.

sentences:
Cook Torrance model implementation : black specular light I am trying to implement the Cook-Torrance model, and this is how I calculate the parameter Rs:

float Rs(float m,float F,vec3 N, vec3 L,vec3 V, vec3 H)
{
    float result;
    float NdotV= dot(N,V);
    float NdotH= dot(N,H);
    float NdotL= dot(N,L);
    float VdotH= dot(V,H);
    float Geom= min(min(1.0, (2.0*NdotV*NdotH)/VdotH), (2.0*NdotL*NdotH)/VdotH);
    float Rough= pow(1.0/(pow(m,2.0)*pow(NdotH,4.0)), ( pow(NdotH,2.0)-1.0)/( pow(m,2.0)*pow(NdotH,2.0)));
    float Fresnel= F + pow(1.0-VdotH,5.0) * (1.0-F);
    return (Fresnel * Rough * Geom)/(NdotV*NdotL);
}

I apply this formula:

Where I set m to 0.5 and F0 to 2.0.

But I think it's wrong because I'm getting a black area where there should be the specular light:

PS: With OpenGL 2.1, GLSL 1.20.

sentences:
What are some valuable conferences for game developers? Lately I was thinking of visiting a Game Developer Conference and so I search the Internet, but I didn't find a thorough list of available Conferences. Now I know some of them, like the GDC in San Francisco but I was wondering, what other Game Developer Conferences are out there.

So my question is: What Game Dev Conferences do you know, that are valuable for Game Developers and Game Designers? Have you visited one of these Conferences yourself? Is there a skill level needed to appreciate such a Conference?

I am aware, that there is no "true" answer to this question, but I think, that an overview over existing Conferences could be usefull for all levels of game developers.

sentences:
Prefab disables its script when a clone is instantiated A clone of a cube is spawned when it is destroyed, however the clones disable the script in the editor (example: http://gfycat.com/SnarlingScornfulEgg). Used the exact same script for a different kind of 'enemy' and it worked as intended.

Relevant part of script:

function Start () {
    health = 100;
}

function Update () {
    if(health <= 0){
        Dead();
    }
}

function OnCollisionEnter (col : Collision) {
    if(col.gameObject.tag == "Bullet"){
        health-=25;
    }
}

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-50, 50);
    var posz = Random.Range(-50, 50);
    Instantiate(enemyl, Vector3(posx, 0.5, posz), transform.rotation);
}

Is there something I'm missing?

EDIT: The clone takes damage but doesn't die like the original when its health is <= 0.

sentences:
What are good ways to model environment radiance (not irradiance)? I'm trying to compile a list with relevant techniques in game development to model scene radiance.
The (probably obvious) candidates I have so far is:

Discreet light source objects in the scene (point ligts, directional lights, area lights etc)
spherical [HDR] bitmap data (mapped to the sphere in various ways. long lat, cube map, oct map etc.)
spherical harmonics
halfspherical harmonics

What other relevant techniques are there to model radiance (not irradiance)?

sentences:
Proper sphere to triangle collision resolution I am working on a 3D game. For simplicity sake, the player is currently represented as a sphere. I have implemented an intersection test between a sphere and triangle, which returns a packet containing the collision depth and normal.
Simply moving the sphere along the normal with a magnitude of the depth works fine, but there are several problems. Sometimes the player just clips throught corners and walls, and you cannot go up slopes, since gravity is pushing you down.
I've also tried combining the collision normal and depth of all the current interesctions, although this doesn't make any difference.
There is no problem with the intersection code, I just want to know how to handle the collision in a fool-proof way.

sentences:
How to transition between states and mix states in a finite state machine? I don't understand how to use a finite state machine with the entity controlled by the player.

For example I have a Mario style game (2d platform). I can jump, run, walk, take damage, swim, etc. So my first thought was to use this actions as states. But what happens, if you are running when you take damage? Or jumping, taking damage and shooting at the same time?

I just want to add functionalities (actions) to the player in a clean way (not using it for all the actions in the entity update) .

sentences:
Comprehension question to MVC Pattern in Game Programming So is my assumption right?

If I use MVC in Games I will have to implement a Model,Controller,View for every kind of interaction object.

For example in an Motorbike game. My Motorbike object will have its own controller, view and model class. Or is it enough if I define a model,view and controller for the world object and just use that view for drawing my bike?!

Or am I mixing something up?

sentences:
Why does unlocking cursor with keyup behave the same as unlocking it with keydown? To understand the difference, let me review a bit about the behavior of GetKeyUp and GetKeyDown with the following code snippet.

void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        Debug.Log("Escape Key Down");
    }

    if (Input.GetKeyUp(KeyCode.Escape))
    {
        Debug.Log("Escape Key Up");
    }
}

Right after pressing the Esc key (and holding it), a message "Escape Key Down" is produced. Later right after releasing the key, a message "Escape Key Up" will show.
The behavior does make sense.

Now I apply this for toggling (locking/unlocking) the mouse cursor. Here is my code snippet.

void Update()
{

    if (Input.GetMouseButtonDown(0))
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    if (Input.GetKeyUp(KeyCode.Escape))
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
    }
}

Right after clicking the left mouse button, the cursor becomes invisible. However, right after pressing down the Esc key, the cursor becomes visible again. The expected behavior is that the cursor will be visible right after releasing the Esc key rather than right after pressing the key.

Question

How to fix this abnormal behavior?

sentences:
Collision detection for 2D RTS game in C++ I'm currently working on a real time strategy game in C++, and I need to implement a collision detection algorithm. I need to have a very efficient algorithm because this game will be running on mobile devices, and has potential to have many objects on the screen at one time.

I was thinking that a QuadTree might work for this, but then I realized it could be slow since QuadTree's are designed for static objects, and having many objects moving around the Q-Tree might not be optimal.

So I'm wondering what a good algorithm is for detecting collisions? The objects in my game will just have simple axis aligned bounding boxes to check for collisions, so I need a nice spacial indexing system so an object only checks for collisions with objects around it.

sentences:
Real-time multiplayer game server development I'm an Android developer, and I want to start developing a real-time multiplayer game, like Pocket Legends.

Would this type of server be good for a real-time multiplayer action game - http://systembash.com/content/a-simple-java-udp-server-and-udp-client/?

I'm absolutly new to server development, so it would be great if you explaind even more about this stuff ...

sentences:
2D Collision masks for handling slopes I've been looking at the example at: http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel and am trying to figure out how to adjust the sprite once a collision has been detected. As David suggested at Sidescroller variable terrain heightmap for walking/collision, I made a few sensor points (feet, sides, bottom center, etc.) and can easily detect when these points actually collide with non-transparent portions of a second texture (simple slope). I'm having trouble with the algorithm of how I would actually adjust the sprite position based on a collision.

Say I detect a collision with the slope at the sprite's right foot. How can I scan the slope texture data to find the Y position to place the sprite's foot so it is no longer inside the slope? The way it is stored as a 1D array in the example is a bit confusing, should I try to store the data as a 2D array instead? For test purposes, I'm thinking of just using the slope texture alpha itself as a primitive and easy collision mask (no grass bits or anything besides a simple non-linear slope). Then, as in the example, I find the coordinates of any collisions between the slope texture and the sprite's sensors and mark these special sensor collisions as having occurred. Finally, in the case of moving up a slope, I would scan for the first transparent pixel above (in the texture's Ys at that X) the right foot collision point and set that as the new height of the sprite.

I'm a little unclear also on when I should make these adjustments. Collisions are checked on every game.update() so would I quickly change the position of the sprite before the next update is called?

I also noticed several people mention that it's best to separate collision checks horizontally and vertically, why is that exactly?

Open to any suggestions if this is an inefficient or inaccurate way of handling this.

I wish MSDN had provided an example of something like this, I didn't know it would be so much more complex than NES Mario style pure box platforming!

sentences: How to set HUD elements position and size depending of resolution How can I set HUD elements' position and size when changing resolution and maintain the desired layout? All HUD elements (including menu items such as play button, setting button etc) need to get some scaling.

sentences:
How do I manually make a .pack file like TexturePacker (without using TexturePacker)? I am using libGDX and apparently the only way I see for creating a UI is with texture packs.

I would say that since a texture pack is nothing more than JSON or XML file and a large png I could manually code a texture pack. How?

sentences: How can a pygame image be colored? How can I color a Pygame image surface? I either want to change every pixel that is color A into color B, or else change every pixel into color B. Either works, so long as transparent regions remain the same.

sentences:
Finding the monitors orientation in XNA for Windows Just to be clear this is not for Windows Phone 7. =)

I've got some interesting requirements for a project and I'm having trouble trying to find the information I need.

I have two monitors. The default monitor is landscape. The second monitor is portrait.

Right now I save the width and height and then change Graphics.PreferredBackBufferWidth and Graphics.PreferredBackBufferHeight to the values returned from GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width (1920) and GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height (1080) right before toggling to full screen. This works fine on the monitor in landscape mode. The monitor in portrait however scales 1920x1080 to fit onto the 1080x1920 screen.

I'm looking for either a way to determine that the monitor is in portrait mode or have the CurrentDisplayMode.Width and CurrentDisplayMode.Height return the portrait appropriate values.

I've been rifling through the XNA Framework documentation and googling like mad and not finding anything helpful.

sentences:
Is there an efficient way to identify in which run-time generated room a character is, in a non-grid 3D environment? How? Here is what I am trying to implement. I wrote a script that allows the player to place walls during run-time, in non grid-based 3D environment (walls can be diagonal with rotation increasing/decreasing in amounts of 10 degrees). Like the figure below shows, since wall can form different angles, rooms might end up having both convex and concave angles:

What I have been looking for, without success so far, is a way to detect in which room a given character is, according to its position. Of course, if that was a grid-based setting, I could only pass an ID for each cell and then retrieve the ID of the cell where the given character stands. However, that being a non-grid setting and with irregular rooms that have shapes unknown in advance, how could I accomplish that in an efficient way?

Many thanks.

EDIT:
Although it is a 3D environment, the problem may be treated as a 2D one since height is not a concern here.

sentences:
Game is responding very slowly? I have a very simple app which removes buttons and re-adds buttons to certain layouts when a button is clicked. The problem is, this process is taking a very long time. My question is: How can I make this process faster

I have a simple program which swaps two buttons:

Remove view (button)
Generate random number, and from my button array list, get the button in the array list with the index of that random number
Remove that random view (button)
Add the two buttons in each others places.

Now, the problem is that I want the buttons to swap places right after I click on a button. Instead, the program is taking about three seconds to do the above four tasks after I click the button.

Here is the code:

    red.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {

                // Remove the clicked button from it's frame layout parent.
                    ViewManager p = (ViewManager) v.getParent();
                    p.removeView(v);
                    // Find another button randomly.
                    Random rng = new Random();
                    View v2;
                    do
                    {
                        int i = rng.nextInt(4);
                        v2 = buttons.get(i);
                    }
                    while (v2 == v); // Loop until you get a different button to swap with.
                    // Remove the other button from it's frame layout parent.
                    ViewManager p2 = (ViewManager) v2.getParent();
                    p2.removeView(v2);
                    // Now simply insert each button into the other buttons frame layout.
                    p.addView(v2, v2.getLayoutParams()); //Adding v2, the random button, into where v, the button clicked, was before(p)!
                    p2.addView(v, v.getLayoutParams()); //Adding v, the button clicked, into where v2, the random button, was before(p2)
                }
   }
       });

So, having done my research, I learned that one thing that may be slowing me down could be the fact that the main UI is handling all of this work. So, I decided to put all of this code inside of a thread to run in the background:

 red.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {

            new Thread(new Runnable() {

                @Override
                public void run() {

//ALL THE CODE I PROVIDED UP THERE

}).start();

But putting this code in a thread gave me another exception. This is probably happening because I am trying to update the UI (remove and add buttons) from the thread.

 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

So, I don't know how I should approach this problem, since I do need to change my views...

Another thing that could be slowing down my app (from the research I did) is that my layout might be inflating after a while, due to such a giant layout. My layout is pretty big, so that may be it:

I doubt it is the layout though, as the screen loads pretty fast. What happens is that when I click a button, the screen freezes for three seconds, and then updates the UI with the completed tasks.

Could I somehow take up more memory to be faster as an app? The whole basis of my app runs on being able to complete those four tasks and update the UI as soon as the user presses on a button. What else should I do? I have also added this line in my manifest after looking at similar questions:

android:largeHeap = "true"

Now, what else should I do? Thanks so much for your help, I really appreciate it. I have been stuck on this all day...so I really (REALLY!) would like any feedback.

Thanks so much for your time

sentences:
Rotation angle based on touch move I want to rotate my stick based on the movement of the touch on the screen. From my calculation I did not able to find correct angle in degree. So please provide guidance, my code snippet for that are below.

if (pSceneTouchEvent.isActionMove()) {
    pValueX = pSceneTouchEvent.getX();
    pValueY = CAMERA_HEIGHT - pSceneTouchEvent.getY();
    rotationAngle = (float) Math.atan2(pValueX, pValueY);
    stick.setRotation((float) MathUtils.radToDeg(rotationAngle));

}

sentences:
Rotation deforming mesh (Opengl ES 2.0) I'm trying to render a rotating cube on Opengl ES 2.0, using some math classes I wrote (based on a lot of online and offline info) for quaternions, matrixes and the like. As far as I know all the math classes are right, but I'm still having some issues rotating objects.

The scene is a simple cube, with no translation or scale, I've tried both without projection setup and with projection, and in any case it acts strangely. Without the projection, it looks like the mesh deforms until at some point it breaks, but it's hard to tell what's really going on. With perspective projection, this is a video of what it does rotating about the y-axis.

The rotation is simply an angle being incremented by 0.05f each frame (never decremented), but the effect isn't what I think it should be at all.

Does someone know where should I start looking for mistakes? Thanks.

Note: I haven't posted any code because I don't know where the problem might be (and posting the whole thing is way too much), if anyone has any clues, I will post any code that might be useful.

sentences:
Why does Unity save textures in bitmap format for APKs and IPAs? Why does Unity save graphic resources in Android apks and iOS ipas in a bitmap format(width*height*bpp)?

I want to save my resources in a small apk, but instead of 1mb for an image Unity stores 11mb for a single image.

sentences:
OpenGL ES 2.0 Best Practices / Architecture Guide I've recently started working with OpenGL (ES 2.0) on the Android. While there is lots of documentation about the basics, I can't seem to find much about the overall architecture of OpenGL. In particular, while I see how a Program works, shaders are linked, and vertices are loaded, I can't find any indication of how this should be used to create entire scenes.

That is, does one create multiple programs, reuse the programs, create multiple indexes, try to share textures/shaders, etc. What I'm looking for are some solid references that explain the trade-offs, and intended use, of these functions in the production of scenes. The various Android docs, and OpenGL docs also hint at several limitations in using the API, but don't give concrete information in many cases.

I understand this may be a bit subjective, but I really can't find anything useful on this topic by searching. I'm  unsure where else to ask and I believe that concrete useful answers can be given.

sentences:
how to detect touch on instantiated prefabs in unity I have instantiated objects (that have collider2D attached) in a grid of 9x13. Now I want to detect a touch on each object individually. I am confused about how to do it. Either write script separately on prefab or do it in my gameController script? Also what is the method to do it?

Here is my code for instantiating:

    public GameObject bubble;
    int row;
    int col;
    float x;
    float y;

    void Start ()
    {
        x = -2.4f;
        y = 2.95f;
        row = 13;
        col = 9;

        Vector2 position = new Vector2(x, y);

        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                Instantiate(bubble, position, Quaternion.identity);
                position.x += 0.6f;
            }
            position.x = x;
            position.y -= 0.6f;
        }
    }

sentences:
How to change material color (LWRP) I've upgraded my project to LWRP, I've changed my materials to: LWRP/lit. But in one of the gamemodes i need to change one my materials' color by script. I used to do it simply like wallMat.color = Color.red, but at LWRP that code doesn't work, how to fix it?

Edit: LWRP = Light Weight Render Pipeline

sentences:
Drawing chunks, and positioning the camera I've seen many questions and answers regarding how to draw tiled maps but I can't really get my head around it. Many answers suggest either loading the visible part of the map, or loading and unloading chunks of the map. I've decided the best option would be to load chunks, but I'm slightly confused as to how this would be implemented.

Currently I'm loading the full map to a 2D array of buffered images, then drawing it every time repaint is called. Q1: If I were to load chunks of the map, would I load the map as a whole then draw the necessary chunk(s), or load & unload the chunks as the player moves along, and if so, how?

My second question regards the camera. I want the player to be in the centre of the X axis and the camera to follow it. I've thought of drawing everything in relation to the map and calculating the position of the camera in relation to the players coordinates on the map. So, to calculate the camera's X position I understand that I should use cameraX = playerX - (canvasWidth/2), but how should I calculate the Y position? I want the camera to only move up when the player reaches cameraHeight/2 but to move down when the player reaches 3/4(cameraHeight). Q2: Should I check for this in the same way I check for collision, and move the camera relative to the movement of the player until the player stops moving, or am I thinking about it in the wrong way?

sentences:
Dialog/event system in Java/libGDX I hope that I'm posting this correctly as I'm new to the site, feel free to correct me if I'm in the wrong spot.

As for my issue:
I'm working on an 2D side-scrolling platformer game in libGDX, and I've run into an issue that I've considered before but never received a solid answer. Here's an example of what I'm wondering about:
In games like, say, the Legend of Zelda, when the player steps on a switch, or catches a torch on fire, this can open a door or release a monster or cause a myriad of other things to happen.

Now, I imagine that this utilizes some sort of Event-trigger relationship or messaging system, but it seems that it would be insane to hardcode all of these events into the game engine itself, even when utilizing an event-based system.

The same goes for tutorial and dialog systems: the player interacts with an NPC, or some sort of in-game object, and the dialog/tutorial continues at certain points.

In my game, I will specifically need to be able to have events triggered after a character does a certain thing, and I will need to be able to have series of dialogues triggered.  I think that I know how I could hardcode these things, but I'm going to have numerous levels that I wish to develop with a level editor such as Tiled, instead of hardcoding them.  Because of this, I don't know how I would integrate events into such a system.

My questions are: what do game programmers do to avoid hardcoding these things into their games? With something like a massive quest system with tons of dialog, or numerous levels with switches and events to trigger, how are these integrated into the game?

Thank you for any answer you can give me, I'm really stumped on this one :)

P.S. If you need any more clarity on what I'm asking for, please tell me so I can give more detail if needed.

P.P.S
I saw this post Level editor event system, how to translate event to game action but I've seen on other pages that people go back and forth on whether to use a scripting language, or some sort of file format like XML or JSON, and it's very confusing...

sentences:
Godot 3 - Trying to make a character dash (wavedash) So, I'm trying to make a character do a wavedash in Godot 3 and I don't know what I'm missing here. When I press 'Z', the character should burst speed and then a few miliseconds later it should decelerate back to the normal speed. Tried to use a while loop, adding the var to the motion, but it didn't work.

Here's the code (testing only in the right direction).

extends KinematicBody2D
const UP = Vector2(0, -1)
const GRAVITY = 20
const ACCELERATION = 50
var MAX_SPEED = 150
var JUMP_HEIGHT = -400
var MAX_DSPEED = 300
var motion = Vector2()
var CAN_DASH = true
var ADD_SPEED = 0

func _physics_process(delta):

motion.y += GRAVITY
var friction = false

if Input.is_action_pressed("ui_right"):
    motion.x = min(motion.x+ACCELERATION, MAX_SPEED)
    $Sprite.flip_h = false
    $Sprite.play("Run")
    if Input.is_action_pressed("dash"):
        ADD_SPEED = 300
        while ADD_SPEED > 0:
            ADD_SPEED -= 3
            motion.x = min(motion.x+ADD_SPEED, MAX_DSPEED)

elif Input.is_action_pressed("ui_left"):
    motion.x = max(motion.x-ACCELERATION, -MAX_SPEED)
    $Sprite.flip_h = true
    $Sprite.play("Run")
else:
    $Sprite.play("Idle")
    friction = true
    motion.x = lerp(motion.x, 0, 0.2)
    JUMP_HEIGHT = -400

if is_on_floor():
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.2)
else:
    if motion.y < 0:
        $Sprite.play("Jump")
    else:
        $Sprite.play("Fall")
    if friction == true:
        motion.x = lerp(motion.x, 0, 0.05)
motion = move_and_slide(motion, UP)
pass

sentences:
RTS Balancing for Units with Different Costs I am creating a space-based RTS. So far, we have three units:

Fighters (cost 5 resources)

Interceptors (cost 20)

Rocket Ships (cost 40).

I've designed this game in a Rock-Paper-Scissors format (Fighters beat Interceptors, Interceptors beat Rocket Ships, Rocket Ships beat Fighters), but the game is designed so that classes beat each other at cost (i.e. a single Interceptor will beat a single Fighter, but four Fighters (cost 20) will beat a single Interceptor (cost 20)).

In this case, when I am using the Incomplete Wins technique to calculate the proportions of each ship that I would expect to see, should I calculate interactions using 1v1 interactions or "at cost" interactions? I believe the two will lead to very different results (for example, a single Fighter does 20% of damage to Interceptor before it itself is destroyed, but four Fighters destroy the Interceptor while only losing one ship; the first interaction leads to a 1 resource advantage for the Interceptor player, while the second interaction leads to a 15 resource advantage for the Fighter player). I would think it I should do the latter comparison, but the linked page does a single unit comparison (one Knight vs one Archer, even though Knight costs half that of Archer)

EDIT: This RTS is partially derived from Total Annihilation/Supreme Commander, so no projectiles hit instantly and the scale of the game is intended to be somewhat large. In that case, should I instead perform comparisons between armies that cost the same? For example, instead of comparing one Fighter vs one Interceptor or four Fighters vs one Interceptor, should I instead compare 40 Fighters vs 10 Interceptors? Would that be more accurate and also help reduce randomness of projectile hits?

sentences:
2D Collision : detection and design So, listening to this very smart piece of advice, I've already completed a basic Tetris game. Moving on, I started a small breakout. But suddenly : a nightmare came. Collisions.

Since I've been struggling with this a lot, I read a bunch of article of the web. Being a beginner, I thought that, in the first approach, I would only use Rectangle to detect collisions.

Right.

Now I still have some problems.

First of all, all the articles I stumbled upon on the Internet told me how to detect collisions, e.g. checking if objects A and B collided with each other. But it is not what I really need. In order to respond properly, I need to tell my objects if the collision happened on the X or Y axis and then setting the new velocity according to some rules. The problem is that there are so many possibilities when making the distinction between types of collisions that I don't think I've taken the right path.

The second point (which, I believe, is really tied with the first) is the pattern in which the detection and the resolution of a collision happen.
Right now, I have a CollidableObject classes and a CollisionDetector classes which knows about these objects. Each frame, the detector is looking for collision (or at least for me, is trying) and when he finds one, it alerts each collided object, saying "Hey you ! You've have collided with Z on the X axis, change that velocity now." and the object abides.

The main issue right now is that I can detect the collision axis and therefore, when saying "Hey you ! You collided !", I cannot respond properly. In which direction should my velocity change ?

I've been thinking a lot about this lately, trying to figure it out on my own, but I haven't find something that I liked so I am asking here now.

Thank you for your answers !

(Note : I don't know if this is relevant, but I'm coding in C++ using SDL)

sentences:
Encode world matrix as 2 float4s? On one of the slides of their presentation "Batch, Batch, Batch!" guys from NVidia suggest encoding animation matrices for pallet skinning into two float4s as:

• axis/angle
• translate/uniform scale

I wonder how can that be done (including decoding) and why do they say that this leads to:

Video memory overhead: model replication

sentences:
Modelling meteoroid to scale in Maya LT I have just recently started using Maya LT so forgive me if I am asking a silly question.

I am trying to model a meteoroid in Maya LT of about 8km in diameter and I am trying to model it to scale. Now I know this sounds like crazy-talk but I don't want a procedurally generated model or a model using a UV-map.

The largest (metric) unit type in Maya is meters, so I have set this to meters and try to create the model at its actual size.

For starters I created a sphere of 2 units in diameter and set the scale to 4000. This results in me seeing nothing. When I try to frame the object I just get a gray screen and I am unable to edit it properly. I feel that my model might be getting a bit to big for the application.

What is the best approach for modelling such large environments. Should I scale it down, add smaller details and scale it up in Unity? How would I best go about this?

sentences:
camera movement along with model I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this.

The cube needs to have a smooth movement like it is traveling on a frictionless surface. So could someone help me achieve this. I need to have this done in a event callback function
I need to move the camera along with the cube. So could someone advice me a good tutorial about camera positions along with an object?

sentences:
What is the simplest way to render video into memory (for drawing to a texture) in .NET? In my project I would like to be able to play back video on surfaces in the world. I intend to do this by having the video frames rendered to a block of memory, then use this  to update a texture each frame.  Everything is in place - except for the part that actually gets the video.

I have looked on Google and found that the video library world is very expansive (and geared towards video processing), and am having trouble finding a suitable one.

FFMpeg is very comprehensive, but is an entire suite and would take  a good amount of work to integrate. So far the most promising library I've found is the one based on the VLC player libraries - by virtue of it using the same resources as VLC Player it is known to be very capable; it also renders to blocks of memory, but the API (at least of the one on Codeplex) is more of a port of the C++ API rather than a managed wrapper.

The 'solution' can be any wrapper/API/library, but with characteristics that make it suitable for use in a rendering engine, namely:

Renders the video frame data to memory, so it can be picked up and
passed to a texture on the GPU easily.
Super simple - all that is needed is a way to load, jump and render a frame programatically - ideally it would use the systems codecs and not require an assortment of plugins.
Permissive license (LGPL or more free-er)
.NET bindings at least; all the better if it is natively managed

Can anyone suggest a lightweight, (.NET) library, that can take a video file, and spit out some frames into a byte[]?

sentences:
Point system that is not competitive or has a clear goal I'm making a game in which the goal is to reach as much entries as possible and I want the player to see that he is making progress somehow. However the game shouldn't be of competitive nature (it co-operative), so I feel that points might not be the right measure. I thought instead of a progress bar, so you work towards a goal of entries. However the problem with this is that there isn't a specific number of entries the user should aim for; The more, the better.

Is there a way of showing progress without assuming there is an end and without it getting competitive?

sentences: Where to start? (3D Modeling) I'm looking for a good resource to start learning 3d modeling. I'm looking for something that starts with the basics (e.g. terminology; what are quads, triangles etc.) before/while going into the actual modeling. Book, website, video,  anything will do. I'm only concerned with the quality of the tutorials, how thorough they are. I have experience with texturing, level design and so on - but I've never created anything more than simple shapes/editing existing assets.

sentences:
How do I make my rigid body rotate a fixed angle value each time I click the movement keys Ive tried some experiments with the character rotation, but I dont want it to rotate when he touches something, but I also need to unfreeze the Z axis rotation or else the character doesnt rotate when I press a key. My code is this right now, each time I press play (with the Z axis unfreeze) the character just turns like 10 degrees each time I press a key and he is still interacting with objetcs, I dunno what I can do and I might need some help :/

public float speed = 2f;
private Rigidbody rb;
private float midJump = 1;
private Rigidbody rB;

//Character Movement

void Start()
{
    rb = GetComponent<Rigidbody>();
}
void Update()
{
    rb = GetComponent<Rigidbody>();

    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3(moveHorizontal, 0f, moveVertical);

    rb.AddForce(movement * speed);

//Character Jump

    if (midJump == 1 && Input.GetKeyDown(KeyCode.Space))
    {
        rb.velocity = new Vector3(0, 45, 0);
        midJump = 2;
    }

//Character Rotation

    else if (rb.velocity.y == 0.0)
        midJump = 1;

    {
        if (Input.GetKeyDown(KeyCode.D))
            rb.AddRelativeTorque(new Vector3(0, 0, 90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.A))
            rb.AddRelativeTorque(new Vector3(0, 0, -90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.S))
            rb.AddRelativeTorque(new Vector3(0, 0, 180));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.W))
            rb.AddRelativeTorque(new Vector3(0, 0, 0));
        rb.angularVelocity = Vector3.zero;
    }

}

sentences: Unity3d memory management I am baking animation to draw a huge amount of crowd in unity3d. I am storing mesh of each frame of skinned mesh in the list and just iterating over it. I can't use the compute shader as I want to target low-end devices too. But now I am facing memory issues as mesh consumes over 1.5gb of memory. Is there any way I can free memory consumes by mesh?

sentences:
Unity - RageTools Performance Has anyone used RageTools for Unity? What do you know about the performance? Is it more performant than using raster, for example with "puppet 2d" or the other way?
I'm developing mobile games, so performance is very important for me.
Thank you!

sentences:
In Unity, can I make a GameObject within a prefab disabled by default? If I create a simple object hierarchy in my scene...

-ExampleGameObject
--Child1 [is active]
--Child2 [is not active]

...how can I accurately store this as a prefab? If I drag ExampleGameObject to a new prefab, then instantiate that prefab, both Child1 and Child2 will be active, which isn't what I want.

sentences:
Unity - Open offline web pages in a browser window by clicking a button? I currently have a Unity game where the user can click on buttons to open up web pages, I use the following script on the button for this...

public void OpenURL(string url)
         {
             Application.OpenURL(url);
         }
     }

The URL is then put into the box that this script produces in the inspector and works perfectly.

However what I would now like to do is open the pages OFFLINE instead, so people without an internet connection can see the information.
The way I envisage doing this is to save the web pages so they can be opened up locally in a browser offline.
However I am stumped as to how to tell the button to open the relevant file and open it - is there a way of doing this?  Maybe save the web page file in a local folder and point the button to that file?

This would be way easier that the only alternative I can think of - to save each web page as an image and have them open up as an image popup within the game as opposed to in the browser (there are a lot, so I would rather not have to do this!)

This is for PC Standalone only.

Any help would be greatly appreciated.

Thanks in advance!

sentences:
glCreateShader causes segmentation fault I can't create a shader when trying to use shaders with sfml. The function glCreateShader(GL_VERTEX_SHADER); causes a segmentation fault. At first I googled it and found that it does that when the program does not have an opengl context. I tried SDL first but the poor documentation and "look at the header to know what to do" made me go for sfml

the code that causes the seg fault is bellow

    sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");

// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);

// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLuint vertShader = glCreateShader(GL_VERTEX_SHADER);

    //...

I'm including glew, gl.h, sfml-window, sfml-system, using opengl 2.1 on gcc linux.

What is missing?

sentences:
Looking for a dirty pseudo 3D trick To be specific I want to do bad sprite scaling like in Operation Thunderbolt. For some reason I'm getting it all wrong so far.

I started over from scratch and I've literally got a sprite that follows the mouse and scales larger as the Y position increases. I've got a horizon line at y128. I don't want the sprite to start scaling until it passes the horizon. I've been through countless examples of pseudo 3d but I want to start simple, one thing at a time so I can get the maths right in my head :S

Right now the code is:

set scale: Sprite.Y / Scalerate

Which keeps the scaling even as I move the mouse up and down but now I want to limit it to only growing after the horizon at 128.  As if a person is walking down the road at you, or maybe an equation that let's you set a start and end point on the y axis.

I'm totally new at the sprite scaling stuff!

sentences:
Is keeping all my game art in a static class wasting memory? When I make games, I generally create a static class called Art that has static fields to track all content in the game. For example

public static class Art
{
    public static SpriteFont defaultFont;

    public static Texture2D playerSprite;

    public static void LoadContent(ContentManager content)
    {
        defaultFont = content.Load<SpriteFont>("Fonts/DefaultFont");
        playerSprite = content.Load<PlayerSprite>("Sprites/PlayerSprite");
    }
}

My question is do these objects in my art class take up memory for the duration of the games lifetime? The point of this class is to only have to load my art once in the game and have easy access to the assets anywhere in my project, but at what cost?

sentences:
Client server design question I'm working on creating a multiplayer game, with the client in ActionScript and the server written in Java. I'm using XMLSocket in the client to connect to the server. The server code looks something like:

ServerSocket server = new ServerSocket(port);

while(true)
{
    Socket client = server.accept();
    ClientHandlingProcess child = new ClientHandlingProcess(client);
    child.start(); // starts new thread for client
}

The client handling process looks something like:

while(true)
{
    byte[] arr = new byte[1024];
    if(socket.getInputStream().read(arr) == -1)
    {
        break;
    }

    handleInputMethod(arr);

    while(!message_queue.isEmpty())
    {
        socket.getOutputStream().write(message_queue.get(0).getBytes());
        message_queue.remove(0);
    }
}

The issue is that the read method is blocking, meaning I can't send any data while I'm waiting for data to come in. What would be a good way to fix this? Have two processes: one for reading and one for writing, have the client send empty requests when it has no proper messages to send, or is there another way I can proceed?

sentences: Does opengl performs Visibilty algorithms based on z-index? Does OpenGL performs Visibilty algorithms based on z-index? Or we have to write our own algorithms. Mainly I'm referring to z-buffer algorithm. Is it in-built?

sentences:
How to program an experience-based levelup system where experience carries over to the next level? I'm new into programming, and i've tried to do a system of level up. Here it is :

if ($exp >= $max_exp)
{
        $query=$db->prepare('UPDATE users SET level_up = 1 WHERE username = "'. $username .'"');
        $query->execute();
        $query->CloseCursor();
}

if ($level_up >= 1)
{
        $query=$db->prepare('UPDATE users SET exp= 0, level = (level + 1 * level_up), max_exp = (max_exp * 1.2), spoint = (spoint +5 * level_up), level_up = 0 WHERE username = "'. $username .'"');
        $query->execute();
        $query->CloseCursor();
}

Explaination :

If the user get more xp (exp) than xp needed to level up (max_exp), he get a level up (level_up)
When the user level up, his XP is set to 0, his level goes up by (1 * the number of times he leveled up), same thing for his spoint (Special points). And next, his xp needed to level up goes up by 1.2.

Here are the problems with my badly coded system :

If max_exp is 100 and the user get 1000 xp, he will only get 1 level and loose the 900 xp because when he level up, the xp go down to 0. Any way to fix this ?
If the user level up twice, the max_exp will only multiply once by 1.2, so if a user is level 1 and level up to 3, he will get the max_exp of a level 2 user.
If there is another way than doing it without the level_up, i will gladly take it.

Thanks for the help !

sentences:
Trouble with the State of things in XNA I'd decided to break the mold and make my first game based on RPG mechanics (note sarcasm).  An RPG style action bar would be a reasonable and fun way to get started as it's limited in scope but still challenging.

I have my spell bar and three targets.  I click a target, cast a spell, start the cast, put the spell on recovery cooldown, set the global cooldown, the spell goes through a casting phase then casts, the effect is applied to the target, mana is spent, the spell goes on cooldown or is removed depending.  Casting is animated, cooldowns are typical gray shading.  Then the other rules start to come into play.

When a spell is being the cast the target cannot be changed.
When a spell is on cool down we want a standard global cool down effect.
When a target has an effect we put a smaller version of the icon near
it which also has the same cooldown effect based on remaining
duration.
When the effect expires we need to remove it.
When something is on cooldown and another cooldown is triggered the
cooldown must become the longer of the two.
Each spell on a target has an effect such as damage or shield
Some effects, like shield, mitigate other effects, like damage

I've ended up with too many UI concerns checking the same pieces of data.  So my buttons have states, I tried the State Pattern, but ended up with the same type of crappy code in determining what state to set my objects to.

Take the example that a spell can't be cast if it's on cooldown.  Pretty straight forward as that's information the spell has about itself.  You can't cast if you have insufficient mana, getting more complicated because now I need to know about the state of the player to properly render the spell as shaded cause it's not available, can't cast on player if effect already exists, getting ugly now I need knowledge about the target and their effects as well.  Every one of these new situations resulted in my code bloating or getting stringy.

I'm event driven enough to detect clicks but should I go farther and be creating events for everything such as OnSpellCastBegin, OnSpellCastInProgress, OnSpellCastComplete, OnManaChanged, OnTargetChanged?

I would think it's the spell classes responsibility to answer if it can be cast but this requires it have a reference to the Player, and the PlayersTarget, and whatever else in the game in the future can effect a spell cast. What kind of design approach would support future adjustments to if a spell could be cast that followed the open/closed principal where I didn't have to modify the spell class every time?

thanks!

sentences:
How to write shaders that can be compiled for DirectX, OpenGL, and Vulkan I recently finished writing the DirectX renderer for my game engine.
Now I have an OpenGL, DirectX as well as a not yet finished Vulkan renderer.
Well, the majority of the renderers work perfectly now but I have a problem: I need a shader programming language.
The problem is that OpenGL and Vulkan use GLSL but DirectX uses HLSL (and Apple's Metal API uses MSL). So I searched for a High Level Shader Language and found only C for graphics from NVIDIA. But since this project was deprecated I looked for something else: Without success.
It's a bit annoying to write for 3 shader programming languages at the same time, so I'm looking for a language that can be translated into the native language immediately when the game starts (or is simply compatible with a lot of rendering APIs)
After several weeks of finding nothing, I decided to write my own language for it. But before I invest too much time I want to know if there is another solution to this problem.

sentences:
How to correctly create bullet rigid from custom .mesh in Ogre? Being new to 3d programming and bullet physics in particular, I am wondering how a 3d model or the mesh generated out of it effects the accuracy of bullet physics simulation.

I have written a small Ogre 3d application in C++, including/using bullet for physics. In a small scene I add a plane as ground and three boxes (simple blender objects that come with Ogre) that have their initial position a bit over that ground. So after starting the application those three boxes fall down until they hit the ground plane, where they move a bit, depending on their initial height and rotation, until they come to a halt.

Watching that scene the bullet physics simulation looks very accurate and realistic, also the boxes seem to touch the ground very exactly.

Ok, then I have created a box model in Sketchup 8 and exported it to an Ogre .mesh file. Then I use this model instead for those three boxes in my scene. The C++ code itself is not changed at all (except that I load the new .mesh file for the boxes).

However, even though on the screen those new box models look exactly as the original ones, their movement is not correct any more. They fall to the ground plane fine, but then they move very weird, it looks not as realistic as before. Even worse, after they have stopped their movement those three boxes now "float" a bit over the ground plane, they do not touch it. I can also see their shadow now below the box on the plane, so they are really not touching the ground plane.

TL;DR: Scene with three boxes, falling down to the ground, simulated by bullet. That works fine with default Ogre (blender) .mesh files for the boxes. But with custom Sketchup models (.mesh files) instead for the boxes, but the same code, the bullet simulation does not work correctly any more.

My question is: how does the mesh of a model impact the accuracy of bullet?
And: what can I do to solve that issue with my custom Sketchup models?

PS: I load the .mesh file and convert it to a bullet rigid body as following:

m_pSceneMgr->createEntity("Cube1", "Cube.mesh");
...
BtOgre::StaticMeshToShapeConverter converter(m_pSceneMgr->getEntity("Cube1"));
btCollisionShape* colShape = converter.createBox();

sentences:
Unable to enable IK on someone else's rig I'm using someone else's character rig for reference but I'm not sure how I can enable IK solvers for the arms.  The hand controller has a NURBS control with an ikBlend attribute, but when I try to use the "Enable IK Solvers" tool, I get an error saying the attribute is locked or connected.

Clicking "Unlock Selected" on the attribute doesn't fix it.  Breaking the connections also breaks the ability for it to drive the enabled/disabled state of the IK handle.

The rigged character can be downloaded here if anyone wants to try to help me out: http://www.antcgi.com/2014/06/03/free-model-15-kila-lods-rig-dynamics/

sentences:
Slow Processing Sketch My game runs through a processing sketch. When I export the .jar file from Eclipse, the sketch moves incredibly slow, but it runs at the proper speed in the IDE. Is there a way that I can fix the jar file and make it run faster?

Here's a GitHub: Machlandia GitHub

sentences:
Collision detection recommendations I am currently developing a prototype game for mobile devices in which the user will see several objects on the screen and will have to touch them one by one in the correct order to win. I guess it that you can say that it is similiar to a Whack a Mole game, but instead of having moles popping up on the screen, I will have several objects moving around.

I am having some difficulties in implementing a collision detection algorithm for this game, thefore I would like your recommendation on what is the best method to use.

For example suppose an object is moving in a given direction, then I could use the SAT to check if it collides with other objects. If it does collides, then it will stop and move in another direction which is randomly chosen.

Another option would be to divide my screen into square or hexagonal tiles. This way I could just check if the tiles are free or occupied before moving the objects.

My game be 2D and will use a top-down ortographic projection and I am developing it using Cocos2d-X and Marmalade SDK. I am not using any physics engine, because my game does not require them (the objects just have to move around, they don't bounce or need any sort of physics behavior).

sentences:
How can I respond to mouse events in AS3? Background:

Trying to make a simple "drop the ball" game.

The code is located inside the first frame of the timeline. Nothing more is on the stage.

Issue:

Using QuickBox2D I made a simple If statement that drops and object acording the Mouse-x position:

if (MouseEvent.CLICK) {
sim.addCircle({x:mouseX, y:1, radius:0.25, density:5});

I imported the MouseEvent library:

import flash.events.MouseEvent;

Nothing happens if I click, no output errors either.

See it in action:
http://gabrielmeono.com/download/Lucky_Hit_Alpha.swf
http://gabrielmeono.com/download/Lucky_Hit_Alpha.fla

Full Code:

    [SWF(width = 350, height = 600, frameRate = 60)]
import com.actionsnippet.qbox.*;
import flash.events.MouseEvent;

var sim:QuickBox2D = new QuickBox2D(this);
sim.createStageWalls();
//var ball:sim.addCircle({x:mouseX, y:1, radius:0.25, density:5}); //

// make a heavy circle

sim.addCircle({x:3, y:1, radius:0.25, density:5});
sim.addCircle({x:2, y:1, radius:0.25, density:5});
sim.addCircle({x:4, y:1, radius:0.25, density:5});
sim.addCircle({x:5, y:1, radius:0.25, density:5});
sim.addCircle({x:6, y:1, radius:0.25, density:5});
// create a few platforms

sim.addBox({x:3, y:2, width:4, height:0.2, density:0, angle:0.1});
// make 26 dominoes
for (var i:int = 0; i<7; i++){
//End
     sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0});
     sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0});

//Mid end

      sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0});
      sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0});
      sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0});
      sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0});
      sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0});

      //Middle Start
     sim.addCircle({x:0 + i * 1.5, y:09, radius:0.1, density:0});
     sim.addCircle({x:1 + i * 1.5, y:08, radius:0.1, density:0});
     sim.addCircle({x:0 + i * 1.5, y:07, radius:0.1, density:0});
     sim.addCircle({x:1 + i * 1.5, y:06, radius:0.1, density:0});
}

if (MouseEvent.CLICK) {
    sim.addCircle({x:mouseX, y:1, radius:0.25, density:5});

sim.start();
/*sim.mouseDrag();*/

    }

sentences:
How can I check if a player-drawn line follows a path? I want to draw an invisible path that the user must follow.  I've stored that path as points.  When a player draws a line, how can I test if it follows the path I've stored?

Here's an example for tracing the letter A.

if((traitSprite.getX()<=Invisible.X  && traitSprite.getX()>=Invisible.X )){...}

(traitSprite is a sprite.)

sentences:
Camera looking around with mouse - Unity, C# I am building a script in C# for camera logic in Unity, the camera is supposed to follow the player (a 3rd person character) around and the user should be able to look around using the mouse, so far everything works fine (the following logic and looking around on the horizontal axis) the problem is I can't get the camera to move along the vertical axis, left and right are fine but up and down are not working.

This is the C# script:

public class PlayerFollow : MonoBehaviour
{
    public Transform PlayerTransform;

    private Vector3 _cameraOffset;

    [Range(0.01f, 1.0f)]
    public float SmoothFactor = 0.5f;

    public bool LookAtPlayer = false;

    public bool RotateAroundPlayer = true;

    public bool RotateMiddleMouseButton = true;

    public float RotationsSpeed = 5.0f;

    public float CameraPitchMin = 1.5f;

    public float CameraPitchMax = 6.5f;

    // Use this for initialization
    void Start()
    {
        _cameraOffset = transform.position - PlayerTransform.position;
    }

    private bool IsRotateActive
    {
        get
        {
            if (!RotateAroundPlayer)
                return false;

            if (!RotateMiddleMouseButton)
                return true;

            if (RotateMiddleMouseButton && Input.GetMouseButton(2))
                return true;

            return false;
        }
    }

    // LateUpdate is called after Update methods
    void LateUpdate()
    {
        if (IsRotateActive)
        {

            float h = Input.GetAxis("Mouse X") * RotationsSpeed;
            float v = Input.GetAxis("Mouse Y") * RotationsSpeed;

            Quaternion camTurnAngle = Quaternion.AngleAxis(h, Vector3.up);

            Quaternion camTurnAngleY = Quaternion.AngleAxis(v, Vector3.up);

            Vector3 newCameraOffset = camTurnAngle * camTurnAngleY * _cameraOffset;

            // Limit camera pitch
            if (newCameraOffset.y < CameraPitchMin || newCameraOffset.y > CameraPitchMax)
            {
                newCameraOffset = camTurnAngle * _cameraOffset;
            }

            _cameraOffset = newCameraOffset;

        }

        Vector3 newPos = PlayerTransform.position + _cameraOffset;

        transform.position = Vector3.Slerp(transform.position, newPos, SmoothFactor);

        if (LookAtPlayer || RotateAroundPlayer)
            transform.LookAt(PlayerTransform);
    }
}

sentences:
OnCollisionEnter2D incorrect contact point? I am trying to shoot a bullet (rigidbody2d, boxcollider2d) to another enemy object (rigidbody2d, kinematic, circlecollider2d). I want the collision point between these two. When they collide, i want a collision particle effect and from the contact point, i want to create 5 rock objects all moving in different directions. How should i achieve this? Problem is that, the contact point i get seems incorrect. Collision particle effect is created when collision happens but the rock objects are created in some other point close to the contact point but not the contact point. Also how to i move the rock objects in different directions after instantiating them?

my code:

void OnCollisionEnter2D(Collision2D coll)
{
    if (coll.gameObject.tag == "Enemy")
    {
        ContactPoint2D contact = coll.contacts[0];

        GameObject rock1 =  Instantiate (rock, contact.point, transform.rotation) as GameObject;
        rock1.rigidbody2D.velocity = transform.up * 20;
        GameObject rock2 =  Instantiate (rock, newPos, transform.rotation) as GameObject;
        rock2.rigidbody2D.velocity = transform.right * 20;
        Destroy(coll.gameObject);
        Destroy (gameObject);
        Instantiate (explosion, transform.position, Quaternion.identity);

    }
}

sentences:
Lookup table in shader opengl es What I need is apparently very simple, a lookup table in a fragment shader. It seems that the natural way would be an array float lut[], but in some implementations of OpenGL ES I am getting an error

  "profile requires index expression to be compile-time constant".

Next approach would be a 1D texture filled with the values, but again OpenGL ES doesn't like that :)

What would be the simplest way to have a lookup table of 256 float elements in the fragment shader? (I guess it will be a 2d texture but it looks like it is some overhead and I am not sure if it's possible to handle two textures on a shader)

P.S. I am a very beginner in OpenGL but what I need is simple handling of images in textures.

sentences:
Carve river beds into existing 3d procedural generated terrain Ok, I've read many threads around about procedural terrain generation with rivers and roads but they suggest approaches from zero to result.

I'd like to know if exists an algorithm to apply to an existing vertex structure which models it by adding rivers beds like cuts through the slope of a mountain for instance.

This approach should:

not work on heightmaps, since my terrain is not generated with
heightmaps
modify the surface with randomness
according to the heights (river sources should be higher and the flow should descend)
be as realistic as possible (like not too many circular paths)

I have no needs for speedy algorithms. would be enought to have a separated algorithm to modify the surface so that I am not forced to do all the work during the creation of the terrain.

I tagged this question with c# because this project is written in c# using xna4.0 and in the case that someone knows any algorithms in different languages, c# is preferred (ye, this is optimism)

By the way, I'm looking forward to see if someone knows anything that could fit these needs

sentences:
Bounce off of objects How do I make my ball bounce off objects on the screen? I'm having trouble detecting the collision, as well as calculating the response.

The picture below is a good example of how the program should be working once the ball runs into an obstacle

I made the ball bounce off the walls, but what's left is making it also bounce off of objects. Thanks for the help!

Here's the source code:

public class 2DGAME extends Application {

    public static Circle circle;
    public static Pane canvas;
    private long counter = 0;
    double X = 0;
    double Y = 0;

    @Override
    public void start(Stage primaryStage) {

        canvas = new Pane();
        Scene scene = new Scene(canvas, 800, 600);

        primaryStage.setTitle("2D Ball Game");
        primaryStage.setScene(scene);
        primaryStage.show();

        circle = new Circle(20, Color.BLUE);
        circle.relocate(100, 100);

        final Rectangle r = new Rectangle(20, 20, Color.DARKMAGENTA);
        r.setLayoutX(400);
        r.setLayoutY(300);

        canvas.getChildren().addAll(circle);
        canvas.getChildren().addAll(r);

        Timeline loop = new Timeline(new KeyFrame(Duration.millis(5), new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X);
                    circle.setLayoutY(circle.getLayoutY() + Y);

//Code to bounce off walls
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

   //Bugged and not sure how to make it work
                    final Bounds rectangleBounds = r.getLayoutBounds();
                    boolean rectangle_left = circle.getLayoutX() <= (rectangleBounds.getMinX() + circle.getRadius());
                    boolean rectangle_right = circle.getLayoutX() >= (rectangleBounds.getMaxX() - circle.getRadius());

   //If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                    }
    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }

    //Bugged code for boucning off obstacle object
                    if (rectangle_left || rectangle_right) {
                       // X = X * - 1;
                    }

                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

sentences:
get access to Transform of a Clone in Unity In my game when you lose, A panel with a button on it appears and if you don't have enough coins, You may be directed to shop by hitting shop button. when buying is completed you can return to the scene from where you left it and resume the game. I'm using PlayerPrefs to save properties like slider.value my player position timescale etc, But I can't access to Transform of an Instantiated GameObject (Clone). it acts like obstacle and is Instantiated continuously. Here is my script;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CodeStage.AntiCheat.ObscuredTypes;
using CodeStage.AntiCheat.Detectors;

public class Spawner5 : MonoBehaviour {

    public float maxTime=1;
    public float Timer = 0;
    public GameObject pipe;
    public float height;

    // Use this for initialization
    void Start () {

        pipe = GameObject.FindGameObjectWithTag ("Gear");
    }

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

        if (Timer > maxTime) {

            GameObject newpipe = Instantiate (pipe);

            newpipe.transform.position = transform.position + new Vector3(4, Random.Range (-height, height) ,0);

            Destroy (newpipe, 15);
            Timer = 0;

        }

        Timer += Time.deltaTime;
    }
}

sentences:
XNA shader compiler error in release mode I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio.

I want to pass a float into my pixel shader, clamp it to a value, and then return it as part of the color. Here is my shader code:

float test;

float4 PixelShaderFunction(float2 texCoords:TEXCOORD0) : COLOR0
{
    float n = clamp(test, 0, 1);
    float4 color = float4(n, n, n, 1);

    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

Here is how I'm using the shader:

    protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            simpleEffect.Parameters["test"].SetValue(-1f);
            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, simpleEffect);
            spriteBatch.Draw(pixelTexture, new Rectangle(10, 10, 100, 100), Color.Red);
            spriteBatch.End();

            base.Draw(gameTime);
        }

The shader compiles fine when Visual Studio is set to Debug mode, but when I set it to Release, it gives me the following error (Please excuse the ShaderModel3Bug solution name... I get the same error with both shader model 2 and 3):

Error   1   Errors compiling E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx:
(15,23): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx 15  23  ShaderModel3Bug

Line 15 of the shader is this:

PixelShader = compile ps_2_0 PixelShaderFunction();

I have tried compiling the shader directly using fxc.exe that comes with the June 2010 DirectX SDK. Using the command fxc.exe /T fx_2_0 E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx /Fc:output.fxc, I get:

Microsoft (R) Direct3D Shader Compiler 9.29.952.3111
Copyright (C) Microsoft Corporation 2002-2009. All rights reserved.

compilation succeeded; see C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x64\output.fxc

So my question is, why can't Visual Studio compile the .fx file in Release mode? Am I doing something I shouldn't be doing?

Update

Apparently XNA Game Studio doesn't use the latest version of fxc. I downloaded the March 2009 DirectX SDK, and the compilation fails with the same generic error message as Visual Studio:

C:\Program Files (x86)\Microsoft DirectX SDK (March 2009)\Utilities\bin\x64\ps.fx(16,23): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed

compilation failed; no code produced

If I run the March 2009 version of fxc.exe with the /Op (disable preshaders) flag, it compiles successfully... I am still not sure what version of fxc xna uses, or what I need to do to get my shader to compile in release mode. Any help would be appreciated.

sentences:
Why does this Unity code work as expected only with the while loop? In unity, in C#, I have the following code in Awake():

Awake()
{
    Transform obj = InstantiateTarget();
    //the bizarrely required and "working" loop
    while (transform.childCount > 0)
    {
        //assign all current children to the replacement object
        foreach (Transform t in transform)
        {
            t.parent = obj;
        }
    }

    Destroy(gameObject);
}

Without the while loop, some random set of the transforms children are destroyed by that end Destroy. With the while, it works exactly as expected (all transform's children become obj's children).

Also, surely with it, there should be an infinite loop (if nothing is changing in another thread, as implied by unity docs). This is in Unity 3.5.

Why does it only work with the while loop? And why doesn't unity get stuck in an infinite loop?

sentences:
SpriteBatch Draw Using Floats with the Destination Rectangle So I created a nice little isometric tile engine and I have it so that when you scroll with the mouse it changes a variable called scale. Scale is a float and gets passed through the spritebatch.draw() function. I apply scale to all of the math I do when generating the positions of the tiles.

The problem I am having is Rectangle will not accept float numbers so when I make my Dest Rectangle for the spritebatch.draw() I can not use the numbers I need to because they are now floats.

I tried using vector4 instead of rectangle but the spritebatch.draw was throwing an exception saying it was expecting Rectangle not Vector4.

Is it possible to draw the dest rect using floats instead of ints?

Btw the scale is all working properly however since I am casting the floats to ints any scale that should have a decimal gets truncated and I end up with spaces between my tiles.

sentences:
Latency issue on multiplayer game networking I am currently writing a 2D top-down shooting multiplayer game using Java.
I have a game loop at the client-side that does the following in order in each game tick (The client is running in a tick rate of 60 t/s):

client_gameloop{
    1. Send an input sample (an object storing info about what keys are pressed)
       to the server through a DatagramSocket
    2. Receive info on change in game state from the server
    3. Update the client-side game state through the received info
}

For the server-side, I have a game loop that does the following in order in each game tick (The server is running in a tick rate of 60 t/s):

server_gameloop {
    1. Read an input sample through a single DatagramSocket
    2. Using the input sample to apply physics to the game world and update the game state
}

When I try to connect the first client to the server, the game flows fluently with unnoticeable delay. However, when I try to connect the second client, both first and second client start to lag behind the server greatly (delay ranges from 5s to 10s). I am currently stuck on what causes the delay. Am I handling the sending and receiving of info between client and server in a wrong way that causes game state in the server-side not being able to synchronize with those of clients'?

sentences:
Find projecting triangle for UV mapping in RuneScape model format I am using an old Runescape model format, also used by Thief and Quake. In this format, instead of specifying UV coordinates for each vertex ABC, we specify a second trio of vertices PMN. Those vertices are then used to project UV texture coordinates onto ABC.
Some previous Q&A explains this projection algorithm and how to reverse it.
I have a mesh with UVs that I want to save in this format. To do that, I want to find a trio of vertices PMN for each triangle ABC that reproduce the correct UVs.
These PMN vertices are chosen from the collection of vertices already in my mesh.
I could search every possible ordered triangle in my mesh, but that scales as \$O(n^3)\$ and would be impractical for meshes with high vertex counts.
How can I more efficiently find a PMN triangle that produces my desired UV coordinates on each triangle ABC?

sentences:
Get MonoBehaviour components from Prefab I need to assign the script values for the following Prefab in Unity 3.5

The structure is the following

Kinect_Prefab

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

All the components have the same name.

I have tried to obtain all of them in an array, but the GetComponents method does not seem to work properly.

var mono : MonoBehaviour[];
mono = Kinect_Prefab.GetComponents(MonoBehaviour);

The thing is the resulting array is empty.

Any idea what might be wrong?

EDIT: When I do GetComponents(MonoBehaviour) I get the following error

InvalidCastException: Cannot cast from source type to destination type.

I have tried receiving the components in var mono : Component [] but I still don't receive anything

sentences:
Why doesn't light continuous on my model? I created a basic textured cube model with Blender to practice modeling, and then I imported it into Unity. After I put up some lighting it looks pretty ugly. The light is not continuous on a row of textured cubes:

What is more odd, the light on the blocks that makes up the floor is continuous. What am I doing wrong?

This is what it looks like without textures:

If I did not know that these are perfect cubes, I'd say there is a slight curve on surface. I also tried lightening the texture but it also didn't help:

I just simply exported the model from Blender and did not set up any normals or things like that. However, I also did not do anything special with the floor brick model.

Checked the normals and they seem to point to the right direction.

Also I don't really see the difference between the two models.
On the textures panel I also set the projection to flat:

I checked the different panels in Blender and the only normal-related option on the "Object Data" panel is this "Auto Smooth" and it is turned off by default:

sentences:
Why is Unity ignoring my camera on Android? I am making a TV remote app for a specific android device (the Pixel XL, 1440x2560 resolution). However, when I put the app on my phone, it truncates most of the app.

Here's what it should look like:

Here's what it ends up looking like:

My game is forced in portrait, and I want to keep it that way.
I have tried rotating the canvas, but that does nothing. The Android app also seems to ignore the main camera; I think it is just using the canvas.

I tried many different things, including changing the scaling and setting the anchors.  None of this had any effect. I have even set the editor Game window to the target resolution, but it appears to work via the editor.

Why is Unity ignoring my camera on Android?

sentences:
Unity, OnMouseOver blocked by another gameobject with a collider in front of it I have two gameobjects, both with 2D colliders.

One of them can be behind the other, and because of this its OnMouseOver can be blocked from firing as the GameObject in front blocks it from triggering.

What is a way around this? I really like the ease of using OnMouseOver, and would rather not use raycastAll.

Asked this question on SO, maybe it should be asked here.

sentences:
How to implement cheat proof trading system in a game? I want to make a game where you can trade items you find from the world, the world would be static, so the master server would always know exactly how much items of X there are etc.

What should i take into account when building such a system?

I want to avoid people being able to cheat and filling the game with free items, but at the same time i want it to be as less server dependant as possible, as i cant afford buying thousands of servers just to run their games on them constantly, even if i had the money, i would prefer not make people to rely on my servers so they can be playing it at any time they want at anywhere, but if they want to ensure the validity of the objects he is going to buy from someone, he would have to connect to the master server if he wants to ensure the objects validity.

But how could i know which objects are genuine and which are fake? So i thought i would give each object in the world an unique ID which cannot be guessed. But then again, wouldnt i have to somehow prove that i collected those items with valid actions? And how could i possibly do that without making the server to run my game from the beginning? And how could i prevent someone trading the same item twice etc.

So i thought i could use a Bitcoin system, but i dont know much about it and im not sure would this be an option since there would be a lot of trading, and a lot more "coins" to trade, so the amount of history information might be too much to handle, not to mention i want to prevent people from cheating in any way, for example you cant trade stuff from the other side of the world and magically teleport the items there (assuming you dont own a teleport atm), you would have to move the items across the world, which would take some time. Also im not very excited about the fact that Bitcoins generation will use intense amounts of CPU power, and im not sure would there be enough Bitcoins for everyone to use; everyone should have equal chance of getting items without depending how fast CPU they have, and im not sure how it would work with fractions of items (like 0.1 of money etc).

Any thoughts and ideas appreciated.

sentences:
Servers are never available to download CryENGINE I have been having some trouble downloading the CryENGINE. I am directed to log in and download the engine through the CryENGINE Launcher, but whenever I try to log in, I get the error "Login failed. Server unreachable."

I can not find any reports of server malfunction, and others seem to be using it perfectly fine. This has gone on for over a week now. Whats going on?

sentences:
Unity game crashing when dialogue with NPC initiated I have 3 NPCs in my "Game". When the player walks up to any of them, they're supposed to have their own dialogue; I've tested this, and they do.

I tried to create a display that shows this dialogue text using a TextMeshProUGUI attached to a blank GameObject called dialogDisplay (tagged DialogDisplay). There is one DialogDisplay object in the scene that I'm trying to get each of my NPC's to use. I tried to make the display object inactive in the NPC Start() function, and enable it when it's time to display the NPC's next sentence.

When I run my game, I get an error on line 21, where SetActive() is called: "Object Reference Not Set to an Instance of an Object".

Here's the NPC script (DisplayNextSentence() is at the bottom, where dialogDisplay is used):

public class NPC : Character {
private bool charInRange;
public Dialogue dialogue;
public bool talkedTo = false;
private Queue<string> sentences;
public TextMeshProUGUI textPro;
public GameObject dialogDisplay;
private bool isTalking;

// Use this for initialization
void Start () {
    charInRange = false;
    textPro = FindObjectOfType<TextMeshProUGUI>();
    dialogDisplay = GameObject.FindGameObjectWithTag("DialogDisplay");
    dialogDisplay.SetActive(false);
}

// Update is called once per frame
void Update () {
    //if player is in range and presses space, triggers NPC dialogue
    if (charInRange && Input.GetKeyDown(KeyCode.Space))
    {
        TriggerDialogue();
    }
}

//if Player gameObject is in NPC collider, player is in range
void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        charInRange = true;
    }
}

//if player exits NPC collider, player is not in range
void OnTriggerExit2D(Collider2D other)
{
    if (other.gameObject.tag == "Player")
    {
        charInRange = false;
    }
}

//if NPC has been talked to before, displays next sentence; if not, loads dialogue and displays first sentence
private void TriggerDialogue()
{
    if (!talkedTo)
    {
        talkedTo = true;
        StartDialogue(dialogue);
    }
    else
    {
        DisplayNextSentence();
    }
}

//loads a queue with lines from Dialogue and displays first sentence
public void StartDialogue(Dialogue dialogue)
{
    sentences = new Queue<string>();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();
}

//displays next sentence in the queue
public void DisplayNextSentence()
{
    string sentence;
    bool done = false;

    //if last sentence in the queue, display it again
    if (sentences.Count == 1)
    {
        sentence = sentences.Peek();
        textPro.text = sentence;
        Debug.Log(sentence);
        return;
    }

    sentence = sentences.Dequeue();
    textPro.text = sentence;
    dialogDisplay.SetActive(true);
    while (!done) {
        Debug.Log("In WHile Looop");
        if (Input.GetKeyDown(KeyCode.A))
        {
            done = true;
        }
    }
    dialogDisplay.SetActive(false);
}
}

Grateful for any insight or tips you can provide. Happy to provide further information if it helps. Thank you!

sentences:
Implementing Vehicles in your game In the game i am creating as an hobby (learning is the primal goal of it all) i plan to implement a space ship that the player can enter and use to explore it. I tried to search the internet for the concept of vehicle implementation but i couldnt find anything worth mentioning, and before I start writing the code I really want a clear idea of what I strive for. So id like to ask the pro game developers how should I look at a vehicle, should I think of it as a player's body extention with different mechanics? or should I just think of it as a usable exterior object? What kind of link should be between the player and the drivable vehicle? How do games usually do it, like GTA 2 and that kind of games?

Main Question: What is the basis of vehicle implementation?

P.S. I dont think its important to mention but the game is 2D and top-down perspective, so i guess GTA 2 can be a close reference to what i wanna do, although the gameplay is very different, but ye, the vehicle implementation i want is similar to GTA 2 although i only plan to do a space ship for now.

sentences:
Vector Art Tool: Size, Position, Shapes, Symbols I'm looking for a vector art tool for gameart, similar to Flash, but preferably free. It just needs the following capabilities:

Create vector images (can scale up/down without losing quality)
Specify shape X/Y to the pixel (eg. set the X to 24.1, like in Flash)
Draw primitive shapes (square/circle/triangle) with border and colour (or gradient)
Specify shape width/height in precise pixels
Export to PNG

Flash can do all this, but it's expensive (and heavy to install). Is there a free alternative that I can use?

This is NOT for pixely, pixel-style art.

sentences:
Advantages And Disadvantages Of Resource Serialization A good example is let's say I'm making a pong game. I have a PNG image for the ball and another PNG image for the paddles. Now which would be better, loading the PNG images with a PNG loader, or loading them in a separate program, serializing it, and de-serializing it in the game itself for use?

The reason why this may be good to know is because it seems like game companies (or anyone in the long run) build all of their resources into some sort of file. For example, in the game Fallout: New Vegas the DLCs are loaded as a .ESM file, which includes everything it needs, all the game does is find it, serialize it, and it has the resources. Games like Penumbra: Black Plague take a different approch and add a folder which contains all the textures, sounds, scrips, ect that it needs, but not serialized (it does this with the game itself, and the DLC).

Which is the better approch and why?

sentences:
Naive minmax optimizations I'm working on a perfect information game in my spare time. I've implemented a naive minmax algorithm for the computer player. I've further optimized it using alpha-beta pruning.

What I'm looking for is next logical steps to improve the speed of the search (currently the computer player searches 5 nodes deep with acceptable time taken).

sentences:
Best practices in managing character states While in development of a character, I feel like I'm digging myself deeper into a hole every time I add more functionality to him, creating more bugs and it seems like my code is tripping over itself all over the place.

What are the best practices when managing character states for a character that has a large selection of abilities and actions that they can perform, without their abilities interrupting each other and creating a mess overall?

sentences:
Shadow flickering with first-person near clipping plane After adding a first-personal controller asset, world shadows flicker like crazy. I don't understand the cause, and everything I've tried based on googling has failed to help.

https://i.imgur.com/Mx5MCKB.gifv

I've tried:

Increasing the near clipping plane of the camera. The first-person asset I have defaults to 0.01. Changing it to 0.1 or higher seems to solve the issue, except that breaks the first-person view.
Toying with bias value on the directional light
Changing Render Mode from Auto to Important on the directional light
Changing the Shadow Projection quality to Stable Fit

The authors of the asset have not been able to help, though it doesn't seem to be specifically related to their product, just the clipping planes required.

I'm using Unity 2019.1.2f1 Personal.

sentences:
C++ : Library for creating 3d view picture I've got a numerical simulation, where I have as an output 3d matrix of billion elements - the visualisation of data is 2d flat image:

When I was starting I was just outputting 2d data to gnuplot, now I generate png file in program itself (to cut generation time). I would like now to get a 3d picture (in flat png) from my billion elements 3d matrix - in isotropic view etc. I found on the Internet things like ImLib3d for image processing, but I am afraid it's not what I am looking for.

sentences:
How to combine objects in a rendered scene with and without bloom effect? I'm working on a game and engine as I go under OpenGL.

I've had a bloom effect in place for a while that works as a post-procesing effect on the entire screen. It's been fine up until now.

I have an object that is made up of a few meshes, and one of these meshes is mostly white. The result is it blooms like crazy, but I really don't want it to.

The only way around it I can see is that the objects I do want to have bloom would need to be rendered to a bloom-framebuffer from which I can bloom (and store the depths) to then mix back in with the rest of my scene.

Is this the only way to go about it? It seems like a lot of work to simply isolate something from a screen-wide affect.

sentences:
Game Asset Storage: Archive vs Individual files As I am in the process of creating a 3D c++ game and I was wondering what would be more beneficial when dealing with game assets with regards to storage. I have seen some games have a single asset file compressed with everything in it and other with lots of little compressed files.

If I had lots of individual files I would not need to load a large file at once and use up memory but the code would have to go about file seeking when the level loads to find all the correct files needed.

There is no file seeking needed when dealing with one large file, but again, what about all the assets not currently needed that would get loaded with the one file?

I could also have an asset file for each level, but then how do I deal with shared assets

This has been bothering me for a while so tell me what other advantages and disadvantages are there to either way of doing things.

sentences:
Creating big scene and little size chasing camera I would like to create a climb based game, so I need to have a big scene and a camera that cover only a little part of it and chase my player. This image explains easier what I want:

How can I do it? I'm trying to resize my camera size only, but I don't get the desired result.
Thank you.
s.

sentences:
Make a square flickering at a preset frequency I'm working on a medi-sci project where I want the patient to use brainwaves to exercise control the environment.

The environmnet is a 2D game where the game character is to be controlled by 2 flickering squares. Each square are supposed to be on different frequencies e.g. 7Hz and 9Hz. They should flicker between black and white.

These frequencies will be measured on the brain and used to move the characters in a BCI solution. The project is being made in Unity and in c#.

I tried to use the animator and the Update function in Unity to get a flickering but it didn't work out (Read: It was very bad) because when the game became slow so did the flickering. I couldn't use that.

A friend told me that there's a difference between CRT and LCD screens so the refresh rate is different and can't be used the same way.
I was also told to look into Timer.Interval in C# (or just the Timer class) and use that to switch between black and white squares to get the right frequency.

Is there anyone who could show me how to do this the right way in unity with C#?
I mean how can I use Timers.Interval or System.Timers.Timer (or something else in the Timer class) to give me the right frequency in Unity?

I would prefer an example because I can't see any way of getting to the solution at all...

sentences:
Are there any OpenGL ES 2.0 examples for JOGL? I've scoured the internet for the last few hours looking for an example of how to run even the most basic OpenGL ES 2 example using JOGL but "by Jupiter!" it has been a total fail.

I tried converting the android example from the OpenGL ES 2.0 Programming Guide examples (and at the same time looking at the WebGL example -- which worked fine) yet without any success.

Are there any examples out there?

If anyone else wants some extra help regarding this question see this thread on the official Jogamp forum.

sentences:
Where do you put assets on iOS 5.1 apps? I'm starting with iOS 5.1 and I'm trying to figure out how to download/and load asset files to the iPad, such as sprites and sounds.

Previously I think I packed them into a .xib file for iOS 3, (wasn't .xib for general user interfaces?) but I'm not sure if this practice is outdated with the new GLKit package.

sentences:
Alternative ways to construct maps I've searched around and it seems like most people are using tile-based map systems.
I suppose, this question is more theoretical than practical (I am not very concerned about memory or performance speed), but I want to know: what other ways can a map be created in a game?
A map being a graphic representation of terrain that can be navigated, has entrances and exits, and boundaries (no-go zones).

Besides using text files to store and arrays to load tile data, one idea I had, was to store a map entirely as a graphic file and use queries on the pixel colour to determine boundaries (i.e. you can only move in a certain direction if the way is bright enough in that direction).

What other creative map systems are out there?

sentences:
How can I make outline shader like "Life is Strange"? I want to make sketch shader like life strange.

shader has two part:

1.animated dashed line

2.noisy outline

I like to know how can I make noisy outline?

see outline of objects

First I tried to make outline by copying of incoming vertex data and scaled according to normal direction then Cull Back.but I think it's something like Image effect because outline sometimes move inside of object.
anyway I will appreciate if someone help me to Implement this shader :)

What I tried

I used edge detection and animate it by vertex shader but this isn't good like above gifs.

sentences:
How do you prepare for feature creep? How can I prepare for feature creep during preproduction?

Feature creep is when you are in the production phase and decide "It would be cool if this were a feature!" That adds n hours to the development time which were not accounted for, and unless you are Blizzard, do not have the time for. You cannot anticipate it being a cool feature during preproduction, because the feature is only discovered during production.

What can I do during preproduction to account for or prevent or prepare for feature creep?

Should I allow feature creep and cut less desired features? Or will this create a problems since the architecture is not designed for the new features? Should I say no features unless they fit into the existing architecture?

I know this is a broad question, but I hope it doesn't get closed as such. This is a major issue in game development, and should be considered.

sentences: Why did an Android update disable  the textures in my game? I recently updated my tablet to Android 4.0.3 and now the textures for my game do not show up. I'm using OpenGL-ES 2.0 for my engine. It worked fine when I was running android 3.0.  Is there any reason as to why this is happening?

sentences:
DirectX 11 GenerateMips only works with premultiplied alpha? The GenerateMips method in the ID3D11DeviceContext allows generation of mipmaps at runtime, which is fine for fully opaque textures. However, when this method is used with transparent textures that do not have premultiplied alpha, the resulting mip levels tend to have black outlines at the transparency edges. For instance, this PNG texture, loaded through WIC and processed with GenerateMips, produces mipmaps with edge pixels that are way too dark:

My question: Is there any way to specify to that this texture uses non-premultiplied alpha, so that DirectX can generate more correct mip levels?

sentences: What is the price to license EA's GlassBox game engine? "SimCity 5" is powered by the GlassBox engine. If we want to use the engine for building our own simulations, what is the price for a license?

sentences:
ParticleEffectPool.obtain() not resetting particles I want to use ParticleEffectPools in libGDX but I'm running into an odd issue where the effects don't seem to be reset when obtained by the pool. The code below looks for an existing ParticleEffectPool for the named effect, creates one if necessary, and then obtains a particle effect for the newly created Actor. The particle effect should be reset in the obtain function (if you look at the source it does so). What happens is the first effect works as expected but every subsequent one flashes very briefly on the screen as if its run out of duration.

public class ParticleEffectActor extends Actor {

    private static final Map<String, ParticleEffectPool> ParticlePools = new HashMap<>();
    private final PooledEffect effect;

    public ParticleEffectActor(String effectName, float rotation) {
        if(!ParticlePools.containsKey(effectName)) {
            ParticleEffect particleEffect = new ParticleEffect();
            particleEffect.load(Gdx.files.internal("resources/particles/" + effectName + ".p"), Images.Atlas);
            ParticlePools.put(effectName, new ParticleEffectPool(particleEffect, 10, 50));
        }

        this.effect = ParticlePools.get(effectName).obtain();

        rotation -= 90f;
        for(ParticleEmitter emitter : effect.getEmitters()) {
            emitter.reset();
            ParticleEmitter.ScaledNumericValue angle = emitter.getAngle();
            angle.setLow(rotation - 35, rotation + 35);
            angle.setHigh(rotation - 35, rotation + 35);
        }
    }

    @Override
    public void draw (SpriteBatch batch, float parentAlpha) {
        effect.draw(batch);
    }

    @Override
    public void act (float delta) {
        super.act(delta);
        effect.setPosition(getX(), getY());
        effect.update(delta);
    }

    @Override
    public boolean remove() {
        effect.free();
        return super.remove();
    }
}

sentences:
More realistic currency for spaceship battle game This is slightly related to real development but as you know hardest thing to do for developer is naming things. So now I can't figure out what specific currency to use in my spaceship battle game.

Little about game: Space, universe, spaceships, battles. Ships can be destroyed, damaged, repaired, aliens (multi-race) - typical spaceship game. Multiplayer, turn-based, battles not limited to 1 vs 1 - can be different count in both teams (70 vs 45).

Struggle is I want more realistic currency than just credits, gold, crystals etc. Because game currency should be related to battles, repair etc. And maybe (but not mandatory for now) with context to other alien races.

All options is viewed from game character perspective not player.

Requirements:

Something to get after battle (imagine destroyed ship, what to salvage)
Used to repair ship (can be as part of some kind of tool)
Valuable stuff to give someone in distinct part of universe
Space pirates would want to have this stuff

1. Credits (EVE, Elite:Dangerous)

Fictional. No context to game universe at all.

2. Crystals or other minerals (majority of games?)

Game related, fictional value.

This works but if we think in scope of Universe as whole for some aliens this mineral could be worth nothing.

3. Scrap metal (FTL)

Game related , real value.

Best option for now is scrap, scrap metal as you know "FTL" game is using. This works only if we assume all ships in all universe using metal for building spaceships.

It can be used as repair material, it can be found after battle even if ship is empty.

Kinda feel bad to steal this currency from FTL as I love that game :)

4. exotic currencies

Using these would be interesting but need

time - Works great with repairing stuff
information - Great currency to salvage after battle from another ship, but fails to for repairing ship.
more?

Summary

I know there is quite obvious answer but wanted to reach to others and maybe hear something I never though of.

Maybe you can write your pros and cons about every currency i mentioned or point out something where to look?

sentences:
Why are games using interpreted languages instead of compiling code into libraries and calling them at runtime? Say I want to include a game mechanic where players are invited to code up some algorithm to control robots which would defeat the enemy and protect the tower efficiently. Most games I've seen to implement something like that, support Lua. But what if they accepted a .Net compiled library with implemented in C# (or Java for example) interfaces, essentially doing the same thing? How is it a better or a worse choice?

Code may (not) compile in either case. Some players may (not) be familiar with one of the languages. The computer may not have .Net (or Java) framework installed (but then the game usually comes with at least some redistributable packages, so it may as well include those too). These obvious arguments go either way. Is there some important reason that interpreted languages are the norm, and not compiled which I'm not aware of?

sentences: Is there a way to apply euphoria physics (ragdoll) to rigged Sprites in Unity2D? With euphoria physics I mean the realistic object interaction and freefall as seen in most games like recent GTAs. But I want to do that in 2D. (I am a beginner :P).

sentences:
Exporting XNA class library as a DLL file I have downloaded an open source project that I intend to use with my current game. The download came with all the class files from the original project as well as a pre-compiled DLL file representing the project. I was able to easily link this DLL with my current project and get it working just fine, no problems there.

The problem I now have is that I want to make a couple of changes to the original libraries (extend its functionality a bit to better suit my needs) and re-export the class library as a DLL again, but I have no clue how to do this. Is there some simple way in VS where I can just take the class library and export/compile it as a DLL file again or is there more to it than that?

This seems like something that should be pretty simple but my efforts to find an answer have so far come up with nothing.

Thanks in advance.

sentences:
How to set multiple times, in a single spritebatch, the same pixel shader parameter I make a test with Effect class in XNA and I want to set multiple times the same parameters (MyParameter in below code).

My code is :

[...]
//In Engine class
Effect ShaderEffect = GameEngine.Instance.Content.Load<Effect>(@"shaders\test");

spriteBatch.Begin(
    SpriteSortMode.Deferred,
    BlendState.AlphaBlend,
    SamplerState.PointWrap,
    DepthStencilState.Default,
    RasterizerState.CullNone,
    ShaderEffect);

[...]

//in drawable class
foreach(//big loop) {
     ShaderEffect.Parameters["MyParameter"].SetValue(//random vector4);
     spriteBatch.Draw(
            SpriteSheet,
            ScreenRect,
            sprite_to_draw.Rectangle,
            color,
            rotation,
            Scene.getInstance().Camera.Position,
            sprite_to_draw.SpriteEffect,
            layer
     );
}

[...]

//In Engine class
spriteBatch.End();
[...]

But on my screen it look like the Parameter "MyParameter" is not overwrite.

So can I overwrite it and If yes do you know how ?

Thanks

sentences:
How to correctly export UV coordinates from Blender Alright, so I'm just now getting around to texturing some assets. After much trial and error I feel I'm pretty good at UV unwrapping now and my work looks good in Blender.

However, either I'm using the UV data incorrectly (I really doubt it) or Blender doesn't seem to export the correct UV coordinates into the obj file because the texture is mapped differently in my game engine. And in Blender I've played with the texture panel and it's mapping options and have noticed it doesn't appear to affect the exported obj file's uv coordinates.

So I guess my question is, is there something I need to do prior to exporting in order to bake the correct UV coordinates into the obj file? Or something else that needs to be done to massage the texture coordinates for sampling. Or any thoughts at all of what could be going wrong?

(Also here is a screen shot of my diffused texture in blender and the game engine. As you can see in the image, I have the same problem with a simple test cube not getting correct uv's either)

Edit -

Added my geometry pass shader source code to show how I'm rendering and sampling the diffuse texture. I'm simply using the UV coordinates provided by the obj file and an anisotropic sampler.

Texture2D    diffuseTexture : register(t0);
SamplerState textureSampler : register(s0);

cbuffer ObjectTransformBuffer : register(b0) {
    float4x4 worldTransformMatrix,  // Translates to world space.
             cameraTransformMatrix; // Translates to camera space. (not including rotation)
};

cbuffer ScreenTransformBuffer : register(b1) {
    float4x4 viewProjectionMatrix; // Rotates to camera space and then projects to screen space.
}

cbuffer MaterialBuffer : register(b2) {
    float3 materialDiffuseAlbedo;
    float  materialSpecularExponent;
    float3 materialSpecularAlbedo;
    bool isTextured,
         isLighted;
};

struct vsInput {
    float3 positionLS : POSITION;
    float3 textureLS  : TEXTURE; // Input signature uses a uvw coordinate but w is 0 and not needed for any geo pass textures.
    float3 normalLS   : NORMAL;
};

struct vsOutput {
    float4 positionCS : SV_POSITION;
    float2 textureLS  : TEXTURE;
    float3 normalWS   : NORMAL;
    float3 positionWS : POSITION;
};

struct psOutput {
    float4 positionWS : SV_Target0;     // Surface positions.
    float4 normalWS   : SV_Target1;     // Surface normals.
    float4 diffuseAlbedo : SV_Target2;  // Surface diffuse albedo.
    float4 specularAlbedo : SV_Target3; // Surface specular albedo.
};

vsOutput VS( in const vsInput _in ) {
    vsOutput _out;

    _out.positionCS = mul(float4(_in.positionLS, 1.0f), mul(cameraTransformMatrix, viewProjectionMatrix));
    _out.positionWS = mul(float4(_in.positionLS, 1.0f), worldTransformMatrix).xyz;
    _out.normalWS   = mul(float4(_in.normalLS, 0.0f), worldTransformMatrix).xyz;
    _out.textureLS  = _in.textureLS.xy; // w coordinate is 0 and not needed.

    return _out;
}

psOutput PS( in vsOutput _in ) {
    psOutput _out;

    // Use the alpha channel to indicate specular light intensity.
    _out.normalWS = float4(normalize(_in.normalWS), materialSpecularExponent);

    float _lightEffectModifier;
    if (isLighted)
        _lightEffectModifier = 1.0f;
    else _lightEffectModifier = 0.0f;
    // Use the alpha channel to indicate whether the surface is affected by light for the light pass.
    _out.positionWS = float4(_in.positionWS, _lightEffectModifier);

    _out.diffuseAlbedo = float4(materialDiffuseAlbedo, 1.0f);
    if (isTextured)
        _out.diffuseAlbedo *= diffuseTexture.Sample(textureSampler, _in.textureLS.xy);

    _out.specularAlbedo = float4(materialSpecularAlbedo, 1.0f);

    return _out;
}

sentences:
Unity2d: orthographic camera and z-axis? I wonder if anyone can help with an explanation of the z-axis and using unity with 2D with an orthographic camera.

Up until now i have only been modifying the x and y values of game objects, thinking this is the correct way. i thought the Z axis didn't exist in 2D space (i.e. unity 2d with orthographic camera) but I do notice that the orthographic camera is placed at -10 on the z axis, if i change this value then the camera disappears. I sort of began to accept that.

Now I cam to a point where I wanted to rotate something, and I notice that rotating eithe on the z or x axis, doesn't seem to do anything, only on the z-axis, there is that z-axis again !

Can anyone tell me when i should be worrying about the z axis in unity using 2D games.

It seems now that it is more important than I once thought :-)

Thanks in advance.

sentences:
Camera scrolling hiccups I'm working on a 2D side-scroller, and I've got the technical aspects working. OpenGL renderer, camera movement using acceleration.

However, while scrolling I'm constantly seeing tiny random hiccups. Split-second pauses, just enough to cause the perception of smooth scrolling to feel choppy instead. Turning on VSync actually accentuates the hiccups. But when I display frame render times, it's always constant (well, constantly flipping between 0.016 and 0.017 second). So far it's just a render loop, no processing going on in the background.

When I look at other 2D side-scrolling games, I never see this stutter, so I don't know if there's something I'm missing that other games know to do...

I recorded a video of it from my phone, on a repeating row of tiles, to show what I mean. It's poor quality, but recorded at slow-motion to emphasize the hiccups. Any tips on how to get rid of this would be great.

sentences:
How to fake flipping a skeleton in Box2D? Imagine I have a skeleton — that is a set of bodies held together through various constraints and joints — and I want to flip it. Bodies cannot be flipped in Box2D, so how can I fake that?

Here's an example: I have a humanoid skeleton, made out of different Box2D bodies: the head, torso, upper arm, lower leg, etc. These Box2D bodies are held together by joints. Some of the joints have angle constraints, like the ones between the upper and lower arm, which do not allow the 'elbow' to twist unnaturally.

When I turn my character the other way around, I should flip the skeleton and its joints should be flipped as well. How can I achieve that in Box2D?

sentences:
Sprite character/item less than tile size I am starting to work on a 2d top down tile-map game for fun and learning purposes. I have read some great answers here re tile-map size vs character sprite size, pixel density, ppu, screen resolution etc.

A standard route is to set a constant PPU and do characters as 2 tiles (vertically usually). We went with 32x32 pixels for the tile and 32x64 for the character.

Unfortunately, our artist didn't draw the character to fill out that space on the extremes (the feet and head do not touch the vertical edges and there is also space between the character and the horizontal edges) and when Unity slices the sprite-sheet we get smaller characters of 28x53.

I imagine this is a problem for keeping the consistency I outlined above with the tile size.

Is this a problem? If so, are the solutions to this to either change the tile size to 28x28 or ensure that the sprite design actually fills the tile space (that is, touching edges of the 32x64 area)? Must one draw items as always filling out the full tile size or can one make, say potions, in a 32x32 tile but only take up say 12x16?

sentences:
How to determine the best approximate direction I want to determine which sprite to use when one agent is "facing" another agent.

My game is 2d, and uses 8-directional movement. Deciding which sprite to use for movement is easy enough since there are only 8 options when moving form one square to another.

def direction(self, start, end):
    # method for determining facing direction
    s_width = int(start[0])
    s_height = int(start[1])
    e_width = int(end[0])
    e_height = int(end[1])
    # check directions
    if s_height < e_height and s_width == e_width:
        return 'down'
    elif s_height < e_height and s_width > e_width:
        return 'downright'
    elif s_height == e_height and s_width > e_width:
        return 'left'
    elif s_height > e_height and s_width > e_width:
        return 'upleft'
    elif s_height > e_height and s_width == e_width:
        return 'up'
    elif s_height > e_height and s_width < e_width:
        return 'upright'
    elif s_height == e_height and s_width < e_width:
        return 'right'
    elif s_height < e_height and s_width < e_width:
        return 'downleft'

It's verbose, but gets the job done. start is the agents current coordinate position, and as you might guess end is the next step in the list of waypoints which makes up an agents path. The problem is that using the same function for determining which sprite should be used when attacking another agent does not look very good at all.

For example, if the target is down, but only one pixel to the right, we would want to show the 'down' sprite, but this function returns 'downright' instead. How can we change it to appropriately return the fitting sprite?

sentences:
How to update model transform of components when using physics? I implemented a high level components system for my renderer and am curious about the right way to update the transforms components of models that have a physics rigidbody attached. I am using bulletsharp. To clarify. Transformcomponents holds the model matrix that is used for rendering. Rigidbody holds the worldmatrix that is getting modified by step simulation of bulletsharp. I want my rigidbody and transformcomponents matrices to stay synced.

My idea is to do it like this per render loop:

Always use transformcomponent for rendering
Execute physics step simulation
Update all transformcomponents with new matrices from  rigidbody
Whenever transformcomponent gets a matrix update from user input and not physics... Update the matrices recursive for the attached rigidbody and all children
Render with matrices of transformcomponents

Is there a better way to implement rigidbody physics in a components system for rendering? I use the physics mainly for raycast picking and OBB collision detection.

And when I use the term "better", I mean more efficient in terms of least updates on scene components. Syncing two components matrices seems tedious and I want to know if there is a solution without syncing.

sentences:
How do I access objects that are in the next scene I'm loading? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class HouseExit : MonoBehaviour
{
    public Transform player;

    public void Houseexit()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            Houseexit();
            GameObject.Find("Wizard").transform.position = GameObject.Find("SpawnPos").transform.position;
        }
    }
}

This code belongs to the scene "Goblin House 1" and I'm trying to find the wizard and the spawn position both from level 1.

sentences:
Round to the nearest multiple of 0.75 in C# How can I round a number to the nearest multiple of 0.75 in C# / Unity?

The context is that I have a block and I want its position to be rounded at the nearest 0.75 multiple. For example: 0, 0.75, 1.5, 2.25, 3, 3.25, 4.5, 5.25, 6, ...
How can I do that?

sentences:
Quaternion based rotation and pivot position I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the space and not a local pivot which is what I want.
Here is the code [Using Java]

Quaternion rotation method:

  public void rotateTo3(float xr, float yr, float zr) {

    _rotation.x = xr;
    _rotation.y = yr;
    _rotation.z = zr;

    Quaternion xrotQ = Glm.angleAxis((xr), Vec3.X_AXIS);
    Quaternion yrotQ = Glm.angleAxis((yr), Vec3.Y_AXIS);
    Quaternion zrotQ = Glm.angleAxis((zr), Vec3.Z_AXIS);
    xrotQ = Glm.normalize(xrotQ);
    yrotQ = Glm.normalize(yrotQ);
    zrotQ = Glm.normalize(zrotQ);

    Quaternion acumQuat;
    acumQuat = Quaternion.mul(xrotQ, yrotQ);
    acumQuat = Quaternion.mul(acumQuat, zrotQ);

    Mat4 rotMat = Glm.matCast(acumQuat);

    _model = new Mat4(1);

   scaleTo(_scaleX, _scaleY, _scaleZ);

    _model = Glm.translate(_model, new Vec3(_pivot.x, _pivot.y, 0));

    _model =rotMat.mul(_model);//_model.mul(rotMat); //rotMat.mul(_model);

    _model = Glm.translate(_model, new Vec3(-_pivot.x, -_pivot.y, 0));

   translateTo(_x, _y, _z);

    notifyTranformChange();
   }

Model matrix scale method:
      public void scaleTo(float x, float y, float z) {

    _model.set(0, x);
    _model.set(5, y);
    _model.set(10, z);

    _scaleX = x;
    _scaleY = y;
    _scaleZ = z;

    notifyTranformChange();
  }

Translate method:
      public void translateTo(float x, float y, float z) {

    _x = x - _pivot.x;
    _y = y - _pivot.y;
    _z = z;
    _position.x = _x;
    _position.y = _y;
    _position.z = _z;

    _model.set(12, _x);
    _model.set(13, _y);
    _model.set(14, _z);

    notifyTranformChange();
   }

But this method in which I don't use Quaternion works fine:

  public void rotate(Vec3 axis, float angleDegr) {
    _rotation.add(axis.scale(angleDegr));
    //  change to GLM:
    Mat4 backTr = new Mat4(1.0f);

    backTr = Glm.translate(backTr, new Vec3(_pivot.x, _pivot.y, 0));

    backTr = Glm.rotate(backTr, angleDegr, axis);

    backTr = Glm.translate(backTr, new Vec3(-_pivot.x, -_pivot.y, 0));

    _model =_model.mul(backTr);///backTr.mul(_model);
    notifyTranformChange();

   }

sentences:
Sorting for 2D Drawing I am drawing a game in 2D (isometric)
My objects have their own arrays. (i.e. Tiles[], Objects[], Particles[], etc)
I want to have a draw[] array to hold anything that will be drawn.
Because it is 2D, I assume I must prioritise depth over any other sorting or things will look weird.
My game is turn based so Tiles and Objects won't be changing position every frame. However, Particles probably will.

So I am thinking I can populate the draw[] array (probably a vector?) with what is on-screen and have it add/remove object, tile & particle references when I pan the screen or when a tile or object is specifically moved. No idea how often I'm going to have to update for particles right now. I want to do this because my game may have many thousands of objects and I want to iterate through as few as possible when drawing.

I plan to give each element a depth value to sort by.

So, my questions:

Does the above method sound like a good way to deal with the actual drawing?
What is the most efficient way to sort a vector? Most of the time it wont require efficiency. But for panning the screen it will. And I imagine if I have many particles on screen moving across multiple tiles, it may happen quite often.

For reference, my screen will be drawing about 2,800 objects at any one time. When panning, it will be adding/removing about ~200 elements every second, and each new element will need adding in the correct location based on depth.

sentences:
How do I determine distance of a point within a ProBuilder mesh? As in the title, I have an effect prepped for my game which applies certain derived parameters to a post-processing effect after the player enters a boundary I created with ProBuilder. Finding how far inside the bound the player is; that is, how far the player would have to travel, at minimum, to leave it; would help me scale this effect. It is not an axis-aligned boundary, and its sloped shape is fairly important. Having the effect go full-on on crossing the boundary would be jarring to the player.

I'm tempted to resort to traditional edge testing with this, but I would like to highlight that it will be done at least once per frame on multiple objects, so I would like to keep it as simple, and non-home-rolled, as possible.

The other possibility would be to keep track of time exposed and scale it by that; but this isn't ideal and I'm seriously curious as to whether a penetration-depth-testing method exists out-of-box.

A requested image of my setup:

It is laterally symmetric, and that is unlikely to ever need to change. However, future volumes are likely to have varying angles and heights. Depth is more-or-less irrelevant, as while I'm using 3D, this game has the physics of a 2D platformer; so you can consider it to have infinite depth if you need to. As you can see on the right, I've added almost nothing to it, other than the MagneticField.cs custom script (which does not even reference the mesh, only whether it's been crossed) and a debug class, TriangleReport.cs, that I'm working on right now.

One thought I had was to get triangles for the top, bottom, left, and right edges, use them to define planes, and then determine the distance from those planes; but if you've got something better I am all ears!

sentences:
How can I track both current and maximum values for a given statistic? In my design I have several cases where I need to track both a max value and a current value (examples include Hit Points or Movement Points).
I could track these as separate variables:

int HitPointsMax;
int HitPointsCurrent;

or as a struct:

public struct HitPoints {
  public int Max;
  public int Current;
}

So my question: Is one of these preferable over the other, and why?

Is there some element of efficiency? A best-practice? Is there a better option?

sentences:
Physics in my game confused after restructuring the Game loop I'm on my way with making a game in Java. Now I have some trouble with an interpolation based game loop in my calculations.

Before I used that system the calculation of a falling object was like this:

Delta based system

private static final float SPEED_OF_GRAVITY = 500.0f;

@Override
 public void update(float timeDeltaSeconds, Object parentObject) {

parentObject.y = parentObject.y +
          (parentObject.yVelocity * timeDeltaSeconds);

parentObject.yVelocity -= SPEED_OF_GRAVITY  * timeDeltaSeconds;
    ......

What you see here is that I used that delta value from previous frame to the current frame to calculate the physics. Now I switched and implement a interpolation based system and I actually left the current system where I used delta to calculate my physics.

However, with the interpolation system the delta time is removed - but now are my calculations screwed up and I've tried the whole day to solve this:

Interpolation based system

private static final float SPEED_OF_GRAVITY = 500.0f;

@Override
public void update(Object parentObject) {

parentObject.y = parentObject.y +
        (parentObject.yVelocity);

parentObject.yVelocity -= SPEED_OF_GRAVITY;
    ......

I'm totally clueless - how should this be solved? The rendering part is solved with a simple prediction method. With the delta system I could see my object be smoothly rendered to the screen, but with this interpolation/prediction method the object just appear sticky for one second and then it's gone.

The core of this game loop is actually from here deWiTTERS Game Loop, where I trying to implement the last solution he describes.

Shortly - my physics are in a mess and this need to be solved.

Any ideas? Thanks in advance!

sentences:
Chunked A* Pathfinding Issues I've run into an issue with A* pathfinding in a chunked world.

This is my current setup:

The world is designed in Tiled and exported as a .json file.
I wrote a little program that converts the .json file into objects that are serialized into binary files the main game loads.
Each chunk is stored in it's own file (-2_-1.cnk for example).
Chunks contain an x, y, width, height, int[,] for tile ids and a bool[,] for solid flags.
The GameWorld contains a Dictionary<Point, Chunk> to store the chunks.
When the game needs to know which tile id exist at (x,y), the world first checks to see if the chunk is loaded. If not it is loaded from disk and stored in memory until it's unloaded.
The pathfinder does not know about chunks, an IGrid interface is passed when FindPath is called, IGrid contains an IsWalkable(x, y) method.
The GameWorld implements 'IGrid' and contains an implemented IsWalkable method.
When IsWalkable is called by the pathfinder, the world calls GetChunk(x, y but does not load a chunk from disk if isn't not already in memory. If a chunk is found, the bool[,] is checked to see if the tile is solid or not. If a chunk is not found, the tile is considered solid.

Pathfinding runs fine, search time range between 0.3ms - 9ms; though I have noticed that there are some corners that take ~40ms to search.

But as for my issue. Say I have a valid, accessible tile that a path can be found for, only it's close to the border of a chunk and can only be reached by leaving the current chunk and moving into an adjacent chunk. This image should be a better representation:

The red lines are the chunk borders, the yellow circle is the goal, the pink circle is the start and the blue line is the path.

For this example, pretend everything ABOVE the red chunk is an unloaded chunk, below the red line is loaded, and the player CAN SEE the goal tile. Diagonal movement is allowed, but not when moving next to a solid tile, so slipping between the trees diagonally is not allowed.

The pathfinder will keep searching the loaded chunk until it reaches the border, the chunk above is not loaded, so any tiles outside the current chunk are 'solid'. The pathfinder will continue to search available tiles in the loaded chunks until it's checked them all and decided a path could not be found.

A work around for this is to allow the pathfinder to load chunks when it reaches chunk borders, but this doesn't seem like a very clean solution.

Is there any way around this? The map is static and will not change, so I can pre-compute 'something' when I convert the map from the .json file.

One solution might be to flood fill each accessible 'region' in each chunk, only allowing paths with goals in the same region the player is standing in. But that would break if the player is standing on the boundary of two chunks, they would have different regions.

Or I'm just way over thinking this and I should just increase the chunks loaded distance so there's more overlap with the on screen and off screen chunks. Then just limit the pathfinding to have a max_search_length limit and stop when it's searched for too long.

Any thoughts?

sentences:
Input.GetKeyDown not working while Unity Remote is running? I have this simple code:
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        Debug.Log("Escape");
    }
}

When I test it...

In the Editor, I press Escape, and it works.

On my Android, I press the Back button, and it works.

But when I hit play in the Editor while Unity Remote is running on my phone, neither the Escape on my keyboard, nor the Back button on my phone works.
The Update method is constantly running, just the Input.GetKeyDown returns false.
Why?

sentences:
How do I calculate the position of a vehicle moving between tiles, over time? I'm working on a small multiplayer game where players can create cities, and these cities will be placed on what's called the "world map." The world map is basically a giant coordinate plane made up of tiles, and the server will load the "world map" in chunks from the database relative to a player's position on the world map.

Now, I want players to be able to send planes from their city to another spot/tile anywhere on the world map. Say for instance player who owns City 1 at position 10,10, wants to create an oil_well at position 70,30. I want a plane to fly from the departure point to arrival point, and client that loads the chunk will see that plane flying across the map.

How can I make the server calculate where the plane is? I have the following information:

departure_time, origin_x, origin_y, arrival_x, arrival_y, speed. speed is the time in seconds that a plane can cross a tile on the world map.

I also have distance, which is simply calculated as (distance formula):

var distance = Math.sqrt(Math.pow( data.arrival_x - data.origin_x , 2) + Math.pow( data.arrival_y - data.origin_y , 2));

Again, how can I calculate the current position of a moving plane on this world map? Because the plane can fly at many different angles, depending on the angle of departure point → arrival point.

sentences:
Why will my server not execute a command sent by the client in Unity 5.1? I'm working on a very simple/basic client-server networking program, the basis of a future game I hope to create. Now the client program/project DOES successfully connect with the 'server program/project' (both completely separate). However when it comes to having the client send a request/command to the server. Well it doesn't send the command to the server, it executes it on the client.

I read about changing the 'Monodevelop' inheritance to 'NetworkBehaviour' so I did and it resulting in an error along the lines of;

Command xxx was sent to the server
...Debug.logerror(object
So I seemed to have got half way there, it allegedly sent the command to the server, but the server did nothing with it. I don't know why.

Below are the relatively short programs I've got for my server and client and are pretty much the same, but if anyone can help me out I'd greatly appreciate it, as my University course didn't really go into Network Programming all that much;

Server Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class server : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public int prevConns = 0;
    private int currConns = 0;

    public virtual void OnServerReady (NetworkConnection conn)
    {
        NetworkServer.SetClientReady (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
            if (GUI.Button (new Rect (100, 125, 100, 25), "Start Server")) {
                Network.InitializeServer (20, port, false);
            }
        } else {
            //CLIENT - NOT NEEDED
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }
            }
            if (Network.peerType == NetworkPeerType.Server) {
                currConns = Network.connections.Length;
                GUI.Label (new Rect (100, 100, 100, 25), "Server");
                GUI.Label (new Rect (100, 125, 100, 25), "Connections: " + currConns);

                if (prevConns != currConns) {
                    if (prevConns < currConns) {
                        Debug.Log ("NEW CONNECTION");
                        prevConns++;

                    } else if (prevConns > currConns) {
                        Debug.Log ("Lost CONNECTION");
                        prevConns--;
                    }
                }

                if (GUI.Button (new Rect (100, 15, 100, 25), "Shutdown")) {
                    Network.Disconnect (250);
                }
            }
        }
    }

}

Client Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class connection : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public GameObject player;

    public virtual void OnClientConnect (NetworkConnection conn)
    {
        ClientScene.Ready (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
        } else {
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }

                if (GUI.Button (new Rect (100, 150, 100, 25), "Send Cmd")) {
                    CmdSendCommand ();
                }

            }
        }
    }

    [Command]
    void CmdSendCommand ()
    {
        NetworkBehaviour.print ("HELLO");
    }
}

sentences:
UI: Main Menu options for mobile games. What options should be listed? What do users want to see? When a user arrives at your main menu on your mobile touch phone game. What do you want them to see? What do they need to see?

Start, About, Load, Leaderboards, and Settings are just a few of the options that I "could" put on the Main Menu. The question really is what "should" be there and why?

My game is about surviving waves of enemies to get to the next level, with a twist of course.

What options could/should be shown on my Main Menu and why?

EDIT UPDATE:

Easy recognizable PLAY button.
Possible buttons include, but are not limited to Options, Stats/Achievements, Leaderboards, Level Solutions, and Promote Game.
Choose appropriate options for your type of game. (ie. Level Solutions good for puzzle games but not FPS)
Less is more, don't clutter the Main Menu to prevent users from getting confused. Weigh the benefits of an additional button against the risks of confusing users.
Symbols can be used to convey the meaning of a button, be sure to reach the largest audience possible.
Have as few clicks as possible to get into the game.

sentences:
Networking in Flash games. Socket or Stratus? Working on a prototype for a Flash game that will use networking communication. It would be better to use Peer 2 Peer connection, since it will be a multiplayer game.

Has anyone used Stratus or tried to make a multiplayer game via the built in socket?

The game will be a turn based game, similar speed to poker but if I could get faster turns that would be great.

sentences:
Simulate shake, tilt and multi-touch in Unity WebGl app I am developing a multi-platform game in Unity.
It works great on Android and also on WebGL (haven't yet checked iOS).
My problem is that in some of the levels I need to use mobile-specific actions like shake, tilt and multi-touch.
Is there any way to simulate this in a WebGL app?
Examples of what I need:
Tilt to move an object without touching the object. The idea is to "sail" the object from the top of the screen into a basket at the bottom avoiding some obstacle on the way.
Tilt to cause an object to move across the screen
Shake to cause something to break.
Multi-touch to select two objects at the same time.

sentences:
How To Animate Skeletal Interactions (Hugging, Handshakes etc.) I am fairly new to animating and IK systems, but I've got the basics down to some extend. Now I am looking into how to go about skeletal actor animation interactions such as handshakes, fighting, horse riding, hugging or sex animations and such, to be used in unreal engine 4. I would like someone to point me into the right direction on how to go about this.

As I am new to this, if the question is too broad or vague please do let me know.

sentences:
Reused Avatar moves mesh I have a humanoid avatar and it's animation controller.
I also have two different human meshes, they're quite similar.
When I use the generic avatar and it's controller in the animator the meshes
shot out into the sky and perform their animation correctly.
The animations run normal they just move in weird directions and don't stay in their original locations.
How to fix it so the mesh doesn't move far away and retain original position?

sentences:
Unity's free look camera too far away I've been making a game to learn unity and I have been using the free look cam that comes default but have encountered a problem that I don't know how to fix. Basically the camera rig isn't following the target very well, it follows really far behind the target and I have turned up the move speed, messed with other settings but no luck.

Help please!

sentences:
Detecting Hitbox Collisions (Rectangle) So I have some Hitboxes set up on 2 classes, HealthPickup and Player.

public static Rectangle Hitbox;

public override void Initialize()
{
    Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32);
}

That's just general code, there are other things in the classes too. So what I want to know is why this doesn't work:

// This is in the HealthPickup class' Update function.
if (Hitbox.Intersects(Player.Hitbox))
{
    Console.Beep();
}

Doesn't work if I put it in the main update function either. Am I missing something?

sentences:
Game-components and memory management I'm stitching together the workings of a component based game engine, and as such have been deeply reading into many aspects of both game engine architecture and a fair amount of opinionated theory of different programming styles / do's and dont's. Etc.

Currently, I really like the idea of treating components like little data structures and having larger sub-systems handle this data appropriately. Thus the "GameObject" is more of a GUID that ties in these struct-based components into a loosely defined object with various properties.

So my question, or well current delima is how to store these various components and I seem to have two competing ideas.

The easy way to handle storing these components, is to have each sub-system double as a factory class which creates and stores the component into a hash table which the sub-system maintains. So the Renderer would have a method that could produce and store a Renderable component given a GUID and some input parameters. Whenever a object or object component is removed from game each sub-system could be messaged and that sub-system could then delete the corresponding component without trouble.

In addition to that, components of the same type are grouped together and since these components are all the same size this makes for a pretty damn clean memory management. I see no problem using std::vector or a hash table of some sort to contain these elements.

The issue I have with this approach is that it fragments a (all) "GameObject's" significantly. Suddenly the position component of a given object is located miles away from the physical component. This seems like a performance nightmare, looking up any other component becomes a cache-miss, etc. Which brings me to option #2...

The other approach I've come up with is to keep the factory part of the sub-systems. Renderer would still produce Renderables, but Renderer would not be responsible for storing the component, instead it would be given a location to write the component struct to as an input parameter by a dedicated system, like a memory manager.

The advantage here is components belonging to a particular GUID could be grouped together in contiguous memory (at least in theory), providing a chance that the needed date for another component (say Physical wants to alter the Position component) may already exist in the processors cache due to the effects of cache-lines.

The (massive) disadvantage that I see in doing this is managing the necessary memory to group these differently sized components together, that sounds like a nightmare to me.

So what I wish to ask is, what do you guys think? Is there a really smart third option I haven't thought of, or am I crazy for even caring about cache-misses? In that case, is the easy way just the correct way, etc, etc.

Thanks, -Cody

sentences:
Creating the Vertices and Triangle Indices for Voxel Generated Mesh I am running into a problem with a compute shader I am writing to generate the vertices and triangle indices for a voxel generated mesh.
Currently, I am creating an AppendStructuredBuffer of triangle structs which just have the three vertices of a triangle and reading from the AppendStructuredBuffer to the CPU. When read to the CPU, I then read from the buffer and set it in a RWStructuredBuffer in the GPU. Following that, I run a compute shader kernel to parse the triangle buffer.
Obviously if I can do this all on the GPU I should since reading and writing between the CPU and GPU is expensive.
When trying to put it all in one kernel I run into problems however. Each voxel has a range of possible triangles (0-5) that can form in it. Because of that, I can't simply use the dispatch ID to put it in a RWStructuredBuffer (at least I don't think so). That's why using an AppendStructuredBuffer seems natural; it allows for the variable amount of triangles.
After getting the array of triangle vertices and array of triangle vertex indices, I bring them back to the CPU and set them to a mesh and render it. In the future I want to use a geometry shader to render the mesh since that is most likely more efficient, but I'm trying to take this one step at a time, and geometry shaders are a whole 'nother beast I know nothing about.

sentences:
HTML5 Canvas: Get rect coords after rotation (relative to screen) update: function(delta) {
    for (var i = 0; i < this.bullets.length; i++) {
        this.bullets[i].velocity = this.bullets[i].speed * delta;
        this.bullets[i].contextX += this.bullets[i].velocity;
    }
},

draw: function(ctx) {
    for (var i = 0; i < this.bullets.length; i++) {
        ctx.save();

        // Move the context to where the player is then make it face the target degree
        ctx.translate(this.bullets[i].startX, this.bullets[i].startY);
        ctx.rotate(this.bullets[i].rotation);

        ctx.fillRect(this.bullets[i].contextX, -5, 10, 10);
        ctx.restore();
    }
}

The code above contains two methods that describe a class that manages the drawing and updating of bullets. The update method moves a bullet along and the draw function then draws it to the screen.

The canvas does the following:

Saves the current canvas context state
Moves the context to where the bullet originated from
Rotates the canvas to the way the bullet was facing when shot
Draw the rectangle
Restore the canvas context to original state

Here is an image I have made that better describes what the canvas context is doing:

So we know the x position of the bullet but this is relative to the context as it's been rotated. What I need to know is the bullet's X and Y properties in relation to the actual screen. Any ideas as to how I can do this?

sentences:
Creating an in-game time system only works with real time I'm trying to create an in-game time system. Thus far it only works properly if you use 1440 minutes to the day (realtime), but I would like to be able to alter the day length to something like 10 minutes for example.

When adjusting it to 10, 20, etc, the clock starts to increment extremely rapidly to the point that an entire week passes in less than a second if you set it to one minute, or a day passes in about 12 seconds at around 10 realtime minutes to the day.

public float DayLengthInMinutes = 1440;// How long a day is in real world minutes
public int HoursToTheDay = 24;       // How many hours there are in a day
public int MinutesToTheHour = 60;    // How many minutes there are in an hour
public int SecondsToTheMinute = 60;  // How many seconds there are in a minute

public float _dayLength;                // Day length in seconds
public float _hourLength;               // Hour length in seconds
public float _minuteLength;             // Minute length in seconds
public float _secondLength;             // Seconds length in seconds
private float timer;                    // Timer that will be tracking game time

void Initialize () {
    timeSinceStart = Time.realtimeSinceStartup;
    _dayLength = _dayLengthInMinutes * 60;  //get seconds to the day
    _hourLength = _dayLength / HoursToTheDay; //determines how long an hour is
    _minuteLength = _hourLength / MinutesToTheHour; //determines how long a minute is
    _secondLength = _minuteLength / SecondsToTheMinute; //determines how long a second is
}
void CalculateTime () {
    if (timer >= _secondLength) {
        currentSecond++;
        timer = 0;
    }
    if (currentSecond >= _minuteLength) {
        currentMinute++;
        currentSecond = 0;
    }
    if (currentMinute >= _hourLength) {
        currentHour++;
        currentMinute = 0;
    }
    if (currentHour >= HoursToTheDay) {
        currentDay++;
        currentHour = 0;
        currentMinute = 0;
        currentSecond = 0;
        dayOrNight = "AM";
    }
}

EDIT: I'm actually basically finished with the while thing, it just isn't very user friendly yet. If people are interested I can answer with the two scripts it is currently running as. I haven't managed to get it into one without Unity crying and I'm not certain why.

sentences:
How to hide Game Progress Files saved in Application.persistentDataPath in Unity Android I am developing a game that saves its state in a text file. I am writing that file in Application.persistentDataPath but my issue is that the game progress file is available to user in Data/PACKAGE NAME/files/*.

How can I hide the game progress file so that user can't access the files ?

sentences:
How to make an expanding radial search in Unity? I am currently working on a City Builder Game and I often come across the problem of having to decide wich location to use.

Examples:

The citizen has a job and needs a home. There are several buildings with open slots.
The citizen is at a positon and is hungry. There are several restaurants on the map.

How can I choose the right building to go to?
I don't really wan't to check the distance for each, because there could potentially be hundreds of buildings and that decision problem occurs quite often.

I also don't care for the optimal solution, any nearby result is fine.

Currently all buildings register them self in a LinkedList. When searching for something I'd start at the beginning and the first occurrence that was 'good enough' would be returned.
Citizen now drive across the map for something that was right next to them if the one far away was built earlier in the game.

Any suggestions?

sentences:
libGDX upload z-axis of sprite to graphics card Background:
I want to obtain each fragments position via vertex interpolation to then calculate the light vector for phong shading (L = [Fragment pos] - [light source pos]).

Problem:

At the moment I am using libGDX's com.badlogic.gdx.graphics.g2d.Sprites to upload my 2d sprites via the batch to the graphics card. However they only transport the x and y information for each vertex ( I think in the shader z is 0). I also want to upload the z axis of the sprite for use with normal map based pixel shading (calculate the vector of the incoming light).

Should I use a com.badlogic.gdx.graphics.Mesh for that or can I extend the Sprite class and somehow put the z axis in the vertices float[] array? If I should do that, how do I do this?

sentences:
How to generate a star onto a render texture with spherical warping How would one proceduraly generate a star in a compute shader that looks like one of thes two at any size needed. Also any way transfer this into a spherical map, would be appreciated.
Goal is to create a spherical skybox of stars, (stars a pre generated, and not just decoration).
Also I have searched about everywhere for such equations, and or tutorials but have not found anything so far.
So far got accurate positioning of the stars on the spherical skybox but lack the equations to get it looking like I want.
Preferably the one on the right.

This below is what I currently have, ~~5 to 15ms processing time,    little over 30k stars

Using Unity2019.3.1f1, needs to be compute shader compatible. (if not I will convert it somehow)
Render Texture output.

sentences:
C++ GameState management I have been attempting to make a game engine in C++ and have come across the dilemma of game state management. I have done a lot of research and found numerous ways of accomplishing from game engine with derived classes to using enums and I would like to know the most effective/efficient way of managing game states.

EDIT
I would like to know how other people implement their game state management, i.e. what you like the most and why you like it. Also, any tutorials/code examples that are generally about game state would also be much appreciated.

sentences:
Isometric 3D grid - what order do I render elements in the grid? I'm trying to create a screensaver, so strictly speaking this isn't for developing a game, but the subjects discussed on this SE site are a better match than any of the other sites, and I think the answer to my problem will be of value to game developers facing the same issue.

I'm trying to render an isometric grid of bricks, using 2D graphics to represent a 3D grid of bricks.

The algorithm I'm using is rendering them in the wrong order so that bricks are appearing as if they're on top of bricks which they're actually behind. For example:

The white, black, and blue bricks should be rendering behind the long red brick. In terms of render order, they should be drawn before the red brick, but because the red brick is 1 step lower along the Z axis, it gets rendered first.

All of the bricks are aligned to integer coordinates. The "flat" bricks are 1 unit tall, and the "regular" bricks are 3 units tall.

The code I've got so far is:

    for (int i = 0; i < world.getDimension().z; i++) {
        for (int j = world.getDimension().y - 1; j >= 0; j--) {
            for (int k = 0; k < world.getDimension().x; k++) {
                BrickInstance brick = world.getBrickGrid().get(k, j, i);
                if (brick != null && !brick.hasBeenProcessed()) {
                    try {
                        BrickRenderer renderer = getBrickRenderer(brick);
                        renderer.setBrick(brick);
                        renderer.setGraphicsOffset(xOffset, yOffset);
                        renderer.drawBrick(gfx);
                    } catch (InstantiationException | IllegalAccessException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

So it loops along z, y, and x axes to determine render order, and the first time it encounters a brick in the grid, it renders the brick and marks it as done.

I also tried swapping the x and z axes:

    for (int i = 0; i < world.getDimension().x; i++) {
        for (int j = world.getDimension().y - 1; j >= 0; j--) {
            for (int k = 0; k < world.getDimension().z; k++) {
                BrickInstance brick = world.getBrickGrid().get(i, j, k);
                ...

This seems to help at first, but the same problem occurs, a little less obviously:

Here the 1x4x1 green brick is sitting on the 1x1x1 blue brick, but it renders behind it instead of on top of it.

What order should I be rendering these elements so that they overlap correctly? What should my algorithm look like, either in code or pseudo-code or plain English?

Github link (I linked to the specific commit, so 6 months from now it should still link to the right version)

sentences:
Understanding UE4 OpenGL contexts Recently, I was browsing the UE4 source code. I was especially interested in the OpenGL implementation on Windows. The OpenGL "Dynamic RHI" (as they call it) implementation can be found in the Engine\Source\Runtime\OpenGLDrv\ directory.

Contexts

After digging the code, I found out that they have multiple contexts with shared data. At the time of the RHI initialization they create two different contexts (FPlatformOpenGLDevice ctor)

SharedContext which will be the "parent" of every other context
RenderingContext that shares data with SharedContext

From now on, every time a new window is created and a context/viewport creation is requested, a new OpenGL context is created (PlatformCreateOpenGLContext function). Of course these contexts also share data with the SharedContext.

These contexts also own a VAO and a FBO (expect the viewport contexts where the VAO is not created for some reason; see PlatformCreateOpenGLContext function).

OpenGL "facts"

According to multiple sources:

A context can only be active in one thread at a given time
To issue gl* calls, you need an active context (of course)
The drivers basically run in sequential mode - so sending gl commands from multiple threads from multiple contexts will be "queued up" and will be executed in a sequence. And even worse this could cause context switches back-and-forth
So basically there is little or no gain by using multiple contexts (if we are using a single window to render into)

UE4 threading

As far as I know (and according to the source code and the documentation) they have a separate "rendering thread" that is used to execute gl commands. There are multiple functions that are interesting:

PlatformRenderingContextSetup which sets up the rendering context in the current thread (with a little "trick" on Windows)
PlatformBlitToViewport which displays the image on a specific target

My goal

I'm currently working on a basic engine (as a hobby and for educational purposes, needed by the universtiy) that must support multiple windows and "threaded loading". It is important that the resources loaded must be accessible by every window (context) so a shared context will probably be used (that's why I was interested in the UE4's approach).

Also I'd like to understand the reasons behind the UE4 devs' decisions and how their rendering works from a threading + context point of view. Currently I'm not interested in the actual render commands and technologies like deferred shading and so on.

sentences: Broken UVs for Maya/Mudbox model I have tried using the automatic mapping in Mudbox and Maya, neither worked sufficiently, I was still experiencing polygon overlap. I tried mapping separate limbs but I came to the same problem, this is the very first model I made and as a result i didn't know to make the limbs separate layers / faces.

sentences:
Client side prediction physics I'm trying to build a simple networked game and I'm having trouble keeping a jump in-sync on the client and server.

I've read the free gaffer on games articles and it's helped somewhat but I'm still not completing grasping the theory behind how to keep physics in sync.

Right now I have a character that can move right and left. This is kept in sync perfectly by sending all of the inputs and then relaying them to the clients.

For the jump command..

- I send a packet indicating that i'm jumping.
- The client then predicts the jump
- The server begins to simulate the jump and tells the other clients that client X is jumping
- that then gets simulated on their clients

The issue is that if I keep on jumping on the spot eventually the jumps will begin to overlap. I came up with some makeshift solutions to that, but realized that if I started moving and jumping at the same time it wasn't simulating everything perfectly and sometimes the player would land on the tip of a platform on one client and miss it on the server/other client.

Right now everything is being done locally so there's virtually no lag. I figured the reason it's becoming out of sync is because of jitter.

I'm just a little confused in figuring out how to fix this. How do I get it so the client side prediction is 100% perfect in a local environment when incorporating physics?

sentences:
Why does the resolution of floating point numbers decrease further from an origin? My OpenGL scene has objects that are positioned at ridiculously far distances away from the origin. When I view these objects, and pan/rotate/zoom a camera around them, they 'jitter'. That is, the vertices comprising the objects seem to snap around an imaginary 3d grid of points. I've read this is a common problem because of the amount of information that can be stored using floating point precision (which OpenGL, and pretty much everything else uses). I don't get why this happens though.

When searching for a solution, I came across the very simple 'floating origin' fix, and it seems to work. I just transform everything so my objects are in the same relative positions but whatever my camera's looking at is close to the origin. I found an explanation here: http://floatingorigin.com/, but I couldn't follow it.

So...Could someone explain why positioning my scene very far away (say 10 million units) from the origin results in the erratic behaviour I observed? And also why moving it close to the origin fixes the problem?

sentences:
Implementing an online database I'd like to get into online games programming. I thought that as a start i'd be a good idea to implement an online database that would store the progress and score for a game i have made, i'll probably want to implement an account system too.

My issue is, i can't see to be able to ask google the right question. I don't know where to start. I've touched some on SQL and PHP, HTML and XSL, but, to me they're just languages, i can't see the big picture, how do these things connect to form a working service? I'm not looking for a solution, i just don't know what should i learn.

I'm not looking for knowledge on sockets, i'm familiar with network programming, i just don't understand the "modern" process of handling databases. I'd be very happy if somebody could lay out the structure of a database, how you put it out on the web, how you access the information and change it (not in a direct solution, just "this is done by programming a filter in SQL"), what languages are used for it, etc.

sentences:
How can I get the parents and childs from the hierarchy in the same order it is in the hierarchy the structure of the hierarchy? The line:

var gameObjects = GameObject.FindObjectsOfType<GameObject>();

Is getting all the parents and children but not in the order it is in the hierarchy. I tried to use the gos List and to add first the childs then the parents to create a List with all parents and it's childs but it's getting messed. I want to get the structure of the Hierarchy.

        var gos = new List<GameObject>();

        var gameObjects = GameObject.FindObjectsOfType<GameObject>();
        for (int i = 0; i < gameObjects.Length; i++)
        {
            if (gameObjects[i].transform.childCount > 0)
            {

                //get children
                GameObject[] children = new GameObject[gameObjects[i].transform.childCount];
                for (int z = 0; z < children.Length; ++z)
                {
                    children[z] = gameObjects[i].transform.GetChild(i).gameObject;
                    gos.Add(children[z].gameObject);
                }
            }
            else
            {
                gos.Add(gameObjects[i]);
            }
        }

sentences:
How to temporarily increase the speed of a character in a Unity game As the title would suggest, I want to give a character a speed boost for x amount of seconds, while increasing their Gameobject's mass. During this little speed boost, I also want to add a script to another player that disappears when the speed boost dies out I am new to C#, and Unity in general, any help would be appreciated.

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

public class PlayerAddMass : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Q))
        {
            rb = GetComponent<Rigidbody>();
            rb.mass = 10;
            rb = GetComponent<Rigidbody>();
            rb.speed = 5;
        }
    }
}

The code above was found on a unity website of some sorts, and I modified it to set the speed and mass numbers (I changed the 0s into a 10 and a 5) The errors I get are "rb does not exist in the current context" x 4

sentences:
Unity-How can I enlarge the sprite to avoid the movement of the character when the pivot change? Changing the pivot to custom on all of the sprites is not a viable option for me
Video showing the problem:
https://youtu.be/YpAdamkbhFA

sentences:
Collision detection in Arkanoid-like game at intersections I'm creating an Arkanoid-like game from scratch. I have no (formal or informal) education of any kind in game-development, so I kinda made up things as I went regarding collision detection based on personal ideas of "how it probably works".

I approximate the ball as a point and ignore its thickness, which is small anyway. I compensate for this visually by very slightly making all objects smaller than they are.

I don't "detect" collision, but anticipate it and change the outcome of the next frame. For example:

The ball is currently in position A, and it "wants" to go to E (red line). But I calculate all intersections with all segments which make up the bricks: B, C, D. The closest one to starting point (A) is B, so I choose B as the "real" intersection. I destroy the brick this segment belongs to.

Now I check how would the ball proceed if it would start at B, with its vector flipped horizontally (because I determine that the segment it hit was horizontal). This is the blue line. Again, from F and G, I pick F. I destroy the brick this segment belongs to.

Lastly, the orange line doesn't intersect, so I determine that the bottom of the orange line is where I should place the ball in the next frame.

This worked fine and I was satisfied with it, until I started nailing the edge case of the ball hitting the T intersection, where it all goes bananas.

What should happen here is that the ball bounces to the left and destroys either of the bricks. But what can happen is that my algorithms decides to choose the middle vertical segment (connecting boxes 1 and 2) as the collision point, either belonging to the 1st or 2nd box.

I thought of ignoring the edges of the segments, but then the ball would pass right through the T-intersection in this scenario, because it would also ignore what it's supposed to hit.

You can see it in action here (around after 00:07 mark): https://www.mp4upload.com/p6966u6kuzad

What are common techniques for handling this case? Even if I introduce the width to the ball, it could still hit the exact T-intersection at the tangent, so the problem would remain.

Requested to post code. Here's the main bit. Please note that I'm not expecting you to (or looking for) debugging the application. I'm more asking about how are these things even handled in general.

export function bounceBall(
  ball: Point,
  vx: number,
  vy: number,
  obstacles: Obstacle[],
) {
  const projectedNextPoint = ball.clone().translate(vx, vy)
  const movement = new Segment(ball, projectedNextPoint)

  const touchedObstacles: Obstacle[] = []

  let loop = 10

  let hasCollision = false
  do {
    hasCollision = false

    if (loop-- < 0) {
      throw new Error('oops')
    }

    // If in the previous loop the ball just grazed the surface
    if (movement.isZeroLength()) break

    const collisions: Collision[] = []
    for (const obstacle of obstacles) {
      const collision = getIntersectionOfSegmentAndObstacle_ClosestToStartExcludingStart(movement, obstacle)
      if (collision != null) collisions.push(collision)
    }

    const collision = getClosestCollisionExcludingSelf(movement.start, collisions)

    // We don't count a collision if it's the starting point.
    // If we did, grazing a surface would turn into an infinite loop.
    if (collision == null || Point.AreEqual(collision.point, movement.start)) {
      hasCollision = false
    } else {
      hasCollision = true
      touchedObstacles.push(collision.obstacle)
    }

    if (hasCollision) {
      movement.setStart(collision!.point)
      if (collision!.segment.isVertical()) {
        movement.mirrorVerticallyWrtStart()
        vx = -vx
      }
      if (collision!.segment.isHorizontal()) {
        movement.mirrorHorizontallyWrtStart()
        vy = -vy
      }
    }

  } while (hasCollision)

  return {
    touchedObstacles,
    vx,
    vy,
    newBall: movement.end,
  }
}

sentences:
How can I randomly generate achievements? Novice programmer here.
To challenge my self i want to create an achievement system that randomly generates achievements for me based on a set of trackable metrics within my game.

To keep it as abstract as possible my game is a turn based highscore chaser. Each game has 13 turns. Each turn consists of placing 4 tiles, each tile can have an individual score which together form the turn score. There are 5 different tile types that can be individually combined to raise each tile's score differently. Each turn one of the 5 tiles gets a bonus making it worth double points. Also in each turn you can form "hands" similar to poker where for example two tiles of the same type next to each other are a pair, which nets a hand bonus for individual turns.

Here's what my generated achievements should look like:

Get a turn score of 15 and create a pair using tile type x.
Create a tile type y that has 5 points.
Create 5 hands of type x and use tile type x or y.
Get a total score of 50 without creating more than 3 hands of type x.

Obviously this seems kind of complicated and i'm kind of asking myself how to create such "complex" achievements. Seems like i need to establish some kind of syntax that i can feed the system to produce these kinds of requirements. But i'm kind of stuck since i couldn't find any info on this issue yet.

Maybe you have done something similar?

sentences:
Architecture a for a central renderer rather than self-rendering For the architectural side of rendering, there's two main ways: having each object render itself, and having a single renderer which renders everything.

I'm currently aiming for the second idea, for the following reasons:

The list can be sorted to only use shaders once. Else each object would have to bind the shader, because it's not sure if it's active. The objects could be sorted and grouped.
Easier to swap APIs. With a few macro lines, it can be easy to swap between a DirectX renderer and an OpenGL renderer (not a reason for my project, but still a good point)
Easier to manage rendering code

Of course, if anyone has strong recommendations for the first method, I will listen to them.

But I was wondering how make this work.

First idea
The renderer has a list of pointers to the renderable components of each entity, which register themselves on RenderCompoent creation. However, I'm worrying that this may end up as a lot of extra pointer weight. But I can sort the list of pointers every so often.

Second idea
The entire list of entities is passed to the renderer each render call. The renderer then sorts the list (each call, or maybe once?) and gets what it wants. That's a lot of passing and/or sorting, however.

Other ideas
???
PROFIT

Anyone got ideas? Thank you.

sentences:
JOGL KeyListener not functioning properly I have been having a problem with the JOGL KeyListener where if I hold down a key, it would register the key as pressed for around 1 second, then it would start quickly switching back and forth between pressed and unpressed. However, if I hold more than one key at once, sometimes the key listener "forgets" about one of the keys and keeps it held down (like it should) while releasing the other one (when it shouldn't).

Here is the relevant code in the class:

import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;

import java.util.HashSet;
import java.util.Set;

public class KeyInput implements KeyListener {
    private static Set<Short> key=new HashSet<Short>();
    public void keyPressed(KeyEvent keyEvent) {
        key.add(keyEvent.getKeyCode());
        System.out.println("added " +keyEvent.getKeyChar());
    }

    public void keyReleased(KeyEvent keyEvent) {
        key.remove(keyEvent.getKeyCode());
        System.out.println("removed " +keyEvent.getKeyChar());
    }

    public static boolean getKey(short k){
        return key.contains(k);
    }
}

I tried using other methods of storing the keys to no avail. How should I fix it so that it properly registers and remembers held down keys? I tried a different program with Swing and it worked fine. It has the exact same code as shown here.

sentences:
Why is my Post Processing not working? I'm trying to get Post Processing working in my Unity Project, with URP enabled, but I'm not seeing it work. I've looked at a few tutorials and I've followed them exactly, but I never see any post processing happen.
Here's the inspector window for my Camera:

And here's the inspector window for my Post Processing GameObject:

sentences:
Creating a 3D text mesh from a 2D glyph I have thought of three steps for doing this:

Acquire the vertex coordinates which will represent the glyph's form
Extrude them
Render

Can you suggest a better method? Can you give me an insight on how to do the first and the second step?

I use FreeType 2.4.10 for text managment.

sentences: Using XBOX controllers on PC for an XNA game Does anybody know how to do this? I have been trying to figure this out with no luck.

sentences:
OpenGL 4D textures with bilinear interpolation I want to use and interpolated 4D texture in OpenGL, i.e. a texture that is accessed with a texture coordinate vector (s, t, p, q) and interpolated linearly in every texture coordinate.

The extension GL_SGIS_texture4D does exactly this. However, it is unsupported on literally every GPU I have access to.

If the was a GL_TEXTURE_3D_ARRAY, I guess I could sample the appropriate 2 layers of a 3D array texture with the (s, t, p) coordinates and then manually interpolate in the q coordinate. However, there are only "ordinary" GL_TEXTURE_2D_ARRAY texture arrays. A possible solution is to treat the texture array as 2D array of 2D texture, sample the appropriate 4 layers with (s, t) and then manually interpolate in p and q. This method is somewhat constrained by GL_MAX_ARRAY_TEXTURE_LAYERS. I am also afraid of the relatively large number of 2D texture fetches required to fetch a single 4D texture value.

Is there a simpler way of achieving 4D interpolated textures?

sentences:
Why should I use separate initialization and clean up methods instead of putting logic in the constructor and destructor for engine components? I'm working on my own game engine, and I am currently designing my managers. I've read that for memory management, using Init() and CleanUp() functions are better then using constructors and destructors.

I have been looking for C++ code examples, to see how those functions work and how I can implement them into my engine. How does Init() and CleanUp() work, and how can I implement them into my engine?

sentences:
Resolving a collision between point and moving line I am designing a 2d physics engine that uses Verlet integration for moving points (velocities mentioned below can be derived), constraints to represent moving line segments, and continuous collision detection to resolve collisions between moving points and static lines, and collisions between moving/static points and moving lines.

I already know how to calculate the Time of Impact for both types of collision events, and how to resolve moving point static line collisions. However, I can't figure out how to resolve moving/static point moving line collisions.

Here are the initial conditions in a point and moving line collision event. We have a line segment joined by two points, A and B. At this instant, point P is touching/colliding with line AB. These points have unit mass and some might have an initial velocity, unless point P is static. The line is massless and has no explicit rotational component, since points A and B could freely move around, extending or contracting the line as a result (which will be fixed later by the constraint solver). Collision is inelastic.

What are the final velocities of the points after collision?

sentences:
OpenGL Water Waves Problem I want to do a simple simulation of water drops producing waves in OpenGL with C/C++. I calculate height for each point of my plane grid in Vertex Shader with formula
 but it seems wrong at the beginning. I will atach a photo to ease the understanding:

This is how the grid looks like at time = 0 (when the drop touched the water). The waves weren't generated only near the touch point and gradually advance. In the corners of the grid (and far from the touch point) there should be no change until a created wave approaches.

sentences:
What are some ways to store level data in a game like Gunpoint? Gunpoint is a 2D stealth game available here. I was wondering how you might go about storing level data for a game like this. I'm mostly concerned about how the collision detection is saved. There are several types of things which need to be stored; solid objects (walls, floors/roofs), breakable objects (glass), and editable objects (doors, light switches). A tile based approach may work, but I think that getting small details like light switches in there would get hairy quick.

(source: steamstatic.com)

sentences:
2D platformer corner collision Repost from my question on stack overflow, didnt know this site existed.

I have a 2d platformer and I need help with collision. To show you my current collision system, here is picture:

Top picture is how game looks normally, bottom picture shows highlighted collision rectangles. Black ones are horizontal (If player rectangle intersects them, move player on Y axis), blue are vertical (move player on the X axis) and red are corners.

I've implemented corner rectangles, after bit of testing after I found out, that when I had black and blue overlapping each other, this happened: Player jumped and intersected both rectangles at once, game would recognize that and resolve both intersection at the same time, cause the player to spaz around the map and ending up in a another rectangle, which would then cause another intesection and resolution until the chain reaction stopped, and player would end up somewhere where he should not have been.

So I added corner rectangles, they should resolve this situation like this: if player hits corner from the bottom, act like horizotal rectangle, if he hits from side, act like vertical.

Thing is, I have no idea how to make them work like that.

Here is my code so far:

        if (InputHandler.KeyDown(Keys.W))
        {
            player.MoveUp();
            Parallel.For(0, horizontalPlayerCollisionRectangles.Count, i =>
            {
              if (player.PlayerRectangleInWorld.Intersects(horizontalPlayerCollisionRectangles[i]))
                {
                    player.PlayerPositionY = horizontalPlayerCollisionRectangles[i].Y + horizontalPlayerCollisionRectangles[i].Height;
                }
            });
        }

        if (InputHandler.KeyDown(Keys.D))
        {
            player.MoveRight();
            Parallel.For(0, verticalPlayerCollisionRectangles.Count, i =>
                {
                    if (player.PlayerRectangleInWorld.Intersects(verticalPlayerCollisionRectangles[i]))
                    {
                        player.PlayerPositionX = verticalPlayerCollisionRectangles[i].X - player.PlayerRectangleInWorld.Width;
                    }
                });
        }

        if (InputHandler.KeyDown(Keys.A))
        {
            player.MoveLeft();
            Parallel.For(0, verticalPlayerCollisionRectangles.Count, i =>
            {
                if (player.PlayerRectangleInWorld.Intersects(verticalPlayerCollisionRectangles[i]))
                {
                    player.PlayerPositionX = verticalPlayerCollisionRectangles[i].X + verticalPlayerCollisionRectangles[i].Width;
                }
            });
        }

        if (player.Gravity)
        {
            Parallel.For(0, horizontalPlayerCollisionRectangles.Count, i =>
            {
                if (player.PlayerRectangleInWorld.Intersects(horizontalPlayerCollisionRectangles[i]))
                {
                    player.PlayerPositionY = horizontalPlayerCollisionRectangles[i].Y - player.PlayerRectangleInWorld.Height;
                }
            });
        }

Its pretty simple. Now that I think about it, my system is flawed, so thats why I'm asking this question. How to make collision work using collision rectangles?

P.S. I can't use any physics engine like Farseer, it's a school graduation project and I have to code as much as possible by myself.

sentences:
How to do game object perception at scale without some god object? I've read through this post Interactions between game objects but it doesn't really address my question.

Background assumptions:

Maximum number of possible objects and the game still runs
Maximum sized game world and the game still runs
Game world is partitioned into sectors
Having an object/process at the game loop level to decide what objects are aware of what would be a bottleneck

The goal is feed an arbitrary game object the data it needs to do its thing.
The question is how should i go about doing this without some global god object/process that sits at the game loop level?

What I thought of (simplified):

Method 1 involved a list of all the objects. This would be the god object. Each game loop, determine an objects perception range, and pull the objects that fit.

Method 2 involved an event stream for each sector. A god process would look at the range of the object and put it into the sector's streams that are in range of the event. At each game loop, the god process would feed the object the streams of the sectors that are in its perception range.

Why I don't want a god object: How to avoid the GameManager god object?

Unfortunately, I'm not sure if the solutions outlined in that question really helps, as the "problem" recognized in that post is poor programming habits/design. At its core, the post and all the answers take for granted that the god object must exist. What I am after is to see if there's a way for objects in the world to be aware of each other without the all seeing eye.

In the real physical world, things do not commune with god, or gods, or the akashic record, or some other esoteric entity in order to be aware of and interact with each other. Things will do their thing and each thing relies on whatever method of sensing they were born with to do their thing.

It might be because of my limited imagination/knowledge/experience that I don't know how to replicate how the world works digitally or it might be because this is not possible. I don't know, hence this post.

sentences:
How to implement ECS architecture in C#? As C# is a strongly-typed language, I'm  having great difficulties associating all my data types together so that I can have a clean, if not performant, game loop.

Example #1: Keeping Components Together

Keeping components together means I need an interface or base class to store them in an array, which would require keeping track of each type separately so that it can be converted back to the derived type before being consumed. The constant type conversion seems like a bad idea in an ECS?

To compound the problem, I would prefer to use structs instead of classes for my components, which when cast to an interface will cause boxing. In some simple stop watch tests I've run it seems the casting/boxing is 16x slower than just looping over the raw type. (Pseudo code below)

IComponent sprite = new SpriteComponentStruct() // boxing

for(int i=0; i<iComponents.Length; i++)
{
    var type = GetComponentTypeByIndex(i);
    var system = GetSystemWithType(type);
    SpriteComponent sprite = Convert.ChangeType(...);
    system.Execute(sprite);
}

Example #2: Keeping Components Separate

To keep components separately in their own classes/managers/systems I would likely need a generic class to cut down on the code duplication. The problem I run into here is that looping over each class will require a base class or interface, which at the very least would force me to cast the component types again. (Pseudo code below)

ComponentManager<T>() where T : struct
{
    T[] components;

    // can't use with non-generic interface to put manager into a list
    public void AddComponent(T component) {...}

    // won't compile; type "T" will not cast to type "T"
    public void AddComponent<T>(T Component) {...}

    // requires casting and/or boxing, which defeats
    // the purpose of keeping components separate
    public void AddComponent(object component) {...}

}

It seems every which way I try to implement a ECS in C# ends with hacky/non-performant code, that's assuming I can get it to compile in the first place. From studying other ECS systems around the net, it seems some side-step these issues by using void/int pointers or storing component bytes directly in memory (like I believe the new ECS in Unity 2018 does). Either way those are unsafe operations in what's supposed to be a managed memory language.

So is C# the wrong tool for the job? Am I approaching this incorrectly? I'd love to hear some opinions as this just seem impossible...

sentences:
Determining if something is on the right or left side of an object? I have a character in a 3D world which is facing an arbitrary direction on a flat plane, the player can click on the left or right side of the character and based on which side is clicked on a different action happens.

How can I determine which side the click occured on? Obviously for straight on ahead (0,0,1) I can simply use the x coordinate of the click point to determine if it's the left or right hand side, but what about other cases?

sentences:
How to create polygonal or elliptical colliders by python tkinter? I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries.
My problem is colliders. I need to detect collisions of game objects. First I used a circle collider (it's easy). But using only circles in a game is not good, so I decided to use polygonal or elliptical colliders, but I don't know how to do it without external libraries such as pygame. Could anyone help me?

My question shorter:

How to detect polygons' or ellipses' collisions in python tkinter canvas using only standard libraries?

P.S. And how to detect collisions of an inclined rectangle?

sentences:
why won't my character move I am using game maker because I am new to game development and I think it's the easiest to understand because I took a course on it but I put in all the events so that my playerobj moves when you press the A and D keys but when I load up the game it doesn't work here is the GML code below that I am using:

//Speed of player: 5 Pixels per frame
 playerSpeed = 5;

 //Shortcuts for keypresses
 MOVELEFT = keyboard_check(ord('A'));
 MOVERIGHT = keyboard_check(ord('D'));
 MOVEUP = keyboard_check(ord('W'));
 MOVEDOWN = keyboard_check(ord('S'));

 //Move Player
 if (MOVELEFT && x > sprite_width/2)
 {
x -= playerSpeed;
 }

 if (MOVERIGHT && x < room_width - sprite_width/2)
 {
x += playerSpeed;
 }

 if (MOVEUP && y > room_height/2)
 {
y -= playerSpeed;
 }

 if (MOVEDOWN && y < room_height - sprite_width/2)
 {
y += playerSpeed;
 }

sentences:
Set the start orientation of the gyroscope to initial phone orientation I am making a mobile VR project in Unity, and I have a 360-degree video that starts playing where I can look around using a VR headset.

I am trying to set the start rotation of the video to the same rotation as my phone. So no matter where I look when I start the video, that should be my start rotation. I used Input.gyro.attitude in the start but that did not fix my problem. I think I am using it wrong.

This is my code (on the camera inside the sphere):

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

public class Gyroscope : MonoBehaviour
{
    private bool gyroEnabled;
    private Gyroscope gyro;
    private GameObject cameraContainer; //A camera container for my main camera
    private GameObject videoSphere; //The sphere my video is in
    private Quaternion rot;

    private void Start()
    {
        videoSphere = GameObject.FindGameObjectWithTag("Video");
        cameraContainer = new GameObject("Camera Container");

        gyroEnabled = EnableGyro();

        cameraContainer.transform.position = transform.position; // put the cameracontainer into the sphere
        cameraContainer.transform.rotation = Input.gyro.attitude; // here I want to set the cameracontainer to the rotation of my phones gyroscope
        transform.SetParent(cameraContainer.transform); // make my main camera a child of the camera Container

        videoSphere.transform.localRotation = cameraContainer.transform.rotation; // Here I wanted to set my sphere rotation to the camera rotation
        Debug.Log(videoSphere.transform.localRotation);
    }

    private bool EnableGyro()
    {
        if (SystemInfo.supportsGyroscope)
        {
            Input.gyro.enabled = true; // turn on my gyroscope

            cameraContainer.transform.rotation = new Quaternion(0, 90, -90, 0); // rotate my camera container so the video shows good
            rot = new Quaternion(0, 0, 1, 0); // set the variable rot so that you can turn your device
            return true;
        }
        return false;
    }

    private void Update()
    {
        if (gyroEnabled)
        {
            transform.localRotation = Input.gyro.attitude * rot; //this makes you turn the device and it recognizes the input of the phones gyroscope
        }
    }
}

sentences:
Trouble with Normal Matrix and Point Lighting I'm having issues with lighting in my game. For some reason, no matter what I try, point lights appear to cut off halfway through the center of the light. I'm trying to render this light on a quad.

Setup:
All of the vertices of my quad have a normal of (0, 0, 1). I translate this quad, rotate 90 degrees along the y-axis (just as a test), rotate 90 degrees along the x-axis (so that it appears as a floor), then scale.
I compute my normal matrix inside my vertex shader currently via the following:
mat3 nMatrix = mat3(transpose(inverse(model)));

Then I determine the normal via the following:
lightNorm = nMatrix * aNormal;

I calculate the vertex position with the following:
verPos = vec4(aPosition, 1.0) * model;

Then in the fragment shader I do the following:
vec3 norm = normalize(lightNorm);
vec3 lightDir = normalize(lightPos - verPos); // lightPos is the position of the light, unaffected by any matrices.
float diffuse = max(dot(norm, lightDir), 0);
vec4 diffuseColor = vec4(diffuseLightColor, 1.0) * diff * inputDiffuse;
lightColor += diffuseColor;

What is strange, is once I remove the rotation along the y-axis, everything appears correctly:

Note: I am using OpenTK. I've noticed some strange behavior with matrices in OpenTK, where multiplication order is flipped from many examples and demos online, so I'm wondering if that might have something to do with it.
I've tried multiplying by the view matrix (I might have not done this correctly), flipping multiplication order, etc, and none of that has seemed to work. I've also used a normal map instead of vertex normals and I get the same result.
Why is it, that when I rotate along the y-axis, my lighting appears to be "cutoff" right through the middle?

sentences: How to add clickable text link in Game Maker Studio 2? I was wondering if anybody knew how to add text, that when clicked, would take you to another website in Game Maker Studio 2.

sentences:
What is the difference between these two shaders in terms of performance? I have implemented a two pass Gaussian blur shader in GLSL like this:
...
const float[] weights = float[](0.382928, 0.241732, 0.060598, 0.005977, 0.000229);
vec2 offset = vec2(1.0f) / vec2(textureSize(image, 0));
vec3 result = texture(image, vec3(io_textureCoordinates, layer)).rgb * weights[0];
if(horizontal) {
  for(int i = 1; i < weights.length(); i++){
    result += texture(image, vec3(io_textureCoordinates + vec2(offset.x * float(i), 0.0f), layer)).rgb * weights[i];
    result += texture(image, vec3(io_textureCoordinates - vec2(offset.x * float(i), 0.0f), layer)).rgb * weights[i];
  }
} else {
  for(int i = 1; i < weights.length(); i++){
    result += texture(image, vec3(io_textureCoordinates + vec2(0.0f, offset.y * float(i)), layer)).rgb * weights[i];
    result += texture(image, vec3(io_textureCoordinates - vec2(0.0f, offset.y * float(i)), layer)).rgb * weights[i];
  }
}
...

Where variable horizontal and layer are uniforms (the image is a texture2DArray, but this is not that important). I use a 9x9 kernel (variable weights, the first weight is the center) and first I blur the image horizontally, then I change the horizontal uniform to false and rerun the shader to blur the image vertically. It works fine, but the performance is really bad. I don't know why, because I don't do anything special. The variable horizontal is a uniform, so it remains the same for every pixel in a draw call, so each shader core executes the the same path for every pixel.
Then I changed the code a little bit, like this:
...
const float[] weights = float[](0.382928, 0.241732, 0.060598, 0.005977, 0.000229);
vec2 offset = vec2(1.0f) / vec2(textureSize(image, 0));
vec3 result = texture(image, vec3(io_textureCoordinates, layer)).rgb * weights[0];
vec2 ofs = horizontal ? vec2(offset.x, 0) : vec2(0, offset.y);
for(int i = 1; i < weights.length(); i++){
  result += texture(image, vec3(io_textureCoordinates + ofs * float(i), layer)).rgb * weights[i];
  result += texture(image, vec3(io_textureCoordinates - ofs * float(i), layer)).rgb * weights[i];
}
...

It's almost the same, I just use horizontal in another place, but the performance is much better. Can someone explain what is the difference between the two shaders what causes a big difference in performance? I thought that maybe the first version executes both sides of the if-else, which means two times more texture sampling, however the second version is much faster even if I execute it two times more.
I'm using WebGL 2 and Nvidia GTX 1050M.

sentences: Design Question, Thoughts on Path Finding for a Galaxy Map I am thinking through solutions for a galaxy map.  We have different solar systems that need to be connected.  I do think a-star (A*) is possibly a good solution but was curious if it was really the only solution.  The galaxy map should remain static for the entire game.  I've also included an image similar to how the galaxy map would be setup.

sentences:
View Space From gl_FragCoord Trying to get the example code for CalcEyeFromWindow() (first one on the page) to work in WebGL, but having no luck.

Paired down the code to the following with some explicit values just in case something is amiss with parameter passing.  Visualizing the output on a sphere of unit radius, centered in the view and 3 units from the camera.  Using step() in the output to provide sharp color transitions on the sphere.

The current output is black.  If I set the step to 0 for X and Y, the transitions for X and Y are centered on the sphere, so it would seem that the problem is at least in part due to the calculation of clipPos.w.

Vertex shader:

precision highp float;

attribute vec3 a_position;

uniform mat4 u_modelMatrix;
uniform mat4 u_viewMatrix;
uniform mat4 u_projectionMatrix;

void main()
{
    gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * vec4(a_position, 1.0);
}

Fragment shader:

precision highp float;

uniform mat4 u_inverseProjectionMatrix;
uniform mat4 u_projectionMatrix;

vec3 CalcEyeFromWindow(void)
{
    vec3 ndcPos;
    // Hard code window-space position at gl_FragCoord
    // Hard code viewport dimensions
    ndcPos.xy = (2.0 * gl_FragCoord.xy) / vec2(1000, 500) - 1.;
    // Hard code clipping depths
    ndcPos.z = (2.0 * gl_FragCoord.z - 1. - 4.) / (4. - 1.);

    vec4 clipPos;
    clipPos.w = u_projectionMatrix[3][2] /
       (ndcPos.z - (u_projectionMatrix[2][2] / u_projectionMatrix[2][3]));
    clipPos.xyz = ndcPos * clipPos.w;

    return (u_inverseProjectionMatrix * clipPos).xyz;
}

void main() {
    // Step to clarify position
    gl_FragColor = vec4(step(vec3(.5, .5, 2.2), CalcEyeFromWindow() *
         vec3(1,1,-1)), 1.);
}

sentences:
In Box2D, how can I SetTransform of a body without getting an IsLocked assertion error? I've created a bullet body and stored a reference to it in herobody:

bDef.type = b2_dynamicBody;
bDef.position.Set(herobody->GetPosition().x, herobody->GetPosition().y);
b = world->CreateBody(&bDef);
b2FixtureDef fixturebDef;
b2CircleShape circlebShape;
circlebShape.m_radius = 0.05;
fixturebDef.shape = &circlebShape;
b->CreateFixture(&fixturebDef);

I'm trying to change the current position of the bullet. I tried to use SetTransform but I get an error Assertion failed: (IsLocked() == false) during world->step in my update method.

// This doesn't work. Causes the above assertion.
/*
b->SetTransform(
  b2Vec2(
    herobody->GetPosition().x,
    herobody->GetPosition().y
  ),
  0
);
*/

// This works, but doesn't set position directly.
b->ApplyLinearImpulse(b2Vec2(5, 0), b->GetWorldCenter(),true);

How do I do this correctly?

sentences: How often should I calculate the position of a bullet? In game's like Battlefield or Arma, how many times per second is the position of a bullet calculated?

sentences:
Using a DirectX Vertex Shader to Modify the Vertex Data in VRAM? I'm working on a GPU-side particle system in DirectX 11 where the vertex shader  uses a vector field encoded into the color channels of a texture to modify the positions of the vertices before drawing them to the screen.

I'm trying to keep the computations on the GPU rather than calculating the updated particle positions on the CPU and send the new vertex data to the GPU every frame, so I've been investigating the possibility of having the vertex shader overwrite the vertex buffer in VRAM with the updated vertex positions each frame. So far, I haven't managed to find anything on the topic.

Would this be possible, and if so, how would I accomplish it?

sentences:
HLSL 5.0 vector interpolation issues I'm having issues with the depth components of my shadowmapping shaders.
The shadow map rendering shader is fine, and works very well.
The world rendering shader is more problematic.
The only value which seems to definitely be off is the pixel's position from the light's perspective, which I pass in parallel to the position.

struct Pixel {
    float4 position : SV_Position;
    float4 light_pos : TEXCOORD2;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

The reason that I used the semantic 'TEXCOORD2' on the light's pixel position is because I believe that the problem lies with Direct3D's interpolation of values between shaders, and I started trying random semantics and also forcing linear and noperspective interpolations.

In the world rendering shader, I observed in the pixel shader that the Z value of light_pos was always extremely close to, but less than the W value.
This resulted in a depth result of 0.999 or similar for every pixel.

Here is the vertex shader code :

struct Vertex {
    float3 position : POSITION;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

struct Pixel {
    float4 position : SV_Position;
    float4 light_pos : TEXCOORD2;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

cbuffer Camera : register (b0) {
    matrix world;
    matrix view;
    matrix projection;
};

cbuffer Light : register (b1) {
    matrix light_world;
    matrix light_view;
    matrix light_projection;
};

Pixel RenderVertexShader(Vertex input) {

    Pixel output;

    output.position = mul(float4(input.position, 1.0f), world);
    output.position = mul(output.position, view);
    output.position = mul(output.position, projection);

    output.world_pos = mul(float4(input.position, 1.0f), world);
    output.world_pos = mul(output.world_pos, light_view);
    output.world_pos = mul(output.world_pos, light_projection);

    output.texcoord = input.texcoord;
    output.normal = input.normal;

    return output;
}

I suspect interpolation to be the culprit, as I used the camera matrices in place of the light matrices in the vertex shader, and had the same problem.
The problem is evident as both of the same vectors were passed to a pixel from the VS, but only one of them showed a change in the PS.

I have already thoroughly debugged the matrices' validity, the cbuffers' validity, and the multiplicative validity.
I'm very stumped and have been trying to solve this for quite some time.

Misc info :
The light projection matrix and the camera projection matrix are the same, generated from D3DXMatrixPerspectiveFovLH(), with an FOV of 60.0f * 3.141f / 180.0f, a near clipping plane of 0.1f, and a far clipping plane of 1000.0f.

Any ideas on what is happening?

sentences:
What do colleges such as Rocky Mountain College of Art and Design look for in a portfolio? I really want to get into Rocky Mountain College of Art and Design (RMCAD), but I don't know if my skills are up to par. A representative came down today and she told me the requirements for the Game Art degree. Turns out I don't need a portfolio, but I know it would definitely help me out with scholarships, acknowledgement of skill and so on. I want one for myself anyway.

I have a few 'good' sketches and some other 'eh' sketches I don't think are anywhere near my best. I have some life drawings I've been working on as well. To improve my skill I decided to start over and I'm currently learning the human anatomy to draw better skeletons for my characters and such.

I want to be a concept artist with characters and levels/buildings, but... I'm not the best at levels or buildings since I've never really drawn them before. My characters aren't the best, but I am improving. if anyone could help me, I'd greatly appreciate knowing what I should put in my portfolio, how to prepare for college, and etc.

Note: The college is an actual college which is a plus because I can learn my major (game art) plus a minor like business or something else. Maybe architecture...

sentences:
Per-object screen space uv issue I am currently trying to sample a texture in screen space. This works well :

float4 positionCS = vertexInput.positionCS / vertexInput.positionCS.w;
screenPos = ComputeScreenPos(positionCS).xy;
float aspect = _ScreenParams.x / _ScreenParams.y;
screenPos.x = screenPos.x * aspect;

But I would like to be able to constrain uv position and scale based on object's position and distance from camera. I found some example but I also faced some issues and for the moment I don't see how to fix them. Here's the code :

float4 positionCS = vertexInput.positionCS / vertexInput.positionCS.w;
screenPos = ComputeScreenPos(positionCS).xy;
float aspect = _ScreenParams.x / _ScreenParams.y;
screenPos.x = screenPos.x * aspect;

float4 originCS = TransformObjectToHClip(float3(0.0, 0.0, 0.0));
originCS = originCS / originCS.w;
float2 originSPos = ComputeScreenPos(originCS).xy;
originSPos.x = originSPos.x * aspect;
screenPos = screenPos - originSPos;

// You can match object's distance like this
float3 cameraPosWS = GetCameraPositionWS();
float3 originPosWS = TransformObjectToWorld(float4(0.0, 0.0, 0.0, 1.0));
float d = distance(float4(0.0, 0.0, 0.0, 0.0), cameraPosWS - originPosWS);
screenPos *= d;

And here's the issue I am facing. You can notice that when the object is near screen edges the texture starts to move. Is there a way to avoid that ?

https://thumbs.gfycat.com/HairySpryArawana-mobile.mp4

I am using URP but this doesn't really matter.

sentences:
Why is 3D game development supposed to be so hard? This may be kind of a dumb question. I have little experience in programming and no experience in game programming. I've only done simple "if, then" programming and simple circuit board chip programming. I do have experience with graphics software similar to  3DS Max. I was wondering what makes programming a game so difficult. All I want to create is a game world the size of a room with earth like physics such as gravity. More of a physics simulator than a true game. Would that be very difficult?

From what I've read it sounds like it would be difficult but I don't know why. I know the physics and have the graphics and rendering experience. Why is it supposed to be so difficult? Is C++ just really hard to learn or am I missing something. I'm curious because I'm considering learning C++ but don't know if it's worth it.

sentences:
efficient way of matching coordinates I have 2 lists of coordinates in C# one as of coordinates of Drivers and the other as of coordinates of cafes. I am looking for an efficient way of populating a static Dictionary with its key as of a Driver from the first list and its associated values of all Cafes in 500 meters radius. Number of cafes can be up to 100000 and number of Drivers are dynamic from 1 to 100000

public void ManageList() {
GlobalList.Clear();
foreach (var driver in driverList)
    {
        var driverCoords = new GeoCoordinate(driver.Latitude, driver.Longitude);
        List<Cafe> matchedCafes = new List<Cafe>();

        foreach (var cafe in cafeList)
        {
            var cafeCoords = new GeoCoordinate(cafe.Latitude, cafe.Longitude);

            if (cafeCoords.GetDistanceTo(driverCoords) <= 500) {
                matchedCafes.Add(cafeCoords);
            }
        }

        GlobalList.Add(driverCoords, matchedCafes);
    }
}

the above works fine as long as drivers are not movable objects. If I want to send the driver's coordinates every 5 seconds and update the GlobalList per driver the above algorithm fails as I am basically clearing the whole list and populate it again.

sentences:
How to rotate a sprite on circle in android using Libgdx Dear Fellow Game Developers
i am newbie to Android Game Development,i like to know how we can develop a sprite rotate in circle on android,with help of libgdx,
i do have a image in assets folder,cant load it in emulator,following code is using to load image in texture

  texture = new Texture(Gdx.files.internal("1325603701_wordpress.png"));

sentences:
Handling 3D perspective for different aspect ratio I have problem for supporting different aspect ratio in developing Mobile Game.

I was developing on 2:3 screen which is iPhone 4 (Retina).

When I use width and height for screen size and use fixed FOV, then most of cases

look ok, but in 3:4 (which is iPad), the user can "See More" horizontally.

If I force the aspect ratio to 2:3, then looks "squeezed".

I am lost adjusting other values like moving camera, or changing FOV.

Is there any proper way or tips??

Or, What is good FOV for portrait mobile device screen which can cover most of aspect ratio look ok? - I am currently using 45 - and force aspect ratio to 2:3

sentences:
How do I make Ground Check stop rotating with the character when it rotate? How do I make my character routice without Ground Check rotating with it, but still follow my character?

Code:

using UnityEngine;
using System.Collections;

public class Player: MonoBehaviour {

public float maxspeed = 10f;
bool facingRight = true;

Animator anim;

bool grounded = false;
public Transform groundCheck;
float groundRadius = 0.2f;
public LayerMask whatIsGround;
public Vector2 jumpDirection = new Vector2(1f, 1f);
public float jumpFocre = 500f;
bool doubleJump = false;

void Start ()
{
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    if (grounded)
        doubleJump = false;

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
}
void Update()
{
    if((!doubleJump) && Input.GetKeyDown ("up"))
    {
        anim.SetBool("Ground", false);
        float move = Input.GetAxis ("Horizontal");
        jumpDirection.x = move;
        GetComponent<Rigidbody2D>().AddForce(jumpDirection.normalized * jumpFocre);

        if(!doubleJump && !grounded)
            doubleJump = true;
    }

}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}
}

sentences:
how could RTT be so slow on my intel card? I simply draw something into a render target, and use it as an normal texture. It's always working greate to me with my nvidia video card. But today I found my program ran terribly slow (less than 5 fps) on a intel card.

After running an analyse I found glGenerateMipmapEXT is the trouble maker, it costs most of the cpu time. Here's how I bind a RT texture:

  glBindTexture(GL_TEXTURE_2D, m_textureID);<br>
  glGenerateMipmapEXT(GL_TEXTURE_2D);

without glGenerateMipmapEXT the texture is nothing but pure white pic. Something wrong with my RTT?

sentences: Farseer engine built for MonoTouch? Does anyone know where I can find a version of the farseer physics engine compiled for MonoTouch, or do most people just download a windows version from codeplex and attempt to build their own solution?

sentences:
Problem loading content in WinForms using XNA I'm currently having trouble implementing loading content with the content pipeline into my WinForm application. I'm using the "WinForms Series 1: Graphics Device" sample provided by microsoft.

By simply creating a project, copying over the classes, creating a both content projects like in the sample worked all fine. But what I really want is use my XNA Game Project and it's Content Project to be used so I can run simple simulations inside my editor with it's code and graphics.

I thought it would be really simple since it appears to be the same structure except this time the games project has some code in it. But it seems like it doesn't, if I try to load some font or a sprite it gives me the classic red cross and a console entry telling me it can't load my asset. However, it's clearly on the Content directory in the build.

sentences:
How do I store an FBO'S as a cube map? As of late I've been trying to implement Cubemaps in my engine, and have managed to get the rendering side of them working. Currently, I'm trying to implement a function for creating them, but I somehow hit a road block.

The way I'm trying to implement this is by rendering my scene once into an FBO from the perspective of the cubemap node (x6 times, one in each direction), and cycle the format of the texture bound to the color attachment as:

  GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, etc

For whatever reason, I haven't been getting any expected results.

All I want to do is take snapshots from the camera's perspective, but I need them in texture units I can use multiple frames over.

I've tried so many ways that I couldn't possibly recount them all here, but the general gist of how I've been trying to go about doing this, is this:

DTextureCubemapComponent *cubemap = getTexture(); // My Texture Component
GLuint target = cubemap->textureObj();            // CUBEMAP texture handle
glBindTexture(GL_TEXTURE_CUBE_MAP, target);       // Make cubemap active

for (int x = 0; x < 6; x++)                       // Render from 6 different angles
{
    gbuffercube->swapFinalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X + x);
    gbuffercube->StartFrame();                    // my FBO Class, binds itself, etc

    /*... RENDER SCENE ...*/                      // Draw into my FBO, etc

    gbuffercube->BindForFinalPass();              // Read buffer == my FBO
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

Where "SwapFinalFormat()" is:

void GBuffer::swapFinalFormat(GLuint format)
{
    format = fmt;
    glTexImage2D(format, 0, GL_RGBA32F, size.width(), size.height(), 0, GL_RGBA,     GL_UNSIGNED_BYTE, NULL);
    glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT6, format, m_finalTexture, 0);
}

I know that my FBO class works (labeld GBufferCube above) , as it is the same class I use normally for my deferred shading system.

sentences: XNA GameDefaults Class Settings Are items such as the GameDifficulty enum, game settings, and other things in the GameDefaults class used for a lot? If so, is there a way to edit them or anything of the sorts?

sentences:
Unity Shadergraph to CPU code? I read that you in theory can get vertex offsets from GPU shader in CPU by transpiling the shader to CPU callable code or creating a compute shader that calls the shader code (are there more ways?).
I am wondering how one should approach this if one wants to use a shader from shadergraph. Can I get the same noise textures on CPU as on the nodes in shadergraph (GPU) for example? They can be important in driving the result.
I think it is possible to export as hlsl so maybe transpiling can be done automatically.

sentences:
Collision between Mesh Plane and 2D Sprite I've just recently started programming using Unity and made a couple of games with it, I'm trying out more and more advanced stuff as I do more games, but right now...

I'm trying to make a game that's basically a way simpler clone of pokemon y/r/g/b (I'm only concerned about tile placement, player movement / collision, and dialogue boxes at this time)

I tried about 3 methods for tile placement and found that using a mesh worked best for me (using tiled and tiled2unity) and imported the tmx files into unity.

Now, I just dont know where to go from here.

Starting with the player, I don't want to add physics since most games like this doesn't really have physics involved. So I tried adding a box collider to the player then a controller that uses transform.translate. Unfortunately, I dont think the colliders work nicely with transform.translate.

In this scenario, is the best setup for the player simply just using a kinematic rigidbody2d then adding the code/methods to collide with the map? Also since translate might be a bad idea, is transform.position a better alternative to use? (note that the player moves in increments in a "tile-like movement", any comments or suggestions?)

I'm also quite surprised by the lack of simpler games such as this one. Most of the examples I can find online are physics based platformers and top-downs that use code like velocity, addForce, with physics components involved. Any available source code that I could study would be welcome.

(I've also posted this on Unity Forums but people frequent here more often)

sentences:
Looking for an Open Source Game Engine with Crowd Simulation I am looking for a game engine for my school project on computer graphics. There are specific requirements that I do not want to implement by myself, since they are irrelevant for the grade, but relevant for the final result.

So reusing other one's code is a good thing here and I am looking for an engine that supports the following features, or that has plugins/3rd party projects available that can do it for me. I have already been looking for it for 2 days, but maybe some of you might just know the right fit for me.

Requirements:

Open Source / Free [so people can always view back my code without any licensing.]
3D
OO [I'm not so good at C++. Preferred are: Java, C#]
Crowd Simulation [I need walking people in my scene. This could be a 3rd party lib. Probably best with nav meshes.]
Render to Texture [I need panels with moving images on it. Unity3d fails here.]
Multi-project [I cannot adjust the installation folder on my school computer. UDK and CryEngine fail here.]
Networking
Cross Platform (at least for Linux)

Engines that fail my requirements:

CryEngine 3
UDK
Unity3d
OpenSceneGraph: not a real engine. I need more interactive components.
XNA: not cross platform.

Update
I found a nice crowd simulation lib after a long long search: http://gamma.cs.unc.edu/RVO2/ So that is not a big issue anymore

Update 2
Apparently, my mentor wants it to be cross platform. Which is an ouch for XNA.

sentences:
Image looks GOOD on the editor but BAD (blurry) on the HTML5 export I have a red bar that looks good inside Unity editor, but when I export the build it looks very strange.
Any idea on how to fix this?

The image on the left is the one with the strange/bad looking red bar...

sentences: .PNG tiles to .PNG map I was wondering how I can get my 110+ .png map tiles conveniently into a 1:1 pixel ratio size map .png. I've been scrolling through Google and forums for the free ware game that I am modding, but the app I'm using recognizes only .png files, and I want more than 1% of the map. If you guys know of a program I would be very appreciative.

sentences:
Get and destroy gameobject component of same type I want to destroy any graphic component on a gameobject , example is image,raw image, sprite , ect .But i don't have the list of all graphic component so i don't know how to loop through it . The reason is because i want to replace the component with the same type , for example i want to add Text component , but i can't add it if there is already graphic component attached in the gameobject because there can only be one graphic component in a gameobject , so i need to destroy the graphic component first , how do i do it ?
I personally prefer the answer on c# but any programming language is accepted !

sentences:
How do I fairly distribute new powerful cards to players in a collectible card game? I'm writing a game in which users start with a few cards. They use those cards to play against other players. The winner can steal a card from the other player.

The aim is to get more/different/rare/higher-powered cards.

If everyone starts with 10 low-powered cards, how would anyone ever get higher powered cards? They'd just be playing against people who have the same type of cards as them.

How do you fairly distribute these more powerful cards among players?

sentences:
Can I rely on SoundEffects being stopped when unloaded? I am using XNA's SoundEffect class to play sounds. I have to unload all sounds from the corresponding ContentManager for technical reasons, while some of them are still playing.

What happens to sounds that are still playing (via SoundEffect instances) when being unloaded? It seems that they just stop abruptly. Is this a deterministic behaviour I can rely on? Can it cause any errors when unloading sounds that are currently playing?

sentences:
How can I add acceleration to the movement of an object in a game Below is the code that I'm using to move an object:

let XX = 0
let YY = 0
let maxSpeed = 100;

if(keyDown.w) {
    XX += Math.sin(angle*Math.PI/180)*moveSpeed;
    YY += -Math.cos(angle*Math.PI/180)*moveSpeed;
}

I'm trying to implement acceleration in moving.  How can I do that?

sentences:
Unused frame(window) management I'm rewriting my game now using software designing patterns and want to do the code, most correct I can. While implementing MVC(Model View Controller) I got a question which I would like to discuss or to hear some opinions of experts.
The question is about management of unused frames... For example next sequence of windows:
ResourceLoadingWindow -> LoginWindow -> GameWindow
Definetly that I don't want to reuse ResourceLoadingWindow , since I'm using Java Applet and I don't see any situation when I will need to reuse it. The different story is about LoginWindow, which can be reused a lot of times, because some player would want to Logout and come back again in few minutes for example. I would like to know, following the MVC structure, should I destroy window, removing it from ContentPane or just hide? Maybe I need to unregister it from controller or I shouldn't do so?

Thanks in adavance.

sentences:
How can I detect if a gameObject has collided with two other specific objects at the same time? How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

sentences:
Offsetting ground texture doesn't work in WebGL so I've created a 2D sidescroller game, the technique I used is to keep the player on the same place, and move the obstacles towards him. I also offset the ground and backdrop constantly to create the illusion of player moving.

The ground texture is on a quad, and the texture wrap mode is set to repeat.
In the editor everything is running fine as I wanted, however when I build it (WebGL), in the browser the ground doesn't seem as if it is set to Repeat but rather Clamp.
Here's how it looks:

You can see from the left part of the image the ground doesn't repeat, the strange thing is that, after the game runs for a few more seconds it fixes, and then in a few seconds becomes like that again.

heres the code attached to the ground to keep it offsetting constantly:

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

public class Offset : MonoBehaviour {

public float scrollSpeed;
public Material mat;

private float offset;

// Use this for initialization
void Start () {
    mat = GetComponent<Renderer>().material;
}

// Update is called once per frame
void Update () {
    offset = Mathf.Repeat(Time.time * scrollSpeed, 1);
    mat.mainTextureOffset = new Vector2(offset, mat.mainTextureOffset.y);
}
}

What may I be doing wrong, and how can I fix it?

Thanks in advance!

sentences:
Implicity of "Objects" in component based design For a while, I have mostly been using "standard OOP" (inheritance heavy, tree structure, etc.) styled designs for my Game Development needs. However, for my current project I am trying to shift over to a component-based design (This is all at a hobby level, so time/money/productivity speed are not important ATM.) However, while researching into component based designs, I am confused about how the concept of "objects" are implement.

From what I can understand, there are 2 schools of thought in regards to the relationship between components and objects. One paradigm seems to implement objects as classes that simply serve as "containers" for holding components that interact with another. However another paradigm seems to get rid of the concept of an object itself, with objects only existing implicitly. (however, I fail to understand how synchronization issues don't appear. If anybody could also explain this, that would be very helpful.)

Regarding these 2 ideals, are there any major benefits (performance, usability, etc.) to choosing one paradigm over another?

sentences:
Stopping on a slope in Box2d I am creating a simple platformer using Box2d. I've implemented a variant of the technique described here.

To make the player character move more 'platformer-like' I want him to stop on (shallow) slopes.

However, the engine I am using does not support angle-joints, so I have trouble restricting the movement of the wheel. I've tried some different alternatives that not worked: Setting the horizontal velocity to 0 every game loop doesn't seem to work, because between calls the wheel catches up speed once again.

Is there another way to fix this?

sentences:
How much is too much? From a game design perspective, I've got the following idea:

Traditional Tower Defense game. - an open, mazeable field as monsters approach the castle.

"Towers" consist of ground-pounding units like foot soldiers, moats, and other things. yawn

However, I'm adding the following features:

"Town" - a separate screen for
upgrading units and buying new
abilities.
"Tap Defense" - There are archers
sitting on the wall with excellent
range - tap monsters to shoot them.
RoF, Damage upgradeable in town.
"Tap Defense+" - for cash purchases,
you can buy wizard spells that deal
mega-damage (think Eagle in Angry
Birds).
"Underground" - the paid version will
come with Dwarven Sappers, which give
you an additional screen of "mazing"
and towers "underneath" the current
map, so you can build defenses in at
least 2 levels.

Is mazing, tapping, and 2 z-levels too much?

What kinds of things should be considered?  I already know that pausing while placing structures will probably be needed (or wanted).  Anything else?

sentences:
Where is the Shader Designer in Visual Studio? I have Visual Studio 2012 Ultimate and I've been trying to access the Shader Designer. I searched through MSDN's text and Channel9's videos, but they keep failing to mention how to access it.

Can someone let me know where it is?

sentences:
Android problem with onTouchEvent I'm making some sort of clone for FlappyBird, but with some adjustments.

I want to change from the FlappyBird's mechaninc of jumping to make the bird raise as long as the player is long-pressing the screen.
I've tried to change this:

@Override
    public boolean onTouchEvent(MotionEvent event) {
        int action = event.getAction();
        if(action==MotionEvent.ACTION_DOWN){
            valo=-30;
            gameSate =true;
        }
        return true;//to have indication when we done
    }

To:

@Override
    public boolean onTouchEvent(MotionEvent event) {
        int action = event.getAction();
        while(action==MotionEvent.ACTION_DOWN){
            spaceY-=3; //y axis location for the bird
            gameSate =true;
        }
        return true;//to have indication when we done
    }

Which didn't work at all, when I changed the onTouchEvent from the if statement to the while loop, the bird was frozen. With the if statement, pressing only make it bounce once, no matter if the screen is being pressed or not

Is there a way to keep the Y axis change smooth while doing it only when action==MotionEvent.ACTION_DOWN

sentences: In-App Billing Library for Android Game I'm trying to add in-app purchases into my Android game and it having some trouble figuring my around the Google Play Billing. Can anyone refer me to a good open source reference for how to do that?

sentences:
Why real time lightning fails to show shadows on terrain in Unity? I'm using the TerrainTools unity package to create a simple 500x500 terrain, and placing a simple character that moves around, however, by default, the lightning is at real time mode, and the shadows over the terrain flicker like this:
https://youtu.be/_eFFDCRjObY
I know I can set the terrain as static and bake the lighting, however, doing that I lose my character shadow.
So my questions are, why this happens over real time lighting?, and, why I cannot see my shadow on a dynamic mesh over baked lightning?
Here you can see my lighting and directional light configs:
Lighting config:

Directional light config:

sentences:
How to setup engine properly in ktx-ashley? I'm trying to setup simplest Ashley project with only 2 entities and get this error:

Exception in thread "LWJGL Application" java.lang.IllegalStateException: createComponent(T::class.java).apply(configure) must not be null

Here is the code:

class AshleyScreen(game: Main): KtxScreen {

    private val engine = Engine()

    override fun show() {
        engine.add {
            entity {
                with<DrawableComponent> {
                    sprite = Sprite(Texture("image1.png"))
                }
                with<TransformComponent> {
                    position.set(0f, 400f)
                }
            }
            entity {
                with<DrawableComponent> {
                    sprite = Sprite(Texture("image2.png"))
                }
                with<TransformComponent> {
                    position.set(500f, 50f)
                }
            }
        }
        val renderSystem = RenderSystem()
        engine.addSystem(renderSystem)
    }

    override fun render(delta: Float) {
        engine.update(delta)
    }
}

// Components
class DrawableComponent(var sprite: Sprite): Component
class TransformComponent(val position: Vector2 = Vector2()): Component

//Systems
class RenderSystem: IteratingSystem(allOf(DrawableComponent::class).get()) {
    val batch = SpriteBatch()
    val tm = ComponentMapper.getFor(TransformComponent::class.java)
    val dm = ComponentMapper.getFor(DrawableComponent::class.java)

    override fun processEntity(entity: Entity, deltaTime: Float) {
        val t = tm[entity]
        val d = dm[entity]
        d.sprite.setPosition(t.position.x, t.position.y)

        clearScreen(0.8f, 0.8f, 0.8f)
        batch.begin()
        d.sprite.draw(batch)
        batch.end()
    }
}

Compiler complains on engine.add line.

sentences:
(GLSL) Lighting code outputting a black quad So, ive been transitioning to modern opengl recently and it's going rather well. But alas, something must go wrong. As the titel says, all I'm getting is a completely black quad. (Ive double checked my C++ code and I'm pretty sure it has nothing to do  with that.)

#version 330 core

//Vertex shader

layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;
layout(location = 2) in vec2 vertexUV;
layout(location = 3) in vec3 vertexNormal;

out vec3 vertNorm;
out vec3 fragmentColor;
out vec3 vertPos;
out vec2 UV;

uniform mat4 MVP;

void main(){
    gl_Position =  MVP * vec4(vertexPosition_modelspace,1.0f);
    UV = vertexUV;
    fragmentColor = vertexColor;
    vertPos = vertexPosition_modelspace;
    vertNorm = vertexNormal;
}

//Fragment shader
#version 330 core

in vec3 Normal;
in vec3 fragmentColor;
in vec3 vertPos;
in vec2 UV;

out vec3 color;

uniform sampler2D textureSampler;
uniform mat4 Model;

void main(){
    vec3 lightPos = vec3(0, 0, 0);
    mat3 normalMatrix = transpose(inverse(mat3(Model)));
    vec3 normal = normalize(normalMatrix * Normal);
    vec3 fragPosition = vec3(Model * vec4(vertPos, 1));
    vec3 surfaceToLight = lightPos - fragPosition;

    float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal));
    brightness = clamp(brightness, 0, 1);

    color = vec3(brightness * 1 * (texture(textureSampler, UV).rgb * fragmentColor));
}

But if you require my c++ code, say so and ill edit.

sentences:
How can I mod a Minecraft slime to be about the size of a full block? I want to make the slime's size roughly the size of a full block,
I have tried some values but I'm not sure if any of those I tried fit the idea I have.
What would you recommend for the size of the slime which roughly matches or matches a block's size?

sentences:
Problem with position for player and 2D camera I'm not sure I understand how the Matrix class for a 2D camera works in XNA. I have a Player object that I'm trying to position in the middle of the screen and then I have the Camera object that I want to follow the Player. But The position of the player is at the top left corner!?

Preciate som help to understand and to improve my code.

Game1.cs

player = new Player(texturePlayer, new Vector2(screenSizeX / 2, screenSizeY / 2));

And in the Update method:

camera.Position = player.PlayerPosition;

The Camera class:

    class Camera
{
    public Vector2 Position { get; set; }
    private Viewport viewPort;

    // Konstruktor
    public Camera(Viewport viewPort)
    {
        this.viewPort = viewPort;
        Position = Vector2.Zero;
    }
    public Matrix GetViewPortMatrix()
    {
        return Matrix.CreateTranslation(new Vector3(-Position, 0f));
    }
}

I guess there is no need to calcualte an origin for the Matrix when the camera isn't going to rotate!?

And finally some part of the Player class. Note that I'm using a "timer" to achieve a movement of the player in steps. Is this OK or is there a better way to achieve this?

    class Player:GameObjects
{
    //public Vector2 Position { get { return position; } }

    private int walkingSpeed = 60;
    private float walkingTimer = 100;
    private float milliSeconds1;

    // Konstruktor
    public Player(Texture2D texture, Vector2 position) : base(texture, position)
    {
    }

    public void Update(GameTime gameTime)
    {
        milliSeconds1 += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    public Vector2 PlayerPosition
    {
        get
        {
            return position;
        }
        set
        {
            position = value;
        }
    }

    public void Up()
    {
        if (milliSeconds1 >= walkingTimer)
        {
            if(position.Y > 60)
                position.Y -= walkingSpeed;

            milliSeconds1 = 0;
        }
    }

    public void Down()
    {
        if (milliSeconds1 >= walkingTimer)
        {
            if(position.Y < 630)
                position.Y += walkingSpeed;

            milliSeconds1 = 0;
        }
    }

sentences:
How to allow infinite custom inputs? Summary: What approach should I take to allow custom inputs saved in a file be interpreted in the engine?
So I am making a game engine similar to Mugen where I want characters to have their own special combo inputs. Similar to how Kage has the Shun Goku Satsu. Where its just a combination of multiple keys pressed in quick succession. The thing is I want to give the ability to create these combinations to the character creators and let the engine handle the rest.
I already parsed the list of moves from the character file, so now I got an in-memory list of valid input sequences for each character and what moves they trigger. But I don't really know how to interpret a valid sequence.

sentences:
How to code camera for layered map in unity For a current unity project I need a layered map like in Dwarf Fortress. The game will take place in a 3D city enviroment and the camera should be 'snapped' to layers. So there will be (for example) a cave layer, ground layer and floor 1 - 3 layer. The player should be able to navigate the camera up and down with a keypress. So if the player is looking currently at the ground layer and press + the camera should snip to floor 1 layer. All layers below the current level will be blurred and all levels above wont be visible (or at least faded out very strong)

My question now is: Is the layer system of unity useful for such a scenario, or is it better to implement an own data structure? I know about the ability of ignoring layers for rendering and raycasting but can the system be extended to support the features described above?

sentences:
How to enable GPU for flash player 11? I just install Flash Player 11 and SDK 4.5 (hero), and test it with a small program. But I find it is still using "software" to simulate 3D API, and

trace("driver info: " + _context3D.driverInfo);

output

driver info: Software

I'm using windows 7, directX works properly, and option "-swf-version 13 -use-gpu" is already added in compiler arguments.

Who can tell me how to enable GPU in Flash Builder?

UPDATE:

context3d is constructed as :

private var _context3D:Context3D;
...
_context3D = stage3D.context3D;

And wmode is set to direct in html.

sentences:
Making animations not smooth while using Record button In my 2D sidescroller game, I want to separate the animations for the head and the body of my character.

While idling, my charcter's body bounces slightly up and down (kind of a breathing motion). Thus, the head should keep up.
However, when I press Record and make adjustments for the head, the head moves up and down smoothly instead of following the body frame by frame.

How can I remove the smooth transitions from one position to the other?

Here is a screenshot from Unity demonstrating the hierarchy and the animation keyframes.

sentences:
Move a 2D sprite into an irregular terrain With a tile based engine, in my knowledge, is not possible to move a sprite into an irregular terrain. So which are the techniques to use for implementing that?
Maybe an hexagonal tile based engine?

sentences:
What does the "random element" do in Cellular Automata I'm reading this post on TutsPlus regarding procedural level generation using cellular automata. My question arises in this code snippet:

float chanceToStartAlive = 0.45f;

public boolean[][] initialiseMap(boolean[][] map){
    for(int x=0; x<width; x++){
        for(int y=0; y<height; y++){
            if(random() < chanceToStartAlive){
                map[x][y] = true;
            }
        }
    }
    return map;
}

In the first line, the author declares a float that represents 45%. This makes sense. However, the role of this is unclear to me. In this line:

if(random() < chanceToStartAlive)

A random number is being generated, and being tested if it's less than 0.45f. Since it is an inequality, this expression can either return true or false correct?

How exactly is this percentage affecting this loop?

Thank you!

sentences:
How to find if an object is facing another object given position and direction as separate vectors I found a very helpful post about exactly what I need here. It uses dot products to which is what I'm specifically looking for.

It talks about players facing monsters basically. They give a helpful picture here,

My question though, is what if you have a function with 3 arguments: the position of object 1, the position of object 2, and the direction object 1 is facing given as a unit vector. So the picture would look as so:

How would you find whether A is facing B?

sentences:
Whats the best way to publish and promote an app by myself? My first little casual-action android game is nearly finished. Its my first one and i dont expect any sucess. But nevertheless i want to try to publish and market it by myself.

But what can i do without any bugdet? How do i attract and reach people ? Are there any tricks ? How did you published and promoted your first app/game ? And what is your experience with self publishing/marketing ?

sentences: How do I combine mesh to all move together with an armature? I can't figure out how to make all these parts move together. I joined them, however, they are still separate? How do I make my model move its parts together?

sentences:
In-Game Tutorial Decisions I'm working on a game with confusing mechanics such as energy storage and the coolant temperature. What is the best way to get a new player learned quickly? What are the pros and cons of different in-game tutorial methods? I was thinking of a tutorial with annotated screenshots, but that makes it sound like a science textbook ("Active towers are towers that consume energy and may generate heat.").
Other ways include:

in-game tutorials, which is somewhat difficult to program
tips that will show in-game and after game over
a reduced difficulty without the energy and coolant things

sentences:
Which API for cross platform mobile audio? This question focuses on the API's available on phones.

I'd been planning to use OpenAL in my game for maximum portability.  It runs great on Linux so I can quickly iterate while developing as well as leverage the desktop's superior debugging tools.

However I've recently heard that Android doesn't support OpenAL well.  Instead they've gone with an OpenSL ES library.

What I'm looking for is a free Audio library that I can use with minimal custom code on iPhone, Android, and my Linux desktop.  Does such a library exists?

Some extra details:
The game is written in C++ with custom minimal front ends, e.g. ObjC for iPhone, Java for Android, and SFML for desktops.  I'm using OpenGL ES for portability as iPhone doesn't support the more advanced OpenGL APIs.

sentences:
Detecting right/left collisions with a bounding box I'm building a platformer in cocos2d, my first game project. I'm working on movement and collision detection. I'm using a tilemap with a "meta" layer of invisible blocks that are designated collidable.

Everything seems to work pretty well except for one minor detail: when the character jumps from above into a platform, he does not fall but clips through it. If he jumps from below, it recognizes it and resets his Y velocity accordingly. I know that it's because of how I'm  detecting the collisions, and just doing a simple comparison of the origin.y's, but I'm unsure of how to refactor this code better:

- (void) update: (ccTime) dt {
    CGPoint scaledVelocity = ccpMult(leftJoystick.velocity, 35.0f);
    CGPoint newPosition = ccp(player.position.x + scaledVelocity.x * dt, player.position.y);
    CGPoint oldPosition = [player position];

    float velocityX = player.Velocity.x + scaledVelocity.x * dt;
    float velocityY = player.Velocity.y;

    BOOL isCollision = NO;
    BOOL isCollisionBelow = NO;
    BOOL isCollisionRight = NO;
    BOOL isCollisionLeft = NO;

    NSMutableArray* collisionSprites = [[NSMutableArray alloc] init];

    if (oldPosition.x > newPosition.x) {
        player.flipX = YES;
    }
    else if (oldPosition.x < newPosition.x) {
        player.flipX = NO;
    }

    for (CCSprite* sprite in gameplayLayer.collidableTiles) {
        if (CGRectIntersectsRect(player.boundingBox, sprite.boundingBox)) {
            isCollision = YES;
            [collisionSprites addObject:sprite];
        }
    }

    // Figure out which direction collision is in
    if (isCollision) {
        for (CCSprite* collisionSprite in collisionSprites) {
            if (collisionSprite.boundingBox.origin.y < player.boundingBox.origin.y) {
                isCollisionBelow = YES;
            }
            if ((collisionSprite.boundingBox.origin.x > player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionRight = YES;
            }
            if ((collisionSprite.boundingBox.origin.x < player.boundingBox.origin.x) && (collisionSprite.boundingBox.origin.y >= player.boundingBox.origin.y)) {
                isCollisionLeft = YES;
            }
        }
    }

    if (isCollisionLeft) {
        velocityX = 0.5f;
    }
    else if (isCollisionRight) {
        velocityX = -0.5f;
    }

    if (isCollision && !isCollisionBelow && player.characterState != kStateFalling) {
        velocityY = 0;
        velocityY -= 0.8f;
        [player setCharacterState:kStateFalling];
    }
    else if (!isCollisionBelow) {
        velocityY -= 0.7f;
    }
    else if (isCollisionBelow) {
        velocityY = 0;
        [player setCharacterState:kStateIdle];
    }

    if (rightButton.active) {
        if (player.characterState != kStateJumping) {
            velocityY += 15.0f;
            [player setCharacterState:kStateJumping];
        }
    }

    // Ground friction
    if (player.Velocity.x > 0) {
        if (player.Velocity.x < 0.5f) {
            velocityX = 0;
        }
        else {
            velocityX -= 0.5f;
        }
    }

    if (player.Velocity.x < 0) {
        velocityX += 0.5f;
    }

    [player setVelocity:ccp(velocityX, velocityY)];
    [player setPosition: ccp(player.position.x + player.Velocity.x, player.position.y + player.Velocity.y)];
    [gameplayLayer setViewpointCenter:newPosition];
    [player setOldPosition: player.position];
}

How can I refactor this code to work properly from all angles and reduce the complexity (I feel that there's too many booleans, and they all get a bit confusing).

sentences:
How do I import 2d character assets in unity? I recently downloaded a 2d platform assets that came with a player model. The character came in a lot of pieces like an image of eye, another for torso, etc. How do I go about making these images an actual character. The asset also came with a few animations like blinking, jumping, etc. How do I apply these?
I'm new to unity and game development(started about a few days ago) so please help even if this may sound like a really dumb question.

I use Unity BTW if it changes what the answer would be.

Link to asset:  https://assetstore.unity.com/packages/2d/environments/free-platform-game-assets-85838

sentences:
Pong tutorial / Unity Logic question I've been following this Pong tutorial, which is great: https://noobtuts.com/unity/2d-pong-game. The C#, unity components etc I understand. But what I am having trouble with is understanding the logic of how it reverses the direction of the ball depending on where it hits.

I know that what it is doing is condensing a new Y value to -1, 0, 1, via the hitFactor function, which returns that value and then sets that to the new Y (so going up or down) based on the relative ball position to the paddle, divided by the height/size of the paddle. But that's the bit I don't really truly understand, how does that work and why? I have been using Debug.log to send all the different parts of it to try and understand, as well as visually looking in Unity and trying to figure it out from there via the inspector, but I'm just having a mental block. To me I can vaguely see how this code is finding a relative position and then dividing by the height of the paddle to somehow condense it to this range but I'm really just stuck on it in my head.(the hitfactor function itself is basically where I am stuck)

Here's the function:

float hitFactor(Vector2 ballPos, Vector2 racketPos,
            float racketHeight) {
// ascii art:
// ||  1 <- at the top of the racket
// ||
// ||  0 <- at the middle of the racket
// ||
// || -1 <- at the bottom of the racket
return (ballPos.y - racketPos.y) / racketHeight;
}

And in context with the collision:

if (col.gameObject.name == "RacketLeft") {
    // Calculate hit Factor
    float y = hitFactor(transform.position,
                        col.transform.position,
                        col.collider.bounds.size.y);

    // Calculate direction, make length=1 via .normalized
    Vector2 dir = new Vector2(1, y).normalized;

    // Set Velocity with dir * speed
    GetComponent<Rigidbody2D>().velocity = dir * speed;

I'm sure this is a very basic thing, but I am struggling with this type of thing. I am on Khan academy, starting from very basic stuff and working my way up, so no doubt maybe when I get to vectors I might understand this more, but I'd like to try and really get my head around this particular issue.

Sorry for the very basic question, I have been dabbling in C# and Unity for a while, but I have realised my weakness is really in the basic core logic of some things....I am a composer by day but I really enjoy trying to get back into this side of my brain, I guess it's super dusty in there hahaha.

Thanks so much in advance for any help, I truly appreciate it.

sentences:
Efficient Collisions Iteration? My project has upwards of 3000 2D objects but not all of them collide with each other. Between each object that can collide, a CollisionPair is created and stored inside a flattened array.

Currently, a MaxObjects is defined for accessing the flattened array. Unfortunately, when iterating over this array for collision checks, I get a lot of overhead from the for loop and null checks.

Is there a more efficient way, both in memory and performance, to store and access CollisionPairs?

Note: Many of these objects are axis-aligned boxes - how does Minecraft handle these collisions?

sentences:
Box2d on authoritative server for Unity client I'm creating a multiplayer platform and shooting game in unity, using unity2d's own physics system (box2d).
But the truth is that I am quite lost in the creation of an authoritative server in c ++.
I have quite clear and experience in the use of socket for communication between client and server, I do not know how to approach the issue of simulating the physics of my game on the server so that it decides the positions/movements of the clients.
Can anyone guide me to use box2d on the server, as I simulate the game on the server? Is this a good option or would it be better to implement my own game physics than to use the non-deterministic engine?
Thank you very much and sorry for my level of English

sentences:
How do I calculate rotation caused by bounce friction? Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit.

Showing this is simple enough: I rotate the ball by its angular velocity every tick and apply the same rotation when it's rendered.

When a ball hits a wall, I know that the speed of rotation is affected by...

the ball's initial speed when hitting the surface
the friction coefficients of the ball and surface (physical constants)
the angle of incidence (the angle between the ball's incoming velocity vector and the surface normal).

The angle of incidence is approximated by the dot product of the ball's impact and exit velocity vectors. (1 meaning high spin, -1 meaning no spin, and everything else relatively in between)

Multiplying all of the above together and making sure they were then transformed to the range 0 - 1, and multiplied by max rotation speed, the ball seemed to respond in rotation speed as expected. Except for one thing: It would always rotate clock-wise (because of positive values).

Is this a good method? Can you think of a simpler way?

If this method seems fine, what am I missing? How do I know when the ball should be rotating counter-clockwise?

sentences:
Is there a collection of images (GUI - interface) program or web page available for programmers / developers games? I would like to add a GUI in my basic XNA games.
Before starting work on "Photoshop" or "Illustrator". I wanted to ask you the following question:
Do you know of a website or other resource program offering a graphics collection ? Oriented (GUI - interface) free preference available to developers ?

sentences:
Unity [MenuItem] disappears when `priority` is 100 Create these classes:

public class MyTestComponent : MonoBehaviour
{
}

-

[CustomEditor(typeof(MyTestComponent))]
public class MyTestComponentEditor : Editor
{
    [MenuItem("GameObject/XXX/DoTest", false, 100)]
    private static void DoTest()
    {
        Debug.Log("DoTest");
    }
}

save, and check if there is a new menu item in the context menu and it won't be there. Now change the priority parameter to 10 or 1 and try again - it won't appear anyway. Sometimes even commenting/uncommenting and reloading the editor doesn't help.

Is this a bug or am I doing something wrong?

sentences:
Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway:

One common thing I see in a lot of games is multiple animations on the same model.

i.e.

A character runs, but also raises his arms an shoots.

A character has a walking animation, but can also be carrying resources as he walks.

I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done.

Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating?

I know this depends a lot on the model, the programmer, language and the way the animation is done.

But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it?

Again, not after detailed specifics, just an overview :)

Thanks!

sentences:
Why would one use a separate alpha mask for sprites? I've seen tilesets of the game Braid, and for each tileset in the main folder there is an alpha map for it in "alpha" folder.

I wonder, why just not to draw your image as it is (with transparent parts where you want), export to PNG format and parse it to RGBA texture?

Why would one use a separate alpha map for this, is there some kind of performance benefit?

sentences:
trying to get an int grid of values from unity tilemap I'm trying to get a 2 dimensional grid of values from a tilemap and found this which seems to do the trick:

_tileMap = gameObject.GetComponent<Tilemap>();

foreach (var position in _tileMap.cellBounds.allPositionsWithin)
{
    Debug.Log(gameObject.name + ": " + position);
    // TileBase tile = _tileMap.GetTile(position);
    // if(tile.name != null) Debug.Log(tile.name);
}

However, something strange happens as it produces two values, when I only have one tile on the tilemap and when I uncomment my .name log above it only works for the second value and errors for the first.

Any help of the best way of finding values from tilemaps would be great.

sentences: Is GNU GCC used for AAA games? GNU GCC is a very common compiler, but it seems like almost no one uses it for bigger projects like AAA games. To me, it's works just fine, never had a problem with it. But I wonder why all AAA games seem to use commercial compilers such as Intel Studio? Why does it matter? GNU GCC also optimizes the code for all systems rather then just Intel, so why do they bother with things such as Intel Studio?

sentences:
Object reference not set to an instance of the object; using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {

    public CharacterController2D controller;

    public float runSpeed = 40f;

    private float horizontalMove = 0f;

    // Update is called once per frame
    void Update () {
        horizontalMove = Input.GetAxisRaw("Horizontal")*runSpeed;
    }

    void FixedUpdate(){
        controller.Move(horizontalMove*Time.fixedDeltaTime,false,false);//error is somewhere here
    }
}

Though all the classes are defines it throws the error
please help!!!!!

sentences:
How can I implement a scanline effect? I am working on an old-school platformer in libgdx and I want it to have a "scanline" effect, like this:

My first attempt was to make a little texture and draw it on a full-screen quad. I used two different orthographic camera modes (one for the main tilemap of the game, and a second to render the scanline texture). Sometime the texture is stuck on the tilemap and sometime it is too large, and covers the whole screen in black.

Is my approach using two cameras and a texture reasonable? What's a good solution to achieve this effect?

sentences:
General visual effects to meshes/entities I am trying to add some visual effects to some entities, meshes, or whatever you want to call them as they are looking pretty dull in my game right now.

What I want to achieve is this: http://youtu.be/zox8935PLw0?t=36s (the "texture" gets disintegrated and then goes back to normal, covering the whole mesh.)

Also I would like to know what is the best way to add effects like the one in the video to my game (for example, thunder effects, shattering, etc.) I know that I can do some things with shaders, but I haven't learned them too well and I am still in a beginner level.

I am using Ogre3D, and GLSL for shaders.

Thanks!

Note: this is a screen-shot of my game, I want to apply the effect in the video to my main character):

sentences:
Special relativity shader in GLSL I'm trying to implement a GLSL shader which helps understanding special relativity Lorentz Transformation.

Let's take two axis-aligned inertial observer  O and O' . The observer O' is in motion w.r.t observer O with velocity v=(v_x,0,0).

When described in terms of O' coordinates, an event P' = (x',y',z',ct') has transformed coordinates (x,y,z,ct)= L (x',y',z',ct')

where L is a 4x4 matrix called Lorentz transformation which helps us writing the coordinates of event P' in O coordinates.

(for details look http://en.wikipedia.org/wiki/Lorentz_transformation#Boost_in_the_x-direction)

I've wrote down a first preliminary vertex shader that apply the Lorentz transformation given the velocity to every vertex, but I can't get the transformation to work correctly.

vec3 beta= vec3(0.5,0.0,0.0);
float b2 = (beta.x*beta.x + beta.y*beta.y + beta.z*beta.z )+1E-12;
float g=1.0/(sqrt(abs(1.0-b2))+1E-12); // Lorentz factor (boost)
float q=(g-1.0)/b2;

//http://en.wikipedia.org/wiki/Lorentz_transformation#Matrix_forms
vec3 tmpVertex = (gl_ModelViewMatrix*gl_Vertex).xyz;
float w = gl_Vertex.w;

mat4  lorentzTransformation =
        mat4(
            1.0+beta.x*beta.x*q ,   beta.x*beta.y*q ,   beta.x*beta.z*q , beta.x*g ,
            beta.y*beta.x*q , 1.0+beta.y*beta.y*q ,   beta.y*beta.z*q , beta.y*g ,
            beta.z*beta.x*q ,   beta.z*beta.y*q , 1.0+beta.z*beta.z*q , beta.z*g ,
            beta.x*g , beta.y*g , beta.z*g , g
            );
vec4 vertex2 = (lorentzTransformation)*vec4(tmpVertex,1.0);

gl_Position = gl_ProjectionMatrix*(vec4(vertex2.xyz,1.0) );

This shader should apply to every vertex and perform the non-linear Lorentz transformation, but the transformation it performs is clearly different from what I'd expect (in this case a length-contraction on x-axis).

Has somebody already worked on special relativity shader for 3D videogame?

sentences:
AABB Collision Problems in SFML I have a problem with AABB collision.

I am making a top down rougelike in SFML and my collision algorithm does't quite work properly.

HERE IS A GIF OF THE PROBLEM.

It mostly works, except for when you're against the corner of the block and hold the direction towards the block for a second. For some reason, after about a second, the player is clipped through the block to the adjacent side.

I think the problem is caused when, for example, the x axis needs to be resolved as the player is approaching the object from the left, but the y penetration ends up being more than the x and thus the collision is resolved incorrectly.

This is my collision code:

sf::FloatRect collisionRect;
std::vector<Entity*> activeEntities;
for each (Entity* e in entities)
    if (e->otype == Dynamic)
        activeEntities.push_back(e);
for each (Entity* dynamicEntity in activeEntities)
{
    for each (Entity* target in entities)
    {
        if (dynamicEntity->sprite.getGlobalBounds().intersects(target->sprite.getGlobalBounds(), collisionRect) && dynamicEntity != target)
        {
            dynamicEntity->velocity = sf::Vector2f(0, 0);
            if (collisionRect.width > collisionRect.height)
            {
                if (collisionRect.contains(collisionRect.left, dynamicEntity->sprite.getPosition().y))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y + collisionRect.height);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y - collisionRect.height);
            }
            else if (collisionRect.height > collisionRect.width)
            {
                if (collisionRect.contains(dynamicEntity->sprite.getPosition().x + dynamicEntity->sprite.getGlobalBounds().width - 1.f, collisionRect.top + 1.f ))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x - collisionRect.width, dynamicEntity->sprite.getPosition().y);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x + collisionRect.width, dynamicEntity->sprite.getPosition().y);
            }
        }
    }
}

EDIT: I have tried making only one call to getPosition() getSprite() etc., and that only makes it glitchier.

EDIT2: I made a gfy of the problem. Sorry for the low res.

sentences:
Using GraphicsDevice.Viewport.Project with a small farPlaneDistance I am using "GraphicsDevice.Viewport.Project()" to create a "3D" waypoint system like so;

I have a farPlaneDistance of 5000 in my camera;

objProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), flAspectRatio, 1.0f, 5000.0f);

Obviously when the waypoint is farther than 5000, it cant find it within the viewport and bugs out. Is there another way to display waypoints on screen (within a 3D world) without using GraphicsDevice.Viewport.Project()?

Or, is increasing my z buffer out to 100,000 not that big of an issue (i find this hard to believe)?

Learning as I go,
Thanks in advance!

Linuxx

sentences:
How to map control key to a specific angle or orientation? At the moment, I basically have built out a large hash table of various angles and what direction they map to, if the user would press right, up, down, left. This is needed, in my case, as I have a collection of geometries that when the user presses right, they all go right, and when left, they all go left ...

However, when the scene containing these is rotated anything other than its original state, these controls need to be updated/reversed/etc. That is, if you're looking at the scene from behind, pressing left now has the objects all going right, etc.

I was trying to see if there is a simpler way of applying matrix transformations instead of hard coding a large hash table mapping various scene angles to keys.

sentences:
Location of drawables Is it possible to get the location of a drawable in Android Studio?

Example: drawable.getLocationonScreen();

I want to use it for collision detection.

sentences: Can the solar system be accurately represented in 3d space using doubles (or longs)? I would like know to how to best manage coordinates in a 3D game whose aim is to realistically model the entire solar system, yet be able to handle the smallest movements in a "ship" (ie: perhaps we can consider 1cm to be the smallest acceptable movement for a frame). Do 64-bit doubles (or 64-bit longs) support this, or do we run into overflow problems? If not, then should longs or doubles be used, or if so, then which alternative approach do you think is the most sensible for modelling positions in the solar system in a 3D game? (ie: only holding a bit of the system in the display at a time based on distance to ship, or having the system somehow represented in a different co-ordinate space etc)

sentences:
Best way to read expandable voxel world (hashmap) such as in Minecraft I'm building a 3D multiplayer Roguelike-style engine (tile and turn-based) and I'd like to make the worlds virtually "infinite", similar to what you would see in Minecraft.

I'm storing data in a manner I'm assuming to be pretty similar to Minecraft based on what I've read so far. Chunks of 16x16x16, stored in arrays that are X amount high based on world height. These arrays are stored in a hashmap indexed as integers based on a z-order / morton curve implementation (to flatten them from 2d for easier storage.)

Everything is working well so far, but I've been coding everything assuming the active world will all fit into one square (based on view distance or something along those lines) instead of multiple areas (difference illustrated here).

But once I start assuming different areas will be loaded and active in the world, it brings a huge performance issue: in order to check individual cubes I'd have to see if it's parent chunk is active and loaded in order to avoid some kind of null pointer exception.

Aside from trying to somehow do pathfinding / world interaction in batches within individual chunks (which would be really hard to think around and I'm trying to just grab individual cubes from the "world" object that handles navigating the hash map) I can't think of any way around the issue except doing a hashMap.containsKey(int) for every single world read operation. So, in other words, if 8 players are on the server in entirely different active areas in the world, every block read would require checking if the Morton Code of the chunk the requested block is in falls into the currently loaded area of Players * Active Area, so 8*(8*8) individual chunks in this example.

So I'm curious if my Hashmap-based setup is incorrect for solving this problem, or if there is any other way around this issue.

sentences:
2D SAT Collision Detection not working when using certain polygons (With example) My SAT algorithm falsely reports that collision is occurring when using certain polygons. I believe this happens when using a polygon that does not contain a right angle. Here is a simple diagram of what is going wrong:

Here is the problematic code:

std::vector<vec2> axesB = polygonB->GetAxes();
//loop over axes B
for(int i = 0; i < axesB.size(); i++)
{
    float minA,minB,maxA,maxB;
    polygonA->Project(axesB[i],&minA,&maxA);
    polygonB->Project(axesB[i],&minB,&maxB);

    float intervalDistance = polygonA->GetIntervalDistance(minA, maxA, minB, maxB);
    if(intervalDistance >= 0) return false; //Collision not occurring
}

This function retrieves axes from the polygon:

std::vector<vec2> Polygon::GetAxes()
{
    std::vector<vec2> axes;
    for(int i = 0; i < verts.size(); i++)
    {
        vec2 a = verts[i];
        vec2 b = verts[(i+1)%verts.size()];
        vec2 edge = b-a;
        axes.push_back(vec2(-edge.y,edge.x).GetNormailzed());
    }
    return axes;
}

This function returns the normalized vector:

vec2 vec2::GetNormailzed()
{
    float mag = sqrt( x*x + y*y );
    return *this/mag;
}

This function projects a polygon onto an axis:

void Polygon::Project(vec2* axis, float* min, float* max)
{
    float d = axis->DotProduct(&verts[0]);
    float _min = d;
    float _max = d;
    for(int i = 1; i < verts.size(); i++)
    {
        d = axis->DotProduct(&verts[i]);
        _min = std::min(_min,d);
        _max = std::max(_max,d);
    }
    *min = _min;
    *max = _max;
}

This function returns the dot product of the vector with another vector.

float vec2::DotProduct(vec2* other)
{
    return (x*other->x + y*other->y);
}

Could anyone give me a pointer in the right direction to what could be causing this bug?

Edit: I forgot this function, which gives me the interval distance:

float Polygon::GetIntervalDistance(float minA, float maxA, float minB, float maxB)
{
    float intervalDistance;
    if (minA < minB)
    {
        intervalDistance = minB - maxA;
    }
    else
    {
        intervalDistance = minA - maxB;
    }
    return intervalDistance; //A positive value indicates this axis can be separated.
}

Edit 2: I have recreated the problem in HTML5/Javascript: Demo

sentences:
EnemyAI rotating on Y-axis in opposite direction After a battle flag has gone off and the player has entered an enemy's battle zone I want to keep track of the player when it moves and make sure the enemy's Z-axis is always pointing towards the player.

Upon the player entering the battle zone, the enemy automatically marks the player as its target However there is a chance that the Z-axis may not be pointing towards the enemy's target when the battle is first initiated. I decided to shoot a ray cast from the Z-axis of the enemy when the battle flag goes off and rotate the enemy until the ray and the player intersect thus telling me that enemy's Z-Axis is lined up correctly.

the enemy always has a reference to its current target. My idea was that as once the enemy spots its target initially, it can save the position of the most recent spotting and then take the delta of the CurrentTargetPosition.x and the LastSpottingPosition.x If the delta is positive rotate right and if the delta is negative rotate left.

THE ISSUE:
my math or logic must be flawed somewhere because although it works sometimes, other times the enemy will randomly rotate itself in the opposite direction and the ray cast will essentially take the long route to hit the player instead of the shortest route as intended. Also the Local Origin of the enemy and the player are at different height respectively but I dont think that should matter in my case Code Below.

//create ray from enemy position orgin and point it on the Z-Axis
        Ray ray = new Ray(CurrentEnemyTransform.position, CurrentEnemyTransform.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 50f))
        {
            Debug.DrawLine(ray.origin, hit.point);

            //ray hits current enemy target
            if (hit.transform == CurrentTargetTransform)
            {
                //check if enemy has seen its target before while in this battle
                //or is it the first time
                if (enemy.hasTargetLastPosition)
                    //replace old last seen position with most recent spotting
                    enemy.ReplaceTargetLastPosition(hit.transform.position);
                //or add the first spotting of target while in this battle
                else enemy.AddTargetLastPosition(hit.transform.position);
            }
            //ray is not intersectiing with the enemy's current target so rotate to look for it
            if (hit.transform != CurrentTargetTransform)
            {
                //check if enemy has seen its target once before in battle
                if (enemy.hasTargetLastPosition)
                {
                    //since last spotting has my target moved more to the left or right?
                    if (enemy.targetLastPosition.value.x > CurrentTargetTransform.position.x)
                    {
                        //rotate right
                        CurrentEnemyTransform.Rotate(-Vector3.up, 5f, Space.Self);
                    }
                            //rotate left
                    else CurrentEnemyTransform.Rotate(Vector3.up, 5f, Space.Self);
                }
                //never seen target yet during this battle so default rotation to right till you found it
                else CurrentEnemyTransform.Rotate(-Vector3.up, 5f, Space.Self);
            }

sentences:
Player & Level class structure in 2D python console game? I'm trying to create a 2D console game, where I have a player who can freely move around in a level (~map, but map is a reserved keyword) and interfere with other objects.
Levels construct out of multiple Blocks, such as player(s), rocks, etc.

Here's the Block class:

class Block(object):
    def __init__(self, x=0, y=0, char=' ', solid=False):
        self.x = x
        self.y = y
        self.char = char
        self.solid = solid

As you see, each block has a position (x, y) and a character to represent the block when it's printed. Each block also has a solid attribute, defining whether it can overlap with other solids or not. (Two solid blocks cannot overlap)

I've now created few subclasses from Block (Rock might be useless for now)

class Rock(Block):
    def __init__(self, x=0, y=0):
        super(Rock, self).__init__(x, y, 'x', True)

class Player(Block):
    def __init__(self, x=0, y=0):
        super(Player, self).__init__(x, y, 'i', True)

    def move_left(self, x=1):
        ... # How do I make sure Player wont overlap with rocks?
        self.x -= x

And here's the Level class:

class Level(object):
    def __init__(self, name='', blocks=None):
        self.name = name
        self.blocks = blocks or []

Only way I can think of is to store a Player instance into Level's attributes (self.player=Player(), or so) and then give Level a method:

def player_move_left(self):
    for block in self.blocks:
        if block.x == self.player.x - 1 and block.solid:
            return False

But this doesn't really make any sense, why have a Player class if it can't even be moved without Level? Imo. player should be moved by a method inside Player.

Am I wrong at something here, if not, how could I implement such behavior?

sentences:
Mesh does not translate accordingly to WheelCollider So I am trying to implement a car controller script in Unity were the WheelTransform position and rotation is set with every update as the same as the WheelCollider position and rotation, it all works fine except for one thing: when translating the WheelTransform, if the car goes slowly, WheelTransform translates as expected, but when the car goes faster, there's a clear offset between the WheelTransform position and the actual position of WheelCollider. Here's the code were WheelTransform position and rotation is set as the same as the WheelCollider position and rotation:
private void UpdateWheels()
    {
        UpdateWheelPos(frontLeftWheelCollider, frontLeftWheelTransform);
        UpdateWheelPos(frontRightWheelCollider, frontRightWheelTransform);
        UpdateWheelPos(rearLeftWheelCollider, rearLeftWheelTransform);
        UpdateWheelPos(rearRightWheelCollider, rearRightWheelTransform);
    }

    private void UpdateWheelPos(WheelCollider wheelCollider, Transform trans)
    {
        Vector3 pos;
        Quaternion rot;
        wheelCollider.GetWorldPose(out pos, out rot);
        trans.rotation = rot;
        trans.position = pos;
    }

Every single one of the car controller scripts I've found and tried use the same code for this section, I have also tried with 2d sprites without any colliders as WheelTransform but neither the scripts or changing WheelTransform solved the problem. Thanks in advance for the help.

sentences:
OpenGL / Assimp oddity or error? A friend and I are working on developing a game engine in C++. He doesn't live anywhere near me, so we use Dropbox to sync our files. I opened his project to test his code, and I kept getting errors saying that the program could not start with an error that stated "This application could not start. 0xc015002." I used a dependency walker to find that ILUT.dll was causing some issues. I have done just about everything suggested on most forums to make ILUT work, and I have not had any success. I've re-downloaded it, put the DLL just about everywhere I could, and I still had issues. We then tried to compile it without Assimp, and the program compiled without errors. This was not the end of our problems though. I made a class to create a primitive cube using OpenGL. When I tested it out, there was no cube on the screen. I had my friend test the program out, and to our surprise, there was a perfectly rendered cube on his screen. So I'm honestly not sure where things could possibly be going wrong. Any help at all would be greatly appreciated. Thank you for taking the time to read this long question. I'll be happy to provide anyone with necessary info needed to help with this question!

My OpenGL version is 4.2. He has an nVidia graphics card, and I have an AMD Radeon graphics card. We are using Visual Studios 2012 as our IDE.

sentences: How to activate GearVR Menu in my own Unity-Apps? So in normal GearVr-Apps, which you can download from the marketplace, you can activate the GearVr Menu to control brightness etc. with a long click on the back button. But this does not work for all of my apps which I made with Unity for the GearVr, is there something special I have to import into my project?

sentences:
Persistent realtime game authentication (JWT, Passport) Context

I am building a MMO game in HTML5 with canvas.
I use NodeJS on server & JS from scratch on client.
I also use socket.io to manage realtime.
The game is persistent & each player keep their equipment / skills etc, even after logout.
To do that, the player need to register with email and password then login.
The client is a browser but could be other device like phone in future. I use HTTPS to encrypt communication.

Problem

In this context, I decide to use a token based authentication system.
I look to JWT from Auth0 and found : https://jwt.io/introduction/

I noticed : They are talking about the JWS implementation of JWT and not about JWE. After looking at https://github.com/auth0/node-jsonwebtoken I saw that it was the same thing, JWS and no JWE. I suppose that JWT module developed by Auth0 doesn't provide a JWE implementation of JWT but only a JWS implementation.

Am I right or did I miss something? In my particular case (game scenario), I don't know if it's mandatory to encrypt with JWE (I don't think sensitive data will be passed in the token), do you think JWS enough?

In the side of this research, I checked for Passport (http://www.passportjs.org/docs/). I read the documentation but I didn't find information about how they perform authentication when we remove session (http://www.passportjs.org/docs/downloads/html/#disable-sessions).

I tried to implement it with session: false but no token was returned.

I supposed I need to implement it by myself, but in this case what's the goal of passport for a token based authentication?

Then last question about socket.io

If I implement a JWS token based authentication to signed my request & HTTPS to encrypt the communication, how can I secure the bidirectional communication? It looks like two different channel of communication, is it easy to implement that with socket.io?

sentences:
Defining and selecting an area from an image I want to create a game, where the world is loaded from an image file, much like Paradox Interactive does it for their games. If I have this image:

Then the red, green, blue, cyan, magenta, white, black and grey should be different provinces. I know how to loop through them, and check if it's a new province, the problem is that I don't know how to define the region of the province for selection: I don't know how I can load in data, to make sure you can click anywhere on that province, and make sure it gets selected.

sentences:
Why do these DirectXMath functions seem like they return column-major matrics? I know these questions have been asked a million times in various formats, but I'm getting weirdly skeptical about some of the row-major vs. column-major claims about the DirectXMath library.

If I run the following code to get a translation matrix for example:

DirectX::XMMATRIX a = DirectX::XMMatrixTranslation(1.0f, 1.0f, -1.0f));

I would expect the memory layout to look like the following (with rN indicating some row, but all the numbers contiguously in memory):

r1: 1.0   0.0   0.0   1.0      r2: 0.0   1.0   0.0   1.0     r3: 0.0   0.0   1.0  -1.0     r4: 0.0   0.0   0.0   1.0

This would correspond to the following matrix (in standard notation) where each row is stored as a contiguous array:

1.0   0.0   0.0   1.0
0.0   1.0   0.0   1.0
0.0   0.0   1.0  -1.0
0.0   0.0   0.0   1.0

Except when I look at the memory, it's the transpose of the above (i.e. the last array in memory is the last column above) which I'm to understand is "column-major" order. So, in memory, what I'm actually getting is this:

r1: 1.0   0.0   0.0   0.0     r2: 0.0   1.0   0.0   0.0     r3: 0.0   0.0   1.0   0.0     r4: 1.0   1.0   -1.0   1.0

This leaves me thoroughly confused with all the commentary and documentation around DirectXMath matrices needing to be transposed before putting them into HLSL constant buffers (of which I'm using the default column-major order). Everything states that DirectXMath matrices are stored in row-major order, but when I actually look at the memory (either as an XMMATRIX or a more direct XMFLOAT4X4) I find myself staring at a translation matrix that looks like it's been stored in column-major order.

So my confusion then lies in the fact that my transformations actually work when I don't transpose the matrices prior to putting them into the constant buffer.

Am I missing something here?

sentences:
Reacting to rectangle on rectangle collisions I don't know how to react to collisions between two axis aligned rectangles that have x, y, width and height values (x and y are from the centre of the box) to make them simply not overlap.

I figured I'd just make them move away from each other depending on how far they intersect in the opposite direction (left, right, up or down) of where they collided. If I check for collisions only on the x axis or only on the y axis it works fine, but when checking for both collisions crazy stuff happens.

This code executes when the first box collides with the second. It's in lua but feel free to answer in anything that isn't to too counter-intuitive.

if box1.x < box2.x then
    box1.x = box2.x - (box1.width / 2) - (box2.width / 2)
end

if box1.x > box2.x then
    box1.x = box1.x - (box1.x - box2.x - (box1.width / 2) - (box2.width / 2))
end

if box1.y < box2.y then
    box1.y = box2.y - (box1.height / 2) - (box2.height / 2)
end

if box1.y > box2.y then
    box1.y = box1.y - (box1.y - box2.y - (box1.height / 2) - (box2.height / 2))
end

sentences: What's the best Python 3D engine? I want a straight 3d Python engine that's easily obtainable for linux and easy to use. Soya3D failed for me because of the lack of documentation. I should be able to load common 3D models without an issue.

sentences:
How do you prevent your JavaScript / HTML5 web game from being copied or altered? I'm in the middle of planning a game built using JavaScript and HTML5.

I'm having trouble understanding how you could prevent someone from simply copying the JavaScript from the web server and either making their own game with it (not my biggest concern), or substituting their own JavaScript functions and dashing any hope for reliable clients in the wild if the game was to eventually support multiplayer.

Can anything be done to prevent just anybody from reading the JavaScript?

If not, should all game processing be taking place on a server somewhere with the client's only responsibilities being capturing user input and drawing graphics?

sentences:
Custom inventory items based on inheritance So, here's the scenario:
I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast.

In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior.

This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item?

Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only.

Development is done in C#, inside Unity 3.5.

Thanks!

sentences:
How do you set event after a pawn takes damage? How can I set event after bot/pawn takes damage in UDK? (possibly in Kismet?)

I need to do something similar to this: http://www.youtube.com/watch?v=gjRf5lTcWLY

sentences: Algorithm for random flight of a fly I'm new to game development. What is a good algorithm to model the random flight of a fly? I've been looking at path-finding algorithms, but they don't give any interesting random behaviour.

sentences:
Libgdx, TiledMap, and tearing My TiledMap tears when the window is specific sizes, resized, or the camera moves.

The tileset is padded by 2px and have tried as high as 10px. Each tile is 70x70.

Here are the pack.json settings,

{
    paddingX: 2,
    paddingY: 2,
    bleed: true,
    edgePadding: true,
    duplicatePadding: true,
    maxWidth: 4096,
    maxHeight: 4096,
    filterMin: Nearest,
    filterMag: Nearest,
    ignoreBlankImages: true,
    wrapX: ClampToEdge,
    wrapY: ClampToEdge,
    grid: true,
    fast: false
}

Here is the code.

Parameters params = new Parameters();
params.textureMinFilter = TextureFilter.Nearest;
params.textureMagFilter = TextureFilter.Nearest;
TileMap map = new TmxMapLoader().load(file.getAbsolutePath(),params);

So what am I doing wrong? If nothing, does that mean libgdx absolutely cannot handle TileMaps of any sort?

sentences:
Do I need to call Release() on D3D objects when I use them in another function? For example, I have an IDirect3DSurface9 * Surface and IDirect3DSurface9 *BackBuffer.

If I were to use them directly in the render_frame function, I would need to release them on the closeD3D function. However, if I use them in a function in same file or in another .h and .cpp file, when I call Release in closeD3D it gives me an error.

So, do I not need to release them if I'm using them in a function, or am I doing something wrong?

sentences:
Line plane intersection: what is this variable? I'm doing line plane intersection, and have come across an un-referenced variable or constant in the tutorial I'm following.
One of the formulae given is this:
t = N dot (p2 – p0)
     N dot V
The variable I'm stuck with is V. Can someone tell me what V is and how I'd go about finding it?
For more info on that formula, please see the link given in the first para.
Thanks,
James

sentences:
Make an object rotates by an arbitrary angle and rotates toward a target in Unity I have an object facing up in Unity. I need it to move from point A to point B, without prior knowledge of where A and B are. So when I place it at point A, I need to rotate it toward point B. I used this:

this.gameObject.transform.rotation = Quaternion.FromToRotation(A.position, B.position);

However, before doing the movement, I also need to rotate the object by 90° around the X axis. I used this:

this.gameObject.transform.rotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);

These two functions worked, but separately. When I try to use these two functions together, the last function called overrides the other.

sentences:
SDL2 - Inconsistent FPS with VSYNC I'm working on a game using SDL2. Today I noticed the game has some jolty issues when not fullscreened so I made an extremely simplified program that simply moves a square from left to right to see if the result is the same.

I expected the squares movement to be very smooth but instead it's very jolty/laggy (when not fullscreened).

At first I thought it was to do with how I was calculating the time between each frame but after outputting the 'ftime' I can see the time each frame takes ranges from 13 to 30(ish) as opposed to a consistent 16/17.

Here's the code:

#include <iostream>
#include <SDL.h>

const int GAME_WIDTH = 1920;
const int GAME_HEIGHT = 1080;

//frame independent movement variables
double old_time = 0;
double current_time = 0;
double ftime = 0;

#undef main
int main(int argc, char** argv)
{
    SDL_Window* mainWindow;
    SDL_Renderer* mainRenderer;

    SDL_Init(SDL_INIT_EVERYTHING);

    mainWindow = SDL_CreateWindow("MiracleSquare", 50, 50, GAME_WIDTH, GAME_HEIGHT, 0);
    mainRenderer = SDL_CreateRenderer(mainWindow, -1, SDL_RENDERER_PRESENTVSYNC);

    SDL_Rect miracleRect; //creating the SDL square
    miracleRect.x = 0;
    miracleRect.y = 400;
    miracleRect.w = 100;
    miracleRect.h = 100;

    bool running = true;

    while (running)
    {
        old_time = current_time;
        current_time = SDL_GetTicks();
        ftime = current_time - old_time;

        std::cout << ftime << std::endl;

        SDL_Event e; //stops crashing on input
        if (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_KEYDOWN:
                break;
            default:
                break;
            }
        }

        miracleRect.x += (ftime / 1000.0f) * 100.0f;
        if (miracleRect.x> 1920) miracleRect.x = 0;

        SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
        SDL_RenderClear(mainRenderer);
        SDL_SetRenderDrawColor(mainRenderer, 255, 255, 255, 255);
        SDL_RenderDrawRect(mainRenderer, &miracleRect);
        SDL_RenderPresent(mainRenderer);
    }

    return 0;
}

Am I doing something wrong? As far as I can tell this should produce a smooth movement.

Any help would be greatly appreciated!

Edit: Since posting this I've figured out it has something to do with my use of dual monitors. If, for example, I have a video playing on chrome on my secondary monitor, the lag issue is very prominent. I'm now looking into if this issue is avoidable, or if I'll just have to ignore it.

sentences:
How to create a texture2d from an array of pixels in DirectX11 I currently have a ray-casting camera that holds an array of pixel colors (XMFLOAT4 color) that is 1024x768.

I am trying to create a Texture2D in DirectX11 that is also 1024x768 and simply copy over the pixels to the texture. I then want to apply the texture to a fullscreen quad to essentially display what geometry my rays are intersecting with.

    D3D11_TEXTURE2D_DESC textureDesc = { 0 };
    textureDesc.Width = 1024;
    textureDesc.Height = 768;
    textureDesc.MipLevels = 1;
    textureDesc.ArraySize = 1;
    textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
    textureDesc.SampleDesc.Count = 1;
    textureDesc.SampleDesc.Quality = 0;
    textureDesc.Usage = D3D11_USAGE_DEFAULT;

    ID3D11Texture2D* fullScreenTexture = nullptr;
    ThrowIfFailed(mGame->Direct3DDevice()->CreateTexture2D(&textureDesc, nullptr, &fullScreenTexture), "ID3D11Device::CreateTexture2D() failed.");

Assuming I have XMFLOAT4 pixels[1024][768]; //Filled in appropriately with colors.

I'm not sure where/how I would take my pixel data and apply it to the texture. Any help would be greatly appreciated.

sentences:
Android frame by frame PNG animation I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

sentences:
tunnel effect cocos2d I am looking to create a similar tunnel effect in COCOS2D (iOS). Could anyone suggest any pointers?

ref Video 1

ref Video 2

Till now I have tried with several ring shape sprites with decreasing scale and positioned center to a same point and keeping Z decreasing as well for each smaller sprite.

With that, animating it with CCScaleTo and changing the size to 2.0 with animation duration but it does not come anyway near to the tunnel effect shown in the reference.

Thanks,
sam

sentences:
maya: cannot rotate ik control in command I use maya default human ik example, see my gif, when i rotate in viewport, rotate work, but when i undo and rotate with same command in script editor, it cannot rotate, how to rotate ik control in command

I try maya 2018 and maya lt 2018, it has same problem

sentences:
Card Game Suggestion I'm developing a gameboard for a 4 players cardgame well know in my region ( like a Bridge with 8 cards).

I create a cardcontrol class, all the deck methods and all the logics for value card and score count.

But I need some link or suggestion for the implementation of  "computer player" based on a few rules to follow.

thank you all for any help.

sentences:
Smooth path/direct movement I have a tile based isometric map and an A* algorithm that returns a path. I am looking to smooth this path efficiently but with good aesthetics. Basically i am using my grid for building the map and pathfinding but i want the player, enemies and certain types of objects to be detached from this grid.

I can think of a line of sight implementation where i start at the first tile of the path, from there check each further tile if i have a clear path straight to it. And repeat from there.

sentences: Any good book on lighting in video games? Lighting plays a fundamental role into videogames. A videogame without a good ilumination is flat and without life. I'm looking for a book that explains how must be iluminated a scene and what factors are involved in the creation of convincing worlds.

sentences:
Sphere collision response I have simple mechanism for testing of two balls colliding:

private static boolean isColliding(float firstBallX, float firstBallY, double firstBallRadius, float secondBallX, float secondBallY, double secondBallRadius) {
       final double a = firstBallRadius + secondBallRadius;
       final double dx = firstBallX - secondBallX;
       final double dy = firstBallY - secondBallY;
       return a * a > (dx * dx + dy * dy);
   }

And it works great. One of the balls is moving and the other (second one) is static.
I have two questions.

When a collision occurs, how do I change the movement of the first ball (the moving) one to its logical path? I suppose I should change the direction somehow, but cannot figure out how...?

The other question is how do I tell the static ball, after the collision move? And what is its path, direction and staff...?

Thanks in advance.

sentences:
Getting notified about a change of a public variable in a script I have a script attached to a GameObject.

In this script I have the variable public int Rotation

If this value is changed, I need to do some calculations.

I know that I can be notified when this value is changed in the Inspector (for example if somebody enters a different number), but I would like to be notified if this value is changed by another script.

Is that possible, or do I need do introduce a void ChangeRotation(int uNewValue) or similiar?

Thank you!

sentences:
Inventory Item Exist checker I have a question regarding declaring my inventory. I made it a string named inventory, with a constant number as its max value. The thing is, I want the user to use an item if he / she gains an item. The problem is, I do not know what syntax should I use to determine if the user has an item and use that item. Here's my code I just started:

so declaring the inventory:

    const int MAX_ITEMS = 15;
    string game_inventory [MAX_ITEMS];
    int itemnum = 0;

I have some items like potion, antidote, gems and others. I use the:

game_inventory[itemnum++] = "Potion"

to place items in my inventory. If I want to use the potion, IF I HAVE one, how can i make a function to check whether I have a potion or anything and use it?

sentences:
How can I accurately simulate orbits in Unity? I would like to create a space simulation with realistic gravity.

This means planets in 3d space which act as central gravity sources and multiple objects which are attracted by those planets gravity so that they orbit them in physically correct orbits (like in Kerbal Space Program, for example).

How can I implement such gravity sources with C# script?

sentences:
Why wouldn't one use Canvas for HTML 5 game development? I'm just getting into the HTML 5 game development. I've discovered that some games seem to be created using just JS/CSS/HTML instead of the canvas.

Since canvas seems to enjoy good browser compatibility (http://caniuse.com/#feat=canvas), I'm wondering why someone wouldn't use it?

sentences:
Should I do intersection testing in world or object space? I'm adding basic ray casting and collision detection for my game, and also adding bounding volumes and collision meshes.

The ray is cast in world space and each mesh's node can track its world transformation. Considering I want to test for intersection between a ray and bounding volume and also bounding volume with other bounding volume, in what space should I perform the intersection test?

Scenarios that I have in mind:

Transform ray into object's local space, perform test, then inverse transform the resulted point.
Transform bounding volume into world space and perform it there, or should I always keep bounding volumes in world space?
Perform bounding/bounding test in world space or one of the objects?

Do things change much between static and dynamic collision regarding used spaces?

sentences:
Math behind drawing one game object relative to another? Let's say I have a square (a) and I want to draw another square (b) that stays on one corner of the square (a).

Square (a) can rotate and move around the game world, what math would be used to keep square (b) on the same relative point on square (a) ?

My current thought process would be:

You give Square b an offset from square a, which would be a distance and an angle.

Then using trigonometry you could update the location of square b to stay in the correct location.

sentences:
Rotation before scaling image/Lower resolution rotation? (XNA/C#) Currently, when I rotate the image using SpriteBatch.Draw() the image is rotated after it is scaled. Resulting in:

Which is using the code
public override void Draw(GameTime gameTime) {
    sprite_batch.Draw(
        texture,
        parent.position,
        new Rectangle(0, 0, (int) 25, (int) 25),
        Color.White,
        rotation,
        new Vector2(texture.Width/2, texture.Height/2),
        new Vector2(2, 2),
        SpriteEffects.None,
        0f);
}

However what I would like to see is more on the grounds of

I've tried to directly edit the texture itself instead of rotating using spritebatch, only I have found that it was incredibly inefficient.
Edit 1:
I am currently looking around at RenderTarget2D and such. Possible solution to my problem.

sentences:
Unity forward vector flips when upside down. Mario Galaxy style gravity, bad rotation? This is a question that I think is best to explain visually, so I will do my best to be succinct here.

What I am trying to do:

Allow the player to run about a world that is spherical, not a flat object. The intended result is going to be much like navigating a planet in super mario galaxy.

My attempt at solving this problem:

Conceptually it is simple. I create a vector from the player to the origin of the planet/world, and use it as the gravity vector. This works great, I know the direction I need to fall towards.

The problem:

When trying to use unity's transform.forward vector, everything is fine until I move slightly off to the side and attempt to circle the planet. At about the south pole, the forward vector points to random places.
I believe this is because of how unity calculates the forward vector, but I don't know how it is done so I can't say.

Should I attempt to calculate it myself? Or should I just store a matrix for my object and do everything manually?

Below are images that hopefully shed some light.

In this image, the forward vector (red ray) points correctly in front. This is at the starting position of the object. The blue ray is the vector toward the planet center

After circling to the bottom of the planet, I just need to move slightly to the side, and the forward vector begins to circle about the blue vector

EDIT for code:

BaseObject class for objects that will react to planet gravity

public class BaseObject : MonoBehaviour {

    public GameObject planet;
    private float gravityConstant;

    public Vector3 TowardOrigin { get; set; }

    void Awake () {
        /// Store the gravity constant
        gravityConstant = Physics.gravity.magnitude;
    }

    void FixedUpdate()
    {
        /// Manually set the force of gravity to point towards the center of the planet
        TowardOrigin = transform.position - planet.transform.position;
        TowardOrigin.Normalize();
        Physics.gravity = -gravityConstant * TowardOrigin;
        transform.up = TowardOrigin;

        ChildFixedUpdate();
    }

    /// <summary>
    /// To be inherited and overriden by child objects
    /// </summary>
    public virtual void ChildFixedUpdate() { }
}

PlayerController class:

public class PlayerController : BaseObject {
    public float speed;
    Rigidbody body;

    void Start()
    {
        body = GetComponent<Rigidbody>();
    }

    public override void ChildFixedUpdate()
    {
        if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0)
        {
            Vector3 forwardMomentum = (transform.forward) * (Input.GetAxis("Vertical") * speed);
            Vector3 sideMomentum = (transform.right) * (Input.GetAxis("Horizontal") * speed);

            body.AddForce(forwardMomentum);
            body.AddForce(sideMomentum);
        }
        else
        {
            body.velocity = Vector3.zero;
        }

    }
}

sentences:
Why, after calling SetVideoMode as in the following, does nothing appear on my screen? I am trying to create an application that will need to use double buffering (for purpose of vsync). I am using SDL.NET. From what I understood, in order to have double buffering, I have to SetVideoMode with the opengl paremeter set to true.

Here's the code I'm using:

        Video.Initialize();

        Video.GLSetAttribute(OpenGLAttr.DoubleBuffer, 1);
        Video.GLSetAttribute(OpenGLAttr.SwapControl, 1);
        Video.GLSetAttribute(OpenGLAttr.RedSize, 8);
        Video.GLSetAttribute(OpenGLAttr.GreenSize, 8);
        Video.GLSetAttribute(OpenGLAttr.BlueSize, 8);
        Video.GLSetAttribute(OpenGLAttr.DepthSize, 16);

        Video.SetVideoMode(VideoInfo.ScreenWidth, VideoInfo.ScreenHeight, false, true, true, true);

If 4th parameter (bool opengl) is false, it works: a new fullscreen window is created and displayed (but I assume the OpenGLAttr's set above are meaningless in this case).

If 4th parameter is true, nothing happens. A new window gets created (at least, it appears in the list of open windows) but I cannot alt-tab into it and nothing appears on the screen.

What am I doing wrong?

sentences:
How is a Challenge implemented for a game networking protocol? Working on an authoritative online game using LiteNetLib. I've been reading about building a game network protocol and I'm feeling stuck with the "challenge" implementation.

The client requests a connection with the server.
The server then returns some sort of challenge (that only the client should be able to solve?).
The client returns the solution and the server allows the connection.

The first thing that I don't get is how to have a "pending" connection without accepting it to begin with. With LiteNetLib, this is how the server handles incoming connections:
listener.ConnectionRequestEvent += request =>
{
    if(server.ConnectedPeersCount < 10 /* max connections */)
        request.AcceptIfKey("SomeConnectionKey");
    else
        request.Reject();
};

From the looks of it, the server must decide whether to allow the client or not at this very instant. If I want to send or receive a challenge, I need to accept the connection first don't I? But that would defeat the point of the challenge implementation.
Is there a resource with an example of how this is done? The article doesn't really go into detail, and when I google things like "online game protocol challenge request packet" the results aren't quite related (almost as if the concept was coined by that article).

sentences:
Profiling server side game loop in java I am looking for tips to profile the server side game loop of a Java program for CPU usage. I tried to use the TPTP plugin for Eclipse so far.

The problem I am having is that it is really slow. For example the startup of the server is normally done in less than a minute. But with the profiler it takes about 30 minutes.

Okay, I can enable the profiler only after the server is started, but I am still facing the problem that it is way too slow and using much CPU. So I am unable to connect a number of clients in order to reproduce the problem (even with disabled timeouts).

I already did some optimization based on no client at all and some very short profiling sessions with one client. This is, however, not really helpful because the game server is doing most of its work only if a player is in reach.

I am thankful for any tips on profiling for CPU usage.

sentences:
XNA C#: How can I prevent blurring when drawing from a RenderTarget2D? I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then drawing from that to the backbuffer.

At first the sprites were blurred by antialiasing and I read that using SamplerState.PointWrap in the spritebatch Begin call would ease this a bit so I made that change. Everything seemed better, however the final on-screen image is still blurry and I think this is because of how it draws from the rendertarget2D to the backbuffer.

The image here is a comparison - On the left is how the output looks now and the right is how I want it to look.

sentences:
What is the correct way of changing image of existing CCSprite? How do I correctly change sprite to show another image? Or to have another texture?
This is the way I do it now. When I need to change sprite image I increase state variable. So i have one picture for 0, another for 1 and another for 2.
First i tried just saying mysprite = [CCSpriteWithFile:@"sprite.png"] but that didn't end up too well since I was making new objects every frame and it got messy pretty fast.
So I added a check. There is another variable that is stateChanged and it starts at zero. So I compare state to stateChanged before actually making any sprites and if it differs I do the magic.
But here comes the problem. Somehow this sprite won't flip. And I believe the problem is in this method.

- (void) updateState
    {
        if (stateChanged != state) {

        if (state == 0)
            {
                currentSprite = [CCSprite spriteWithFile:@"eggclosed.png"];
                [self addChild:currentSprite];
            }

        if (state == 1)

        {
            currentSprite = nil;
            [self removeAllChildrenWithCleanup:YES];
            currentSprite = [CCSprite spriteWithFile:@"eggopen.png"];
            [self addChild:currentSprite];
        }

        if (state == 2)
        {
            currentSprite = nil;
            [self removeAllChildrenWithCleanup:YES];
            currentSprite = [CCSprite spriteWithFile:@"yoshi.png"];
            [self addChild:currentSprite];
        }

            stateChanged = state;
        }
            }

TLDR: How to correctly change image of sprite. I have a Pet object that has a CCSprite property. And I sometimes need to change sprte to look another way. How do?

sentences:
Transforming a 2D Grid in 3D Space Hi everyone,

I'm trying to implement a 2D Grid in a simple 3D Editor. Here are some debug-rays I already implemented:

Everything is working as intended as long as the object is not rotated.
For demonstration purpose the box is aligned with the grid center (the purple box).

(I can move the object along the grid without changing the grid location):

Now if I rotate the large white cube I want the grid to rotate as well.

Here is the problem: I dont want the origin of the grid to change it's relativ location. The grid location of the green line should still align with the upper left corner of the large white box.

And I just cannot figure out the offset I have to translate the grid :(

Here is what I've tried:
Calculate the difference between the two collision points (Yellow and Green) and use this as offset but on rotation the offset is too large and the grid is shifting.

Here is the data I have available:

Vector3 Origin = new Vector3();
Vector3 GridPlaneNormal = new Vector3(0, 0, 1);
Plane GridPlane = new Plane(Origin, GridPlaneNormal);
Plane objectPlane = /*.... (it's the plane of the cubes front)*/

Vector3 GridNormalInDirectionOfObject = Vector3.TransformNormal(GridPlaneNormal, Matrix.RotationQuaternion(Object.RotationQuaternion));

float angle = GridPlaneNormal.SignedAngle(GridNormalInDirectionOfObject, GridPlane.Normal);
Vector3 rotationAxis = Vector3.Normalize(Vector3.Cross(GridPlane.Normal, objectPlane.Normal));

Please help me! :)

sentences: Where can I find some "must see" game development portfolios? I am trying to put together a website/portfolio and it would be great to see what others have done.

sentences: Best way to learn iphone game development? I know php and some python, but not much c. Where should I start to learn iphone game development? Is there some recommended books/tutorials for beginners? I'm looking at using cocos2d but I'm open to anything that isn't too limited.

sentences:
Handling RPG (rocket launcher) launcher and rocket In my game, the player has an RPG (rocket launcher).
Using this launcher, he can shoot a rocket.

When shown in the inventory, the rocket is stuck in the launcher.
Also, when the user walks, the rocket is stuck in the launcher, and the RPG (the combination of launcher and rocket) is placed on his back.

Now when the user shoots, the rocket leaves the launcher, and the launcher pulls the player into a little spin to simulate a recoil.

Since the rocket and the launcher are stuck together most of the time, I was thinking that I should have a main game object named "RPG" with the 2 meshes "launcher" and "rocket".
Most of the time, they would be stuck together.

When the user launches the rocket, I would change the position of the rocket in order to simulate it flying away. When it has exploded, I would make the rocket mesh invisible.

I was really proud of that plan until I noticed that the recoil will move the rotation and position of the RPG (launcher). Imagine the recoil of a pistol: The recoil will cause the pistol (and the hands) go up a bit.

Now when I do this with the launcher, the rocket will change its flight path. That would look unrealistic.

Can somebody tell me how this is commonly dealt with?

Thank you!

sentences:
Box2d RopeJoint bug - fix or alternative solution? What I am trying to do is to create rope game. Below you can find a movie how it looks like now.

https://youtu.be/QTULCGNF70I

I am using RopeJoint and I am reducing maxLength each frame to be able to accelerate. Everything seems fine, but the problem appears for bubble kind of ball. I realized that shortening rope does not increase balls velocity. For example if I throw the rope fully vertical and the only "force" is from shortening the rope, the velocity is 0,0. Seems like, body movement is not simulated?

After I let the rope go the momentum is lost. The bubble can fly, but the factor from rope shortening is ignored.

I don't know if you understand what I mean. The movie should clarify it better.

Workarounds I tried:

Good idea was to use prismaticJoint, but the rotation is fixed, so it
doesn't work. I couldn't swing
Another idea was to use wheelJoint and make use of it's frequency
parameter. However here there's a problem that rope becomes rubber.
Swing feeling is bad, when it can extend more than initial length, it
should always only shorten.

Solutions I see, but they are not available

RopeJoint which keeps body momentum from rope shortening
PrismaticJoint without fixed rotation
WheelJoint with possibility to set max length or create the rope with it's max length, not the rest position.

sentences:
HLSL Pixel Shader Sematics I have a HLSl pixel shader that I'm using to create a deferred buffer, I have simplified the code to show you:

struct PS_INPUT
{
    float4 PosWVP                   : SV_POSITION;
    float4 NormalWorld              : NORMAL2;
};

struct PS_OUTPUT
{
    float4 PosWorld                 : POSITION;
    float4 NormalWorld              : NORMAL2;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output = (PS_OUTPUT)0;

    output.PosWorld = input.PosWorld;
    output.NormalWorld = input.NormalWorld;

    return output;
}

When I compile this code, I get this warning warning X3576: semantics in type overridden by variable/function or enclosing type, what is this warning and how can I fix it?

sentences:
How to make my installer install XNA framework and .NET 4.0 I have made a simple Monogame game. Right now I am using this installation-package maker: http://installforge.net/

Currently my installer only installs my "game". (All the output files generated by the build)

However I also want it to install the XNA framework 4.0

https://www.microsoft.com/en-us/download/details.aspx?id=20914

and the .NET Framework 4.0

http://www.microsoft.com/en-us/download/details.aspx?id=17718

How would I do that?

sentences:
How to use the SDL viewport properly? I'm very confused about the SDL2 viewport, I did some googling to find out how to implement it but people keep mentioning things like "world coordinates" which I don't have in my game.

Question : Do I even need world coordinates for the SDL2 viewport to work? If yes, how do I implement it?

I've currently got a problem where if my viewport goes too much to the right or down, the entire window will become green, kinda like if it stopped rendering all my sprites.

Here's a GIF to show you what I mean :

As you can see, whenever I go too much to the right or down the entire screen goes green.

I thought this maybe was beause of me not using world coordinates, but I have no idea I'm just guessing stuff at this point...

My current codes for moving the viewport, drawing it, and such looks like this :

Creating the viewport / camera :

Camera::Camera(Uint16 x, Uint16 y, Uint16 w, Uint16 h)
{

    // Sets up the viewport positions and sizes
    viewport.x = x;
    viewport.y = y;
    viewport.w = w;
    viewport.h = h;

    // Sets the viewport so that SDL uses it
    SDL_RenderSetViewport(Window::GetRenderer(), &viewport);

}

Drawing the viewport : (gets called every frame)

void Camera::DrawCameraViewport()
{
    SDL_RenderSetViewport(Window::GetRenderer(), &viewport);
}

I set the cameras position during runtime like this :

void Camera::SetCameraPosition(int _x, int _y)
{
    viewport.x = _x;
    viewport.y = _y;
}

And here's how I set the cameras position using the above function :

Note : Sorry, the line became giantic...

camera->SetCameraPosition(
    -SpriteManager::GetPlayerSprite()->GetPosition().x
    + Window::GetWindowMiddlePoint().x
    - SpriteManager::GetPlayerSprite()->GetMiddlePoint().x

    , -SpriteManager::GetPlayerSprite()->GetPosition().y
    + Window::GetWindowMiddlePoint().y
    - SpriteManager::GetPlayerSprite()->GetMiddlePoint().y);

Question : Am I implementing the viewport correctly?

sentences:
How to add ingame tutorial for first time? I want to know how to show tutorial when player playing for First time.
Only once

sentences:
What is a fragment in 3D graphics programming? What is a fragment in a fragment shader? Wikipedia says that:

  In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment survives to become a pixel (depth, alpha, stencil, scissor, window ID, etc.)

So is it textures, vertices or something else?

sentences:
Unable to save player data in a binary file within Update() method I'm trying to save player life within a binary file in Application.persistenceDataPath. I've written a method to store the player life:

  public void SaveLife()
     {
         BinaryFormatter bf = new BinaryFormatter ();
         FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
         PlayerData data = new PlayerData ();
         data.savedLife = life;
         bf.Serialize (file, data);
         file.Close ();
     }

The problem is that when the SaveLife() is called OnApplicationQuit it works. Instead, if I call it within an Update() method of a class, it doesn't work.

The Update() method is called when a certain event is triggered:

void Update()
{
    if (life < 20)
    {
        if (//certain event is triggered)
        {
            SaveLife();
        }

        lifeTimer -= Time.deltaTime;
        if (lifeTimer <= 0)
        {
            ResetLife ();
        }
    }

}

The container class for the data is

[Serializable]
 class PlayerData
 {
     public int savedLife;
 }

What could be the problem?

sentences:
Getting wrong value for middle of screen My mouse is able to move the camera and rotate it around my model. If the mouse is in the middle of the screen, the camera should not move.

The red circle is where my mouse has to be at in order for the camera to stay still. If I put the cursor in the middle of the screen, it rotates the camera which shouldn't happen.

    Point screenCenter;
    float scrollRate = 1.0f;
    MouseState previousMouse;
    bool moveMode = false;

    #region MOUSE
        screenCenter.X = this.Window.ClientBounds.Width / 2;
        screenCenter.Y = this.Window.ClientBounds.Height / 2;

        this.IsMouseVisible = true;

        previousMouse = Mouse.GetState();
        Mouse.SetPosition(screenCenter.X, screenCenter.Y);
        #endregion MOUSE

    if (this.IsActive)
        {
            MouseState mouse = Mouse.GetState();

            if (moveMode)
            {
                Vector3 temp = player.playerWorld.Translation;
                player.playerWorld.Translation = Vector3.Zero;
                player.playerWorld *= Matrix.CreateRotationY(MathHelper.ToRadians(mouse.X - screenCenter.X) / 75);
                player.playerWorld.Translation = temp;

                cam.up -= MathHelper.ToRadians(mouse.Y - screenCenter.Y) / 25;
            }

            if (mouse.RightButton == ButtonState.Pressed)
            {
                if (graphics.GraphicsDevice.Viewport.Bounds.Contains(new Point(mouse.X, mouse.Y)))
                {
                    moveMode = true;
                }
            }
            else
            {
                if (moveMode)
                {
                    moveMode = false;
                }
            }

            if (mouse.ScrollWheelValue - previousMouse.ScrollWheelValue != 0)
            {
                float wheelChange = mouse.ScrollWheelValue - previousMouse.ScrollWheelValue;

                cam.up += 0.7f;
                cam.backward += 0.7f;
            }
            previousMouse = mouse;
        }

Why could this be happening? the screen is 650X1000. ScreenCenter x and y are the correct values.

Now that I play with it more, it seems each time the game starts, the mouse is set to a different position. The mouse should automatically be set to the middle of the screen each time the game starts, but it ends up anywhere but the middle.

Any idea of what could be happening here?

sentences:
How to import a texture to be used as occlusion map? The same way normal maps need to be imported as "Normal map" in the import settings, how should I setup an Ambient Occlusion texture to correctly work?

I've been searching around in the manual and the web but still not sure if AO maps should be imported as Lightmaps.

sentences:
How to mirror a texture in libGDX Is it possible to rotate my sprite in LibGDX?

public class Flame {
    private static final int FRAME_COLS = 6;
    private static final int FRAME_ROWS = 1;

    private Animation flameAnimation;
    private Texture flameSheet;
    private TextureRegion[] flameFrames;
    private SpriteBatch spriteBatch;
    private TextureRegion currentFrame;

    private float stateTime;

    private int xFlame;
    private int yFlame;
    private float rotation;

    /*
        Some code here
    */

    public void draw(){
        stateTime += Gdx.graphics.getDeltaTime();
        currentFrame = flameAnimation.getKeyFrame(stateTime, true);
        /*
          I also try currentFrame.flip(true, false); // but this doesn't work
        */
        spriteBatch.begin();
        spriteBatch.draw(currentFrame, xFlame, yFlame);
        spriteBatch.end();
   }

sentences:
Android Object get Jagged at the border I am new to OpenGL ES 1 in android. My 3D Model border getting Jagged. Please help me to look like a smooth border instead of jagged.

Screenshot : http://i.stack.imgur.com/1Gq83.png

private class Renderer implements GLSurfaceView.Renderer {
    public Renderer() {
        setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        getHolder().setFormat(PixelFormat.TRANSLUCENT);
        setZOrderOnTop(true);
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        gl.glClearColor(0.0f,0.0f,0.0f, 0.0f);
        gl.glDisable(GL10.GL_DITHER);
        gl.glEnable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA_SATURATE, GL10.GL_ONE);
        gl.glDepthFunc(GL10.GL_LEQUAL);
        gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glShadeModel(GL10.GL_SMOOTH);
    }

    public void onSurfaceChanged(GL10 gl, int w, int h) {
        mViewWidth = (float)w;
        mViewHeight = (float)h;
        gl.glViewport(0,0,w,h);

        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluPerspective(gl, 45, mViewWidth/mViewHeight, 0.1f, 100f);

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
        gl.glPushMatrix();

        gl.glDisable(GL10.GL_DITHER);

        GLU.gluLookAt(gl, 0, 0, 10, 0, 0, 0, 0, 1, 0);

        //draw_model
        gl.glPushMatrix();

        if(mOrigin != null && mRotate != null) {
            gl.glTranslatef(mOrigin.x, mOrigin.y, mOrigin.z);
            gl.glRotatef(mRotate.x, 1f, 0f, 0f);
            gl.glRotatef(mRotate.y, 0f, 1f, 0f);
            gl.glRotatef(mRotate.z, 0f, 0f, 1f);
        }

        if(mModel != null) {
            mModel.draw(gl);
            if(!RendererView.textureFileName.equals(""))
                mModel.bindTextures(mContext, gl);
        }

        gl.glPopMatrix();
        gl.glPopMatrix();

        if(isPictureTake) {

            w = getWidth();
            h = getHeight();
            b = new int[w*(y+h)];
            bt = new int[w*h];

            IntBuffer ib = IntBuffer.wrap(b);
            ib.position(0);
            gl.glReadPixels(0, 0, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
            createBitmapFromGLSurface(context);
            isPictureTake = false;
        }
    }
}

Thanks in advance.

sentences:
What is the best practice to handle event with order? When you play card games, you always face some abilities and effects will be triggered at the same time. To resolve this, players relies on the rules. For example, if a minion dies, it triggers effects on my side and opponent side. If the effects is handled on my side first if it is my turn.

But how would you resolve it in computer games. Even you are using mediator for event handling, the event is usually handled by the order of subscription. Unless there are some indicators for the subscribers, you will not able to distinguish between the subscribers. But wouldn't it defeats the purpose of observer pattern? What is the best way implement it?

sentences:
Precision problems with realistically scaled planets/terrains Recently I've been working on a realistically scaled planet engine. I found several interesting links about how to do it, what problems will come up after, and how to solve them. The approach I took was the one I found on many articles: Use 6 quadtrees, one for each faces, then transform the cube into a sphere.

My quadtree logic seems to be working, I tried it on a flat terrain and on a sphere ( with reasonable distances ), and it worked great, then I tried with bigger distances.

The first problem was z-fighting, fixed using a logarithmic depth buffer ( http://outerra.blogspot.fr/2009/08/logarithmic-z-buffer.html ). The second was floating point precision on big numbers.

I read two main approaches to fix it. The first one is to use doubles instead of floats for operations, and give the gpu every positions relative to camera space. The second was to use different spaces in different units ( object space in meters, planets space in kilometers, solar system space in AU, etc... ). While the second was encouraged by many people, I took the first one because it seemed easier to do. I plan to try the second in the future anyway.

The first approach worked on flat terrains because it was easy to compute the position relative to the camera ( centerOfNode - cameraPos ). One bug I still have with it is about height. I use 3D simplex noise on the gpu, which works in float and needs a vec3 input. With relatively small distances, the worldspace position works great. With huge distances, the worldspace position doesn't work when far from the origin, the pattern is very odd because of missing precision. And of course, it won't work with cameraspace position as input. I haven't find anything about that. Something I will try tomorrow is the second approach above. That is, define several spaces with different units, transform the position in each of the spaces, and use each of them as input for the simplex noise function, which will give me several textures I will be able to use for scale. I don't know how I will do in details, but I think it won't work since transform from the lower to the high space might result in floating points errors right? I could dynamically create vertices in the CPU using simplex noise with double precision but it doesn't sound right... I'd like to use the GPU as much as possible, unless I have no other choices.

Second problem I have is with spherical terrains this time. So my steps to get the planet are:

1) From the quadtree nodes, scale, rotate and translate an unit quad to his position in the current plane of the 6 quadtrees

2) normalize it to get the normal

3) multiply the radius to get a sphere at sea level

4) add the height

Since the first step is related to the origin of the planet, even in view space it will require operations with huge numbers ( the radius ), so I am not sure how I can avoid precision problems here... Again, I could create them on the CPU and send them to the GPU, but this sounds exhausting and I don't want to do it unless I have no other reasonable choices. I would gladly use the second solution ( several spaces ) if I had an idea of how to fix it with it, but I'm not sure how to do it...

sentences: 3rd party terrain editor I am looking for a good application for generating 3d terrains (really allowing generation and then some user-editing) . After a google search, I found many, but I need one that can export the entire terrain as a mesh. This, I was unable to find. (I need either a .obj .fbx or .3ds output) The size of the file that is written and the price of the program are not major factors in my decision.

sentences:
Voxel terrain engine Is there some voxel frameworks or extensions for game engines like Unity?
I really need a system to dynamically generate voxel ruinable terrains.

sentences:
Drawing Projected Vertices/Faces In Order I recently created a 3d engine, and have gotten to what is (as I've found) the hardest part so far. I need to sort the objects and then draw them. I've looked at sorting algorithms, but my case is rather specialized. I have an array of vertices stored inside the Face3D object which I've created, and need to draw faces correctly when overlapping, Firstly, am I thinking about this correctly? Draw the back vertices first? Secondly, How would I sort this? Here's my code for the Face3D file:

package me.dylan.ThirdDimension.src;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.util.ArrayList;

public class Face3D {
    Polygon face=new Polygon();
    ArrayList Lines = new ArrayList();
    ArrayList Vertices = new ArrayList();
    Color color;
    public Face3D(int x,int y, int z, int width, int height, int depth,Main m,Color c) {
        color=c;
        Vertices.add(new Point3D(x, y, z, m));
        Vertices.add(new Point3D(x, y+height, z, m));
        Vertices.add(new Point3D(x+width, y+height, z+depth, m));
        Vertices.add(new Point3D(x+width, y, z+depth, m));
        for(int i=0;i
            Vertices.get(i).update();
            Point2D tmp = new Point2D.Double();
            tmp.setLocation((int)Vertices.get(i).x2d, (int)Vertices.get(i).y2d);
            face.addPoint((int)Math.round(tmp.getX()),(int)Math.round(tmp.getY()));
        }

}

public void paint(Graphics g) {
    g.setColor(color);
    Graphics2D g2d = (Graphics2D)g;
    face=new Polygon();
    for(int i=0;i<Vertices.size();i++) {
        Vertices.get(i).update();
        Point2D tmp = new Point2D.Double();
        tmp.setLocation((int)Vertices.get(i).x2d, (int)Vertices.get(i).y2d);
        face.addPoint((int)tmp.getX(),(int)Math.round(tmp.getY()));
    }
    g2d.fillPolygon(face);

}

}

I'd just like to apologize if my question is unclear, it's difficult for me to explain this.

sentences:
Storing large array of tiles, but allowing easy access to data I've been thinking about this for a while. I have a 2D tile bases platformer in XNA with a large array of tile data, I've been running into memory problems with large maps. (I will add chunks soon!)

Currently, Each tile contains an Item along with other properties like how its rotated, if it has forground / background, etc.

An Item is static and has properties like the name, tooltip, type of item, how much light it emits, the collision it does to player, etc. Examples:

public class Item
{
    public static List<Item> Items;

    public Collision blockCollisionType;
    public string nameOfItem;
    public bool someOtherVariable,etc,etc

    public static Item Air
    public static Item Stone;
    public static Item Dirt;
    static Item()
    {
       Items = new List<Item>()
       {
            (Stone = new Item()
            {
                nameOfItem = "Stone",
                blockCollisionType = Collision.Solid,
            }),
            (Air = new Item()
            {
                nameOfItem = "Air",
                blockCollisionType = Collision.Passable,
            }),

        };
    }
}

Would be an Item, The array of Tiles would contain a Tile for each point,

public class Tile
{
     public Item item; //What type it is
     public bool onBackground;
     public int someOtherVariables,etc,etc
}

Now, Most would probably use an enum, or a form of ID to identify blocks. Well my system is really nice just to find out about an item. I can simply do tiles[x,y].item.Name To get the name for example. I realized my Item property of the tile is over 1000 Bytes! Wow! What I'm looking for is a way to use an ID (Int or byte depending on how many items) instead of an Item but still have a method for retreiving data about the type of item a tile contains.

sentences:
How can I change some tree's radius and length in C# script in Unity3D? So, I have this little tree stem. It only has its initial node.
All I would like to do is make it grow in length and radius in Update(). How can I do that?

sentences:
Almost working 2D Collisions I'm terribly sorry I'm asking this question YET AGAIN, but I can almost guarantee that this will be the last time I'll have to ask.

I'm currently on the verge of FINALLY getting these collisions to work for my game, made with libGDX in Java. My collisions use the same method as (and are basically copied and modified code from) the XNA Platformer example (here) where the direction of the collision is based on the rectangle where two objects are overlapping.

The collisions themselves almost work perfectly, but for some reason, holding down/up and left and colliding with the floor/ceiling while doing so doesn't seem to work well. I'm not at all sure why.

Instead of vaguely giving my problem and snippets of code, I've decided to instead provide a binary and the source of the game I have so far so you can see for yourself what my problem is. Link. (Note: make sure you unzip everything into a folder somewhere or it will not work)

You'll find the collision code in the method workingCollisions() in Link.java. Please excuse the messy code and terrible graphics as this whole thing is in pre-pre-alpha.

If anyone is kind enough and helps me out here, you are the best person ever. I'm completely desperate; I've been trying this on and off for months and I just can't get it to work. I cannot thank you enough.

sentences:
What calls trigger a new batch? I am finding my project is starting to show performance degradation and I need to optimize it. The answer to my previous question and this presentation from NVidia have helped greatly in understanding the performance characteristics of code using the GPU but there are a couple of things that aren't clear that I need to know to optimize my drawing.

Specifically, what calls make the distinction between batches.

I know that any state changes cause a new batch, so that includes:

Render State Changes
Buffer Changes
Shader Changes
Render Target Changes

Correct? What else counts as a 'state change'?

Does each DrawPrimitive() call constitute a new batch?** Even if I were to issue the same call twice, with no state changes, or call it once on on part of the buffer, then again on another?

If I were to update a buffer, but not change the bindings, would that be a new batch?

That presentation and a DX9 page suggest using all of the texture slots available, which I take to mean loading multiple objects in 'parallel' by mapping their buffers/shaders/textures to slots 1-16. But I am not sure how this works - surely to do this you would need to change the buffer binding and that would count as a state change? (or is it a case of you do but it saves 16 calls so its OK?)

sentences:
The true cost to get my XNA game on XBox? There seem to be many hurdles to get ones game onto Xbox, so far I have uncovered:

You need Visual Studio (once your game becomes commercial you cannot use Express - but have to pay for professional). $1000+
You then buy a XBox to find you also need a harddrive - so buy a Xbox harddrive too. $400
You need to buy XBox Gold LIVE subscription. $70 (Free)
You need to buy AppHub Creators Club subscription $100

Then after all that I cannot even find the place on my XBox to download Indie games?!!! Seriously WTF - after doing all this I could have come proficient in WebGL and done it all for free...

Before I go all the way down this path (hole) are there any other hidden hurdels before I can publish my game?

UPDATE: "Indie Games are not available in Australia, due to the requirement for all games to be rated by the Australian Classification Board, and the prohibitive expenses involved."....... im going to have to break something....

sentences:
OUYA Developer Kit throws various errors on start I followed these instructions for Mac OS X using an existing IDE (shell + text editor) instead of the Eclipse ADT thingy. I activated “Use Host GPU”, and installed Intel HAXM.
Installing the ouya-framework.apk and ouya-launcher.apk appears to go well. But when I start up my AVD there’s a dialog box saying “Unfortunately, the OUYA Launcher has stopped.”, I still get the choice of starting up the OUYA Launcher. When I do so there’s another dialog box saying “Can’t play this video”. I skip the controller settings, and then there’s a JOIN A WIRELESS NETWORK screen which I can’t get past.

This is the ODK 1.0.2, and I tried it using both Mac OS X 10.8.3 and 10.7.5.

sentences:
enemy View Range , chase player for 3D:
Q1 : I want to make zone range for each enemy in the game , so that when the player in the view range he will be chased .

Q2 :if I want to make enemy walk a little bit around his position ( from -10  to 10 ) for example , i.e as he is searching for some one , can you give me just steps ! thanks

Q3 : How to make enemy moves toward Player if he is being detected ?
Sorry for question , but I am new to this world :)

sentences:
Swift: Saving Video to Library PHPhotoLibrary.shared().performChanges({
            PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL as URL)
        }) { success, error in
            if !success {
                print("Error saving video: \(String(describing: error))")
            }
        }

Results in:
Error saving video: Optional(Error Domain=PHPhotosErrorDomain Code=-1 "(null)")
I found this similar problem solution on github for images and I think objC(?):

the code below will cause error on iOS 13 devices when import uri is
https://xxxxx.png assetRequest = [PHAssetChangeRequest
creationRequestForAssetFromImageAtFileURL:inputURI];
this way works well
NSData *data = [NSData dataWithContentsOfURL:inputURI];
UIImage *image = [UIImage imageWithData:data];
assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];

https://github.com/react-native-community/react-native-cameraroll/issues/159
So I am thinking I might need to find a wrapper class for video? I'm finding if very difficult to find good resources for working with swift.

sentences:
Why do asymmetric specular highlights appear in a scene with only ambient lighting in Unity? I have a scene in Unity (2019.3.0f3 Personal) using the High-Definition Render Pipeline. There are no lights in the scene, and Baked Global Illumination is disabled. The skybox is a GradientSky. By all means, the lighting in the scene should be absolutely uniform, but instead there is a gradient from one side to the other.

This is what the scene looks like:

Though the effect is faint, you can see that the right side of the plane is slightly lighter than the left. The ground shader is HDRP/TesselationLit, and by bringing the Smoothness Remapping to max I can exaggerate this effect, as shown below. This is why I am under the impression the effect is specular in nature.

Interestingly, if I switch the camera to the Isometric mode, the effect disappears:

Finally, the effect appears to occur in world rather than camera space, as shown by the changes in lighting when I rotate my camera in increments of 90 degrees:

What is causing this effect, and how can I disable it?

sentences:
Top Down RPG Movement w/ Correction? I would hope that we have all played Zelda: A Link to the Past, please correct me if I'm wrong, but I want to emulate that kind of 2D, top-down character movement with a touch of correction. It has been done in other games, but I feel this reference would be the easiest to relate to.  More specifically the kind of movement and correction I'm talking about is:

Floating movement not restricted to tile based movement like Pokemon and other games where one tap of the movement pad moves you one square in that cardinal direction. This floating movement should be able to achieve diagonal motion.
If you're walking West and you come to a wall that is diagonal in a North East/South West fashion, you are corrected into a South West movement even if you continue holding left (West) on the controller. This should work for both diagonals correcting in both directions.
If you're a few pixels off from walking squarely into a door or hallway, you are corrected into walking through the hall or down the hallway, i.e. bumping into the corner causes you to be pushed into the hall/door.

I've hunted for efficient ways to achieve this and have had no luck. To be clear I'm talking about the human character's movement, not an NPC's movement. Are their resources available on this kind of movement? Equations or algorithms explained on a wiki or something?

I'm using the XNA Framework, is there anything in it to help with this?

sentences:
how can i make a sprite from a spritesheet increase its size? I want to be able to increase the size of a sprite to give the illusion that it is walking towards you (or decrease in size to move away).
how do i manipulate the size of a loaded sprite off a sprite sheet (png format, if that matters)?

sentences:
Repositioning and resizing when i change the size of my window I am trying to write a game.

When someone resizes the window of my game, I need all the graphics i have drawn on the screen to reposition correctly so that the ratio of the graphics' width and height remain correct and that the new position determined by x and y, have been adjusted for the new size screen.

In the following image, the top left corner is 0,0... all coordinates / widths / heights are measured from this point.

What do I need to do to x, y, width and height from the variable width and height of my screen in order to keep this aspect ratio correct?

SIDE NOTE: the aspect ratio of the screen will always be 16:9!

sentences:
Path following with turning radius and obstacle avoidance I would like to move an object through a path found by A* star but taking into account the object's turn radius and movement speed, while also avoiding possible obstacles during a curve. After some research, I found this article in gamasutra about realistic turns and this question. If I understood correctly, to add smooth turns I just need to create a circle in either the left side of the object or the right (depending on which direction it will rotate) and then move the object along that circle until it reach the point in which it can move straight to the goal. I implemented the code from the article, however I couldn't get it working

The tank is the object I want to move and the boxes are obstacles;
The red Xs are the "waypoints" and the blue line is the line segment
between those points;
The white circle is the tank's turning radius;
The green line is the actual movement the tank would perform taking
its turning radius and movement speed into account;
And the pink
dotted circle represents the "point to leave the circle and start on
the straight line" that I've got with the algorithm;

The first problem is that I'm not sure how to calculate the right place for the pink circle. If I understood correctly, it should be positioned between the end of the green line's curve and the start of the straight one.
The second problem is that, once solved the first, I don't know how to actually move the tank through the "circular" path, while in straight path I could simply take the direction between the current point and the next, and move along that.
Here's my implementation in gdscript
extends Node2D

var speed = 80
var rotation_speed = 1

var goal = null
var velocity = Vector2()

func _ready():
    goal = get_parent().get_node("Goal").global_position

func _physics_process(delta):
    if goal == null:
        return

    var pos = global_position
    var circle_radius = speed / rotation_speed

    var angle_to_circle_center = rotation + PI/2 #rotation - PI/2
    var circle_pos = pos
    circle_pos.x += circle_radius * cos(angle_to_circle_center)
    circle_pos.y += circle_radius * sin(angle_to_circle_center)

    var dx = goal.x - circle_pos.x
    var dy = goal.y - circle_pos.y
    var h = sqrt(dx*dx + dy*dy)
    var r = circle_radius

    if h < r:
        return

    var d = sqrt(h*h - r*r)
    var theta = acos(r / h)

    var phi = atan(dy / dx)
    var Q = Vector2()
    Q.x = circle_pos.x + r * cos(phi + theta)
    Q.y = circle_pos.y + r * sin(phi + theta)

    get_parent().get_node("icon").global_position = Q

Any insight would be appreciated - thanks in advance!

sentences:
Best way to play footstep-sounds of character? I am developing an XNA-Game, which is pretty much a runner game (side-scrolling).

Now I am in the middle of adding sounds to my game. And as it turns out, I am having quite some problems with the footstep-playback.

The following is in C#, but I am quite sure that anyone will understand it:

 public static void StartStepTimer()
 {
     _stepTimer = new DispatcherTimer();
     _stepTimer.Interval += TimeSpan.FromMilliseconds(500);
     _stepTimer.Tick += _stepTimer_Tick;
     _stepTimer.Start();

     _step = _content.Load<SoundEffect>("Sound\\World\\Summer_1");
     _stepInstance = _step.CreateInstance();
     _stepInstance.Volume = 0.4f;

 }

  private static void _stepTimer_Tick(object sender, EventArgs e)
  {
      _stepInstance.Play();
  }

As you can see, I am playing the footstep based on a timer. I am using this method, since the gamespeed gets higher during gametime (I can change the interval in that case).

But this method isn't really working. The playback lags.
I thought of making a prerendered 10s soundfile and looping that in gametime, but than the playback won't fit when the gamespeed rises.

Any suggestions?

sentences:
How to program friction in an air hockey game in Cocos2d-x 3.11? I'm developing a simple air hockey game, and I have a question about friction of puck and puddles with the game scene. How can I do that? I'm using cocos2d-x default physics engine, and the friction setting of physic bodies only applies when they collide.

I've found an old air hockey example project, but it seems that it's ported to cocos2d-x 3.x so it doesn't use built in physics engine.

sentences:
How can I make custom character face editor In my game In an optimal way? In many games there Is section as customize character that you can make your own character.I always love to know how can I make something like It.

Even old game have this feature? but how ?

For Implementing It I need accurate separation for communating between values and facial parts size.
So first I made multiple height-map based on facial parts for modifying by vertex shader and work correctly but this method Isn't optimal.can I Implement It just by one texture?

then I tried by using colorful mapping texture for detecting facial parts, but I have problem for getting color values from mapping texture In my shader code.

mapping texture:

My problem Is that my vertex shader Isn't match with my mapping texture.for example If I change _NoseLength other parts will changes.how can I tell to vertex shader which part is nose,forehead,lip,cheek,... In my colorful mapping.

Here Is my Shader Code:

Shader "Custom/Extrude" {
        Properties {
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _ModTex ("Vertex Modify", 2D) = "white" {}
            _NoseLength ("NoseLength ", Range(-0.05,0.01)) = 1.0
            _LipSize ("LipSize ",  Range(-0.05,0.01)) = 1.0
            _CheekBones ("CheekBones ", Range(-0.05,0.01)) = 1.0
            _ForeHead ("ForeHead ", Range(-0.05,0.01)) = 1.0
            _EyeSize("EyeSize", Range(-0.05,0.01)) = 1.0

        }
        SubShader {
            Tags { "RenderType"="Opaque" "Queue" = "Transparent"}
            Cull off
            CGPROGRAM
            #pragma surface surf Lambert vertex:vert
            #pragma target 3.0

            sampler2D _MainTex;
            sampler2D _ModTex;

            uniform fixed _NoseLength;
            uniform fixed _LipSize;
            uniform fixed _CheekBones;
            uniform fixed _ForeHead;
            uniform fixed _EyeSize;

            struct Input {
                float2 uv_MainTex;
            };

            void vert(inout appdata_full v) {
                float4 lipSize = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).g;//Green
                float4 nose = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).b; //Blue
                float4 eye = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).r; // Red
                float2 cheek = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).rg; // Yellow
                float2 forehead = tex2Dlod(_ModTex, float4(v.texcoord.xy, 0, 0)).rb; // Purple
                v.vertex.y += _LipSize * lipSize;
                v.vertex.y += _NoseLength * nose;
                v.vertex.y += _EyeSize * eye;
                v.vertex.y += _CheekBones * cheek;
                v.vertex.y += _ForeHead * forehead ;

            }

            void surf (Input IN, inout SurfaceOutput o) {
                half4 c = tex2D (_MainTex, IN.uv_MainTex);
                o.Albedo = c.rgb;
                o.Alpha = c.a;
            }
            ENDCG
        }
        FallBack "Diffuse"
    }

sentences:
How to check in Unity whether tile B can be reached in a straight line from tile A? I'm currently trying to smooth out my A* paths based on this article.

This is what I want to achieve:

But sadly I'm stuck at implementing the Walkable method.

I don't know how could I check whether a unit can reach tile B in a straight line from tile A.

(Let's keep it simple, and currently every unit is 1 tile wide.)

sentences: How to stitch terrains together in Unity I'm building a world that consists of multiple terrains and I was wondering, how do I go about stitching them together so that features of my map will "fit" together?  I know Unity has the SetNeighbors() method, but it appears as though that simply tells each terrain which terrain is next to the other.  What I'm trying to accomplish is having multiple terrains and being able to have something like a mountain range move from one terrain to another and make it appear as though it's all one terrain.

sentences:
Unity uNet Low Level API - which values should I snyc? I am using unitys unet low level api: TransportLayer.

I send my own message by converting strings to byte-arrays.

I want a server authoritive setting, so that I can try to implement my own client side prediction.

I am also using unitys physics2d, rigidbodies and so on.
I thought about to move the rigidbodies with it's velocity.

I wonder which values I should send from client to server and backwards, to avoid the rigidbody jittering.

I know that I cannot simply send the clients position to the server, because that will cause the jittering "effect".

Would be nice, if anyone can give me guidance.

Thanks :)

sentences:
How many localisations are too much for a game? We are making an RTS game and we intend to add localizations to all languages our players use. So far we have 16 locales and about 3-4 are being planned.

Now some crazy ideas pop up from our community, players ask for "funny text" localizations. We have been already offered a pack that makes it for 1 of our languages. Now I was thinking where should we draw a line between official localizations which we include into the game and unofficial mods that players will have to install on their own?

Obviously overcrowding locale selection menu with all sorts of funny locales (LOL-cat, redneck, welsh, medieval, simplified, etc.) for all the languages seems way too much. But is it really? What are the hidden pros and cons of having too much locales and how much is too much?

sentences:
How to find the nearest object from another, in a non tile based game where obstacles are present? The nearest object means the path from the initial position to this object is shorter than the path from initial position to any other object. The path is the smallest number of pixels this object must move to reach the target object while making sure that it does not collide with any obstacle.

Like in this example below, consider that object A has to determine which object is closer, object B or object C. The pink rectangle is an obstacle. Now if we consider the euclidean distance, object B will be closer but due to the presence of an obstacle euclidean distance will give false answers.

Another solution would be to find the distance using some pathfinding algorithm (like A*), which will give the correct solution, but will be slower than simply calculating euclidean distance.

The ideal solution should give the answer as an object the path to which is no more than 10% larger than to the nearest object. And it should take no more than 10 millisecond on a modestly powered computer to find the nearest object for 1000 different objects on a map that has upto 1000 obstacles of different sizes and the map is no larger than 1000*1000 pixels (like in the image above the nearest object for A is C, for B it is A and for C it is A). Also it should not take more than 50 MB of RAM (excluding the size of RAM used to store the coordinates of objects and obstacles and their sizes).

And the map is dynamic. The solution need not return the path between the objects, it need to only find the nearest object.

What will be the ideal solution of this problem?

sentences:
Where to find market research info on adventure games? Looks like adventure games are on the rise again. There were several great releases in 2012, including brilliant and highly acclaimed Walking Dead from TellTale.

Is there a market research that proves the new rise of adventure games? Bonus points for revenue estimates and such. I'm particularly interested in mobile games segment, but everything else is of interest as well.

sentences:
Is multipass rendering possible with SpriteBatch? I'm trying to implement a bloom effect. This requires three shader passes: a brightness threshold, a horizontal blur, and a vertical blur. It also requires resizes, but these are irrelevant to the question. I've also omitted the threshold, as the problem lies in the blurs.

Now, I've read that HLSL passes are just syntactic sugar for different shaders, and that switching between them is about as expensive as setting a new effect to the GraphicsDevice. Still, I prefer to keep them in one .fx file.

The passes:

    pass Pass0
    {
        PixelShader = compile ps_2_0 PS_Threshold();
    }
    pass Pass1
    {
        PixelShader = compile ps_2_0 PS_BlurHorizontal();
    }
    pass Pass2
    {
        PixelShader = compile ps_2_0 PS_BlurVertical();
    }

The blurring code:

        private void Blur(SpriteBatch SpriteBatch, RenderTarget2D Source, RenderTarget2D Rendertarget1, RenderTarget2D Destination)
        {
            // Blur pass 1
            Contents.BloomEffect.CurrentTechnique.Passes["Pass1"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Rendertarget1);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Source, Rendertarget1.Bounds, Color.White);
            SpriteBatch.End();

            // Blur pass 2
            Contents.BloomEffect.CurrentTechnique.Passes["Pass2"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Destination);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Rendertarget1, Destination.Bounds, Color.White);
            SpriteBatch.End();
        }

Finally, the Draw loop:

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.SetRenderTarget(RT1);
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, bloom);
            spriteBatch.Draw(android,
                             new Rectangle(0, 0, 258, 294),
                             Color.White);
            spriteBatch.End();

            Blur(spriteBatch, RT1, RT11, RT1);

            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null);
            spriteBatch.Draw(RT1,
                RT1.Bounds,
                Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

The output, however, is as follows:

It's obvious what happens: the last pass is applied twice. I've tested the passes individually by snipping them out of the shader, and they work fine. Is EffectPass.Apply() simply not meant to be used with SpriteBatch, or is there another way to change what passes are applied (without putting the passes in different .fx files)?

This has all been in XNA. To make this even weirder, when I do the same thing in Monogame the opposite occurs: the shader will only use Pass0. However, I'm converting the shader to OpenGL there, so that might be a conversion quirk.

EDIT: I fixed this by putting the different passes in different techniques, and switching techniques instead of passes. That doesn't answer the original question though, so I'll leave it open.

sentences:
Processing move between tiles with an animation in isometric map In my isometric map, entities can only be in the center of the floor tile.
So it's tile per position.
This is my map with an entity:

(source: gyazo.com)
Entity can either move forward, left, or right.
Where forward is X + 1, left is X - 1, Y - 1, right is X + 1, Y + 1.
I simply can move these entities by doing tile.updateX(1) for forward, etc.
But I want to make an animation for this move, so it can look like this:

(source: gyazo.com)
Can you see how that small shit moving smoothly through the tiles?
I've tried doing it like this:
public void updateShip() {
    this.move = true;
    this.moveX = 2;
    this.moveY = 1;
}

moveX and moveY are the offsets im going to add in the move.
and in the update method:
@Override
public void update() {
    if (move) {
        // Update animation every 17ms
        if (System.currentTimeMillis() - this.moveTime >= 17) {

            // adding relative offsets
            tiles[5][5].relativeX += moveX;
            tiles[5][5].relativeY += moveY;

            // adding moved token
            moved++;

            // timer to move Y coordinate
            if (System.currentTimeMillis() - turnY > 50){
                moveY++;
                turnY = System.currentTimeMillis();
            }

            // timer to move X coordinate
            if (System.currentTimeMillis() - turnX > 125){
                moveX++;
                turnX = System.currentTimeMillis();
            }

            // If moved more than 29 px, cancel animation and locate
            // to the right spot.
            if (moved >= 29) {

                // stops move
                move = false;

                // sets location
                tiles[5][5].updateX(1);
                tiles[5][5].updateY(1);

                // clears relatives offets
                tiles[5][5].relativeX = 0;
                tiles[5][5].relativeY = 0;
            }

            // upadates time
            this.moveTime = System.currentTimeMillis();
        }
    }

In the tile's grapics class, I draw the tiles like this:
public void render(Graphics g) {

    int width = this.getWidth() - offX;
    int height = this.getHeight() + offY;

    int x = (this.x * GRID_WIDTH / 2) - (this.y * GRID_WIDTH / 2) - width / 2;
    int y = (this.x * GRID_HEIGHT / 2) + (this.y * GRID_HEIGHT / 2) - height;

    x += relativeX;
    y += relativeY;

    g.drawImage(this.sprite.getImage(), x, y);
}

Ignore how messy my design is for now, I am just trying to figure out how moving to sides can be animated with a isometric grid.
however, with my method I could animate forward moving, I just keep the moveX to 2, and moveY to 1, and it will always move forward.
But with my code, this is what it does:

(source: gyazo.com)
What am I calculating wrong?
Ignore that fact that I need the sprites of the ship's sides. First I need to test without.
Update I think I did it:
private float moveX = 0.045f;
private float moveY = 0.000f;

@Override
public void update() {
    if (move) {
        Tile tile = tiles[5][5];

        if (moveX > 0.001)
            tile.updateX(moveX);

        if (moveY < 0.045)
        tile.updateY(moveY);

        moveX -= 0.001f;
        moveY += 0.001f;
    }
}

(source: gyazo.com)

sentences:
Can't remove JPanel from JFrame while adding new class into it Basically, I have my Frame class, which instantiates all the properties for the JFrame, and draws a JLabel with an image (my title screen). Then I made a separate JPanel with a start button on it, and made a mouse listener that will allow me to remove these objects while adding in a new Board() class (Which paints the main game).

*Note: The JLabel is SEPARATE from the JPanel, but it still gets moved to the side by it.

Problem: Whenever I click the button though, it only shows a little square of what I presume is my board class trying to run.  Code below for the Frame Class:

package OurPackage;
//Made By A.K. 5/24/12
//Contains Frame.

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;
import javax.swing.plaf.basic.BasicOptionPaneUI.ButtonActionListener;

public class Frame implements MouseListener
{
    public static boolean StartGame = false;
    ImageIcon img = new       ImageIcon(getClass().getResource("/Images/ActionJackTitle.png"));
    ImageIcon StartImg = new ImageIcon(getClass().getResource("/Images/JackStart.png"));
    public Image Title;
    JLabel TitleL = new JLabel(img);
    public JPanel panel = new JPanel();
    JButton StartB = new JButton(StartImg);
    JFrame frm = new JFrame("Action-Packed Jack");

    public Frame()
    {
        TitleL.setPreferredSize(new Dimension(1200, 420));
        frm.add(TitleL);

        frm.setLayout(new GridBagLayout());
        frm.add(panel);

        panel.setSize(new Dimension(220, 45));
        panel.setLayout(new GridBagLayout ());

        panel.add(StartB);
        StartB.addMouseListener(this);
        StartB.setPreferredSize(new Dimension(220, 45));

        frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frm.setSize(1200, 420);
        frm.setVisible(true);
        frm.setResizable(false);
        frm.setLocationRelativeTo(null);
    }

    public static void main(String[] args)
    {
        new Frame();
    }

    public void mouseClicked(MouseEvent e)
    {
            StartB.setContentAreaFilled(false);
            panel.remove(StartB);
            frm.remove(panel);
            frm.remove(TitleL);
            //frm.setLayout(null);
            frm.add(new Board()); //Add Game "Tiles" Or Content. x = 1200
            frm.validate();
            System.out.println("Hit!");
    }

    @Override
    public void mouseEntered(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseExited(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mousePressed(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseReleased(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

}

EDIT: I also created a new Board Object(?) in my Frame class. Will I be able to resize it and such?

sentences:
LibGdx and in-game fonts - any proven methods? I use 3 sizes for fonts in my game: small, medium, and large. I take the base font size and attempt to scale the font based on screen size and density, but this is proving to be pretty hard.

Does anyone have a proven formula for scaling fonts? Right now I'm simply using the pixel width of the screen to put the device into 1x, 2x, and 3x font scale bucket sizes, but I feel like I should be using the screen density in the calculation as well.

sentences:
XNA: Draw Bounding Box around Sprite I'm just starting with XNA and I wanted to draw Debug Lines around my Texture/Sprite to help me.

Is there an easy way to do it with SpriteBatch?
I haven't used the GraphicsDevice yet to draw....

Thanks!

sentences:
How do I fire a projectile at where an object will be located in the future? I'm making a tower defense game where the towers are shooting projectiles at enemies. I do not want to make the projectiles homing, and I want to make sure that when a tower fires a projectile, it will hit where the enemy is going to be, instead of firing at where the enemy is currently located.

My givens are the position and velocity of the enemy, the position of the tower and the speed at which projectiles travel. There is no acceleration.

I was considering taking the distance between the tower and the enemy, calculating how long it would take the projectile to connect with the enemy, and then using that to calculate the future position of the enemy, firing at that instead. However, now the distance between my tower and the enemy in the future might be different, so my calculation isn't going to be precise, and it might miss.

How do I correctly calculate where to fire the projectile so that it will always connect with the moving enemy?

sentences:
Creating a 2D Line Branch (Part 2) Yesterday i asked this question on how to create a 2D line branch;
Creating a 2D Line Branch

And thanks to the answered provided, i now have this nice looking main branch; *coloured to show the different segments in the final item.

Now is the time now to branch things off as discussed in the article;
http://drilian.com/2009/02/25/lightning-bolts/

Again however i am confused as to the meaning of the following pseudo code;

splitEnd = Rotate(direction, randomSmallAngle)*lengthScale + midPoint;

I'm unsure how to actually rotate this correctly. In all honesty i'm abit unsure what to-do completely at this part, "splitEnd" will be a Vector3, so whatever happens in the rotate function must then return some form of directional rotation which is then * by a scale to create length and then added to the midPoint.

I'm not sure. If someone could explain what i'm meant to be doing in this part that would be really grateful.

sentences:
Disadvantages of using multiple versions of OpenGL in LWJGL? So, I'm trying to figure out LWJGL, and my goal is to use OpenGL 3.2 (because pretty shaders are pretty).  But in every tutorial I can find for LWJGL, they import a bunch of different OpenGL versions and use them at the same time.  For example, this one imports GL11, GL15, GL20, and GL30 and uses functions from all of them.  This seems intuitively like it would be messy and generally a bad idea.  Besides the normal disadvantages of using deprecated functions, is there any particular reason not to do this?  Could it affect performance in any way?  Is there a potential for errors and odd behavior to occur?

Also, if possible, does anyone have an example of LWJGL written only using GL32?  I've found C++ code samples that do this, but I'm not too familiar with C++, so it's difficult for me to translate.

sentences:
Is it possible to rotate an image on an HTML5 canvas, without rotating the whole canvas? So I basically want to rotate single sprites on the canvas without rotating the whole canvas, is that someway possible.

I also don't want to create a new canvas for each object I have.

Also, it would be interesting to know which solution is then the most performant.

sentences:
Point Light Soft Shadows How to implement soft shadows for omni directional (point) light. We use typical shadow mapping technique. Depth is rendered to texture cube and addresing is pretty simple then. Just using vector from light to fragments world position. It works perfectly. Until you want soft shadows. In our engine we use PCSS technique for spot lights. But for point light there begins troubles.

How to sample in 3D?

I developed technique when orthonormal basis is created from  a direction and upvector (0,1,0). And then multiply sampling vector (something like this (1.0,i/depthMapSize,j/depthMapSize) with this basis. But this (of course :)) looks pretty bad for vectors near (0,1,0) and (0,-1,0).

I will appreciate any help on this.

sentences:
How can I make an update patch for a Unity game on Windows? I ran into trouble making a PC game using Unity.

If I try to update my game, I can't a update the C# scripts (because AssetBundles don't include C# scripts)

So I think I'll need to use a server and patch all files.

But I don't know how to do so...

How can I make an update for my Windows game?

sentences:
How to orient a layer to connect 2 points AND facing the camera here is my question, which I hope will be in general interest:

If you have got 2 Points in 3D space and want a plane to connect those, you can quite easily use a function similar to "lookAt" to orient the layer pointing with its x-axis from one point to the other. But how can you at the same time make sure the layer is rotated in the way so that the layer is facing the camera (the maximum amount possible, of course it cant be orthogonal to the camera)?
The x Axis from the resulting plane should face from the one point to the other.

sentences:
Implementing game state without switch statements everywhere? Executive summary

Are there any good tutorials on Game State FSMs, particularly OOP/OOD-based and not switch-statement-based?

Summary

Is there a practical process for creating a game state engine other than using a switch statement, preferably with examples? Wikipedia's event-driven FSM article only shows a switch statement and the article on FSMs is strictly theory-based with no practical examples.

Background

Currently all my games use a very simplistic game state "engine" that uses switch statements everywhere. It's very messy, violates DRY horribly, and does not scale very well.

Each state is treated as a level and must be checked at all three points throughout the game loop, i.e. Input, Processing, and Render. If a level or screen is added it must be added to all the switch statements.

Practical example of recreation of pac-man for educational purposes (seriously, this was a school project a few years ago):

enum STATE {
    LOADING,
    TITLE,
    LEVEL_ONE,
    LEVEL_TWO,
    // ...
    WIN,
    GAME_OVER,
    CREDITS,
}GAME_STATE;

void Input() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            InputCommon();
            break;
        case WIN:
        case GAME_OVER:
            if(keyboard->KeyDown(KEY_ENTER))
                GAME_STATE = CREDITS;
            break;
        case CREDITS:
            if(keyboard->isKeyPressed())
                quit = true;
            break;
    }
}

void Processing(int dead) {

    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            ProcessLevel();
            if(GAME_STATE == LEVEL_SEVEN) {
                // ...
            }
            break;
        case WIN:
            break;
        case GAME_OVER:
            break;
        case CREDITS:
            break;
    }
}

void Render() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(0));
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...

            // ...
            break;
        case WIN:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(3));
            break;
        case GAME_OVER:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(1));
            break;
        case CREDITS:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(2));
            break;
    }

    //End render process, display to screen.
    _gw->EndRender();

}

sentences:
Using one Vive controller: default to left hand? We're making a sailing game in VR for Vive Pro, where you hold the rudder with your left hand using a Vive controller. We use just one controller because there's nothing to do with your other hand, and the rudder is on the left side of the player (it's a seated setup). The second controller will be charging, or it will be off while the game is being played.

We use the Player prefab that comes with the Steam VR Unity Plugin, that has GameObjects for both the left and right hand, with the option to show controllers and/or hand skeletons that move according to what controls you're using on the controllers.

The problem is that when only one controller is on and detected by Steam VR, it decides to show the right hand, instead of the left hand that we're holding it with.
When both controllers are switched on and connected, it works as expected. The left hand controller is at the player's left side as long as the unused controller is located at the player's right side.

I tried putting a left handed skeleton on the right hand controller gameObject in the Player prefab, but that resulted in an unresponsive skeleton (not visualising the interaction of the player with the controller).

How can we make it so that when using only one controller, it shows as the left hand?

So what we want is like in this picture, hold the controller with one hand (normally the left hand) except always showing a left virtual hand in the application, and still mimicking whatever controls the user is pressing on the real controller.

sentences:
How to prevent an object with high velocity from passing through a collider? Consider a simple 2D platformer. I have a BoxCollider2D on the player object and a TilemapCollider on the ground below(grid). I created a "jump" script for the player through which the player object jumps and comes back to the ground, clean. But when the player object goes relatively high and comes down with a high velocity, it doesn't collide with the ground(grid) instead it goes right through the tilemap collider and into the void.
How can this behaviour be prevented?

sentences:
1D Perlin Noise Game in Unity I'm working on a 2D side-scrolling game in the Unity engine. I am using the 1-Dimensional Perlin Noise function and using pseudo-code. I can't use two links so I'll provide a link to imgur with the images and the links in numerical order. First link in imgur links to the pseudo-code/implementation of perlin noise I am using.
My implementation so far is showing good results.
Here is a picture:

This image uses the values:

Persistance = 0.7

Octaves = 4
From the first article I linked, it states:

Now, you'll want several different random number generators, so I
suggest making several copies of the above code, but use slightly
different numbers. Those big scarey looking numbers are all prime
numbers, so you could just use some other prime numbers of a similar
size.

This block of text is referring to this part of code which is an Integer-noise function:
  float Noise (int x)
    {
        x = (x << 13) ^ x;
        return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
    }

Another site I found the author adjusts the Integer-noise function from discrete to continuous (allowing the range not to be limited). I've made this change although I am not sure if my implementation of both links I've provided is entirely correct. The results are promising but when you change these variables values to:

Persistence = 1

Octaves = 8

the terrain starts to have little gaps at the bottom like so:

I am not quite sure how to fix this, I know lowering the persistence provides smoother results resolving this issue but that makes the terrain's amplitude rather low for a side-scrolling platformer.
Here is the complete code:
    void Start ()
    {
        objectArray = new GameObject[width, height];

        for (int i = 0; i < width; i++) {

            float x = PerlinNoise_1D (i, persistances, octaves);

            for (int j = 0; j < height; j++){
                objectArray[i,j] = (GameObject)Instantiate (gameobject, new Vector3 (i, j + x, 0), Quaternion.identity);
            }
        }

    }

float Noise(int x){
    x = (x << 13) ^ x;
    return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
}

float CoherentNoise  (int x)
{
    int intX = (int)(Mathf.Floor(x));
    float n0 = Noise (intX);
    float n1 = Noise (intX + 1);
    float weight = x - Mathf.Floor (x);
    float noise = Mathf.Lerp (n0, n1, weight);
    return noise;
}

float SmoothedNoise (int x)
{
    return CoherentNoise (x) / 2 + CoherentNoise (x - 1) / 4 + CoherentNoise (x + 1) / 4;
}

float InterpolatedNoise (float x)
{

    int integer_X = (int)x;
    float fractional_X = x - integer_X;

    float v1 = SmoothedNoise (integer_X);
    float v2 = SmoothedNoise (integer_X + 1);

    return Cosine_Interpolate (v1, v2, fractional_X);
}

float Cosine_Interpolate (float a, float b, float x)
{
    float ft = x * (float)Mathf.PI;
    float f = (float) ((1 - Mathf.Cos ((ft))) * .5);

    return  a * (1 - f) + b * f;
}

float PerlinNoise_1D (float x, float persistance, int octaves)
{

    float total = 0;
    float p = persistance;
    int n = octaves - 1;

    for (int i = 0; i <= n; i++) {

        float frequency = (float)Mathf.Pow (2, i);
        float amplitude = Mathf.Pow (p, i);

        total +=  InterpolatedNoise (x * frequency) * amplitude;
    }

    return total;

}

Thank you for your help and time.

sentences: Bind render result to texture id I want to save the result screen of the rendering and then apply another shader on that result, the typical way is to read the screen using glReadPixels and then buffer that image to gpu and then apply my effect, so is there a way to bind the screen result to a texture id directory in gpu, instead of retrieving it back to CPU and then buffer it to GPU ?

sentences:
How do I check user's unlocked achievement and leaderboard scores via GPG plugin I need to load user's achievement and their scores from leaderboard in my game. But the Social.LoadScore() and Social.LoadAchievements() both returns a 0 size array in callback.

When I checked the implementation in Google Play Gaming's PlayGamePlatform.cs, both the method has this summary -

Not implemented yet. Calls the callback with an empty list.

So my question is How do I get this data in Unity? Has anyone tried any other method to get the data?

sentences:
How can I protect my save data from casual hacking? What options are there for saving game data in a secure manner? I'm interested in solutions specifically tailored for C++.

I'm looking for something that is fast and easy to use. I'm only concerned about storing simple information such as

Which levels are and are not unlocked
The user's score for each level

I'm curious again to know what's out there to use, any good libraries to use that give me nice, secure game data files that the average player can't mess with.

I just found this here which looks very nice, but it would be great to get some opinions on potential other libraries/options out there.

sentences:
Compensate for animation time in multiplayer network game I'm developing a multiplayer turn-based card game. In certain scenarios, the clients are required to perform an animation before moving on with the game. For example, the server informs the clients to animate dealing cards to all players. This animation takes around 5 seconds. Afterwards, the server informs a client to make a move, with a timer showing how long they have to play.

How can the server wait for the animation to finish before moving on and starting a timer and informing a client to play? The timer obviously needs to start after the animations are complete.

I've thought of the following:

1) Hardcode the animation durations on the server side and delay sending out the next message to the clients until after the duration of the animation.

2) Have the clients inform the server when an animation is complete.

..but I feel that there should be a better way.

Is there any other way to do this?

sentences:
Creating outline from a collection of points following the concavity I am trying to create an outline from a collection of points. I found this solution for Convex Hull. I specifically picked this implementation: https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
Edit: I can't find an algorithm that will find the concavity of the region specified in green. The yellow line is the Hull from the algorithm amove

I have the point is defined as:
[Serializable]
public struct Point : IComparable<Point>, IEquatable<Point>
{
    public int X;
    public int Y;

    public static int Cross(Point o, Point a, Point b)
    {
         return (a.X - o.X) * (b.Y - o.Y) - (a.Y - o.Y) * (b.X - o.X);
    }
}

Here is the implementation of the algorithm:
        public static List<Point> ConvexHull(List<Point> points)
        {
            if (points == null || points.Count <= 3) {
                return points;
            }

            var size = points.Count;
            var k = 0;
            var hull = new Point[2 * size];

            points.Sort();

            //build lower hull
            for (int i = 0; i < size; ++i) {
                while (k >= 2 && Point.Cross(hull[k - 2], hull[k - 1], points[i]) <= 0) {
                    k--;
                }

                hull[k++] = points[i];
            }

            //build upper hull
            for (int i = size - 1, t = k + 1; i > 0; --i) {
                while (k >= t && Point.Cross(hull[k - 2], hull[k - 1], points[i - 1]) <= 0) {
                    k--;
                }

                hull[k++] = points[i - 1];
            }

            var result = new List<Point>(hull);

            if (k > 1) {
                result.Resize(k - 1);// remove non-hull vertices after k; remove k - 1 which is a duplicate
            }

            return result;
        }

sentences:
Problems making my basketball bounce around horizontally This is probably a very easy question, but I can't seem to understand why it's not working.

I want the basketball to bounce horizontally when it touches the borders on the right and left, but when it bounces on the right, it seems to go just a little bit further than it should.

Any suggestions?

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    basketballPosition.X += ballSpeed;
    if (basketballPosition.X > Window.ClientBounds.Width - basketball.Width || basketballPosition.X < 0)
    {
        ballSpeed *= -1;
    }

    base.Update(gameTime);
}

And my Draw method:

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();

        spriteBatch.Draw(basketball,
                         basketballPosition,
                         null,
                         Color.White,
                         0,
                         Vector2.Zero,
                         1.5f,
                         SpriteEffects.None,
                         0);

        spriteBatch.End();

        base.Draw(gameTime);
    }

Edit The problem was I was using a scale of 1.5f for drawing the image. Can someone explain how I would get the true border of the image if I were using scale? It seems the border stay as the original size, but the texture is drawn to whatever scale I choose.

sentences:
Unity assets turned binary from text I'm working with unity and git, and for some reason, from some point - the assets started being Binary files, meaning that they're not visible as normal YAML files, and I cannot see textual git diff results on them.

Has anyone experiences it and knows how to revert to the textual format from the binary format?

sentences:
How to detect and collide two elastic line segments? There are 4 moving physical nodes in 3D space. They are paired with two elastic line segments / strings (1 <-> 2; 3 <-> 4).

Part I: How to detect the collision of two segments?

Part II: On the moment of collision, fifth node is created at the intersection point and here you have the force-based graph. 5-th node (bend point) can slide among the strings as in a real world. Given the new coordinates of 4 nodes, how to calculate the position of the 5-th node on the next frame? I assume string force on the nodes to be F = -k * x where x is the string length.

All I came up to is that the force between 5 and 1 equals 5 and 2 (the same with 3 and 4). What are the other properties?.

sentences: How can I detect touch intensity or pressure via libGDX? How can I detect the intensity of touch pressure in libGDX? For example, low pressure, medium, medium-high, high and so on. There are some questions about it but there aren't answers for libGDX.

sentences:
Why do people like `realistic' physics and graphics in games? If games are all about fun, then why do people tend to like realistic physics and graphics are good for games?

Can you cite your source?

sentences:
AddForce results in stuttering movement I'm currently developing a simple breakout/arkanoid mobile game. Now, I noticed that my ball movement is noticably stuttering. I've read various approaches about how to make the ball move and decided to go for AddForce so I don't have to do any physics calculations myself.
The only thing im currently doing is using AddForce on my ball's rigidbody2D and have it collide with the walls and blocks. There's nothing done manually in Update or FixedUpdate and there are no other scripts running while the ball is moving. The scene is pretty empty actually.

Things I have tried so far without success:

Disable V-Synch
Increase the velocity iterations (I tried values 15-500)
Set the RigidBody2D's interpolation mode to: Interpolate/Extrapolate
Using different mass values and force values in AddForce
Checking, whether it's just an optical illusion (it seems to run more smoothly in editor and other breakout/arkanoid games don't have that problem on my Galaxy S7)

RigidBody settings of the ball:

Body Type: Dynamic
Material: Friction: 0 | Bounciness: 1
Mass: 0.025
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 0
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: Interpolate

The walls and blocks are simple BoxCollider2D components. And I'm calling AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED)) on the ball's RigidBody2D.

Edit:

public void OnPointerUp(PointerEventData eventData) {
    if(!_ballStarted) {
        PaddleController.ShootStickingBalls();
        _ballStarted = true;
    }
}

public void ShootStickingBalls() {
    int stickyBallsAmount = _stickingBallsRigidBody2D.Count;
    for (int i = 0; i < stickyBallsAmount; i++) {
        _stickingBallsRigidBody2D[i].AddForce(new Vector2(0f, GameConstants.DESIRED_BALL_SPEED));
        _stickingBallsRigidBody2D[i].transform.SetParent(_nonStickyBallsTransform);
    }
    Sticky = false;
}

sentences: How can I handle a touch event in cocos2d for Android? How can I handle a touch event in cocos2d for Android? And how to move a sprite using ccTouchesMoved?

sentences:
How should I use Monte Carlo method to simulate some police cars that keep patroling in a tile based map? I have a tile map (isometric) and I have some police cars that they patrol all the time on the map, there is some building and other cars in map too so they are considered as constraints in my shortest path algorithm (below).

I use to randomly select some target for each police car and use A* algorithm to find the path to the randomly selected destination tile and this cycles over and over. because cars should move all the time! (except those that gamer should control)
The problem is police cars routes are correlated and they do not just traverse the area randomly, for instance, they do not usually cover a same area or they do not repeat their own route so my implementation based on some random destination point wasn’t a good idea and the result was not satisfying. Take a look at the following picture, it shows how randomly selecting the destinations worked for me, obviously, it is a dumb patroling for sure, even a cockroache could do better!

Suddenly, I remembered Monte Carlo Method and I thought it would solve my problem, because it exactly does what I wanted to do, However may be I should use Zobrist Hashing since it is tile base in nature. Does anyone has any idea how should I use this kind of methods?
Question in Brief :
How can I use Zobrist Hashing or Monte Carlo method to set destinations points for my patroling car (like police car)?
If anyone knows another way to implement a patrolling method, he/she is very welcome to post an answer, I am not sure if Zobrist Hashing is the best and worth to implement.
---First Edit (added following paragraph) :
I need to distribute the cars and their destination points in a homogeneous manner. Every kind of solution that get me close to a good pattern could be my answer, of course there is a lot of methods to do so, but I dont have any clue.

sentences:
How do I make cars on a one-dimensional track avoid collisions? Using three.js, I use a simple spline to represent a road. Cars can only move forward on the spline. A car should be able to slow-down behind a slow moving car. I know how to calculate the distance between 2 cars, but how to calculate the proper speed in each game update?

At the moment I simply do something like this:

this.speed += (this.maxSpeed - this.speed) * 0.02; // linear interpolation to maxSpeed

// the position on the spline (0.0 - 1.0)
this.position += this.speed / this.road.spline.getLength();

This works. But how to implement the slow-down part?

// transform from floats (0.0 - 1.0) into actual units
var carInFrontPosition = carInFront.position * this.road.spline.getLength();
var myPosition = this.position * this.road.spline.getLength();

var distance = carInFrontPosition - myPosition;

// WHAT TO DO HERE WITH THE DISTANCE?
// HOW TO CALCULATE MY NEW SPEED?

Obviously I have to somehow take current speed of the cars into account for calculation.

Besides different maxSpeeds, I want each car to also have a different mass (causing it to accelerate slower/faster). But this mass has to be then also taken into account for braking (slowing down) so they don't crash into each other.

sentences:
How can I fix the face/normal direction of my 3d mesh in blender/UE4? So I am playing around with UE4 to make some concept art for a game. I extracted the model I wanted to use from the game's files and imported it into blender. It's a tank with 4 parts: the hull, the suspension, the turret, and the cannon. The suspension and cannon work as intended, but there is something wrong with the way the hull and turret are rendered. Here I have linked 3 photos of what is happening:
http://imgur.com/a/ErpeO

The first screenshot is what the model looks like when rendered in blender (internal and cycles both look like this).

The second screenshot is the model in blender's 3d preview. Looks completely normal.

The third screenshot is what the model looks like in UE4 with textures and normals applied. The outside of the hull and turret meshes are see-through, so only the inside faces on the backside of the mesh are visible.

I have already looked through google and can't find anything to help me. By default the normal direction for the faces (not the vertices) are flipped inside out. Also if I tick "backface culling" blender removes the front faces of the mesh instead of the back faces (should be the other way around). Which means somehow the faces of the 3d mesh are flipped inside out and I need help getting them the way they should be. I have already tried flipping as well as re-calculating the normals (with the "make normals consistent" box ticked) and neither fix the problem. Would really appreciate some help with this. Will upload the model if I have to, but it's not mine so it might be considered copyright infringement.

EDIT: I'm not sure if this matters, but the hull and turret need to be mirrored in blender to match up with the orientation of the cannon/suspension. By defualt they're flipped in the wrong direction. This doesn't seem like a coincidence.

sentences:
New Unity version copies the settings of previous version I use Ubuntu 20.04.
When I download a new version of Unity 3D through Unity Hub, this new version automatically takes the settings of the previous version. I have installed Unity 2020.1, and I am facing the same problem. I created a new project, but it written in 2020.1 that I used preview package. I didn't even installed any package in Unity 2020.1. I did install preview package in 2019.4. But I didn't even open the project with 2020.1. I only have one project with 2020.1. The new project I just created. I asking help because I faced this issue when I first installed 2019.1, 2019.2, etc.
How can I flx it? Thanks

sentences:
How to draw the simplest grid map OpenGL 1.0 I want to draw a simple black & white grid map, like that:

I have been searching for a way to generate tile, a tile map and tho and I want to draw this map and thats all. I mean that I want to draw it only once so it should be easy.
I use OpenGL 1.0. How can I draw that and how should I draw - should I draw an Image and place it  like a map, should I draw a tile and multiple it ?

sentences:
LibGdx, conflicting UI button clicks and screen touch events My game's main game class is a Screen which also implements InputProcessor to handle touch events.

The screen renders a TMX map using an HexagonalMapRenderer and a Camera, like this:

_camera = new OrthographicCamera();
_map = new TmxMapLoader().load("1087.tmx");
_mapRenderer = new HexagonalTiledMapRenderer(_map);
_camera.setToOrtho(false, Gdx.graphics.getWidth(),  Gdx.graphics.getHeight());

To allow the user to scroll the map, I am overriding the touchDown and touchDragged methods; it works.

However, I also have a Scene2D Stage rendering on the Screen, which I use to display some buttons.

They get displayed. and I have created a ClickListener like this:

 button.addListener(new ClickListener(){

    @Override
    public void clicked(InputEvent e, float x, float y){
        System.out.println("Clicked!");
    }
 });

If I use

Gdx.input.setInputProcessor(this);

Only the Screen scrolling functions will work, and the buttons will become unresponsive.

On the other hand, if I use:

    Gdx.input.setInputProcessor(stage);

I will be able to use UI buttons, but the map will become unresponsive.

I'd like to enable both (map will scroll if user clicks anywhere BUT the UI buttons, it will then fire the button clicked listener), is there any way to do this?

Thanks.

sentences: Consume input events in Unity 4.6 How do I consume the input events in the new 4.6 unity gui system? If I click on a button for instance I don't want anything else non GUI related that might be listening for mouse input to react to the event.

sentences:
The SFML equivalent of polling to see if a key has been released? I'm testing out SFML by trying to make a square move with lerp velocity. The desired result was that when, let's say, D was pushed, the square would accelerate smoothly from velocity.x = 0 to velocity.x = maxVel (20). When
the D key is let go, it decelerates back to 0. The problem is, I can't get it to decelerate! When I let go of D, it keeps on going!

Player.cpp (only relevant code shown):

#include "Player.h"

void Player::input() {
    using Key = sf::Keyboard::Key;
    auto keyDown = [](sf::Keyboard::Key k) {
        return sf::Keyboard::isKeyPressed(k);
        };

    if (keyDown(Key::A)) {

        velocityGoal.x -= 3;
    }
    else if (keyDown(Key::D)) {
        velocityGoal.x += 3;
    }
    if(keyDown(Key::A) != true){
        velocity.x = 0;
    }
    else if (keyDown(Key::D) != true) {
        velocity.x = 0;
    }
    if (keyDown(Key::F)) {
        velocity = velocity; //just a breakpoint cue. Move along.
    }
}
void Player::update(float dt) {

    //interpolating velocity
    velocity.x = Math::interpolate(velocityGoal.x, velocity.x, dt);
    velocity.y = Math::interpolate(velocityGoal.y, velocity.y, dt);

        //capping out speeeeed
    if (velocityGoal.x > maxVel) {
        velocityGoal.x = maxVel;
    }
    if (velocityGoal.x < -maxVel) {
        velocityGoal.x = -maxVel;
    }

    //adding velocity to the player's position
    newPos += velocity;
    rect.setPosition(newPos);
}

void Player::draw(sf::RenderTarget& target) {
    target.draw(rect);
}

My interpolation function:

float Math::interpolate(float goal, float current, float deltaTime){
float diff = goal - current;
if (diff > deltaTime) {
    return current + deltaTime;
}
else if (diff < -deltaTime) {
    return current - deltaTime;
}

return goal;
}

It appears to be a problem with the if statements that set velocity.x to 0. SFML doesn't have anything like keyJustPressed or keyUp, so I just polled to see if keyDown(D) was not true. This evidently is not the right thing to do in this situation.

Does anyone know the right way to do this, or if there is some way I can track a key being released?

sentences:
What functions should be called in C++ gameloop from Lua Script I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any good resources about this topic.

For example. lets say that i am trying to render a sprite on the screen, which sprite is created inside a lua script. As usually the sprite should call render() function every frame, my question is that, should i call every frame functions from Lua in my game-engine loop ? or its bad habit? i mean can i have a structure in lua like below :

function init()
   --called only once
end

function render()
  --called every frame in C++ gameloop
end

or should I implemented in other way?
Can someone suggest me any books about this matter or any good resources ?

sentences: How to make enemies randomly choose a path and then come back if wrong one? So I'm making a 2D Tower Defense-game in Unity with C# where the enemy has to go to the base, but can go to the wrong path randomly and then turns around when the road ends. How can I achieve this?

sentences:
Unity3d - zooming with orthogonal camera like in Google maps I am implementing 2d orthogonal zoom.

As far as I know - in Unity3d there are no translations like in OpenGL.
Taking this into consideration, I work with :

camera size
camera position (center)
real world mouse position

I have no issues implementing simple zoom in/ zoom out operations, combined with camera position changes ( drag'n'drop )

But I have some issues calculating camera zoom shift in this case :

camera size = (4,4)
camera position = (0,0)
real world mouse position = (1,0)

A double zoom in (2x) is applied, as a result -

camera size = (2,2)
camera position = (0.5,0)
real world mouse position = (1,0)

User shifts real mouse position to (1.5,0) and applies a double zoom out ( 0.5 ). In this case :

camera size is again (4,4)
camera position = ???????
real world mouse position = (1.5,0)

What should be the camera shift so the mouse doesn't visually move ?
What is the formula for calculation in this case ?

Thank you in advance.

P.S. Any suggestion regarding current method of handling zoom are welcome

Update

So - I resolved this issue with Blue's help. The basic idea about shifting is right. The main reason it didn't work was incorrect zoom factor.

Example :

Initial camera size is 5. User zooms in by 1, camera size is now 4 ( it displays less content on the same 'screen'). User changes mouse position and zooms out by 1. Camera size is 5 again, but the amount of zoom is actually different :

initially the change was 20% ( 1/5 )
in the second time, the change was 25% ( 1/4 )

My fault was that, when zooming out, I tried to restore position by 20%, not 25%.

sentences:
AutoFill function and methods not working in unity 5.3.5 I opened one of c# code in my projects, and edited something in the code, and I noticed that MonoDevelop no longer gives auto filling of function and method options.
Below is the screen shot of the code.When I type debug,its not showing the dropdown with list of function and methods.

Iam using 5.3.5 (64 bit)Personal and windows 8.
Can anybody help me sorting this issue.
When I open a c# code. its showing the namespace in redcolor

this is how the code structure looks

sentences:
Collision Resolution: How to avoid Interpenetration/Tunneling Caused by Prior Collision Handling? My game processes world collisions followed by entity collisions. The problem here is that entities can break through walls the next frame when world checks are run again as a result of the prior collision resolution.  For example:

Entity1 is up against a wall and pushing against it
Entity2 runs into Entity1, collision detection resolves Entity1 inside the wall.
World collisions push Entity1 onto the other side of the wall.

What happens is that Entity2 pushes Entity1 into the wall far enough that when the world collision detection attempts to find the shortest distance out of the wall, that position happens to be on the other side.

sentences:
2D game world creation (libGdx, java) I'am starting to develop a 2D game with motorbikes.

My Question now is:
When my bike reaches the right edge the world should move. (Like in that game: Game example) My first thought was to implement a camera and to create a huge image for the world. (e.g 4096 x 512).
So I only have to move the camera to solve the problem.

Is that a good solution?!

Thank your.

Regards,
Matthias

sentences:
2D Point Light XNA , Why my point light radius is Oval? I friend of mine , taught me how to make a simple 2d point light with shader, so i follow his steps and finally done it !

but something happend , the light shape is like an oval and not like a circle , my friends couldnt explain me why,

could you help me how to fix it, and explain me why it happend?

here is how it looks like http://dl.dropbox.com/u/2553973/screengrab/PointLight_07.png

ShaderCode

Texture InputTexture;

sampler InputTextureSampler = sampler_state {
    texture = <InputTexture>;
    magfilter = LINEAR;
    minfilter = LINEAR;
    mipfilter = LINEAR;
    AddressU = mirror;
    AddressV = mirror;
};

struct VertexShaderOutput
{
    float4 Position  : POSITION0;
    float2 TexCoord  : TEXCOORD0;
    float4 Color     : COLOR0;
};

float4      ambientColor = float4(1.0,1.0,1.0,0.0);
float       ambientIntensity = 0.3f;

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    //float4 color = float4(1, 0, 0, 1);
    float4 texCol = tex2D(InputTextureSampler, input.TexCoord);

    float4 color = ambientIntensity*ambientColor;
    float dist;

    //Light 1
    float  lightRadius = 0.2f;
    float  lightIntensity = 15.0f;
    float4 lightPos = float4(0.3f,0.3f,0.0f,0);
    float4 lightColor =  float4(0, 0, 1, 1);

        dist = distance(lightPos, input.TexCoord);
    color += saturate((lightRadius-dist)*lightIntensity)*lightColor;

    texCol = saturate(color) *texCol;

    return texCol;
}

technique PointLight
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

XNA CODE

    GraphicsDevice.SetRenderTarget(normalRender);
    GraphicsDevice.Clear(Color.Black);
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, effectLight);
      spriteBatch.Draw(background, Vector2.Zero, Color.White);
    spriteBatch.End();

    normalRenderTexture = normalRender;

    GraphicsDevice.SetRenderTarget(null);
    GraphicsDevice.Clear(Color.Black);
    spriteBatch.Begin();
       spriteBatch.Draw(normalRenderTexture, Vector2.Zero, Color.White);
    spriteBatch.End();

sentences:
Why does scissor test happen after fragment shading? In OpenGL why is scissor test performed after shading. Wouldn't be more efficient to do the discarding before shading?

Reference pipeline overview, the scissor test is inside the Fragment Processing stage.

sentences:
Timestep in multiplayer game I'm trying to wrap my brain around the concept of creating a server/client multiplayer experience.

My problem is mainly related to timestep.  Consider the following scenario:

A client connects to a server.  The client sends his inputs to the server to indicate he wants to move.  Server simulates the input and determines the position of that client in the game world.

Since the client and the server are both running on different timesteps, how do you accurately simulate so that all clients are in sync with the server?   My server is currently set at at 30ms timestep.  When I process client movements, there are potentially hundreds of requests waiting to be processed, yet no way to indicate how long it took between each one of the requests.

I'm really not grasping how to properly simulate on the server based on time, in order to have everything sync up.

sentences:
Midpoint Displacement 1D - How to properly reduce my random number range? So I'm trying to implement this http://www.gameprogrammer.com/fractal.html#midpoint algorithm, to generate myself a terrain.
In the tutorial is said:

OK, before we go into 2D fractal surfaces, you need to know about the roughness constant. This is the value which will determine how much the random number range is reduced each time through the loop and, therefore, will determine the roughness of the resulting fractal. The sample code uses a floating-point number in the range 0.0 to 1.0 and calls it H. 2(-H) is therefore a number in the range 1.0 (for small H) to 0.5 (for large H). The random number range can be multiplied by this amount each time through the loop. With H set to 1.0, the random number range will be halved each time through the loop, resulting in a very smooth fractal. With H set to 0.0, the range will not be reduced at all, resulting in something quite jagged.

Let's say rand_start and rand_end are the starting and ending values that a random number can be generated by using for example random.uniform(rand_start, rand_end) or random.uniform(-1.0, 1.0)

Then I must reduce the number range so I do:

rand_start *= H * (pow(2, -H))

rand_end *= H * (pow(2, -H))

With H set to 1.0 for example.Both rand_start and rand_end will be lowered by half and in the next iteration the random value will be between -0.5 and 0.5.
All clear, just like the tutorial said it.

Here is the problem:

My x coordinate starts at 0 in the left side of the window, and y coordinate in the top of the window, in Pygame

I draw my line at this coordinates:

line_start = (0, 300)

line_end = (WINDOWWIDTH, 300)

How to reduce my random range if start and end values are initialized like that:

rand_start = 400

rand_end = 200

Again, my line starts at y coordinate 300 and the highest the midpoint can be displaced is 200, the lowest - 400.

Any code required will be provided asap.

sentences:
Map editor undo function - Not actually setting values to tiles I'm currently attempting to implement an undo/redo function for my map editor for a tile-based 2D platformer game made with XNA. I've found a lot of resources online about this and decided to try to write my own code for it to gain a better understanding of how it works.

My issue is when I pass the my tile's information into a stored "Action" and change the data within the newly created Action, it does not actually change the data in my tiles.

Below is the Action struct and the UndoBuffer class where I modify the tile's data based on the stored actions that I created elsewhere:

public struct Action
{
    public object[] StoredItem { get; set; }
    public object[] ModifiedItem { get; set; }
}

public class UndoBuffer
{
    private readonly List<Action> _undoBuffer;
    private readonly List<Action> _redoBuffer;

    public UndoBuffer()
    {
        _undoBuffer = new List<Action>();
        _redoBuffer = new List<Action>();
    }

    public void StoreAction(object[] storedItem, object[] modifiedItem)
    {
        var action = new Action {StoredItem = storedItem, ModifiedItem = modifiedItem};

        _undoBuffer.Insert(0, action);
    }

    public void Undo()
    {
        if (_undoBuffer.Count == 0) return;

        _redoBuffer.Insert(0, new Action {ModifiedItem = _undoBuffer[0].ModifiedItem, StoredItem = _undoBuffer[0].StoredItem});

        for (int i = 0; i < _undoBuffer[0].StoredItem.Count(); i++)
        {
            Action tempAction = _undoBuffer[0];
            tempAction.ModifiedItem[i] = tempAction.StoredItem[i];
            _undoBuffer[0] = tempAction;
        }

        _undoBuffer.RemoveAt(0);
    }
}

Here's how I'm passing the data in to the class above:

private void ReplaceTile(Tile oldTile, TileInfo tileInfo, bool storeAction = true)
{
    int tileX = (int)oldTile.Position.X / Tile.Width, tileY = (int)oldTile.Position.Y / Tile.Height;
    if (tileX < 0 || tileY < 0 || tileY >= _tileData.Tiles.Count || tileX >= _tileData.Tiles[tileY].Count) return;

    var storedTiles = new ArrayList();
    var modifiedTiles = new ArrayList();

    if (storeAction)
        storedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);

    _tileData.Tiles[tileY][tileX].TileInfo = tileInfo;

    if (storeAction)
    {
        modifiedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);
        _undoBuffer.StoreAction(storedTiles.ToArray(), modifiedTiles.ToArray());
    }

    _saved = false;
}

And here is the actual Tile class and its TileInfo struct:

public struct TileInfo
{
    public string ViewName;
    public int Frame;
    public TileCollision Collision;
    public CollisionType CollisionType;
    public TileProperty TileProperty;
    public SpriteEffects Effects;
    public Color TileColor;
    public float Rotation;
    public float Layer;
}

[Serializable]
public class Tile
{
    public TileInfo TileInfo;
    public Vector2 Position;

    public const int Width = 8;
    public const int Height = 8;

    public static readonly Vector2 Size = new Vector2(Width, Height);

    public Tile CreateTile(TileInfo tileInfo, Vector2 position)
    {
        var tile = new Tile
        {
            TileInfo = tileInfo,
            Position = position
        };

        return tile;
    }
}

So essentially, I just need the UndoBuffer class to actually change the data within the TileInfo structs that are passed into it, and not change a boxed copy of them.

sentences:
Getting scene normals in Unity When I get the depthnormals with the shaderreplace script, it just replaces all the shaders in the scene and uses the meshes geometry to calculate the normals, ignoring the normalmap textures applied on them.

How can I get the final rendered scene normals to a rendertexture like it appears in the editor windows normal debug mode that is used for deferred light calculations and ambient occlusion and such ?

sentences:
Compile shader and root signature of a ray tracing shader into a single binary using DXC I'm new to DXR, so please
If I got it right, when we want to compile a ray tracing shader using the DirectX Shader Compiler, we need to specify lib_6_* as the target profile.
Now assume I've got a HLSL file containing a single ray generation shader RayGen whose root signature is specified by a RootSignature attribute of the form
#define MyRS "RootFlags(LOCAL_ROOT_SIGNATURE),"  \
        "DescriptorTable("                  \
            "UAV(u0, numDescriptors = 1),"  \
            "SRV(t0, numDescriptors = 1))"
[rootsignature(MyRS)]
[shader("raygeneration")]
void RayGen() {}

Using IDxcCompiler::Compile, I'm able to compile both the shader itself using the target profile lib_6_3 and the root signature using the target profile rootsig_1_1, but if I got it right it's not possible to invoke IDxcCompiler::Compile such that the created IDxcBlob contains both the shader and the root signature. (I've tried to add the argument -rootsig-define MyRS to the call for the compilation of the shader, but it seems to me that the compiler expects the root signature specified in this way to be a global root signature.)
So, I end up with two IDxcBlob's. Is there any possibility to "merge" them into a single one which can later be used to specify the shader as well in a call of ID3D12Device5::CreateRootSignature?

sentences:
Can I test collision inside an edge collider area in Unity? I have a triangle with its perimeter represented by an EdgeCollider2D, and I want to trigger an event when the player reaches this area.

So I set the collider as a trigger and, I used the OnTriggerStay2D function in my code.

But the event works only when the player is intersecting the line of the collider, not when the player is inside the triangle but not touching the edge.

How can I continue to get OnTriggerStay messages when I'm inside the triangle, not touching the edges?

sentences:
How to create a projectile motion of a cannonball in top down view? Objective

To move the bullet with projectile motion to specific destination by touch point.

In the below image is an example of a bullet which has a projectile motion. On my observation, the bullet speed and angle is calculated base on distance.

(source: pixwerk.net)

Where I'm at? (How do I move the bullet to its destination?)

In the below code, is the method I use to move a bullet to its destination. But the problem is I want to create a cannonball bullet which it has a projectile motion. How do I create these tricks to make a cannon ball projectile motion like the image below.

public Vector2 getVelocity(Vector2 currentPosition, Vector2 targetPosition) {
    Vector2 targetDirection = targetPosition.cpy().sub(currentPosition);
    return targetDirection
            .nor();
}

What I have done? (Currently I could move the bullet straight to its destination.)

Bullet is moving straight (It's not problem).

[EDIT]

Drawing a projected trajectory

To get the trajectory point, base on iforced example. I've already have the libgdx box2d version of this.

b2Vec2 getTrajectoryPoint( b2Vec2& startingPosition, b2Vec2& startingVelocity, float n )
  {
      //velocity and gravity are given per second but we want time step values here
      float t = 1 / 60.0f; // seconds per time step (at 60fps)
      b2Vec2 stepVelocity = t * startingVelocity; // m/s
      b2Vec2 stepGravity = t * t * m_world->GetGravity(); // m/s/s

      return startingPosition + n * stepVelocity + 0.5f * (n*n+n) * stepGravity;
  }

Rendering the trajectory point

glColor3f(1,1,0);
  glBegin(GL_LINES);
  for (int i = 0; i < 180; i++) { // three seconds at 60fps
      b2Vec2 trajectoryPosition = getTrajectoryPoint( startingPosition, startingVelocity, i );
      glVertex2f(trajectoryPosition.x, trajectoryPosition.y );
  }
  glEnd();

[Solve]

The answer is to find the angle and speed by the distance by s.tarik.cetin

Another issue encountered (this must be move to another question)

This is the problem, I don't know how do I set the starting velocity. Currently in the below code, to set the startingVelocity and startingPosition where the underlined code is the part that I'm not sure.

    touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(touchPoint);

    Vector2 touch = new Vector2(touchPoint.x, touchPoint.y);
    Vector2 touchDirection = touch.cpy().sub(bulletPosition).nor(); // get the the direction from bullet position to touch point and normalize the value.

    float distance = touchDirection.dst(startingPosition);
    float angle = touch.angle();
    float speed = 6.0f; // currently the speed is fixed. I need to know the speed base on distance

    startingPosition.set(bulletPosition); // current position of the bullet
    startingVelocity.set(touchDirection.scl(speed)); // where the bullet should be

sentences: What's the difference between displacement mapping and height mapping? What's the difference between displacement mapping and height mapping and what is the connection to adaptive tessellation?

sentences:
How can I implement a main menu? I have been following the tutorials at http://lazyfoo.net/tutorials/SDL/index.php and although they are all very well written and I have learned more than I would have on my own, I am not sure how to go about building a basic main menu that has the normal "new game," "settings" and "exit" options.

How would I handle such a menu inside of a normal game loop?

sentences:
OpenGL pitching problem I've been trying to implement several camera movements for my application. So far yawing, rolling, strafing, walking has been working properly, but I can't get my pitching to work properly. If I continue pitching upwards, it doesn't rotate back 360 degree, and instead gets stuck looking at the top of the screen.

Here's my code for Camera class

class Camera
{
    float m[16];
    Vector dirForward, dirUp, dirRight;

    void loadCameraDirections()
    {
        glGetFloatv(GL_MODELVIEW_MATRIX, m);
        dirForward = Vector(m[2], m[6], m[10]).unitVector();
        dirUp = Vector(m[1], m[5], m[9]).unitVector();
        dirRight = Vector(m[0], m[4], m[8]).unitVector();
    }

public:
    Vector position;
    Vector lookAt;
    Vector up;

    Camera()
    {
        position = Vector(300, 0, 100);
        lookAt = Vector(0, 0, 100);
        up = Vector(0, 0, 1);
    }

    void rotatePitch(double rotationAngle)
    {
        glPushMatrix(); {
            glRotatef(rotationAngle, dirRight.x, dirRight.y, dirRight.z);
            loadCameraDirections();
        } glPopMatrix();

        lookAt = position.repositionBy(dirForward.reverseVector());
    }
}cam;

I call the gluLookAt funtion by-

gluLookAt(cam.position.x, cam.position.y, cam.position.z, cam.lookAt.x, cam.lookAt.y, cam.lookAt.z, cam.up.x, cam.up.y, cam.up.z);

sentences:
Libgdx , how to get mouse position relative to a Tiled Map I'm porting a game that i did for Ludum Dare 26, this year, i made it using Contruct2, i decided to port it to Libgdx, for learning reasons,

http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15150  (check the web version)

My problem is that the Player moves base on the Angle, where the mouse is pointing at,
in Contruct2, they have a really nice function called

setAngleToward(Mouse.X,Mouse.Y)

in libGdx i made this function

@Override
public boolean mouseMoved(int screenX, int screenY) {

    Vector2 centerPosition = new Vector2((float)Gdx.graphics.getWidth() / 2, (float)Gdx.graphics.getHeight() / 2);
//  Vector2 centerPosition = new Vector2(getX(), getY());

    screenY = Gdx.graphics.getHeight() - screenY ; //Inverse the Y

        Vector2 mouseLoc = new Vector2(screenX, screenY);

        Vector2 direction = mouseLoc.sub(centerPosition);
        float mouseAngle  = direction.angle();/*(float)(Math. atan2(direction.y, direction.x)); */
        setRotation(mouseAngle);

        return true;
}

which works nice, but when i reach the corners on the maps, it give me the wrong angles, because the Player is not centered anymore,

I know the solution is just use "centerPosition" with the player coords, and use
"mouseLoc" with the mouse coords but needs to be relative to the tiled map, and that's my problem i don't know how to get those paramenters , screenX and screenY, are the mouse location but base on screen position

im using OrthographicCamera and OrthogonalTiledMapRenderer

i hope can understand my problem, this is the jar i have right now

https://dl.dropboxusercontent.com/u/2553973/Others/zombiesblocksattack.jar

sentences:
How can I track a falling ball with a camera? I have been trying to get my camera to follow a falling ball but with no success.

here is the code

        float cameraY = (FrustumHeight / 2)+((ball.getPosition().y) /2) - (FrustumHeight /2);
        if (cameraY <  FrustumHeight/2 )
            cameraY =  FrustumHeight/2;
        camera.position.set(0f,cameraY, 0f);
        Gdx.app.log("test",camera.position.toString());
        camera.update();
        camera.apply(Gdx.gl10);
        batch.setProjectionMatrix(camera.combined);

        batch.begin();
        batch.draw(backgroundRegion, camera.position.x - FrustumWidth / 2,
 -cameraY - (FrustumHeight/2) , 320, 480);
        batch.draw(ballTexture, (camera.position.x - FrustumWidth / 2) + ball.getPosition().x,-cameraY + ball.getPosition().y - (FrustumHeight/2)  ,
                32, 32);

I'm sure I am doing this completely wrong - what is the correct way to do this?

sentences:
Unity 2D Input.gyro eulerAngles X value strange behaviour I am working on a project where I want to create an 'scrolling' effect using gyroscope on mobile devices. The basic idea is that I have an Image object in my Scene and I want to be able to show different part of it using gyroscope like for example you see the wall of a room and rotation your phone you see different parts of the room, but in 2D.

For now I managed to move my Image using Input.gyro.attitude.eulerAngles.x; from gyroscope like this:

    protected void Update()
    {
        var x = transform.localPosition.x;
        var gyroX = Input.gyro.attitude.eulerAngles.x;
        x += -gyroX * Speed;

        BackgroundImage.transform.localPosition =
            new Vector3(x, transform.localPosition.y, transform.localPosition.z);

    }

The problem which I am seeing is that when Input.gyro.attitude.eulerAngles.x reaches 86.0 it starts decreasing and even if you are rotating your phone to right it changes it's direction.

Checked the documentation, examples over internet, but didn't find anything about that.

If you have any idea what can cause that issue and how can I fix it, or any other suggestions how can I achieve the thing which I want to create, pleae share your knowledge.

Thanks in advance!

Edit:
The only rotation axis which I am interested in is X, because the app will be in portrait mode and I want to be able to move the image only horizontal (by X).

So the phone's rotation has to be similar to while taking an panoramic photo on your mobile as shown on the first picture:

sentences:
Why are MVC & TDD not employed more in game architecture? I will preface this by saying I haven't looked a huge amount of game source, nor built much in the way of games.
But coming from trying to employ 'enterprise' coding practices in web apps, looking at game source code seriously hurts my head:
"What is this view logic doing in with business logic? this needs refactoring... so does this, refactor, refactorrr"
This worries me as I'm about to start a game project, and I'm not sure whether trying to mvc/tdd the dev process is going to hinder us or help us, as I don't see many game examples that use this or much push for better architectural practices it in the community.
The following is an extract from a great article on prototyping games, though to me it seemed exactly the attitude many game devs seem to use when writing production game code:

Mistake #4: Building a system, not a game
...if you
ever find yourself working on
something that isn’t directly moving
your forward, stop right there. As
programmers, we have a tendency to try
to generalize our code, and make it
elegant and be able to handle every
situation. We find that an itch
terribly hard not scratch, but we need
to learn how. It took me many years to
realize that it’s not about the code,
it’s about the game you ship in the
end.
Don’t write an elegant game component
system, skip the editor completely and
hardwire the state in code, avoid the
data-driven, self-parsing, XML
craziness, and just code the damned
thing.
... Just get stuff on the screen as
quickly as you can.
And don’t ever, ever, use the argument
“if we take some extra time and do
this the right way, we can reuse it in
the game”. EVER.

is it because games are (mostly) visually oriented so it makes sense that the code will be weighted heavily in the view, thus any benefits from moving stuff out to models/controllers, is fairly minimal, so why bother?
I've heard the argument that MVC introduces a performance overhead, but this seems to me to be a premature optimisation, and that there'd more important performance issues to tackle before you worry about MVC overheads (eg render pipeline, AI algorithms, datastructure traversal, etc).
Same thing regarding TDD. It's not often I see games employing test cases, but perhaps this is due to the design issues above (mixed view/business) and the fact that it's difficult to test visual components, or components that rely on probablistic results (eg operate within physics simulations).
Perhaps I'm just looking at the wrong source code, but why do we not see more of these 'enterprise' practices employed in game design? Are games really so different in their requirements, or is a people/culture issue (ie game devs come from a different background and thus have different coding habits)?

sentences:
How to organize the highlighting of a 3D object with which contact occurs? I want to repeat a certain "Select (); - Deselect ();", as shown in the screenshot.

Prompt with advice how to implement it or what you need to read to implement this feature.

I tried to found something similar to what I want to do.

PlayerInteraction.cs from Farm Alarm game by Brackeys

private void OnTriggerEnter2D(Collider2D col)
    {
        if (target != col.gameObject && target != null)
        {
            Deselect();
        }

        target = col.gameObject;

        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.Select();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = new Color(1f, 1f, 1f, 0.9f);
        }
    }

    private void OnTriggerExit2D(Collider2D col)
    {
        if (col.gameObject == target)
        {
            Deselect();
            target = null;
        }
    }

    void Deselect()
    {
        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.DeSelect();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = Color.white;
        }
    }

}

But if I understand right it's way for 2D.

P.S. Screenshot from the game "Overcooked"

sentences:
Help designing Board game using LibGDX Hi i'd just like to preface this by saying i'm new to game development and currently learning the ins and outs of libGDX.

I want to create the board game scrabble however i'm having trouble figuring out how i would display the board and the pieces each player has.

So in my game the board will probably be 14x14 , each player (4 maximum) at the start of the game will have about 6 letter tiles in their hand. The player whos turn it is , is able to place letter tiles from their hand onto the board and do so until a word is spelt on the board. The player should also be able to pick up individual letter tiles that they have placed down.

From searching on the internet I figured out that i should probably make the board a 2d array of either actors or buttons. For example, the player would click on the letter tile and then click on the board and the tile would be placed. However, as there is limited information online about libGDX in the form of tutorials I do not have a complete solid understanding of this. If anyone could help me understand how I would go about implementing my ideas i'd really appreciate it.

sentences:
OpenGL Shadow Mapping from directional light I have read this tutorial:
http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/

I wonder, is this the current best technique for generating shadows in an arbitrary 3D scene? Is it the way current modern games implements directional light shadows or are they using some other better way of calculating shadows on the fly?

What I mean is if you know your geometry so good that you know exactly every impact a shadow can have on an objects colors, it must be better to use that information instead of rendering a Shadow map?

For example, if we have a 3D grid world with all perfect cubes at perfect offset (think minecraft) and the directional light if exactly 45 degree in all dimensions, that leave us with a situation where a cube closer to the light will also cast shadow on the entire cubes at position offset -1, -1, -1 from that cube, and so on. The shadows always go diagonal and put other equally sized cubes sides in 1 of three states: all shadow, all light or 50% in shadow.

If we know our geometry so good, then using that information must be much faster than rendering shadow maps right? Even when most of such calculation is done on the CPU instead of the GPU.

sentences:
Does research exist on the impact of vibration in mobile games? I've implemented vibration for various player collisions in my mobile game, but I feel like this is not a common thing on mobile even though it is on consoles.

Is there any research on the positive or negative benefits of using vibration feedback in mobile games that would suggest guidelines for when it is and isn't appropriate to use?

sentences:
Skeletal Animation: No initial bone rotation I am currently trying to implement animations in my game. I am having an issue where the bones do not rotate properly.

In my program, I apply an inverse bind pose to each bone to move them to bone space. Then I recursively calculate the transformations for each bone for the keyframe.

The bone transformation looks like this:

bone.Transform = InverseRootGlobal * Global * bone.InversePose

InverseRootGlobal is the inverted root node transformation
Global is the recursively calculated transformation
bone.InversePose is the inverse pose matrix

It appears that all is correct apart from the bones initial rotation. When I move the bones to bone space, they loose their rotation from the bind pose and 'point up'. Here's what it looks like:

If it helps, I am using Assimp to import the data.

Thanks in advance.

sentences:
Formula for Planetary Alignment I am attempting to create a game where there is a universe of two 16-bit addresses ranging from (-32768, -32768) to (32767, 32767), or in hexadecimal, each value can run from $8000 to $FFFF then 0 to $7FFF, although the universe is probably not going to use the whole 4 billion possible addresses.

What I want is for any location, given the two values, to return a value from 0 to around 15 or 20. Where:

0 is empty space.
1 to 9 are planet technology levels, with a level 1 planet being less developed than 2, which means a level 5 planet can build up to a level 5 hull, warp drive or shield, but to upgrade to level 6 requires going to a level 6 or higher planet, or possibly paying a horribly high price.
10 and above are for anomalies, e.g. black holes, suns and other things which have an effect such as random movement or increase in power.

While the most common value will be zero, the universe should have some minimum non-zero locations, e.g. 10% or 20% or some reasonable number of the locations are planets or anomalies.

Note the alignment factors are not random, the value should be calculated so that -60,12 returns the same planetary value any time it's called. I've seen this done in a simple formula amounting to less than 5 lines of code but that was 30 years ago, and I don't have the math to do the calculations myself.

Any help would be appreciated.

sentences:
How to destroy an object, and then instantiate it again later? I'm creating an enemy spawner in Unity (2D). At long last, I have something that is quite close to working, but the problem is that I want it to destroy all instances of the enemy when the player can no longer see the spawn area.

That is, the player happens upon the spawn area to find several enemies, but if they move so that the camera can no longer see the spawn area, I want those enemies to be deleted and then a different set of the same enemies to be instantiated when the player (camera) happens upon the spawn area again. But when I attempt this initial delete, the script component no longer has an object to instantiate when the player returns.

Here's a snippet of what I have:

    if (!notOnScreen && spawned == false)
    {
        int numberOfEnemies = Random.Range(1, enemyMax);

        for (int i = 1; i <= numberOfEnemies; i++)
        {

            spawnX = Random.Range(minX + 1, maxX - 1);
            spawnY = Random.Range(minY + 1, maxY - 1);

            Vector3 spawnpoint = new Vector3 (spawnX, spawnY, 0);

            if (enemies.Length == 1) {
                typeOfEnemy = 0;
            }
            else if (enemies.Length > 1) {
                typeOfEnemy = Random.Range(0, enemies.Length);
            }
            else {
                typeOfEnemy = -1;
            }

            Instantiate(enemies[typeOfEnemy], spawnpoint, Quaternion.identity);
        }

        spawned = true;
    }

    if (notOnScreen) {
        spawned = false;

        currentEnemies = GameObject.FindGameObjectsWithTag("Enemy");
        for (int i = 0; i <= currentEnemies.Length; i++) {
            Destroy(currentEnemies[i]);
        }
    }

}

}

I'm sure there's a way to preserve an instance of the enemy so that they can be instantiated again later, but I'm not sure how (sorry--very new to this). I thought about cheating and having one enemy remain at a different z coordinate behind the map (as this is a 2D game), but that doesn't seem like an appropriate solution. Any thoughts or advice?

sentences:
Events and objects being skipped in GameMaker Update: Turns out it's not an issue with this code (or at least not entirely). Somehow the objects I use for keylogging and player automation (basic ai that plays the game) are being 'skipped' or not loaded about half the time. These are invisible objects in a room that have basic effects such are simulating button presses, or logging them.

I don't know how to better explain this problem without putting up all my code, so unless someone has heard of this issue I guess I'll be banging my head against the desk for a bit
/Update

I've been continuing work on modifying Spelunky, but I've run into a pretty major issue with GameMaker, which I hope is me just doing something wrong.

I have the code below, which is supposed to write log files named sequentially. It's placed in a End Room event such that when a player finishes a level, it'll write all their keypress's to file. The problem is that it randomly skips files, and when it reaches about 30 logs it stops creating any new files.

var file_name;
file_count = 4;
file_name = file_find_first("logs/*.txt", 0);
while (file_name != "") {
    file_count += 1;
    file_name = file_find_next();
}
file_find_close();

file = file_text_open_write("logs/log" + string(file_count) + ".txt");
for(i = 0; i < ds_list_size(keyCodes); i += 1)
{

    file_text_write_string(file, string(ds_list_find_value(keyCodes, i)));
    file_text_write_string(file, " ");
    file_text_write_string(file, string(ds_list_find_value(keyTimes, i)));
    file_text_writeln(file);

}
file_text_close(file);

My best guess is that the first counting loop is taking too long and the whole thing is getting dropped?

Also, if anyone can tell me of a better way to have sequentially numbered log files that would also be great. Log files have to continue counting over multiple start/stops of the game.

sentences:
Möller-Trumbore intersection point I am using the Möller-Trumbore method as part of my (still very basic) collision detection system.

The information I'm craving about is the distance from the ray origin and intersection point. The intersection point would be fine too obviously.

I probably wrongly assumed t in the code below is actually the distance from the ray origin to the intersection point. If it actually is, then I don't know what's wrong with my code.

I have got a simulation with a mesh and "bullets", sometimes firing a collision acurately, and sometimes not (bullets passing thru mesh, or firing a colision before it actually should hit).

bool rayTriangleIntersect(const XMFLOAT3 &orig, const XMFLOAT3 &dir, const XMFLOAT3 &v0, const XMFLOAT3 &v1, const XMFLOAT3 &v2, float &t, float &u, float &v) {
// http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

    float kEpsilon = 0.000001f;
    XMFLOAT3 v0v1 = v1 - v0;
    XMFLOAT3 v0v2 = v2 - v0;
    XMFLOAT3 pvec = XMFLOAT3Cross(dir, v0v2);

    float det = XMFLOAT3Dot(v0v1, pvec);

    if (det < kEpsilon) return false;

    float invDet = 1.0f / det;

    XMFLOAT3 tvec = orig - v0;
    u = XMFLOAT3Dot(tvec, pvec) * invDet;
    if (u < 0 || u > 1) return false;

    XMFLOAT3 qvec = XMFLOAT3Cross(tvec, v0v1);
    v = XMFLOAT3Dot(dir, qvec) * invDet;
    if (v < 0 || u + v > 1) return false;

    t = XMFLOAT3Dot(v0v2, qvec) * invDet;

    return true;
}

Is t really the distance im looking for ? If not how do I get it, or the intersection point. I've heard of baricentric coordinates in a triangle related to u and v - is it the way to go ? If yes I'd be thankful for an example or link related to the Möller-Trumbore method.

Thanks!

sentences:
Centering a textbutton in a table libGDX I have a few Tables spread across a Stage, now I have a problem.
In one table, all the TextButtons are centered, while in a different one they aren't, like this:

Table 1           Table 2
XXXtextXXX        text
XXmoretxXX        moretext
XXXXtxXXXX        MoreTextHere

The problem is that as much as I try I can't seem to center them.
In the first table I have only textbuttons in each row, while in the second one I have two rows with 3 textbuttons, which the rest are only one text button.
this is the code:

        settingNames.bottom().left();
    settingNames.add(new TextButton("Resolution:", style));
    settingNames.row();
    settingNames.add(new TextButton("VSync:", style));
    settingNames.row();
    settingNames.add(new TextButton("FullScreen:", style));
    settingNames.row();
    settingNames.add(new TextButton("Borderless:", style));
    settingNames.row();
    settingNames.add(new TextButton("Force FPS:", style));
    settingNames.row();
    settingNames.add(new TextButton("Target FPS:", style));
    settingNames.setBounds(0, 0, Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
    settingNames.debug();

    resPrevious = new TextButton("<", style);
    resText = new DynamicLabel(resHandler.getResolution(), labelStyleSkin);
    resNext = new TextButton(">", style);
    vsyncToggle = new TextButton("Off", style);
    fullscreenToggle = new TextButton("Off", style);
    borderlessToggle = new TextButton("Off", style);
    forceFPSToggle = new TextButton("Off", style);
    targetFPSPrevious = new TextButton("<", style);
    targetFPSText = new DynamicLabel("60", labelStyleSkin);
    targetFPSNext = new TextButton(">", style);
    fullscreenToggle
            .setColor(fullscreenToggle.getColor().r,
                    fullscreenToggle.getColor().g,
                    fullscreenToggle.getColor().b, 0); ---> Used this line to check how the textbutton looks.
    changeOptions.center().bottom();
    changeOptions.add(resPrevious);
    changeOptions.add(resText);
    changeOptions.add(resNext);
    changeOptions.row();
    changeOptions.add(vsyncToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(fullscreenToggle);
    changeOptions.row();
    changeOptions.add(borderlessToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(forceFPSToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(targetFPSPrevious);
    changeOptions.add(targetFPSText).center();
    changeOptions.add(targetFPSNext);
    changeOptions.setBounds(0, 0, Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
    changeOptions.debug();

I added all the tables to a stage and display them, but can't figure what's wrong, I could really use help here...

sentences:
How do I implement a field of vision for AI entities? I am considering how to implement a field of vision system for my AI entities, but am not sure on the order of steps to take. The thought process that I had was to use a combination of radial distance and dot product.

Keeping in mind that this is a 3D environment (meaning that all vectors have 3 components), and I will be using quaternions for the orientation of all entities.

What order should I do these in? and is my logic accurate?

Dot product: Taking the position of the playerObject, and the position of the AIEntity create a vector, and then take the orientation quaternion, and convert that to a vector of fixed length, and perform the dot product between them (testing for a specific range of values) to see if it is within a given arc.

Radius test: Simple 3D radius to determine distance.

I know for sure that a dot product test should be quite simple (3 subtractions, 3 multiplications, 2 additions, and however many operation to turn a quaternion into a vector), but arriving at the orientation vector I have no direct idea (if this process could be explained it would be of great help, I know I would have to multiply by the needed magnitude after normalizing), and radius test is also simple (3 subtractions, 3 additions, and 4 multiplications) both of these would still include a boolean tests, but which order would reduce faster?

My first guess would be to be the dot product, and then the radius test; As the dot product would be outside of bounds if the player is outside of the arc or to far away, and the radius test would only fail if the object is to far away. I understand that both tests can give false positives, but for some reason I feel that the dot product test would give fewer.

sentences:
LibGDX: Miscalculated polygon collision These 2 polygons are not colliding, though this method returns true:

Intersector.overlapConvexPolygons(
            new float[]{
                        100.0f, 750.0f,
                        200.0f, 750.0f,
                        100.0f, 150.0f,
                        200.0f, 150.0f
                        },
            new float[]{
                        77.0f, 695.0f,
                        91.0f, 695.0f,
                        84.0f, 681.0f
                        },
            null);

Am I using it correctly?

sentences:
Programming a game onto multiple platforms I just had a pretty good idea for a mobile game and I'm having a little trouble selecting what tools or languages to use for the job.

I have experience with flash and AS3 and I know I can put that onto mobile devices via Adobe Air. What I found kind of frustrating was that I have 5 games on my Samsung galaxy tablet and they all look like they were made in flash, but they didn't use Air. The only game that required Air on my tablet was my game that I made in flash. Anyways, how do you guys think/know they are programmed?

A simple game like angry birds... is that programmed in pure java or something or do they use some kind of engine. I've heard of Unity and it looks pretty cool, but now I just found ShiVa and that also looks pretty sick. I'm trying to make a Castle Crashers type game. Side scrolling/2D type of thing. Thanks in advance

sentences:
Direct3D 11: Changing fullscreen resolution does not work In my application I can switch back and forth between windowed and fullscreen mode using IDXGISwapChain::SetFullscreenState. When the WM_SIZE is handled, IDXGISwapChain::ResizeBuffers is called in response. This works fine and when entering fullscreen mode DXGI chooses the desktop resolution.

The problem comes when I'm trying to change resolution while remaining in fullscreen. I try to change resolution by using IDXGISwapChain::ResizeTarget. The mode description I'm trying to switch to is aquired by using IDXGIOutput::GetDisplayModeList, so it should be valid. When doing the resize I get the usual blinking that happens when I enter fullscreen, but nothing has changed; the resolution is still the same and there's no WM_SIZE message being generated like in Choosing the DXGI Output and Size.

DXGI best practices also contains alot of information but it didn't help me.

I am using the DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH flag when creating the swap chain and I have also tried using IDXGIFactory::MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES and DXGI_MWA_NO_ALT_ENTER flags to no avail.

If I hardcode the swap chain to be created in fullscreen mode using a low resolution I can see the mouse cursor being jagged and larger, and this visual difference is not present when changing resolution.

Am I possibly getting the concepts wrong here? Am I supposed to get a WM_SIZE message after calling ResizeTarget? How are the display mode and back buffer related? I know that when the front buffer size is changed the back buffer should be resized to match in order to do flips instead of blits according to the links, which is why it's recommended to do the resize when the application gets the WM_SIZE message.

In a few of the similar questions I've found there are discussions about it maybe being a bug, but they all just died out with no final answer.

EDIT:
I just tried to manually call OnResize (my method actually calling ResizeBuffers and so forth) after I attempt to change resolution and the following warning shows up in the debugger (not visible before):

  DXGI WARNING: IDXGISwapChain::Present: Fullscreen presentation inefficiencies incurred due to application not using IDXGISwapChain::ResizeBuffers appropriately, specifying a DXGI_MODE_DESC not available in IDXGIOutput::GetDisplayModeList, or not using DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH.DXGI_SWAP_CHAIN_DESC::BufferDesc = { 800, 600, { 60, 1 }, R8G8B8A8_UNORM_SRGB, 0, 0 }; DXGI_SWAP_CHAIN_DESC::SampleDesc = { 1, 0 }; DXGI_SWAP_CHAIN_DESC::Flags = 0; [ MISCELLANEOUS WARNING #98: ]

The new resolution (800x600) seems to be set, but note that the Flags member is 0. Shouldn't it be 0x2? Could that be the reason the resolution doesn't have any effect? The flag is set in the swap chain description right before the swap chain is created so I don't understand how it's changed to 0.

EDIT 2:
In a tiny remark at the bottom of the DXGI_SWAP_CHAIN_FLAG documentation it says that ResizeBuffers can reset or change the flags. I took a look at my code and there it was: flag was set to zero (reading my book I must have accepted it as reusing the old flag or something). I changed it to allow mode switch and voilá, resolution changed and I got my WM_SIZE. I did however get a couple of warnings about presentation inefficiencies but that was expected, and I have plans on how to fix those.

sentences:
An Object is moving but its velocity is 0 In Unity 5 I have an object move when I press a button, force is added as seen by the code below. Then once this force is added I print out its velocity. The problem is that in the console my first print out with the first button press is "velocity(0.0,0.0)" then the second button press gives the printout "velocity(2.0,0.0)". Why is it that i get a velocity of 0 on the first button press even though my object is moving on the screen?

if (isPressed == true) {
            moveableBarrel.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (100, 0));

            Debug.Log ("velocity" + moveableBarrel.GetComponent<Rigidbody2D> ().velocity);

            isPressed = false;
        }

Edit **Incase anyone else asks, the code is within a FixedUpdate Method

sentences:
How can I create character graphics similar to Valkyrie Profile? I want to create a game with the character graphics similar to Valkyrie Profile.
I don't know whether I should make my game character sprites pre-rendered or hand drawn, or which technique would let me create a similar look.
Are these created pixel by pixel, what sets me off is the ditter found in a lot of the images, kind of looks like the characters from treasure hunter G or harvest moon friends of mineral town.
@edit
Added the screenshots from Treasure Hunter G and Harvest Moon. I know these are pre rendered sprites that are later incorporated into the game, just for comparison against the valkyrie profile ones.
Also, the treasure hunter G is a SNES game, and the Valkyrie Profile is PSX one, so I expect an upgrade in graphics.

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

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

sentences:
How to implement a restart button after game over? How would one go about implementing a method in which it calls the game to restart by pressing a button after game over?

I have my game class which puts the player in and starts the enemy sequence shown below. I already have my restart button as shown in the code snippet from the mouseinput class below and the problem is I don't know what to put in the area where the question marks are to get the thread to restart, if I'm using the appropriate language or not I'm not sure. I'm new please bare with me.

Thank you. What I'm doing now isn't working because it's glitching and the fps is shaky.

public Game()
{
    new Window(1000, 635, "Galaxy Monkeys", this);
    start();

    handler = new Handler();
    camera = new Camera(0, 0);
    this.addKeyListener(new KeyInput(handler));
    menu = new Menu(this);

    BufferedImageLoader loader = new BufferedImageLoader();
    sprite_sheet = loader.loadImage("/spritesheet.png");

    Enemy enemy = new Enemy(-20, r.nextInt(563), ID.Enemy, handler, this);
    Monkey p = new Monkey(500, 250, ID.Player, handler, this);

    handler.addObject(p);

    for(int i = 0; i < enemy_count; i++)
    {
        handler.addObject(enemy);
    }

    this.addMouseListener(new MouseInput(handler, camera, this));
    background = loader.loadImage(("/background.jpg"));

    INSTANCE = this;
}

Restart event on MouseInput.java:

public void mousePressed(MouseEvent e)
{
    int mx = (int) e.getX();
    int my = (int) e.getY();

    if(Game.state == STATE.GAMEOVER)
    {
        if(GameOver.restartButton.contains(mx, my))
        {
            // Pressed Restart Button
           Game.setState(Game.STATE.GAME);
            Game.INSTANCE = new Game();
        }
    }
}

sentences:
Box2D - Proper way to simulate player's body and feet I'm new to LibGDX and Box2D, and I'm trying to create my player's body but got some issues.

I've created the ground as a ChainShape, and my player as a Rectangle. I want to attach a fixture for its feet, so I tried adding an EdgeShape but - correct me if I'm wrong- it seems that an EdgeShape cannot collide with a ChainShape.

Is there a proper way to create the player's feet? Should I change my ground from ChainShape to Rectangles or should I use some other shape for the feet?

Edit:
Following DMGregory's advice, I've made some progress.
Since my print statements won't be of much help, I'll post this link with a very detailed explanation:
https://stackoverflow.com/questions/7459208/distinguish-between-collision-surface-orientations-in-box2d

And some background reading here:
https://www.iforce2d.net/b2dtut/collision-anatomy

sentences:
How to calculate acceleration and deceleration I have a car with speed x, and can accelerate at a rate of 0.5 m/s^2, and can decelerate at a rate of -0.1 m/s^2. Maximum speed is 20 m/s.
To accelerate the car speed, at each frame I need to do:
car.CurrentSpeed = car.CurrentSpeed + 0.5

To decelerate the car speed, at each frame I need to do:
car.CurrentSpeed = car.CurrentSpeed - 0.1

Is this correct?
I have found this answer which suggest the following speed formula:

Speed += ((MoveDirection * MaximumSpeed) - Speed) * AccelerationFactor
Where:

Speed is the current speed the entity is travelling at on the current
axis.
MoveDirection is the direction the entity is trying to travel in
on the current axis, 1 is forward, 0 is still and -1 is backwards. All
values in between are allowed.
MaximumSpeed is a constant determining
the fastest that the entity can travel on the current axis.
AccelerationFactor is a constant between 0 and 1 that represents the
rate of acceleration and deceleration. 1 is instant, and 0 will never
move.

Using the same formula then:
To accelerate:
car.CurrentSpeed += ((MoveDirection * 20) - car.CurrentSpeed) * 0.5

What would be the move direction? Can it be the heading?

sentences:
How to mix pixel colors in Shader? I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything.

How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this:

half3 original = half3(1, 1, 1);
half3 mycolor = half3(1, 0, 0);
half3 result = original * mycolor;

But what can I do if:

half3 original = half3(0.36, 0.74, 0.18);
half3 mycolor = half3(1, 0, 0);
half3 result = ?;

What operation or function should I apply to my original pixel color to override it ?

sentences:
How do I fix this "Accessed None trying to read property Save Game" error? I have create this blueprint, with a Check for an existing Save-Game and load it in case of true. Else, create a new save game object. While Z is pressed, create a new Save Game, getting the Player Position.
The problem is that when I try to start the game, I have two errors:

How can I solve those problems? This is my blueprint:

Thanks.

sentences:
how can I move an actor in opposit direction of mouse's position in GameSalad? I have a moving actor named ball and I want to move it in the opposite direction of my mouse's position.

In my code in Move To behaviour for X-axis location I write

  -game.mouse.position.X

and for Y-axis location I write

  -game.mouse.position.Y

But it's not working properly.

sentences:
Corona SDK Continuous Integration Is it possible to build corona applications from console?
Or how can I automate build process?

sentences: How can I make a trail renderer flat with the normal of the nearest face? I'm making a basic skid system for a car model using a trail renderer. I have everything setup and working properly except that the trail renderer always faces the camera. I want the trails to be perfectly flat with the ground. So I thought if unity can make the faces all rotate towards the camera, then would it be able to rotate towards the normals of the nearest faces?

sentences:
Edge Detection on Screen I have a edge collision problem with a simple game that i am developing. Its about throwing a coin across the screen. I am using the code below to detect edge collisions so i can make the coin bounce from the edges of the screen.

Everything works as i want except one case. When the coin hits left edge and goes to right edge the system doesnt detect the collision. The rest cases are working perfectly, like hitting the right edge first and then the left edge.

Can someone suggest a solution for it?

public void onMove(float dx, float dy) {
 coinX += dx;
 coinY += dy;

  if (coinX > rightBorder) {
    coinX = ((rightBorder - coinX) / 3) + rightBorder;
  }
  if (coinX < leftBorder) {
    coinX = -(coinX) / 3;
  }
  if (coinY > bottomBorder) {
    coinY = ((bottomBorder - coinY) / 3) + bottomBorder;
  }

  invalidate();
}

sentences:
How to distort graphics in a wave-like way? I saw a certain graphics distortion effect on multiple games over time and am interested in doing it in 2D. It is like a wave-like texture distortion, I am not entirely sure what it is called actually. Super Mario 64 had an effect like that when you enter a painting depending on your position (https://www.youtube.com/watch?v=H6r5oF73gNI#t=72), also Braid has one which is even more similar to that what I am trying to achieve when you use the time ring (https://www.youtube.com/watch?v=uqtSKkyJgFM#t=38).

I would really like to know how those effects were implement and if there is support for something like that in LWJGL (or even Slick2D). So far, I found absolutely nothing explaining on how it was done.

sentences:
What are the texture coordinates for a tetrahedron EDIT This is the WebGL code for initializing the tetrahedron points. You may want to skip to the second code block, because you may be able to answer without this.

    //Making a tetrahedron with equal sides
    //Using rotation matrices to determine the points

    //-120 degrees
    var q = -Math.PI/2.0 * 4.0/3.0;
    //Transformation matrix for X-axis rotation
    var rotationArrayX = [
        1.0,    0.0,            0.0,            0.0,
        0.0,    Math.cos(q),    Math.sin(q),    0.0,
        0.0,    -Math.sin(q),   Math.cos(q),    0.0,
        0.0,    0.0,            0.0,            1.0
    ];

    var rotationMatrixX = mat4.create(rotationArrayX);
    var d = vec3.create(new Array(0.0, 1.0, 0.0)); //Topmost point
    var a = vec3.create();
    mat4.multiplyVec3(rotationMatrixX, d, a);

    //Now we have the top most point and the first point of the base
    //After rotating the vector A with 120 degrees two times, we have the 3 base points

    //120 degrees
    q = -q;
    //Transformation matrix for Y-axis rotation
    var rotationArrayY = [
        Math.cos(q), 0.0, -Math.sin(q),     0.0,
        0.0,         1.0,       0.0,        0.0,
        Math.sin(q), 0.0, Math.cos(q),      0.0,
        0.0,         0.0,       0.0,        1.0
    ];

    var rotationMatrixY = mat4.create(rotationArrayY);

    //Calculating points B and C
    var b = vec3.create();
    mat4.multiplyVec3(rotationMatrixY, a, b);
    var c = vec3.create();
    mat4.multiplyVec3(rotationMatrixY, b, c);

    //The remaining point is the top point

    var vertices = new Array();

    //bottom
    vertices.push(a); vertices.push(b); vertices.push(c);
    //front
    vertices.push(b); vertices.push(c); vertices.push(d);
    //right
    vertices.push(c); vertices.push(a); vertices.push(d);
    //left
    vertices.push(a); vertices.push(b); vertices.push(d);

How should I imagine texturing these triangles? Is this a valid set of texture coordinates?

    var textureCoords = [
        //bottom
        0.5, 1.0,
        0.0, 0.0,
        1.0, 0.0,

        //front
        0.5, 1.0,
        0.0, 0.0,
        1.0, 0.0,

        //right
        0.5, 1.0,
        0.0, 0.0,
        1.0, 0.0,

        //left
        0.5, 1.0,
        0.0, 0.0,
        1.0, 0.0,
    ];

I based this on http://www.codeguru.com/forum/showpost.php?p=1542703&postcount=2:

  -------(0.5,1)-------
  |                   |
  |      Texture      |
  |      Image        |
  |                   |
  |                   |
(0,0)---------------(1,0)

Thanks in advance!

sentences:
Rendering a minimap from large bitmap I'm trying to create a minimap for my game but am having an issue.

I'm using Direct2D as the graphics API and have a ID2D1Bitmap* which contains the pixel data for the loaded area of the world.

I'd like the minimap to be around 100 x 100 pixels but the ID2D1Bitmap* contains about 3500 x 3500 of pixel data. When I try to render 3500 x 3500 pixels in a 100 x 100 pixel area, the image becomes very distorted and unpleasant.

In most cases, I thought this was solved by generating a mipmap chain but I don't see any options like this offered by Direct2D.

How can I create a clear minimap using DirectX?

sentences:
How do I determine which voxels to test for collision against the player? I've implemented Minkowski subtraction to test whether (and where) two AABBs collide, independent of framerate/time-step, in my Minecraft-like game.

But since there may be tens of thousands of voxels, I'm realizing I can't just test everyone of them. Is there an alternative to just scanning for nearby voxels? I worry that if I just do collision for voxels within a fixed range, then I've undone the framerate independence that I had sought.

sentences:
How can I measure the execution time of some code? How can I capture how long something takes to complete and log it to the output window (in Visual Studio)?

Is there a special library for this?

clock_t start, end;
double cpuTime;

start = clock();

//....bit to be timed

end = clock();

cpuTime= (end - start) / (CLOCKS_PER_SEC);

OutputDebugString(TEXT("Time: %d", cpuTime));

This code might work but where does it come from?  A special include?

sentences:
How do I add corner tiles to infinitely generated terrain base tiles? I have a tileset as seen on the right and they make the images seen on the left:

In game I have placed the full grass and full stone tiles for each chunk (infinitely generated) using perlin noise as seen in the image below:

I am trying to find a way to determine what corner tiles to use and then place them.  As you can see there is so many possibilities that I don't know how to do it.  Using Lua with love2d engine by the way.

This question is different.  Everything I read about bitmasking with corners says that you need at least 48 tiles or more in a set to do corners.  I am wondering how and if it is possible to use the tile set at the right which doesn't need this many tiles to make any possible shape.  It only uses 14 original plus 2 existing tiles.  Here is a image of what tiles are used in bitmasking.

sentences:
Fullscreen triangle SV_POSITION and deferred shading So I'm trying deferred shading in DirectX11.

I am using the following method (used in the FXAA shader and described here: http://www.altdev.co/2011/08/08/interesting-vertex-shader-trick/) to render a fullscreen triangle for my deferred shading pass.

FullscreenTriangleVSOut main(uint VertexID: SV_VertexID)
{
    FullscreenTriangleVSOut output;

    output.mTexcoord = float2((VertexID << 1) & 2, VertexID & 2);
    output.mPosition = float4(output.mTexcoord * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);

    return output;
}

And then in the pixel shader, I want a proper texture coordinate to sample my diffuse, normal, position textures from the GBuffer.

In GLSL, I simply do:

ivec2 texcoord = ivec2(textureSize(unifDiffuseTexture) * (gl_FragCoord.xy / UnifAmbientPass.mScreenSize));

But for some reason, in HLSL my SV_POSITION is always (0.5, 0.5). I looked in visual studio 2013 and debugged the pixel shader at various pixels, and yes at all places the SV_POSITION is (0.5, 0.5). Why is this?

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

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

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

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

sentences: Is there a specific library to handle the collision system of a big game world like WoW, or any physics library will work? Nothing else to add. Is there a specific library to handle the collision system of a big game world like WoW, or any physics library like ODE will work?

sentences:
How does client-side prediction work? I've read Valve + Gafferon and hundreds of pages from Google, but for whatever reason I can't get my head around client prediction.

To my understanding, the basic problem is:

Client A sends input at T0
Server receives input at T1
All clients receive the change at T2

At T2 however, using client prediction, Client A is now at a position appropriate to T4.

How do you ensure that the Client A, when predicting that the server will accept the movement request, won't be ahead of the server? Obviously all the time they are ahead, this results in snapping back to where the server last saw them. With all corrections I've tried, this is still noticeable when you stop, because the server stops behind you

sentences:
What is wrong with my collision detection code? I want to check collision detection between two bitmaps but I am not getting how to do it. I read several queries and tutorials but didnt get properly. I want to check by their width and height. I have implemented some logic also but not getting where I am doing wrong

public boolean collision(){
        for(int i=0; i<9; i++){
            for(int j=0; j<14; j++){
                if(frog.getX() < x + getX() || frog.getY() < y + getY() || frog.getX() > x || frog.getY() > y){
                //if(other.getWidth() > x && other.getWidth() < x + width && >other.getHeight() > y && other.getHeight() < y + height);
                    frog.frogShiftDown();
                }
            }
        }
        return true;
    }

public void draw(Canvas canvas){
        canvas.drawBitmap(bmp, x, y,null);
        carmove();
        collision();
    }

sentences:
FPS controller initializing at bizarre location I have got the hang of basic construction, terrain modification, applying materials, placing trees, etc.  I have created a water plane, positioned my terrain above it, and am able to sink lakes and pools, and raise hills and mountains.  Built a couple of primitive structures too.

Initially (before mucking about with the Y position of the terrain) I was also able to invoke Gameplay mode and walk around my game using FPS Character Controller.  I could walk into and out of my structures and hike over the hills and valleys of my terrain.

However, since changing the Terrain Heightmap to make the "sinkhole" (negative altitudes) work, I am having the strangest trouble with my FPS Character Controller.  I position it at a reasonable height above the terrain, and everything looks fine in Editor mode;  but when I start Play mode my FPS character starts out miles below the world, looking up at the underside of the terrain.

So far nothing I have tried will make the FPS Controller start in the location where I have dragged it in Editor mode.  I have tried Saving Scene and exiting and reloading.  I have deleted and recreated the FPS controller.  No matter what I do, it persists in initializing itself in this oddball "way below the world in outer space" location.

I have googled diligently but have not found any mention of this problem.  Presumably I'm skipping some important step, but tutorial videos don't offer any advice beyond "drag the fps controller into the scene and it should work."

sentences:
Setting up SFML with CLion on Windows 10 For a school project I am trying to set up SFML on my computer that runs Windows 10. The assignment is developing a small engine, based on SFML, in a few weeks. I am very new to C++, and I am not used to the working pipeline and the ways of C++ development yet.

At the moment I am trying to set things up so that I can work on the project from home, but I have a lot of trouble understanding and setting things up, since it's very different to what I'm use to.

My CMakeLists.txt file looks like the following:

cmake_minimum_required(VERSION 2.8.4)
project(CppEngine)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
if(WIN32)
    set(SFML_ROOT "$ENV{PROGRAMFILES(x86)}/SFML")
endif(WIN32)
set(CMAKE_BUILD_TYPE Release)
find_package(SFML 2.1 COMPONENTS system window graphics REQUIRED)
include_directories(${SFML_INCLUDE_DIR} ${PROJECT_SOURCE_DIR})
set(SOURCE_FILES main.cpp   )
set(HEADER_FILES            )
add_executable(CppEngine ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(CppEngine ${SFML_LIBRARIES})

I get a very strange error message, as a result, whenever I try to compile and run. It is particularly strange, because I am running on Windows:

  error: #error This UNIX operating system is not supported by SFML library
               #error This UNIX operating system is not supported by SFML library

How can I fix this error?

sentences:
How do I make a resolution independent system? I'm blanking on this one. I can anchor stuff on edges of course, that would make my UI resolution independent...until it changes so much that the graphics are too small. How do I scale appropriately whenever needed? How do I keep my graphics at the right proportion while scaling? I don't want them stretched if the resolution has a different proportion like 16:10 as opposed to whatever else.

Is there a true and tested approach to this? Video players show black borders because of this problem, is this not properly solvable?

sentences:
Compare two x and y if they are in a valid range Today my mind is a little foggy, the right thing was for me to do it the other day, but I will not, I will continue today. XD I need some help to think and find a way that works without bugs.

What I'm trying to do is compare two vector2 which are nothing else in my implementation in javascript/nodejs than an array with two floats.

I want to be able to compare if oldVector2 has any of its float x or y values in a range much different from floats x and y values of newVector2.

Example:

// When newVector2 is in a valid range less than 10
oldVector [0] = 1.55; // This is x
oldVector [1] = 0.22; // This is y

newVector2 [0] = 2.55; // This is x
newVector2 [1] = 1.55; // This is y

// When newVector2 is not in a valid range less than 10
oldVector [0] = 1.55; // This is x
oldVector [1] = 0.22; // This is y

newVector2 [0] = 21.55; // This is x
newVector2 [1] = 1.55; // This is y

if (the x and y of newVector2 is in a valid range less than 10 compared to the x and y of the oldVector?) {
     // You are in a valid range
} else {
     // Not in a valid range
}

My question is this: and when there are signs? Negative and positive numbers, how would this comparison compare?

what I'm trying to do here I already use abs(), I've done this before, but I did differently, because it was in unity3D that I did once, it was like this:

var distance = (a-b).magnitude;

where a and b are two 2D vectors, here is what magnitude does https://docs.unity3d.com/ScriptReference/Vector2-magnitude.html.

Then he compared

if(distance> 10)...

I'm confused at why I did it that way.

And the Vector2 are the position of an entity, I want to verify that it is not going faster than the permitted.

sentences:
Make non-sprite render in front of sprite How do I make the non-sprite (BasicSpellProjectile) render in front of the sprite (Tower 2)?

Note: The camera is located at z=-10.

The z positioning apparently doesn't do anything, and I am unable to set the sorting layer/order of the non-sprite as there isn't one such option.

sentences:
How to "reload" a TTF Text during runtime? As the title says I would like to know how to reload a TTF_SDL Text during runtime in C++.

What I want to do is to update all the values of the text each frame so I can, to example change the font size and it will instantly change it in-game as well without needing to restart the entire game.

How would I do this?

Note : I'm using textures to render the text, using the SDL_CreateTextureFromSurface() function.

This is the way I'm currently trying to update the TTF Text :

void Text::Update(SDL_Renderer* renderer)
{
    SDL_FreeSurface(m_surface);
    SDL_DestroyTexture(m_texture);

    m_surface = new SDL_Surface();

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

And in the header file the two variables look like this :

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

And I currently get an error at SDL_FreeSurface(m_surface); which looks like this :

  Thread 1: EXC_BAD_ACCESS (code=EXC_l386_GPFLT)

However, the code can also be 1 with a address that seem to change every time I run my application

However I sometimes get another error on this line :

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

Instead, which has the following error code :

  Thread 1: EXC_BAD_ACCESS (code=1, adress=0x11)

But the address on the error codes are not the same every time I run it.

(On both lines of code)

 **Full sprite class code :**

Sprite.hpp :

//
//  Text.hpp
//  SDL_Project
//
//  Created by Someone... on 2016-03-18.
//  Copyright © 2016 Someone... All rights reserved.
//

#ifndef Text_hpp
#define Text_hpp

#include <stdio.h>
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2_ttf/SDL_ttf.h>

class Text {

public:

    Text(std::string __m_text, int x, int y, SDL_Renderer* renderer);
    void Render(SDL_Renderer* renderer);
    void Update(SDL_Renderer* renderer);

    void SetText(std::string text, SDL_Renderer* renderer);

    void Destroy();

private:

    SDL_Rect* m_rect = nullptr;
    SDL_Surface* m_surface = nullptr;
    SDL_Texture* m_texture = nullptr;
    SDL_Color m_color_fg;
    TTF_Font* m_font;

    std::string m_text;

};

#endif /* Text_hpp */

Sprite.cpp :

//
//  Text.cpp
//  SDL_Project
//
//  Created by Still made by someone on 2016-03-18.
//  Copyright © 2016 :). All rights reserved.
//

#include "Text.hpp"

Text::Text(std::string __m_text, int x, int y, SDL_Renderer* renderer)
{
    m_text = __m_text;
    m_font = TTF_OpenFont("arial.ttf", 24);

    m_rect = new SDL_Rect();

    m_rect->x = x;
    m_rect->y = y;

    m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
    if (m_surface == nullptr)
    {
        std::cout << "Failed to create text surface : " << SDL_GetError() << std::endl;
    }

    m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);
    if (m_texture == nullptr)
    {
        std::cout << "Failed to create text texture : " << SDL_GetError() << std::endl;
    }

    TTF_CloseFont(m_font);
    SDL_FreeSurface(m_surface);
}

void Text::Render(SDL_Renderer* renderer)
{
    SDL_RenderCopy(renderer, m_texture, NULL, m_rect);
}

void Text::Update(SDL_Renderer* renderer)
{
    // This part throws me a error and makes the game crash.

    std::cout << "1 : " << SDL_GetError() << std::endl;
    SDL_FreeSurface(m_surface);
    SDL_DestroyTexture(m_texture);

    std::cout << "2 : " << SDL_GetError() << std::endl;

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

void Text::SetText(std::string text, SDL_Renderer* renderer)
{
    m_text = text;
    Update(renderer);
}

void Text::Destroy()
{

}

sentences:
Could I implement MakeHuman into a UE4 game as a character creator? Would it be possible to take MakeHuman and put it into a game made in Unreal Engine as a character creator?

Of course many unnecessary features would have to be removed, but would it work at all, and would it be easier than making such a system from scratch? MakeHuman is open source so there shouldn't be any legal issues.

sentences:
Which camera angle is used for these sprites? I am trying to replicate these sprites:

But I am not managing to make sense of how it is done. The character is facing forward ( <--- ), but you can see the front of its body instead of just the side. Why? Is the camera positioned diagonally? Or is the body bent, as in a fighter stance?

Or a combination of both?

Which exactly is the positioning/perspective/view I should use to replicate it correctly?

sentences:
Problem with NGUI Unity 2D Sprite across devices I have a problem with NGUI for Unity, using the Unity 2D Sprite objects.

First, have this image:

And then create an NGUI Unity 2D Sprite object in the scene. Apply this image and you get this:

Very odd. This doesn't happen if you use an Unity UI Image object or a SpriteRenderer component. But I really need to use NGUI's Unity 2D Sprite.

Then I ran the scene in several devices. Some of them display the sprite correctly - but others do not. Look:

Top-left device: iPad Mini 1: The sprite is bad.
Top-right device: iPad Mini 3: The sprite is good.
Bottom-left device: iPhone 5c: The sprite is bad.
Bottom-right device: iPhone 6 plus: The sprite is good.

I fail to understand what is the problem.

Again, this doesn't happen with sprites rendered with SpriteRenderer or Unity's builtin UI Sprite system. However, I need to do this with NGUI.

NGUI has a "NGUI Sprite" which I believe does work. But I don't want to use that one - I need to use the "NGUI Unity 2D Sprite" option.

Any ideas?

Unity 5.0.0b20

sentences:
How can I implement multiplayer cloaking with visuals that resists client-side hacking? I've been thinking about implementing stealth in a multiplayer game. It's a MOBA style game, so think League of Legends (LoL) and Heroes of the Storm (HotS). Multiple clients connect to a single server, which broadcasts the game state to all clients. Clients send their input data to the server, which might reject it when encountering invalid commands, thus rendering cheating impossible (well, in theory).

Now, I mention these games on purpose because both implemented stealth differently. LoL has stealth with two possible states: you're either completely visible or completely invisible. HotS on the other hand, implements stealth in such a way that you can tell by a shimmer in the air:

I think this is a neat mechanic, as it promotes / rewards paying attention to your surroundings. However, this being a multiplayer game made me realize that this might prove easily exploitable.

When you implement stealth in 'the LoL' way, you can simply stop sending player coordinates to the other clients. When the player's character breaks stealth, the server can broadcast the location again.
However, with the HotS model, a shimmer can be seen in the air where the character is moving about. This means that the server must be sending the player's location to the other clients. Which means that players that change the texture or model or even the game code itself could render the cloak mechanic useless. Here is a thread on the HotS boards about it.

My question is whether there is some way to implement cloaking (with a 'shimmer', à la HotS), without having the issue that crafty players can modify the game (data) and 'beat the system'. Is this possible, and if not, how do other multiplayer games with this mechanic deal with this? Is only the LoL style of invisibility uncheatable?

I thought about having the server send bogus 'cloak' locations every now and then, but this also harms fair players that are just paying attention, so that won't do.

sentences:
rotate opengl mesh relative to camera I have a cube in opengl. It's position is determined by multiplying it's specific model matrix, the view matrix, and the projection matrix and then passing that to the shader as per this tutorial (http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/). I want to rotate it relative to the camera.

The only way I can think of getting the correct axis is by multiplying the inverse of the model matrix (because that's where all the previous rotations and tranforms are stored) times the view matrix times the axis of rotation (x or y).

I feel like there's got to be a better way to do this like use something other than model, view and projection matrices, or maybe I'm doing something wrong. That's what all the tutorials I've seen use.

PS I'm also trying to keep with opengl 4 core stuff.

edit: If quaternions would fix my problems, could someone point me to a good tutorial/example for switching from 4x4 matrices to quaternions. I'm a little daunted by the task.

sentences:
Should I combine multiple tiles of terrain as one mesh in Unity3D? I have a tiled terrain, generated by multiple noise algorithms. Currently, each tile is it's own GameObject, that has a handler for an OnMouseOver event. The area that is loaded at a time consists of 9 chunks that each contain 4096 tiles. This totals to 36864 tiles that are loaded at a time. On top of this, there are actual objects on top of these tiles.

Is there any considerable performance difference if I were to combine some of these tiles into a single GameObject and mesh?

sentences:
Exporting spritesheet for Cocos2d I would like to know how people usually save the animations in order to load them easily in Cocos2d with as few hard-code as possible.

E.G. The solution I thought of is to have one plist file containing information about each frame, and the second plist to contain information about each of the animation(name of the animation, which frames to play, and the delay probably).

If this is the correct solution, how can I generate such plist files for spritesheet automatically?

sentences:
Instantiate from two values, each in separate array I have a problem with Instantiating GameObjects from floats in arrays, which I have to merge into one Vector2 (or Vector3). I have only two values in arrays:
GameObject = somePrefab
float[] = value1
float[] = value2

First I have to combine them into a vector, then Instantiate as many prefabs as the combined vector number is...
Can anybody help me with how to merge these floats into a vector and instantiate?

sentences:
SelectBox in LibGDX doesn't display and freezes the program after a click I am currently trying to apply an overlay with LibGDX over my 3D ModelBatch. Everything works fine except for the SelectBox. Once instanciated, it shows up on my screen I can click on it once but then it freezes. The drop-down list is not displayed and the clicks are no longer registered by my application. However, if my second click is under the standard position of the list, that is where it should be drawn when it drops down, an item is selected but then any third click will just return the list to the original selected item and no click is registered by my application anymore. I am running the application on Desktop.

Using break points in the SelectBox.class I was able to notice that the third and other next clicks are registered by the SelectBox.class as part of the list in the Listener responsible for selecting an item.

selectBox = new SelectBox<Object>(skin);
selectBox.setItems(array);
selectBox.setSelected("Custom");
stage.addActor(selectBox);

array in this case is an instance of Object[] containing only Strings. This is the only part of code I have related to the selectBox.

I have tried using an array of String[] at first but then switched to Object as suggested on a LibGDX forum.

I am currently using the latest Nightly Build of 2014/04/11 as I also need TextArea which is not yet in the stable release. However, I have tried the stable release 0.9.9 and it doesn't work either.

Am I using the right code to declare my SelectBox, or what could I do to make the SelectBox behave properly that is display its list when clicked and return to a normal state after an item is selected?

sentences:
Delay when moving elements How you can see my mouse goes little bit faster than widget.

My movement algorithm is:

cursorPositionPrev.set(cursorPosition);
cursorPosition.set(getCurrentPos());
...
Vector2f delta = new Vector2f(cursorPosition).sub(cursorPositionPrev);
widget.getPosition().add(delta);

I am using LWJGL and my own GUI solution.

Here is visual structure of event processor part.
One thread for processing events generated by user and another thread render current gui state.

Even if rendering and processing events is in one thread the issue is still exist.

So what can I do to make to avoid this delay and make widget to keep up with the mouse movement?

sentences:
Tweaking incentives for lottery with a twist I have been developing a game which is a lottery where your chance of winning is proportional to the square of your bet.

To prevent people from overbetting the pot (optimal strategy shouldn't just be to bet as much as possible, I think), and to make subsequent jackpots appealing, I've made it so the winner gets (current round bets + past round leftovers) / 2.  48% of the jackpot goes forward, and 2% of the jackpot goes to the house.

This is generally working, but when there are not many people on the site, one person will sit there and drain the pot every round with the minimum bet.

Though I think the concept is pretty cool, I have the feeling that some small tweaks could make a big difference.

Any ideas how to get the pot to grow as big as possible?

Apologies if this is not the right place to post.

sentences:
Software/Hardware options for game music I have some friends who want to make the music for a game I'm developing. We have no idea where to start. I've seen software like Reason (way too expensive at $450). I've also seen stuff like GarageBand for $15. I'm happy to pay up to $50 for software, and I've seen some good quality free software like lmms. I just have no idea what each of them are good for. I'm also thinking of getting a cheap midi keyboard, since that'd be a million times easier than clicking a mouse trying to get the right notes in the right places. So,

1) What hardware is recommended for simple background music

2) What software is recommended for simple background music

3) Where can I direct my friends for learning more about music creation on a computer

I know that I'm being really general, and some people might want to know the "type" of music or what instruments will be used. I have no idea, so I'm just speaking basically.

sentences:
Spawning 5 bullets at once and checking if alive, gives an error I am developing a game for my University project and came across a problem with pointers. I have a vector of bullets that has every bullet checked for collisions. But, when I try to spawn 5 bullets at once (shotgun shot), it spawns everything correctly, then I go through the vector and check if the bullet is alive. For some reason it finds a NULL pointer or a corrupted data of a pointer. Would be really appreciated if someone knew how to fix this. Thanks!

Bullet check:

void Bullet::checkOutOfRange()
{
    if(type == "enemy_bullet")
    {
        if(body->GetPosition().x <= -10.0f)
        {
            alive = false;
        }
    }
    // checks if the body is out of the window size
    else if (body->GetPosition().x > 510.0f || body->GetPosition().x < -10.0f || body->GetPosition().y > 291.0f || body->GetPosition().y < -10)
    {
        alive = false;
    }
}

Bullet collision detection:

class MyContactListener : public b2ContactListener
{
    void BeginContact(b2Contact* contact) override
    {
        if (contact && contact->IsTouching())
        {
            Entity* A = static_cast<Entity*>(contact->GetFixtureA()->GetBody()->GetUserData());
            Entity* B = static_cast<Entity*>(contact->GetFixtureB()->GetBody()->GetUserData());

            //------
            if((A->type == "player_bullet" && B->type == "enemy") || (A->type == "enemy" && B->type == "player_bullet"))
            {
                Bullet *bullet = nullptr;
                Enemy *other = nullptr;
                if (A->type == "player_bullet" && B->type == "enemy")
                {
                    bullet = dynamic_cast<Bullet*>(A);
                    other = dynamic_cast<Enemy*>(B);
                }
                else if (A->type == "enemy" && B->type == "player_bullet")
                {
                    bullet = dynamic_cast<Bullet*>(B);
                    other = dynamic_cast<Enemy*>(A);
                }
                if ((A && B) || (B&&A))
                {
                    other->bodySprite.set_animation("death");
                    bullet->alive = false;
                    other->alive = false;
                }
            }
        }
    }
}

Bullet check in game:

    for (auto itr = player_bullets.begin(), itrEnd = player_bullets.end(); itr != itrEnd; ++itr)
    {
        (*itr)->checkOutOfRange(); // go to declaration to see where the bullets stop
        (*itr)->bodySprite.set_position((*itr)->body->GetPosition().x, (*itr)->body->GetPosition().y);
        (*itr)->bodySprite.set_rotation((*itr)->bulletDir * 180 / PI);
        (*itr)->moveBullet(20.0f);
        if ((*itr)->alive == false)
        {
            input_world->DestroyBody((*itr)->body);
            delete *itr;
            itr = player_bullets.erase(itr);
        }
    }

Shotgun shot spawn:

void spawnShotgunShot(float x, float y, float dir, b2World *world)
{
    // maybe bad pointer management?
    Bullet *bullet_ptr1 = new Bullet(x, y, dir, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr1);
    Bullet *bullet_ptr2 = new Bullet(x, y, dir + 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr2);
    Bullet *bullet_ptr3 = new Bullet(x, y, dir + 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr3);
    Bullet *bullet_ptr4 = new Bullet(x, y, dir - 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr4);
    Bullet *bullet_ptr5 = new Bullet(x, y, dir - 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr5);
}

And here is a testbuild with the sln in it:
Link to testbuild

sentences:
Problem in nested parent-entity relationship in ecs In the given flow, the character is the parent entity, gun is child of character and bullet is child of gun. I've got a component called NodeComponent which has the storage of child entities and a NodeSystem that iterate the children then update its position relative to its parent. The problem is when the iteration reach to the bullet, it takes some time to update the bullet position. So when I move the parent the bullet is noticeable. How do I handle the parent-child relationship transformation without losing or slowing down the update from top to bottom?

Character >>
             Gun >>
                    Bullet

sentences:
libgdx FollowPath proper usage I'm developing top-down rpg game and got some problems using https://libgdx.badlogicgames.com/gdx-ai/docs/com/badlogic/gdx/ai/steer/behaviors/FollowPath.html

I have a path (picture 1), in this case 2 points - corner and target.

Pic.1
Then I try to make the character move (passing my path to libgdx FollowPath Steering Behavior).

private FollowPath<Vector2, LinePathParam> followp= new FollowPath<Vector2, LinePathParam>(this, new LinePath<Vector2>(astar.findPath(position, target)),0f,0f);

(astar.findPath(position, target) - function that returns Array of points(path).
Experimenting with 3rd and 4th parameters (passOffset and predictionTime) made it worse.)
And it gains such result (purple line on Picture 2).

Pic.2
But how can I get  such result (green line on Picture 3)?

Pic.3

sentences:
Strange if-else branching behavior in a fragment shader In my fragment shader I have passed an uniform int uLightType variable, which indicates what type of light is in usage right now. The problem is that if-else branching does not work correctly - the fragment shader performs instructions in every if statement block.

if (uLightType == 1) { // Spotlight light type
    vec3 depthTextureCoord = vDepthPosition.xyz / vDepthPosition.w;
    shadowDepth = unpack(texture2D(uDepthMapSampler, depthTextureCoord.xy));
}
else if (uLightType == 2) { // Omni-directional light type
    shadowDepth = unpack(textureCube(uDepthCubemapSampler, -lightVec));
}

In the case when uLightType equals 1, unless I comment out the content of the second if block, it assigns an another value to shadowDepth.

Also while uLightType equals 1, when I remove the second 'if' block and change == to != like in the sample code below, nothing happens (which means that uLightType really equals 1).

if (uLightType != 1) { // Spotlight light type
    vec3 depthTextureCoord = vDepthPosition.xyz / vDepthPosition.w;
    shadowDepth = unpack(texture2D(uDepthMapSampler, depthTextureCoord.xy));
}

Also, when I manually create an int variable (which is not an uniform) like this: var lightType = 1; and replace uLightType with it in the if-else branch, everything works fine, so I guess it have something to do with the fact that uLightType is the uniform.

sentences:
How to pass vector to GLSL shader? I am using core OpenGL to draw fonts. This works when I do just one font set at a time. Now I am trying to use three different sets in an array.

I have this structure:

struct _sdf_Vertex
{
    glm::vec2       position;
    glm::vec2       textureCoord;
    glm::vec4       color;
};

and I use three fonts - so this:

vector<_sdf_Vertex>     sdf_vertex[3];
vector<unsigned int>        sdf_indexes[3];

I then populate each font type like this ( this works fine - I can see all the data in each element):

void sdf_addVertexInfo(uint whichFont, glm::vec2 position, glm::vec2 textureCoord, glm::vec4 color)
{
_sdf_Vertex     sdf_vertexTemp;             // Temp to hold vertex info before adding to vector

sdf_vertexTemp.position = position;
sdf_vertexTemp.textureCoord = textureCoord;
sdf_vertexTemp.color = color;
sdf_vertex[whichFont].push_back(sdf_vertexTemp);
}

and then I want to pass one set of font data to the shader:

    glBufferData ( GL_ARRAY_BUFFER, sizeof(_sdf_Vertex) * sdf_vertex[whichFont].size(), &sdf_vertex[whichFont], GL_DYNAMIC_DRAW );

    glVertexAttribPointer ( shaderProgram[SHADER_TTF_FONT].inVertsID, 2, GL_FLOAT, GL_FALSE, sizeof(_sdf_Vertex), (GLvoid*)offsetof(_sdf_Vertex, position) );
    glEnableVertexAttribArray ( shaderProgram[SHADER_TTF_FONT].inVertsID );
    //
    // Specify the texture info
    glVertexAttribPointer ( shaderProgram[SHADER_TTF_FONT].inTextureCoordsID, 2, GL_FLOAT, GL_FALSE, sizeof(_sdf_Vertex), (GLvoid*)offsetof(_sdf_Vertex, textureCoord) );
    glEnableVertexAttribArray ( shaderProgram[SHADER_TTF_FONT].inTextureCoordsID );
    //
    // Specify the color array
    glVertexAttribPointer ( shaderProgram[SHADER_TTF_FONT].inColorID, 4, GL_FLOAT, GL_FALSE, sizeof(_sdf_Vertex), (GLvoid*)offsetof(_sdf_Vertex, color) );
    glEnableVertexAttribArray ( shaderProgram[SHADER_TTF_FONT].inColorID );

glBufferData ( GL_ELEMENT_ARRAY_BUFFER, sdf_indexes[whichFont].size() * sizeof(unsigned int), &sdf_indexes[whichFont], GL_DYNAMIC_DRAW ) );
glDrawElements ( GL_TRIANGLES, sdf_indexes[whichFont].size(), GL_UNSIGNED_INT, 0 ) );

Checking the vertex shader with renderDoc - I'm not seeing any of the sdf_vertex data coming through, or sometimes it's all scrambled.  I think it's got to do with the how I'm trying to point glBufferData to the vector of structs inside an array.

How do I pass the location of the vector inside an array?

Thanks.

sentences:
How can I render a font in C with OpenGL? What I tried:
I was testing some things in order to render text with stb_truetype.h and OpenGL in C.
I took as a reference the example that appears here.
Basically, this example, loads a .ttf file and returns the raw information in bytes, that can be used to generate a texture in OpenGL.
I adapted the example, mentioned before, into modern OpenGL, because, the example uses OpenGL deprecated functions, like glVertex2f. The only thing I get to output on screen was this kind of noise of strange colors:

The code I use:
texture_t fnt_texture;
GLuint fnt_shader;

unsigned char ttf_buffer[1 << 20];
unsigned char temp_bitmap[512 * 512];

stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs

#define FONT_VS\
    "#version 330 core\n"\
    "layout(location = 0) in vec3 m_Position;"\
    "layout(location = 1) in vec2 m_TexCoords;"\
    "out vec2 TexCoords;\n"\
    "void main() {\n"\
    "TexCoords = m_TexCoords;\n"\
    "gl_Position = vec4(m_Position, 1.0);\n"\
    "}\n"\

#define FONT_FS\
    "#version 330 core\n"\
    "in vec2 TexCoords;\n"\
    "uniform sampler2D Texture;\n"\
    "void main() {\n"\
    "gl_FragColor = texture(Texture, TexCoords);\n"\
    "}\n"\

void font_init(void)
{
    fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
    stbtt_BakeFontBitmap(ttf_buffer, 0, 32.0, temp_bitmap, 512, 512, 32, 96, cdata); // no guarantee this fits!

    glGenTextures(1, &fnt_texture[3]); // My texture type, is an array that saves the texture on the 3rd position.
    glBindTexture(GL_TEXTURE_2D, fnt_texture[3]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp_bitmap);
    glGenerateMipmap(GL_TEXTURE_2D);

    // can free temp_bitmap at this point
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glBindTexture(GL_TEXTURE_2D, 0);

    fnt_shader = shader_init(FONT_VS, FONT_FS);
}

void font_render(model_t model)
{
    shader_bind(fnt_shader);
    texture_bind(fnt_texture, 0);

    model_begin(model);
    model_draw(model, GL_TRIANGLES); // The model (vao, vbo, ibo) is rendering the whole buffer, not individual glyphs
    model_end();

    texture_unbind();
    shader_unbind();
}

Can someone tell me what I'm doing wrong, and, how I'm suposed to render correctly text, with modern OpenGL, with textures and buffers, in order to read the .ttf file and create the necessary information with stb_truetype.h and, then, render the text?

sentences:
iOS paralleling of game tasks (Client) What good practice in paralleling of rendering, main game logic and networking on iPhone/iPad? If I program on Windows I use threading and IOCP, but I am new to iOS. So what patterns, io async libraries or something like kernel queues you choose when program complex mobile games? I need your advices on how do not stuck on waiting of server's answer and show animation at the same time? How must be organized main loop of client of the game? My interest first of deals with C++ approach and Marmalade SDK, but I'll be happy to any solutions!

So, for game logic, rendering, networking, user input and audio:

What paralleling mechanisms do you use? Pure threading or some library?
How does your waiting logic for server's answer work? I guess that animation, rendering and game logic still play and not wait server.
Any know how, links, post mortems from client-server iPad/iPhone games?

sentences:
libgdx Vector.cpy question Why do people use this:

public void set(Vector2 v) {
    this.vector2 = v.cpy();
}

insted of just using:

public void set(Vector2 v) {
    this.vector2 = v;
}

What I don't know that I should know?

sentences:
How do I make NPC pathfinding look believable? Is there an "academic" way to have NPC walking randomly on a map, but having a believable comportment ?

The obvious scenario is a armed guard who is walking around a basement to secure it. It's quite easy to set up a "believable" path.

What I'm looking for is a way to simulation a crowd in a small town, in fact. How can I make their move look like they aren't goalless robots.

sentences:
Calling glGetError() in release builds? Currently, I'm calling glGetError() after each OpenGL function call in order to be able to detect and report bugs.

I've been reading that glGetError() calls should be reduced to once per frame in release builds. But if I do this and something does not work properly I won't be able to report where the code is failing, I would get an exception report saying that something related to OpenGL is not working properly but I wouldn't be able to detect where the code is failing.

What are the most common aproaches to report errors related to OpenGL? Should I keep all the glGetError() calls or should I call glGetError() just once per frame?

sentences:
Variable number of GUI Buttons I have a generic HTML5 Canvas GUI Button class and a Scene class. The Scene class has a method called createButton(), which will create a new Button with onclick parameter and store it in a list of buttons. I call createButton() for all UI buttons when initializing the Scene. Because buttons can appear and disappear very often during rendering, Scene would first deactivate all buttons (temporarily remove their onclick, onmouseover etc property) before each render frame. During rendering, the renderer would then activate the required buttons for that frame.

The problem is that part of the UI requires a variable number of buttons, and their onclick, onmouseover etc properties change frequently. An example is a buffs system. The UI will list all buffs as square sprites for the current unit selected, and mousing over each square will bring up a tooltip with some information on the buff. But the number of buffs is variable thus I won't know how many buttons to create at the start. What's the best way to solve this problem? P.S. My game is in Javascript, and I know I can use HTML buttons, but would like to make my game purely Canvas-based.

Create buttons on-the-fly during rendering. Thus I will only have buttons when I require them. After the render frame these buttons would be useless and removed.
Create a fixed set of buttons that I'm going to assume the number of buffs per unit won't exceed. During each render frame activate the buttons accordingly and set their onmouseover property.
Assign a button to each Buff instance. This sounds wrong as the buff button is a part of the GUI which can only have one unit selected. Assigning a button to every single Buff in the game seems to be overkill. Also, I would need to change the button's position every render frame since its order in the unit's list of buffs matter.
Any other solutions?

I'm actually quite for idea (1) but am worried about the memory/time issues of creating a new Button() object every render frame. But this is in Javascript where object creation is oh-so-common ({} mainly) due to automatic garbage collection. What is your take on this? Thanks!

sentences:
Rotating the playing field. (MonoGame) My maths isn't as good as it should be, I need to pick up some reference books on Trig.

Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point?

It's a 2D system in MonoGame.

I'm going to try to describe the scenario, I can't think of anything quite like it to reference.

Imagine a game screen, you are looking down on the world, with my character in the middle, my character sprite will never change, but if I turn left or right I want everything else to rotate around the central point.  Of course every sprite will have to be moved, and also rotate to account for the spin.

Can someone point me in the right direction?
Thanks.

sentences:
How important is a character's sexuality when it come to audience appeal I ask because I came across this comment about putting gay characters in games:

The necessity of exposing the larger playerbase to the homosexual tendencies of two of its cast mates is never really expounded upon by ScreenRant. That’s not to mention that only a tiny percentage of people even identify as on the LGBTQ spectrum, even according to Gallup, which puts the national average at 4.5%. So why exactly would Blizzard force the majority of their straight players to have to engage with the homosexual tendencies of two of its non-straight characters?
(Source)

And here:

So what better way to get back at the core gamers who dropped one-liners and zingers that have become memes of legend, than to strip away from gamers the last remaining normal character in Overwatch?
Most people figured Soldier 76 would be safe. He’s a patriotic military man, a hard-fighting soldier with undying loyalty, and a code of honor. He’s the perfect representation for what the majority of gamers like to see out of a hero. And besides, you need at least one normal sized, healthy, properly muscled straight, white male with all of his limbs intact to cater to the majority of your playerbase. Right? … RIGHT?!
The average male gamer typically gravitates toward a game where there’s a character who looks like he can kick butt and take names, and Soldier 76 was that guy.

....

The last bastion for masculinity in a game that’s constantly bleeding testosterone faster than the Overwatch League bleeds viewership,
(Source)

It's obvious that this guy thought that 76 was straight before this. So his outrage that his face character was revealed to be gay when there was no evidence to say otherwise beforehand is pretty sad.
Beyond this there is a point he makes that is interesting. Is a characters sexuality really that important? Yes most gamers are straight, but does that automatically mean that every game character needs to be straight? Or is this an appeal to the majority fallacy?

sentences:
Networking and Timing issue I have been trying to use the low-level API for UNET and the focus of this problem is this: NetworkEventType recData = NetworkTransport.Receive(out recHostId, out connectionId, out channelId, recBuffer, bufferSize, out dataSize, out error);
This line is supposed to take in information from many different clients and sits within Update() function. I haven't actually started coding anything in yet... But the point is, if the clients are all transmitting data to the server at a rate equivalent to Update() then this line of code will not be able to (I think?) receive all of them at once (10+ clients vs 1 server). So is there a way to not lose any of the incoming data and process them accordingly?

sentences:
MVC-like compartmentalization in games? I was contemplating the design of a game (translating a boardgame to the computer, specifically, which I suppose is relevant in this case) and it occurred to me that it might make sense to build the 'game' separate from the 'display.'

It would allow me to prototype something quickly with a simple text interface, and then go pretty it up later. It would also let me port the game to other media more easily.

Is this sort of compartmentalization common in games? Should I try to break things down further? Are there complications I might be missing?

sentences:
Custom Inspector for textures? I am working with an open source project called Project Porcupine. The project is a game engine for a base building game that allows for one to extend the game. We have a system to read texture files, and use a .XML configuration file to parse the details of that file. This to me seems like a good use case for a custom inspector. Unfortunately, I can't figure out how to even configure the script to read in images as such, and google is letting me down. How can I write a custom editor for an image, even better if limited to a folder? Thanks!

EDIT

To clear things up a bit, I'm trying to make a custom inspector for images in the /StreamingAssets folder. These assets are included with the build, and thus editable in Unity, but I would like to make a tool to make editing these a bit easier. Right now the inspector looks like this, the problem I'm having is getting anything to appear on the inspector at all.

I've tried two things, first a Custom Inspector on TextureImporter, and using the following code, neither of which seemed to do anything. I would be happy to get anything printed in the Inspector, from that point I can figure out the rest, I hope. Thanks!

using UnityEditor;
using UnityEngine;

public class SpriteXmlViewer : AssetPostprocessor
{
    void OnPreprocessTexture()
    {
        GUILayout.Label("Hello OnInspectorGUI!");
        Debug.Log("Test");
    }
}

Lastly, I'm clicking on the following image for the display above:

sentences:
testPoint not working - libgdx I'm making a game like angry birds with LibGDX and box2d in which I want to drag a ball (instead of the bird) back before releasing it.

I deploy with testPoint function: when I touch down the screen, I check if the point is within the body of the ball or not but testPoint function never works exactly. Here's what I'm trying thanks so much:

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    for(Fixture fixture:bird.getBody().getFixtureList()) {
        if(fixture.testPoint(screenX/100, (mapHeight-screenY)/100)) { //100 is scaled parameter
             draggedBird = true;
             return true;
         }
    }
    return false;
}

sentences:
How to avoid Gimbal Lock on Rubik's Cube I am making a Rubik's cube program. That will simulate a Rubik's cube. I am having problems with gimbal lock. I need to know how to avoid it. To my understanding I can either multiply the x, y, z rotation matrices in a specific order to acquire the rotation I am trying to get. Or I can use a quaternion which is like rotating around a single user defined axis instead of the axis x, y, or z. I can't really understand visually how I can get the resulting axis from two other axis. (x, y, z) How can I get the resulting axis for my quaternion from my Euler rotations? Will it just result in gimbal lock again?

One of the big problems is. I don't know what rotations are going to be made. I need to make it general purpose.

Edit:
Little bit more documentation of my problem:

My Euler matrix multiplication looks like this

    rotate = XMMatrixRotationX(content.mesh[meshToRotate[i]].rotation.x) * XMMatrixRotationY(content.mesh[meshToRotate[i]].rotation.y) * XMMatrixRotationZ(radians);
    content.mesh[meshToRotate[i]].rotation.z = radians;

As a gimbal lock would suggest the last axis in the rotation gets the problem. When you attempt to rotate the front or back face you get problems.

sentences:
Obstacle Avoidance or Wall Avoidance for Tiles ? I have a enemy in my game that is supposed to chase the player around the world and I thought it be a good idea for the enemy not to pass through the walls like a ghost, the levels are tile based, I've initially gone with the wall avoidance since a tile is essentially four lines, but I'm beginning second guessing the idea.

So should I go with Wall Avoidance Steering Behavior or Obstacle Avoidance Behavior ?

sentences:
Texture with transparency not rendered correctly in LibGDX The title might be a bit misleading but I'm having a hard time to explain the problem so I'll try with pictures:

Same tree from opposite site:

I'm trying to create a voxel game and at the moment I try to get textures with transparency working. The mesh is generated for each chunk individually so that every chunk has its own ModelInstance that is rendered.

And the result should be like in the second picture (almost) so that every block is rendered behind the transparent textures but thats not the case for every side.

The relevant code for the transparent textures:

        Mesh mesh = new Mesh(true, meshDataBlended.sizeEstimate, (int)Math.round(meshDataBlended.sizeEstimate * 1.5),
            new VertexAttribute(VertexAttributes.Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
            new VertexAttribute(VertexAttributes.Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE),
            new VertexAttribute(VertexAttributes.Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

        BlendingAttribute blendingAttribute = new BlendingAttribute();
        blendingAttribute.blended = false;
        blendingAttribute.sourceFunction = GL20.GL_SRC_ALPHA;
        blendingAttribute.destFunction = GL20.GL_ONE_MINUS_SRC_ALPHA;

        mesh.setVertices(meshDataBlended.vertices);
        mesh.setIndices(meshDataBlended.indices);

        Node terrainNode = modelBuilder.node();
        terrainNode.id = "terrain_blended";

        modelBuilder.part(
                "terrain_blended", mesh, GL20.GL_TRIANGLES,
                new Material(TextureAttribute.createDiffuse(World.TEXTURE), blendingAttribute)
        );

I'm pretty new to OpenGL, so I'm totally lost with this problem. No idea why it behaves like this and I even don't know where I could find the needed informations. So far i just know that it depends on what is rendered first (that's why it works from one side but not the opposite side)
Sorry for using Minecraft textures it's just for testing purposes.

Let me know if some additional information is needed I'll add them then.

Thanks
Blakk

EDIT: setting blended to true will make everything visible behind the leaves except other leaves (still only from specific sides).

sentences:
The colors of Unity 2019 are different I currently use Unity 2018 LTS, because of my 2019 Unity colours are not really good.
For example, the white is not really white but more like grey and the Shadows are really strong too even if I change the Shadow type.
Why is this happening?

This is Unity 2019

and Unity 2018-LTS

If I change the Directional Light Color from light yellow to Full White then it is whiter, but it doesn't solve the Shadow problem.

sentences:
How to handle animations for a turn based deterministic game? I have a turn based combat system where all monsters act one turn, then all players, etc. The combat mechanics are completely deterministic - I can pre-calculate the outcome of a turn.

I'm interested if I should do all calculations ahead of time (monster A will be at X, monster B will be at Y), and then just play a bunch of animations based on these calculations:

(Calculate for A)
(Calculate for B)
(Animate A move to X)
(Animate B move to Y)

OR do one animation per calculation?

(Calculate for A)
(Animate A move to X)
(Calculate for B)
(Animate B move to Y)

sentences:
How to make an authoritative multiplayer game deterministic for all clients? I'm starting to create a multiplayer online game, with an authoritative server. As it is, the clients send inputs to the server which do the simulation and then send back to clients the updated state. The game is a top-down shooter, so it's fast-paced and input lags are not allowed here, so to avoid this I'm doing the simulation on the client too, and when the server update come back I compare the local simulation with the server response. If they are compatible everything is fine, otherwise, the client version is corrected.

I was expecting that the client simulation desync at some point, because of all of the variables on physics, floating points, network etc... But this happens much more than I thought.

Just by sending the inputs and simulating on the server, the results are very different, even on simple movements, like forwards and backwards on a clear space.

Green is local, red is server response

I need help on this step, a way of keeping, at least this kind of simple movement, consistent on the server and the clients.

sentences:
Android: Loading bitmaps without premultiplied alpha (OpenGL ES 2.0) Is this possible? To load textures in non-premultiplied format (Straight alpha?)?

My game has 1 or 2 images which have semi-transparent pixels and I need to be able to fade them in and out but this doesn't seem possible easily.

As far as I understand Android always loads graphics in premultiplied alpha format, but if this is the case, how to blend them correctly?

Any help would be appreciated.

EDIT  I have included some code:

String strFShader =
"precision mediump float;" +
"varying vec2 v_texCoords;" +
"uniform sampler2D u_baseMap;" +
"void main()" +
"{" +
"gl_FragColor = texture2D(u_baseMap, v_texCoords);" +
"gl_FragColor.a *= "+opVal+";"+    //where opVal is a value from 0.0f to 1.0f
"}";

And then......

//Enable Alpha blending and set blending function

GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

//Draw it
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

//Disable Alpha blending
GLES20.glDisable(GLES20.GL_BLEND);

Using this, the semi-transparent parts of the image will display too dark (including a dark border where anti-aliased edges should be) but will fade in and out (It's just no good though as the image isn't correct).

If I change the blending mode to:

//Enable Alpha blending and set blending function

GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

Then it will display perfectly at full opacity (1.0f) but becomes 'oversaturated' (This is the best way I can describe it) the more transparency you introduce (ie 0.9f down to 0.0f).

Thank you for the suggestions, as highlighted in the accepted answer in the end I didn't need to load without with "straight alpha" as I was able to correctly work with the pre-multiplied version that Android loads by default by changing the 2nd line of my Fragment shader to:

"gl_FragColor *= "+opVal+";"+

sentences: Mouse detect object without Collider? Is there any method for mouse or ray to detect object doesn't have collider ? If no, what also can I use ?

sentences:
Change the sprite of a Object in Unity Inside the script code of the the hero(object) I want add the possibility to change its sprite.

So the player hits the space button and the sprite changes into the other sprite already added to the project.

Can you provide me a sample code to do this?

sentences:
In Unity, Meta Files are Tracked but Behaviours Fall Off My team is working on a Unity game, and we are using a mercurial repository on BitBucket. Whenever we update, all of the behaviours 'fall off' of state machines, behaviours, etc. When searching for a solution, I discovered that this information was stored in the meta files. I had previously ignored the meta files, but the are now being tracked. However, the files still 'fall off'. I cannot find any other reason this would be happening.

Any assistance you can give me would be appriciated. Let me know if you need any additional details.

sentences:
How do I derive the angular movement for a craft I have the regular (linear) motion implemented like this:

class Craft{
...
Vector location, velocity, acceleration, angularVelocity, angularAcceleration;

...
//the move class responsible for linear motion
//this method works
 public void move(Vector target){
  Vector desired = target.sub(location);
  desired.normalise();
  accleration.set(desired.multipied(speed));
  velocity.add(acceleratio);
  location.add(velocity);
}

//the turn method
//I need help/tips

public void turn(float angle){
//I need the craft to gradually turn in a circular motion
// so that eventually maybe 10 secs, it makes 360 degrees turn

}

}

sentences:
Matchmaking by user-supplied parameters I'm looking for matchmaking algorithm for a 1 vs 1 online game. Players must not be matched by their skill level, but instead by some specific filters set by the players.

Each player sends a request that specifies some set of parameters (generally, 2-4 parameters). If some parameter is specified, the player can be matched only with those who had sent this parameter with exactly the same value or those who haven't specified the parameter at all.

I need this algorithm to be thread-safe and preferably fast. It would be great if it worked with 3-4 or even more parameters, but even one is alright (in my case, it's a game bet). Also, I'd appreciate ideas on how to implement or improve this algorithm on my server platform - ASP.NET.

One more problem I'm facing is that match finding can't be executed right after the user sends request, because if another user sends a request before a previous matching is finished, they won't be matched even if they possibly could. So it seems that match finding should be started on schedule. I need help on how to optimize it and how to choose time interval for starting new match finding.

P.S. I've also posted this question on stackoverflow

sentences:
For PC game development with Visual Studio, how do AAA developers reconcile their dozens-of-GB games with VS's 4 GB memory limits? As far as I understand it, Visual Studio is the de-facto standard for Windows development in C# and C++, but it is limited by the fact that it's a 32-bit application and thus only has access to 4 GB of RAM for loading projects (Microsoft wrote a blog post 10 years ago explaining(?) why there is no 64-bit version). AAA games, however, are dozens of GB large, and even after factoring out the assets (which VS doesn't load), still amount to quite a bit of executable code.

Are AAA developers able to work within those limits for PC development, or do they use other IDEs that have 64-bit versions?

(I am aware that Visual Studio often uses out-of-process facilities for actually building and running projects, but the IDE itself is 32-bit and a lot of its functions, such as CodeLens, run in process).

sentences: Setting a Box2D Bodies Center? How do I set the center of a fixture/body consisting of multiple shapes (triangles)?

sentences:
How to load an AudioClip at runtime without the WWW class? I am currently pulling a .wav file from an API. I would like to play it at run-time. Currently I need to save the .wav file to the persistentDataPath and then use the WWW class to load an audio clip using the file:// prefix. It works fine but the docs do mention that the WWW class is obsolete. What other options do I have if I want to avoid the obsolete method group?

I don't need to save the file to disk, I am simply doing that at the moment because its fairly safe to save it and then read it back out.

sentences:
Keep state in Unity editor without hitting serialization In my game I have a MonoBehaviour WorldView that, when created at editor time, initializes a large dictionary. Later from a Editor WorldViewEditor I call WorldView.SetBlock() that tries to access this dictionary, but finds it empty.

If I understand correctly this is because my editor doesn't access the same WorldView instance, but rather a copy it received through serializing and de-serializing my original instance.
Pushing this dictionary through the serializing process is a performance nightmare and not supported by Unity out of the box.

This dictionary should never be shown in any editor, is private to the instance and initialization will be called every time the scene is loaded.
This sounds like a perfect case for keeping it somewhere outside the serialization process.

I could try to leverage ISerializationCallbackReceiver but this still requires me to pull the entire dictionary through some serialization process.
I'm looking into keeping everything state related in a separate library outside of unity, but this has it own downsides.

Is there a way to put this dictionary in a place where its state is kept?

sentences:
How to load a spherical planet and its regions? I'm designing a game partially composed of planets exploration. I want to use pseudo-random generation for them, regenerating from a defined seed when I have to load them rather than store every detail, which would be too heavy. So I will just store in a file the random seed and modifications done by the player if any.
The player must be able to see the planet from orbit (with very low level of details, then go down to the ground, increasing slowly the level of details of the region where he/she is landing, and unloading the ones on the other sides of the planet, which go outside the player's field of view.
If I had to do it on a plane ground, I would do it easily with a square chunk system. But the problem here is that planets are - almost - spheres.
So what would be the best way to load ground details (relief and grounded objects) around a precise point ?
I already though on two solutions, but both have a weak point:
1. Cutting the sphere in square chunks.

Once the player is close enough of the ground, I just have to improve details of closest squares from his/her position.
If it is not enough, I still can cut each square in sub-squares to load when the players is on or really close of the ground.
But as you can see on the picture, there is a problem if the player try to land on a pole: squares become very slim rectangles, or even triangles for the last line, and additionally to the fact that they would be many to load, generation would appear distorted.
2. Starting from an icosahedron.

Here, I could just increase triangle tessellation around player's position when he/she is getting close.
But I don't know how to locate triangles close than player's position. I heard Cartesian coordinates could be usefull in that case, but I don't know how to use them.

I'm using C++/OpenGL for it, so the main thing to generate and load here are vertices representing the surface relief and color/texture.

sentences:
How to handle wildly varying rendering hardware / getting baseline I've recently started with mobile programming (cross-platform, also with desktop) and am encountering wildly differing hardware performance, in particular with OpenGL and the GPU. I know I'll basically have to adjust my rendering code but I'm uncertain of how to detect performance and what reasonable default settings are.

I notice that certain shader functions are basically free in a desktop implemenation but can be unusable in a mobile device. The problem is I have no way of knowing what features will cause what performance issues on all the devices. So my first issue is that even if I allow configuring options I'm uncertain of which options I have to make configurable. I'm wondering also wheher one just writes one very configurable pipeline, or whether I should have 2 distinct options (high/low).

I'm also unsure of where to set the default. If I set to the poorest performer the graphics will be so minimal that any user with a modern device would dismiss the game. If I set them even at some moderate point, the low end devices will basically become a slide-show. I was thinking perhaps that I just run some benchmarks when the user first installs and randomly guess what works, but I've not see a game do this before.

sentences:
Actor in Stage Does Not Update the MoveTo XY Location I am creating a game wherein an apple is being shot with an arrow. The apple's location is the XY location of the user input and the arrow actor has to move to that location using the code actor.moveto. The problem is the arrow only moves only once to the user input's direction. I know that the moveTo action of the actor is updated many times per second when I called stageArrow.act in the update method so I am wondering why the arrow only moves once. Here's my code:

appleclass.java

public class AppleClass implements Screen {

Arrow arrow;
private final MainApp app;
public Image ShotImage;

public AppleClass(final MainApp app){
        this.app = app;
        this.stageApple = new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));
        this.stageArrow =new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));

        arrow = new ArrowClass(app);

    }

@Override
    public void show() {

        InputMultiplexer inputMultiplexer = new InputMultiplexer();
        inputMultiplexer.addProcessor(stageApple);
        inputMultiplexer.addProcessor(stageArrow);
        Gdx.input.setInputProcessor(inputMultiplexer);

        arrow();

    }

    public void arrow(){
        arrow.isTouchable();
        stageArrow.addActor(arrow);
        arrow.addAction((moveTo(Gdx.input.getX(),Gdx.input.getY(),0.3f)));   //===> only executes once.
        arrow.addListener(new InputListener(){
            public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor){

            if (Gdx.input.isTouched()){
                        ShotImage.setVisible(true);

                          }
                        }
                    });}

}

@Override
    public void render(float delta) {

        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        update(delta);
}

public void update(float deltaTime){

        stageApple.draw();
        stageArrow.draw();

        stageApple.act(deltaTime);
        stageArrow.act(deltaTime);

    }

ArrowClass.java

public class ArrowClass extends Actor {
    MainApp app;
    AppleClass appleClass;
    public Texture arrowTexture;

    public ArrowClass(final MainApp app){
        this.app = app;
        arrowTexture = new Texture("medievalarrow.png");
        this.setSize(arrowWidth, arrowHeight);
        this.setTouchable(Touchable.enabled);
        this.setBounds(app.screenWidth*0.45f,0,arrowWidth,arrowHeight);
        this.setOrigin(0,0);

}
@Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);

        final float delta = Gdx.graphics.getDeltaTime();
        this.act(delta);

        app.batch.begin();
        app.batch.draw(arrowTexture, getX(),getY(),getWidth(),getHeight());
        app.batch.end();

    }
}

Any help will be highly appreciated. Thanks.

sentences:
How can I make sure that a component gets destroyed the last out of all components attached to an object in Unity? How can I make sure that a component gets destroyed the last out of all components attached to an object in Unity?
I have a component with some scripts on it: Script1 and Script2. Inside the Script2.OnDestroy method I have the following line of code: GetComponentInParent<Script1>().
I want that line of code to return Script1 whenever I click the Play button inside Unity editor to stop my game. While right now it returns null.

sentences:
SDL - Limiting loop with timer? Not polling I am using SDL/Glew to create an engine for a game I want to make. I am trying to set a constant framerate of like around 60 (once every 17ish ms). I don't know the best way to do this so I do attempted to do it with a timer.

//Main Loop
int EngineLoop(int interval, CEngine* engine)
{
    Input->Poll();
}
//---------

void CEngine::Start()
{
    _running = true;

    SDL_AddTimer(17, (SDL_TimerCallback)EngineLoop, this);
}

The input poll is this:

void CInput::Poll()
{
    SDL_Event evnt;

    while (SDL_PollEvent(&evnt))
    {
        switch (evnt.type)
        {
        case SDL_MOUSEMOTION:
            *(Rect*)(&MousePosition) = Rect(evnt.motion.x, evnt.motion.y);
            *(Rect*)(&MouseDelta)    = Rect(evnt.motion.xrel, evnt.motion.yrel);

            break;

        case SDL_MOUSEBUTTONDOWN:
            _mouseButtons[evnt.button.button - 1] = true;
            break;

        case SDL_MOUSEBUTTONUP:
            _mouseButtons[evnt.button.button - 1] = false;
            break;
        }
    }
}

This system works perfectly when I put it in some random class function to pump as much as it'd like. But when I introduced the timer, nothing works, no input is taken and the window freezes up. Is it because I am not Polling the events quick enough or?

I tried using a separate timer function that called the class function to poll the input because maybe having it on a different thread is the reason, that didn't work either.

So why didn't this work?
What other approach should I take if necessary?

sentences:
Passing data into a vertex shader for perspective divide In OpenGL and GLSL, I am just learning about perspective projection and the vertex shader. However, I am a little confused about what data actually needs to be passed to the vertex shader, and what needs to be done in the shader code itself.

I have two questions:

Suppose I have a triangle defined in 3D coordinates (x,y,z). Do I need to pass a 4D vector with values (x,y,z,w), where w = z? Or do I just pass the 3D vector? The reason I ask is that I know that somewhere in the pipeline, the x and y coordinates are divided by the w component, in the perspective divide.

In the vertex shader code, do I need to manually divide the x and y components by the w component myself? Or is this taken care of automatically?

Thanks!

sentences:
I'm looking to learn how to apply traditional animation techniques to my graphics engine - are there any tutorials or online-resources that can help? There are many traditional animation techniques - such as blurring of motion, motion along an elliptical curve rather than a straight line, counter-motion before beginning of movement - which help with creating the appearance of a realistic 3D animated character.

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

sentences:
Wall-Sliding, Stuck at Corners I am having trouble with my 2-D wall-sliding.  Namely, when the player avatar collides with the wall, it "snaps" to the corner (see screenshot, below) and sticks there.  The red, transparent rectangle is my "wall":

My code is as follows:

"FootRectangle" is your standard xna rectangle. Location is a vector2.  The player is moving to a target, which could be anywhere on the screen, which is also a vector2.

 if (wall.CollisionRectangle.Intersects(player.FootRectangle))
            {

                // collision above block
                if (player.FootRectangle.Top <= wall.CollisionRectangle.Top)
                {
                    player.Location = new Vector2(player.Location.X, wall.CollisionRectangle.Top - player.FootRectangle.Height / 2);
                }

                // collision below block
                else if (player.FootRectangle.Bottom >= wall.CollisionRectangle.Bottom)
                {
                    //player.FootRectangle.Y = block.CollisionRectangle.Bottom;
                    player.Location = new Vector2(player.Location.X, wall.CollisionRectangle.Bottom + player.FootRectangle.Height / 2);
                }

                // collision left of block
                if (player.FootRectangle.Left <= wall.CollisionRectangle.Left)
                {
                    player.Location = new Vector2(wall.CollisionRectangle.Left - player.FootRectangle.Width / 2, player.Location.Y);
                }

                // collision right of block
                else if (player.FootRectangle.Right >= wall.CollisionRectangle.Right)
                {
                    player.Location = new Vector2(wall.CollisionRectangle.Right + player.FootRectangle.Width / 2, player.Location.Y);
                }

How can I resolve these collisions so that the avatar snaps to a corner and smoothly makes his way to the target destnation?

I attempted to implement a similar solution to that at this post; however, it seemed to stick when the collision occurred.

sentences:
SDL draw dynamic select box This might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here.

I tried to make a rectangle like you have in RTS games, so to speak a dynamic select box, but it does not work correctly.
It would also be enough is someone lists up bullet points which each step for creating a box like this.

(Don't wonder I'm really new to c++)

Mouse.h :

#ifndef MOUSE_H_
#define MOUSE_H_

class Mouse {

public:
    bool leftButtonDown = false;
    bool mouseMoves = false;

    struct MouseCoords {
        int x = -1;
        int y = -1;
    };

    MouseCoords start_coords;
    MouseCoords move_coords;
    Mouse(){}

    void setState(Uint32 eventType, SDL_Event event){

        if ( eventType == SDL_MOUSEBUTTONDOWN) {
            this->leftButtonDown = true;
            SDL_GetMouseState( &this->start_coords.x, &this->start_coords.y );
        }

        if ( eventType == SDL_MOUSEBUTTONUP ) {
            this->leftButtonDown = false;
        }

        if ( eventType == SDL_MOUSEMOTION ) {
            this->mouseMoves = true;
            this->move_coords.x = event.motion.x;
            this->move_coords.y = event.motion.y;
        } else {
            this->mouseMoves = false;
        }
    }

    /**
     * Provides coordinates when mousebutton down
     */
    MouseCoords getCoordinates(){
        return move_coords;
    }

    /**
     * Refresh the coordinates. MUST be called after Mouse::clearCoordinates();
     */
    void clearCoordinates(){
        this->move_coords.x = -1;
        this->move_coords.y = -1;

    }

    /**
     * Creates selector rect, call this in the render loop
     */
     void createSelectBox(SDL_Renderer *renderer){
         if(this->leftButtonDown) {
            Block rect(
                       this->start_coords.x,
                       this->move_coords.y,
                       this->start_coords.y -this->move_coords.y ,
                       this->move_coords.x - this->start_coords.x
                       );
             rect.draw( renderer );
             this->clearCoordinates();
         }
     }
};

#endif

Block.h

#ifndef BLOCK_H_
#define BLOCK_H_
/**
 * Standard Class which can be used to build a player, enemy, or something similar
 */

class Block{
    SDL_Rect rect;
public:
    Block(int x=10, int y=10, int w=10, int h=10, int filled=true){
        rect.x = x;
        rect.y = y;
        rect.w = w;
        rect.h = h;
    }

    /**
     * draw with the given rendererer
     */
    void draw(SDL_Renderer *renderer){
        SDL_SetRenderDrawColor( renderer , 200 , 155 , 255 , 255);
        SDL_RenderDrawRect( renderer, &rect );
        SDL_RenderPresent( renderer );
    }

    bool framed(){
        return 0;
    }

};
#endif

Then in my main.cpp

SDL_Window *window;
SDL_Renderer *renderer;
Mouse mouse;
Block rect;

void renderWindow(){
    window = SDL_CreateWindow("commanding rects", 100, 100, 700, 600, 0);
    renderer = SDL_CreateRenderer(window, -1, 0);
}

void renderGame(Mouse mouse){
    SDL_RenderSetLogicalSize( renderer, 400, 300 );
    SDL_SetRenderDrawColor( renderer, 0, 0, 0, 0);
    SDL_RenderClear( renderer );
    SDL_RenderPresent( renderer );
    mouse.createSelectBox( renderer );

}

void gameLoop(){
    bool game_run = true;
    while (game_run) {
        SDL_Event event;
        while( SDL_PollEvent(&event)){
            if ( event.type == SDL_QUIT ) {
                game_run = false;
            }
            mouse.setState(event.type, event);
        }
        renderGame(mouse);
        SDL_Delay( 15 );
    }

}

int main(){
    renderWindow();
    gameLoop();
    return 0;
}

sentences:
Flip sprite vertically AND horizontally? In Microsoft.Xna.Framework.Graphics.SpriteEffects there is the possibility to flip a texture horizontally or vertically before rendering. But can one do both at the same time?

When I use: spriteEffect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; with spriteEffect being a parameter of the particle. The method spriteBatch.Draw(spriteSheet,
                        currentPositionForDraw,
                        sourceRectangle,
                        currentColorMultiplied,
                        currentRotation,
                        currentOriginForDraw,
                        Temp.delta,
                        spriteEffect,
                        0); does not draw the particle flipped on both axis.

sentences:
Moving a rotated model in XNA This seems like a simple problem with an equally simple solution that is invisible to me.

I have a model that spawns at the origin and looks at my player model wherever it goes.

I would like it to move forward where it's going. Whenever I try to translate it, it disappears. What am I doing wrong and how do I fix it?

public override void Update()
{
    //Glo is a global class, where I store the player's world.
    targetShip = Glo.world.Translation;
    targetShip.Normalize();

    //Rotates the model to face the player's position
    rotation = RotateToFace(targetShip, pos, Vector3.Up);
    pos += Vector3.Normalize(targetShip - pos) * 20f;

}

public override Matrix GetWorld()
{
    // return  rotation * translation * world ;
    return Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(pos);
}

UPDATE:
When I replace:

translation *= Matrix.CreateTranslation(direction);

with

translation *= Matrix.CreateTranslation(Vector3.Forward);

It now moves forward.

It does not correctly face me, however. It still thinks it's at the origin, and is rotating accordingly.

Here is the edited RotateToFace function
The original just returns a Matrix.

Quaternion RotateToFace(Vector3 O, Vector3 P, Vector3 U)
{

    //The direction we're facing.
    Vector3 D = (O - P);
    //Our relative Right.
    Vector3 Right = Vector3.Cross(U, D);
    Vector3.Normalize(ref Right, out Right);
    //Our back
    Vector3 Backwards = Vector3.Cross(Right, U);
    Vector3.Normalize(ref Backwards, out Backwards);
    //Our relative up
    Vector3 Up = Vector3.Cross(Backwards, Right);
    //Make a matrix out of all of these.
    Matrix rot = new Matrix(Right.X, Right.Y, Right.Z, 0, Up.X, Up.Y, Up.Z, 0, Backwards.X, Backwards.Y, Backwards.Z, 0, 0, 0, 0, 1);
    Quaternion rot2 = Quaternion.CreateFromRotationMatrix(rot);
    return rot2;
}

Draw code:

public void Draw(Camera camera)
{
    Matrix[] transforms = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect be in mesh.Effects)
        {
            be.EnableDefaultLighting();
            be.Projection = camera.projection;
            be.View = camera.view;
            be.World = GetWorld() * mesh.ParentBone.Transform;

        }

        mesh.Draw();
    }
}

sentences:
Would adding delay to inbound traffic give you an advantage in online games? Wouldn't adding a latency delay to inbound traffic and limiting your download speeds to a low but playable standard give you an advantage in online games, especially shooters?

Because wouldn't your shots be registering as normal (using upload/outbound) while anything that attempts to hit you (download/inbound) would be delayed and/or slow?

sentences:
Can I used a NES USB controller with XInput? I'm doing a project to graduate from my game design degree and I have to recreate two levels from MegaMan(1987).
I saw that there are usb nes controllers out there that are used for emulators on PC.  Before I purchase them and try out programming my game with them, I'd like to confirm that I can use them with Xinput.

If anyone knows if this is possible, please let me know!

Thank you!

sentences:
objects are keep falling I added some screenshots above. When I run the game obstacle are falling rapidly through y axis. So, there's no more obstacle in that ground. If there's ground than those obstacle should stopped. I tried by freezing them. But, when another object hit them they are froze. So, I want ground to stop them. I have another question also. I have player movement. When I will run the program. The Player should be go through z axis. But, The object(player) don't move.
PlayerMovement.cs
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody rb;
    public float forwardForce=2000f;

    void FixedUpdate()
    {
        rb.AddForce(0,0,forwardForce * Time.deltaTime);
        if(Input.GetKey("d")){
            rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }else if(Input.GetKey("a")){
            rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }

        if(!Input.touchSupported)
        {
            // Still support PC keys
            if(Input.GetKey(KeyCode.D))
            {
                rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
            }
            else if(Input.GetKey(KeyCode.A))
            {
                rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
            }
        }
        else
        {
            // For touch devices
            if(Input.touchCount == 1)
            {
                var touch = Input.GetTouch(0);
                var touchPos = touch.position;

                var isRight = touchPos.x >= Screen.width / 2f;

                if(isRight)
                {
                    rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
                }
                else
                {
                    rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
                }
            }
        }

        if(Physics.Raycast(transform.position,Vector3.down,0.5f)==false){
            // rb.velocity = new Vector3(0, rb.velocity.y, 0);
            rb.constraints = RigidbodyConstraints.FreezePositionZ;
        }else{
            rb.constraints = RigidbodyConstraints.None;
        }

        if(rb.position.y < -1f){
            FindObjectOfType<GameManager>().EndGame();
        }
    }
}

PlayerCollision.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class PlayerCollision : MonoBehaviour
{

    public PlayerMovement movement;

    void OnCollisionEnter(Collision collisionInfo)
    {
        Debug.Log(collisionInfo.collider.name);
        if (collisionInfo.collider.tag == "obstacle")
        {
            movement.enabled = false;
            FindObjectOfType<GameManager>().EndGame();
        }else if(collisionInfo.collider.name == "END"){
            FindObjectOfType<GameManager>().CompleteLevel();
        }
    }
    void Restart(){
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

If you look at above source code clearly. So, you might see that I have a Debug.Log right there. But, when I run the game. I don't get any message to console.
As a new game developer(learning) I don't know what's happening, what's wrong with this.

sentences:
Rendering lighting only on specific objects I have done something similar to this in monogame:

My question is, what would I have to do to draw that lighting effect only on the pillar and not the background ? Is there something like ignoring certain sprites when using BlendState.Additive ? How would that work ? Here is how i'm drawing it now.

//draw background
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
spriteBatch.Draw(Background, Vector2.Zero, Color.White);
spriteBatch.End();

//draw pillar
spriteBatch.Begin(SpriteSortMode.Deferred);
spriteBatch.Draw(Texture, new Rectangle(PillarX, PillarY, Width, Height), Color.White);
spriteBatch.End();

//draw lighting sprite in additive mode
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
spriteBatch.Draw(LightTexture, pos, null, Color.OrangeRed, 0f, Vector2.Zero,
    scale, SpriteEffects.None, 0f);
spriteBatch.End();

Edit: Also, apart from the pillar I have as an example, I need to do that for 3D models as well, so would the Stencil Buffer work here ?

sentences:
FBO rendering different result between Galaxy S2 and S3 I'm working on a pong game and have recently set up FBO rendering so that I can apply some post-processing shaders. This proceeds as so:

Bind texture A to framebuffer
Draw balls
Bind texture B to framebuffer
Draw texture A using fade shader on fullscreen quad
Bind screen to framebuffer
Draw texture B using normal textured quad shader

Neither texture A or B are cleared at any point, this way the balls leave trails on screen, see below for the fade shader.

Fade Shader

private final String fragmentShaderCode =
        "precision highp float;" +
        "uniform sampler2D u_Texture;" +
        "varying vec2 v_TexCoordinate;" +
        "vec4 color;" +
        "void main(void)" +
        "{" +
        "   color = texture2D(u_Texture, v_TexCoordinate);" +
        "   color.a *= 0.8;" +
        "   gl_FragColor = color;" +
        "}";

This works fine with the Samsung Galaxy S3/ Note2, but cause a strange effect doesnt work on Galaxy S2 or Note1. See pictures:

Galaxy S3/Note2

Galaxy S2/Note

Can anyone explain the difference?

edit

Folowing VinceFR's comment, we've tried adding the following. When the renderbuffers are initialised they are briefly bound to the framebuffer and set the background to a uniform buffer with:

    GLES20.glClearColor(backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]);
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

The result is unchanged on the S3, on the S2 it has improved a certain amount, but problems still exist:

note the 20 in the bottom right corner is supposed to be there.

sentences:
Unity animation transition with 0 Exit Time doesn't transition immediately Question

Why doesn't an animation transition with an Exit Time of 0 immediately transition to the next state?

Minimal example

Using Unity 2018.3, I set up an AnimatorController with two states: Initial and Next. I wanted Initial to transition to Next immediately, so I tried setting an Exit Time of 0. However, this doesn't transition immediately:

As shown above, Initial state still runs instead of transitioning immediately to the Next state. (There is no Motion attached to the AnimationState, so perhaps it's using a default duration.)

Below are screenshots of my animation transition settings.

Strange behaviour with small non-zero ExitTime

I also tried using an Exit Time of 0.01 (i.e. transition after 1% of the animation has played), and it transitions almost immediately as I expect most of the time. However, occasionally it will still play the Initial state:

In this case, even though it transitions to Next immediately most of the time, it still occasionally waits for the Initial state to complete. (It happens much less frequently than the image above suggests, but the issue becomes more frequent if I set the ExitTime even lower, e.g. 0.003).

Workaround

From searching online, the recommended solution for immediate animation transitions seems to be to turn off Exit Time and use a condition (e.g. bool or trigger) to transition immediately instead.

(Edit: in my case, I've defined an animator bool parameter called ImmediateTransition and set it to true by default instead of using Exit Time 0.)

This seems to work, but I would like to better understand how Exit Time works and why it's not working the way I expect.

sentences: Adaptive vs progressive mesh Is there any distinction between these two? I couldn't find anything in google under "Adaptive vs progressive mesh", but googling them both separately gives results as if they were likely the same.

sentences:
Steam hammer.exe Load custom textures for other players? I sometimes make maps with custom textures, models, materials, sounds, etc. and I showed one of my map creations to my friend, and the custom textures were pink-and-black. It was intended to be a 'display-case' map with custom sprays & sounds upon clicking a button, but he just saw black and pink textures. Is there a way to make it built-in to the map and have it auto-download? I had the textures in its own folder, like "cars/materials/texture1.vtf"; it wasn't in the actual materials folder of my steam, it was just in its own folder. If I place the textures in the Steam materials/models/etc folder, will it automatically download it for other users?

ON SINGLEPLAYER/LAN, BUT KNOWLEDGE FOR MULTIPLAYER WILL BE NICE FOR FUTURE REFERENCE

sentences: What is the better approach to redraw a static background scene for game? Take for an example I have the background scene of a game which should remain static for an interval.Then for every time redrawing the scene,is it better for me to store the color buffer for every pixel on the viewport and redrawing using the stored color buffer or to applying a texture to the whole background or to draw the triangular,quad meshes?

sentences:
Coding style about collisions with geometry Let's say I'm writing 3D Pacman.  I have "Dot" objects throughout my maze, that are structured as follows in the Inspector:

Dot (GameObject)
- Sphere w/Collider

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

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

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

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

sentences:
How to organize passing data to shaders in cross-API render system? I try to create rendering system that supports DirectX and OpenGL. I am trying to create class for constant buffer, but DirectX constant buffers and OpenGL uniform buffers have different memory organisation rules.
Is there any way to to achieve the compatibility between DirectX and std140 from OpenGL?

Or probably will it be better to choose a other way to create abstraction of constant buffers for shaders? And how developers solve problem of passing data to shaders effectively in serious engines?

sentences: SpriteKit Game State Management I've created a SpriteKit Mac OS X app and I am using a simple finite state machine to manage the game states. I've seen some solutions, especially for C++ games, where a GameState class and a GameStateManager class are used to regulate states of the game through the use of a stack of GameState objects. What I don't understand is what these GameStates objects would be in SpriteKit. Would they be separate SKScene nodes? How would I implement this into a SpriteKit game?

sentences:
Unity blue sprite always showing on top regardless of order I have 3 SpriteRenderer

SpriteRenderer - Green Sprite
SpriteRenderer - Blue Sprite
SpriteRenderer - Brown Sprite

The problem is that the blue sprite always shows on top of the others. I even tried to keep the SpriteRenderer in the same order and change the images but no matter which SpriteRenderer I put the blue image into it always shows on top.

I have the sorting layer set to 0 for all 3 and I cannot change them because I will have to change so many other objects in the game.

sentences:
How do C++ games handle memory allocation failure? I am aware of several games which are written in C++ but do not use exceptions. Since handling of memory allocation failure in C++ is generally built around the std::bad_alloc exception, how do these games handle such a failure?

Do they simply crash, or is there another way to handle and recover from an out-of-memory error?

sentences:
Correctly bitmasking path tiles based on existing paths Currently, I have a bitmasking implementation that sometimes incorrectly bitmasks the tiles. Conventionally, it is done correctly, and the math/etc is sound, but it achieves results such as the following:

This is similar to what you might expect, and looks fine when doing simple x-shaped crossings. However, I would like for the images to remain unchanged in some of these cases. For instance, the parallel paths in the third image would remain parallel paths instead of being bitmasked into many crossings. In the first and second images, only the parts of the path highlighted in the following images would be bitmasked (Different parts of path labelled for clarity.)

If I purely update only the tiles that make up the newest path, I again get good results in simple x-shaped crossings, however I get results such as those demonstrated in the following image:

What could I do to achieve results where this would not occur? I have though about adding some sort of flag to the tile to indicate that it is a crossing, but how could I detect that?

sentences:
Analog sticks, deadzones, diagonals, etc I'm messing about with a knockoff PS3 controller and SDL2 on windows, and noticed that despite the circular restriction, when I position the stick as close as I can to an extreme diagonal, I am reading a max value for displacement on the X and Y axis. Now as a newbie, I would not expect this as obviously in this position the stick is some way from being as far displaced in either axis as it could be. So it seems that the region for min and max readings is a square whose limits are well within the full circular range of movement of the stick, and anything outside this region is deadspace.
I guess different controllers might have different exact sizes for deadzones, but in general, is it the case that all analog controllers are going to exhibit this general behaviour?

sentences:
Which toolkit to use for 3D MMO game development? Lately i've been thinking about which path to follow for developing an 3D Online game.
I have googled a lot but i couldnt find a good article that covers both game development and online server & client development in same context.
This question has been in mind for about 2 weeks now.
So.. yesterday i started developing a game from scratch by using
Irrlicht.Net Wrapper to use Socket library of .NET which im already familiar.
But i found out .Net wrapper of Irrlicht is not totally finished yet and still have lacks from the original.
So i lost all my motives :/.

So i thought why not to ask the experts before i run into another dead end...

What Game Engine and Networking Library is best way to go for 3D MMO Development?

Here is some of my early conclusions:
Please let me know the ones im wrong.

C++:

Best Performance for 3D Graphics.
Most Game Engines has native C++ Libraries.
Lacks a Solid Socket Library
.NETC++ Lacks Intellisense Support.

C#:

Intellisense Support
NET Socket Library
Lacks 3D Graphics Performance
Lacks a native solid 3D Game Engine

sentences:
Help with a Fast 2D Grid-Based world rendering technique First I'm going to give you my current situation and explain what I'm attempting. I will then pose my question below. I will attempt to include a "TL;DR" for those of you who prefer things to be concise.
OVERVIEW OF CURRENT SETUP:

The current representation of my game world is one where ' Pieces ' of a larger world are represented by three layers of IDs as follows.

//This is being done in C++
struct WorldPiece {
   ivec2 pieceLocation;         //Where ivec2 is a vector containing ints
   short backLayer[PIECE_SIZE]; //Where PIECE_SIZE is the size of the grid this piece contains, ie. for a 32x32 grid, this is 1024
   short middleLayer[PIECE_SIZE];
   short frontLayer[PIECE_SIZE];
};

The world as a whole is then composed of these pieces, which are loaded (and cached as needed) as the player traverses from piece to piece.
I currently have the data side of this all working. I may change the active data set and move around the camera (zoom in and out as well) and watch it all function.
I have also written a tool to support the loading and saving of pieces, and the painting of IDs across the world.
I HAVE THIS DATA:

Each ID within a piece maps to a texture that will be used when that ' cell ' of the piece must be rendered.

QUESTION:

How might I go about rendering each piece in such a way as to do this in as few passes as possible? I could render each cell at a time, but that would be slow. I could generate a list of vertices and indices and create massive VBOs, or sets of quads. Or perhaps there is a better way?
I would prefer to keep the data separate from the rendering and to keep the size of the data as small as possible (so as to have a small as possible load time while the game is running).
If possible, I would like this to be fast enough to render large swaths of tiles, (for example a 3x3 area of 1024 tiles apiece, or more). Since zooming in and out is possible it would be nice to provide this functionality to the player while still maintaining the detail of rendering the world.

If there would be a better setup for the world data to accommodate these requirements, I'm open to suggestions.
SIDE NOTES:

Please do not bring collision/physics, or other game-map-related things into this. I have that worked out and it will not be a bottleneck. I am merely concerned with a best approach to a rendering pipeline where speed is the top concern.
Please do not suggest API X or ENGINE Y. I have looked around quite thoroughly and nothing available would properly provide what I need or integrate with my current codebase.
I will be using a texture atlas.

tl;dr version-  I have a grid based world that streams pieces in as needed, I would like suggestions on a fast way to render these pieces and nothing I have found anywhere has a suitable solution for my current situation.

sentences:
Tweening Colors in OpenGL I'm making a sky gradient in OpenGL by drawing with glColorPointer and glDrawArrays. I would like to be able to change the sky colour from morning to daytime to evening etc. I can either:

Make a number of sprites and fade them in with my framework
Somehow tween the color vector in openGL over time and use a single sprite

The second one seems like a more efficient option, but my framework doesn't pass the time delta into the draw method for me to decide how far I've progressed into fading.

Here's my current code:

glDisable(GL_BLEND);
glDisable(GL_DITHER);
glDisable(GL_FOG);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);

CGSize size = [[CCDirector sharedDirector] winSize];
float w = size.width;
float h = size.height;

const GLfloat vertices[] = {
    0, 0,
    w, 0,
    0, h/3,
    w, h/3,
    0, h*2/3,
    w, h*2/3,
    0, h,
    w, h,
};

const GLubyte colors[] = {
    254,255,134,255,
    254,255,134,255,
    230,157,0,255,
    230,157,0,255,
    230,60,0,255,
    230,60,0,255,
    167,0,86,255,
    167,0,86,255,
};

glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glEnable(GL_TEXTURE_2D);

Which gives me:

sentences:
Applying statements to a single instance in Game Maker? I'm currently in the process of making a platformer, and am currently in the process of creating "depth" into my game, by making Up/Down-W/S control your depth. (Come closer to screen, go further).

The reason I chose to do this is so I can walk around stairs, go behind tables, etc.

But I have run into a problem.

When I call in my player code, if (depth == oWall.depth) {//code}, it is applying to every single wall ever. Is there a way to only make it apply to the object you are currently touching?

Here is my code so far:

/// Collision

// TODO: Make "depth" apply to a singular instance.
//   \/          \/
if (depth == oWall.depth) {

    /*
        Colliding with a wall on the Horizontal Axis, causes the player to stop moving.
    */

    if (place_meeting(x + h_speed, y, oWall)) {
        while(!place_meeting(x + sign(h_speed), y, oWall)) {
            x += sign(h_speed);
        }
        h_speed = 0;
    }

    /*
        Colliding with a wall on the Vertical Axis, causes the player to stop moving.
    */

    if (place_meeting(x, y + v_speed, oWall)) {
        while(!place_meeting(x, y + sign(v_speed), oWall)) {
            y += sign(v_speed);
        }
        v_speed = 0;
    }
}

Hope you understand what I'm asking.

sentences:
Best way to save game data in Unity I am currently developing a game in unity and I want to add some sort of saving system that saves the following:

Locked / unlocked level.
The amount of money the player has.
Items / perks that the player has.

As you can see, the data I want to save is global, and has nothing to do with any specific scene.
How would you reccomend save this kind of data? I have heard about the EasySave asset but I don't know if it is the right choice: it is pretty expensive and I belive that there has to be some easier, cheaper (even free) way to save the data.
I'll appreciate any answer or consideration.

sentences:
Content.Load() throws ContentLoadException when loading a texture in SL XNA I've developed a while back in XNA but I'm a bit rusty. I've started working on SL XNA but have a problem I can't explain while trying to load content (model -fbx- or texture).

I place the image named redRect.jpg in the Content project by right-click -> Add existing item and I've made sure all the properties are ok:

Asset Name: redRect
Build Action: Compile
Content Importer: Texture - XNA Framework
Content Processor: Texture - XNA Framework

I declare a texture

Texture2D redTexture;

but when I try to load the texture

redTexture = contentManager.Load<Texture2D>("redRect");

I get an error telling me that the image is not found

  Error loading "redRect". File not found.

sentences:
How do I change the turn from a user to the next? I was asked by a friend to develop a small web game which should support 10 players.
Very basic game-play:
There is a piñata which has x-"healthpoints". Each player can hit the piñata when it's their turn.
However, I'm having a hard time figuring out how to handle this. As of now, I have three databases:
Table: game

hasStarted
usersTurn

Table: users

id
username

TABLE: usersPlaying

id
username

So far my game works like this:
'users' holds all of the users.
When the game starts all of the online users username are copied into 'usersPlaying'.
Then a random row from 'usersPlaying' is selected and that username is copied into 'game' in the 'usersTurn' field.
From the webpage there's a AJAX-script checking for 'usersTurn' variable every second. If the username matches $_SESSION["username"] the users will know if it's their turn.
However from here, I've totally lost it. I cannot figure out how to move on to the next player, and I'm even wondering if this is the right way to go at all. It's not ment to be too fancy, it's only going to be used once or twice.
So with my hands folded - is there anyone who can point me in the right direction?

sentences:
How many views can be bound to a 2D texture at a time? I am a newbie trying to learn on DX11.x. While reading about resources and views in MSDN, I thought this question
For a given 2D Texture created with ID3D11Texture2Dinterface (or for that matter any kind of resource), how many of following views can be bound to it?

1) DepthStencilView
 2) RenderTargetView
 3) ShaderResourceView
 4) UnorderedAccessView

Thanks in advance.
PS: I know the answer would be app specific, but still any insight into this would be helpful.

sentences:
360 degree viewer for AR I want to implement a 360-degree viewer for Augmented-Reality in Unity. Augmented-Reality means in this case, that I want to place an image like an interface mockup in my viewer which has transparency. The transparency is getting filled with the real world. So the real world part is working without problems, but that is also the reason, why a sky box is not possible since the sky box would block that.

So I already had 2 approaches:

A sphere with a shader which rendered only the inside (turned the
normals), worked on my MAC, but didn't render anything on my vr/ar
device (Samsung GearVR)... Here a picture how it should look like and does look like in the Unity Editor. But nothing of this "crosshair" is showing up on the GearVR

A sphere or cylinder where I turned the normals beforehand in
Blender, didn't apply the texture correctly and didn't show anything
in Unity and on Device except a blank color.

sentences:
Is it a good idea to make a game for one aspect ratio and arbitrary screen resolution? After several very small games I have decided to make something more standalone (2D) and playable. However, I have met the problem of every game that is going to be played in more screen resolutions.

Basically, after some research I see that there are several solutions.

This seems to be the simplest one: Let's say I define a constant aspect ratio for the game (16:9) and the whole game will be created for a resolution 1680 x 1050.

The game will be rendered in this resolution and then I will be able to scale the render to match the player's display resolution. Therefore the game might be playable on almost any resolution, while it would keep the aspect ratio. So, if the game was run on 4:3 display, the top and the bottom of the display would be filled with black color.

It seems easy, but my question is - Is this a good approach for a simple game? The game will be simple, but I want to maintain high quality.

sentences:
what are the networking features available in iphone? So far I couldn't find anything on google so I'm asking here:

I need to connect two iphones or more to each other for a multiplayer game, what features does iphone api provide? is there some kind of bluetooth device or equivalent in iphone or should i just search over the wireless network connection? and what api should I use to connect them? is it possible to use c++ or are the api functions only available via obj-c iphone sdk?

sentences:
Why doesn't this ContentLoader project (VS2010 e) recognize Microsoft.Build.dll? I am working with an XNA content loader sample. In the references for the project (VS 2010 Express) there are:

Microsoft.Build
Microsoft.Build.Framework

//as well as the standard XNA framework and graphics references

To emulate this project, I am trying to first add a reference to Microsoft.Build.dll. But Visual Studio warns me that it cannot load the .dll. I looked at MSDN and the document referenced Microsoft.Build.Evaluation. This is suppose to be available in the Microsoft.Build.dll and then I'll have access to the Project class.

Has anyone had any experience with this?

sentences:
Communicating with Collision System in ECS I have read tons of articles and forums threads about ECS but still can't understand how anything in engine should communicate with Collision System. Let's say I have Input System that handle keyboard input and then at some point it want to move player character forward. Before doing this I should ask Collision System if there would be a collisions after that move and only if no - change position.

My current approach is to have requestTranslation function in CollisionSystem that take translation function and object like this:

moveForward(){
    V3.CollisionSystem.requestTranslation(this.mesh, function(object){
        object.translateZ(-this.movingSpeed);
    }.bind(this));
}

What do you think about this approach? How good/bad it is? What are know alternatives?

sentences:
The normal vector to a plane ax+by+cz+d=0? I am calculating the normal vector to a plane ax+by+cz+d=0

According to the book:

The normal vector N is often normalized to unit length because in that case
the equation

d = N ⋅Q + D

gives the signed distance from the plane to an arbitrary point Q. If d = 0, then the
point Q lies in the plane. If d > 0, we say that the point Q lies on the positive side
of the plane since Q would be on the side in which the normal vector points.

How to get the N (Normal vector)? Thank you

sentences:
How to make a character that moves like a slinky? I have a school assignment to make a 2D platformer game, with a character that moves like a slinky:

(Animated example from the assignment linked above)

At first, the character needs to grow in height over time
When the player presses a button, the character starts to bend toward the next platform
Its height when you press the button determines whether it will hit the next platform
After that it must shrink to its initial size, and it goes over again.

How can I approach this?

sentences: PBR texture conversion Is it possible to convert from specular/glossiness to metallic/roughness textures for UE4?

sentences:
What are the tools, programming languages and development processes of AAA games? Only thing I am able to find about "big" games like ac, hl, bf, cod is engine used to run the game. But I am interested in what software development methodology, programming and scripting languages were used. As well as tools for creating models, music, animations and other media. Further, were the team team organisations and so on for a certain game (or game series).
Is this information even available to the public?

sentences:
Intuitive way to handle dragging outside the Arc Ball? So I'm writing a game (or toy, rather), which involves manipulating a 3d object with the mouse. I'm trying to get the most intuitive control that I can.

I've implemented the "Arc Ball" mouse control. I'm happy with how it "feels", except for when I drag the mouse outside the range of the virtual ball.

Currently when the ray from camera to mouse-pointer in world-space does not intersect the virtual sphere, I simply find the closest point to it.

This results in something that acts like this example (not my code, just an example I found with the same implementation as me).

Notice the behaviour change when you click and drag away from the cube.

I'm not sure if it makes sense, but I am hoping for some way of allowing the cube to continue to rotate no matter how far away the mouse pointer gets, while still maintaining the useful property of standard Arc Ball that returning the pointer to the starting point will undo all rotation.

Any suggestions?

sentences:
Monetize solitaire game I recently released my first game - solitaire for ios.

What the best way to monetize game?

Options I have in mind:

In-app purchase themes (cards, backgrounds etc...)
Ads subscription (remove ads)
Limited number of games which can be played in certain
period of time with possibility to buy “life”.
Paid return (back) button.

Thank you in advance!

sentences:
Do you need resource manager for HTML5 games? Usually, resource manager is needed for desktop/mobile games. But is it needed for HTML5 (browser) games?

Resource manager's main responsibility is to make sure there is no clone of a resource in memory. But in browser, when you request something, the request is usually cached. So when you make another request to the same resource, the resource is not loaded anymore. You immediately get it. (CMIIW).

So, do you need resource manager for html5 browser games?

Thanks.

sentences:
Trapping mouse inside window in OpenGL with GLUT? I perfectly understand that GLUT is limited and the following problem can't probably be solved with OpenGL/GLUT, but since I don't know exactly if it can or not, I better just ask. Maybe I'm doing something wrong or forgetting something important. Or probably not and GLUT doesn't get better than this.

My problem is that I can't trap the mouse inside the window. Well, actually, I can, the code below does just that. I trap the mouse inside the window and I can use the mouse freely to rotate the world. The problem? If I move the mouse too fast I can get way from window prison.

Is there a way around this with OpenGL/GLUT or the only option is another library or make some calls to the Windows API directly? Enough words, here's my current code:

void processPassiveMouseMotion(int x, int y) {
    static int centerX = glutGet(GLUT_WINDOW_WIDTH) / 2;
    static int centerY = glutGet(GLUT_WINDOW_HEIGHT) / 2;

    CameraAngle.x = -1.0f * (y - centerY);
    CameraAngle.y = -1.0f * (x - centerX);

    if(CameraAngle.x != 0.0f || CameraAngle.y != 0.0f) {
        SceneCamera.Rotate(CameraAngle);
        glutPostRedisplay();

        glutWarpPointer(centerX, centerY);
    }
}

glutPassiveMotionFunc(processPassiveMouseMotion);

sentences:
Level design - modular vs single project I'm working in Blender and UE4 for a while now...

I always have the dillema of how to create my levels. My two ideas are:
a) modular - like lego blocks. Create a wall, a floor, wall with hole for a window etc inside blender, and then, in UE4 make a level out of them. The advantage here is that I can arrange them however I want. The disadvantage is - I always have a problem getting the elements to fit properly. Even if I scale one element up or down, everything else starts falling apart.

b) single project - make a whole object like a room or house in blender. Then everything connects nicely, but I'm always worried that it will be harder to edit, and I usually end up messing something. For example, whole house looks great, but inside the game a window is way too high, or the doors are too narrow to go through.

My question:
What should I do - should I stick to one method and try to fix the disadvantage? If yes, how would I do that? Is one of the methods considered "better" or the "industry standard"?

sentences:
How can i make my program use 2 windows? I'm working in Xna 4.0 and iwant to make a program that uses the same code in 2 different windows.
What i want out of this is that one player plays in one window and the other player to play in the second window.

So i have 2 different questions:

Is it possible to use 2 windows for the same program?

Is it possible for 1 window to have focus on one controller and the other window on the other?

sentences:
How can I plug a Unity application into native Android and native iOS? There are a lot of questions about running native Android and iOS code in Unity.  I am trying to run Unity inside of native Android and native iOS apps.

My problem is that I have two native apps, and I don't want to write code twice when I add a feature.

I currently have two native apps - one in Android and one in iOS.  I am trying to write code once, and add it to both.  Can I write a Unity program, and put that into my native apps?

I am thinking something along the lines of writing a Unity Android app, building it as an Activity instead of an APK, and launching that Activity from the native android app.  Then also the equivalent in iOS, whatever that may be.

Does anyone know a solution to this problem?

sentences:
How can I move an object in a direction other than the ordinals? I want to move a game object from its current position to the mouse position, but my current code only ever moves in one of the eight ordinal directions. In other words, I want it to move along the red path, but I only know how to move it along the white path.

Here's my code:

while(cont){
    if(x1 > x){
        x++;
    }else if(x1 < x){
        x--;
    }
    if(y1 > y){
        y++;
    }else if(y1 < y){
        y--;
    }
    frame.repaint();
    sleep(); // Thread.sleep(200)
}
// x1 y1 - mouse position
// x, y - sprite position

What am I missing?

sentences:
How does the SAT collision detection algorithm work There are a lot of tutorials and sample code available showing how to implement the SAT collision detection algorithm.

But can someone explain, without math or code, what are  the general principls behind this technique.

sentences:
Change collision body position in Bullet Physics Hello World project I have got stupid and annoying problem in my app. I am using bullet physics and I've started with hello world example on wiki:
http://bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World

There is someting like this:

btDefaultMotionState* fallMotionState =
            new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,50,0)));

What is described as set object 50m above something. So I can change the height but nothing more. I can't move it left, right - anything. Also when I set 0 everywhere ( I mean in btVector3) the object is jumping up rather than falling down or better stay still.

Can someone help me with that?

Also are there any materials except those on bullets page where are some tutorials or something?

EDIT

The main thing which I want to achive is to move my object for example left not only top or bottom.

Hope It will help in understanding.

sentences:
How can I change the anchor point of a Pyglet sprite? while trying to make my game, I noticed that you can't change the anchor point of Sprites in pyglet.
I use some convoluted way(see bottom of the post) to draw my minimap(WIP) so that the rooms are centered and lined-up correctly, however, I thought of the following occurence.

I'll be using the mouse-pointer to direct a 2D person from the top. However, if the anchor point of a sprite is the bottom-left corner of the orginal image, how can you make it feel as though the anchor point is in the middle of the sprite.

This may not be so important for the Player, but it would be hell to algorithmically controll the NPC's that fight.

Any help and input appreciated.

Code:

        pic_img = image.load(imgPath)
        picX, picY = window.width/2,window.height/2
        pic = pyglet.sprite.Sprite(pic_img, x=picX, y=picY)
        pic.rotation = roomType.ImageRotation

        if pic.rotation == 0:
            picX = picX - pic.width / 2
            picY = picY - pic.height / 2
        elif pic.rotation == 90:
            picX = picX - pic.width / 2
            picY = picY + pic.height / 2
        elif pic.rotation == 180:
            picX = picX + pic.width / 2
            picY = picY + pic.height / 2

        elif pic.rotation == 270 or pic.rotation == -90:
            picX = picX + pic.width / 2
            picY = picY - pic.height / 2
        pic.x,pic.y = picX, picY

sentences:
Random white lines appearing while translating rendering slick 2d images Hmm I'm getting this weird problem that i think may be a bug with slick but when ever i translate an image in slick 2d for some reason a weird white line appears on the left side of every image like this

This is the method for rendering each of the tiles, btw they are 32x32 textures

public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
    g.translate(-playerX, -playerY);
    //render the blocks here
    for(int x = 0; x <= ((Size.WIDTH/Size.Tile)+1); x++) {
        for(int y = 0; y <= ((Size.HEIGHT/Size.Tile)+1); y++) {
            g.drawImage(Sprites.dirt, x*Size.Tile, y*Size.Tile);
        }
    }
    g.translate(playerX, playerY);
    //render the player here, dont touch
    //no texture it was based off an old sheet
    g.drawImage(Sprites.grass, (Size.WIDTH-Size.Tile)/2, (Size.HEIGHT-Size.Tile)/2);

Sprite Getter :

public class Sprites {
    public static Image SpriteSheet;
    public static Image grass;
    public static Image dirt;
    public static void Init() throws SlickException {

        SpriteSheet = new Image("assets/images/SpriteSheets/Sprites.png");
        grass = SpriteSheet.getSubImage(0, 0, Size.Tile, Size.Tile);
        dirt = SpriteSheet.getSubImage(0, 1*32, Size.Tile, Size.Tile);
    }
}

if you want to see the rest of the code it is at MC2D.zip

sentences:
Rotating a circle on its axis I have a circular shape object, which I want to rotate like a fan along it's own axis.
I can change the rotation in any direction i.e. dx, dy, dz using my transformation matrix.
The following it's the code:
 Matrix4f matrix = new Matrix4f();
 matrix.setIdentity();
 Matrix4f.translate(translation, matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), matrix, matrix);
 Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), matrix, matrix);
 Matrix4f.scale(new Vector3f(scale,scale,scale), matrix, matrix);

My vertex code:
 vec4 worldPosition = transformationMatrix * vec4(position,1.0);
 vec4 positionRelativeToCam = viewMatrix*worldPosition;
 gl_Position = projectionMatrix *positionRelativeToCam;

But, it's not rotating along its own axis, it is flipping like a coin instead. What am I missing here?

sentences: How can I make simple launcher for FiveM server? I would like to know how to create simple launcher for FiveM server. I don't need help about UI, design, etc. only script when someone clicks 'Play' it connects him to server. Thank you very much!

sentences:
How to create OpenGL models like the ones created by blender's wireframe modifier? How could I create programatically wireframe models like this out of a triangular mesh? What'd be the algorithm behind?

(Source)

Creating an additional mesh using lines instead triangles or just using a single mesh with the typical geometry shader using barycentric coordinates are the most straightforward approaches. But they're far away from being as cool as the results shown in the above link.

So I was wondering how difficult would be creating a new mesh like the shown in the above link, would it be possible to achieve by just having a simple triangle soup?

sentences:
Unity - Check if sprite is within range around player I need to know if a sprite is within range (circle or square doesn't matter) around the player. If the sprite is, let's say, 100 blocks away from the player, I will disable it. This wouldn't be too much of an issue, just compare positions and you're done. However, my game is a tile based game and I want the world to be as big as possible, which will result in millions of sprites.

I could also add a overlapcicle2D, but the problem is this these objects can't have a collider, since they could be walkable.

So how can I check if the millions of sprites are in range of the player, without lowering performance?

Alternatively, I could add occlusion culling. But how do you do this with sprites?

sentences:
CGVectorMake to move SKNode at a certain speed towards the middle of screen? I am trying to launch my ball sprite towards the middle of the screen at the same speed every time I launch it.

let vel: CGFloat = 1000

dx = size.width / 2 - ball.position.x
dy = vel - size.height / 2 - ball.position.y

ball.physicsBody?.velocity = CGVectorMake(dx, dy)

This works in that it does launch the ball towards the center of the screen but at differing speeds depending on where the ball starts from.

sentences: Tetris Copyright Issues? I am making a Tetris clone with a new idea but I won't use the Tetris or Tetriminos name in the game I will refer to them as Tetrominos. Will there be copyright issues if I release this game? Does the Tetris company own the right to produce "Tetris" games?

sentences:
Why the transform never rotate between the range angle of 70 and -70? When running the game the rotationRange is always 0.

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

public class Rotateturret : MonoBehaviour
{
    public enum RotateOnAxis { rotateOnX, rotateOnY, rotateOnZ };
    public bool randomRotation = false;
    [Range(0, 360)]
    public int rotationRange = 70;

    private void Start()
    {

    }

    private void Update()
    {
        if (randomRotation == true)
        {
            rotationRange = Random.Range(rotationRange, -rotationRange);
            transform.Rotate(Vector3.right, rotationRange);
        }
    }
}

I want it to rotate on the x axis between 70 and -70

sentences:
How to make something rotate a certain amount over an exact amount of time I'm trying to make a plane rotate down a certain amount and 180 degrees horizontally over 2 seconds.

Basically I want it to take the plane 1 second to rotate to a horizontal-facing angle, then take the other second to rotate 180 degrees around to face the other direction.

The formula I'm currently using is:

    //If you're rotating, lower the speed and rotate the plane.
    if (rotate == 1 && rotationPhase > 0) {
        //If in phase 0, figure out which phase you need too go to.
        if (angle > 90 && rotationPhase == 1) {
            //Rotation phase 2 = rotating down
            rotationPhase = 2;
            rotationAngleTime = angle - 90;
        }
        else if (rotationPhase == 1) {
            //Rotation phase 3 = rotating up
            rotationPhase = 3;
            rotationAngleTime = 90 - angle;
        }

        //After phase 0, if in phase 1 begin rotating down, if in phase 2 begin rotating up.
        if (angle > 90 && rotationPhase == 2) {
            transform.Rotate(0, 0, -rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)));
            angle -= rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (angle > 89 && angle < 91) {
                angle = 90;
                rotationPhase = 4;
                rotationAngleTime = 180;
            }
        }
        else if (rotationPhase == 3) {
            transform.Rotate(0, 0, rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)));
            angle += rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (angle > 89 && angle < 91) {
                angle = 90;
                rotationPhase = 4;
                rotationAngleTime = 180;
            }
        }

        //After you have rotated to horizontal in phase 1/2, rotate around to face the other direction.
        if (rotationPhase == 4) {
            transform.Rotate(rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2)), 0, 0);
            rotationAngle += rotationAngleTime * (Time.deltaTime * (rotationSpeed / 2));
            if (rotationAngle > 179) {
                rotationAngle = 0;
                rotationPhase = 0;
                rotationAngleTime = 0;
            }
        }
    }

I've tried many different things, but I can't figure out what to do.

EDIT:
This seems to be a problem with Time.deltaTime. I can get the plane to rotate correctly, but for some reason it's not rotating over the right amount of time. I have a timer being subtracted by Time.deltaTime, and this animation happening, and the animation always finishes about half a second before the timer runs out.

sentences:
Is there a standard way to track 2D tile positions both locally and on screen? I'm building a 2D engine based on 32x32 tiles with OpenGL.  OpenGL draws from the top left, so Y coordinates go down the screen as they increase.  Obviously this is different than a standard graph where Y coordinates move up as they increase.

I'm having trouble determining how I want to track positions for both sprites and tile objects (objects that are collections of tiles).  My brain wants to set the world position as the bottom left of the object and track every object this way.  The problem with this is I would have to translate it to an on screen position on rendering.  The positive with this is I could easily visualize (especially in the case of objects made of multiple tiles) how something is structured and needs to be built.

Are there standard ways for doing this?  Should I just suck it up and get used to positions beginning in the top left?

Here are the OpenGL calls to start rendering:

// enable textures since we're going to use these for our sprites
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

// enable alpha blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// disable the OpenGL depth test since we're rendering 2D graphics
glDisable(GL_DEPTH_TEST);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);

I assume I  need to change:

glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);

to:

glOrtho(0, WIDTH, 0, HEIGHT, 1, -1);

sentences:
Rectangular area light illuminance - colour banding I'm currently working on an implementation of rectangular area lights but I am having some issues with the illuminance calculation, which gives me serious colour banding across the entire lit area. I'm using the paper published by DICE, "Moving Frostbite to Physically Based Rendering" (http://www.frostbite.com/2014/11/moving-frostbite-to-pbr/) as my base for implementation (Listing 12).

This is the relevant code used:

Solid angle of the rectangle

#define M_PI 3.14159265358979323846
float RectangleSolidAngle(vec3 worldPos, vec3 p0, vec3 p1, vec3 p2, vec3 p3)
{
    vec3 v0 = p0 - worldPos;
    vec3 v1 = p1 - worldPos;
    vec3 v2 = p2 - worldPos;
    vec3 v3 = p3 - worldPos;

    vec3 n0 = normalize(cross(v0, v1));
    vec3 n1 = normalize(cross(v1, v2));
    vec3 n2 = normalize(cross(v2, v3));
    vec3 n3 = normalize(cross(v3, v0));

    float g0 = acos(dot(-n0, n1));
    float g1 = acos(dot(-n1, n2));
    float g2 = acos(dot(-n2, n3));
    float g3 = acos(dot(-n3, n0));

    return g0 + g1 + g2 + g3 - 2.0f * M_PI;
}

Illuminance calculation

float RectangleIlluminance(vec3 worldPos, vec3 worldNormal, AreaLightData lightSource)
{
    float result = 0.0f;

    if (dot((worldPos - lightSource.position), lightSource.normal) > 0.0f)
    {
        float hWidth = lightSource.halfWidth;
        float hHeight = lightSource.halfHeight;

        vec3 p0 = lightSource.position + lightSource.right * -hWidth + lightSource.up * hHeight;
        vec3 p1 = lightSource.position + lightSource.right * -hWidth + lightSource.up * -hHeight;
        vec3 p2 = lightSource.position + lightSource.right * hWidth + lightSource.up * -hHeight;
        vec3 p3 = lightSource.position + lightSource.right * hWidth + lightSource.up * hHeight;

        float solidAngle = RectangleSolidAngle(worldPos, p0, p1, p2,    p3);

        float illuminance = solidAngle * 0.2f * (
                            Saturate(dot(normalize(p0 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p1 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p2 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(p3 - worldPos), worldNormal)) +
                            Saturate(dot(normalize(lightSource.position - worldPos), worldNormal)));

        result = illuminance;
    }

    return result;
}

The paper mentions some level of banding but it should not be on the level which I am currently getting, which can be seen in motion in this video: https://youtu.be/gmkOOxIYc9s .
These images show the illuminance without shadows or anything.

From what I can gather from the paper, the code is correct. The current solution is deferred, reconstructing position using the depth stencil texture and sampling normals from a RGBA32F texture (trying to eliminate precision issues). A directional light also seems to produce some level of banding, although not as visible as with the area light, which can be seen in the following images.

So maybe it's still just a precision issue? The code for handling my depth and position reconstruction looks like this:

uniform sampler2D gDepthStencil;

vec4 ReconstructWSPosition(float z, vec2 uv_f)
{
     vec4 sPos = vec4(uv_f * 2.0f - 1.0f, z, 1.0f);
     sPos = gInvProjView * sPos;
     return vec4((sPos.xyz / sPos.w ), sPos.w);
}

void main()
{
    ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);
    float depth = texelFetch(gDepthStencil, pixel, 0).r * 2.0f - 1.0f;
    vec4 wPosition = ReconstructWSPosition(depth, uv);
}

Which to me looks correct, but I might be missing something. Any other ideas or suggestions? Maybe a matter of tonemapping/HDR problems?

sentences:
MMORPG Server architecture: How to handle player input (messages/packets) while the server has to update many other things at the same time? This is more or less like what I'm thinking up to now:

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

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

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

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

sentences:
How do OpenGL ES 2 engines typically handle automatic geometry sorting and batching? I'm trying to write a basic OpenGL ES 2 engine that can automatically sort and batch a fairly flexible set of input draw descriptions.

When I say 'draw description' I mean the actual uniforms, state, the shader, etc required to issue a single draw command for some geometry described by a vertex/index buffer.

When I say 'sort' I mean order a list of draw descriptions so that unnecessary state changes are minimized (ie. sort by surface, then shader, then texture, etc)

When I say 'batch' I'm specifically referring to merging draw calls by merging multiple vertex/index buffers that share the same draw description.

What I've tried

It seems like if you can sort a list of draw descriptions, you can batch as well because you can group draw descriptions that compare identical. So I thought I'd create something like:

std::map<DrawDesc,std::vector<Geometry>,DrawDescComparator>

std::map sorts the DrawDescs and I can stash geometry for identical draw descriptions in std::vector for batching.

However, I'm having trouble creating a draw description object that encapsulates all the required information, and specifically allows it to be compared.

Some things are easy to describe and compare, like a shader which can be assigned a unique id. Other things get complicated; to check if blend state is the same between two draw descriptions I'd have to look at (blend_enabled, equation_rgb, src_rgb, dst_rgb, equation_alpha, src_alpha, dst_alpha, and blend_color) in the worst case:

bool CompareBlendState(DrawDesc a, DrawDesc b)
{
    if (!a.blend)
        return true;

    if (!b.blend)
        return false;

    if (a.equation_rgb != b.equation_rgb)
        // just use the underlying gl_enums for a consistent comparison
        return a.equation_rgb < b.equation_rgb;

    if (a.src_rgb != b.src_rgb)
        return a.src_rgb < b.src_rgb;

    //...

    if(a.etc != b.etc)
        return a.etc < b.etc;

    return false;
}

This is probably probably pretty inefficient. One possible way of making this nicer is storing blend state information in a std::bitset and just comparing the corresponding integer(s)

In general though, I feel like I may be barking up the wrong tree. There's way more state to compare (depth, cull modes, etc) and I don't want to create a difficult-to-maintain mess of code.

I'd like to know how other engines or libraries (unity, ue4, etc) typically handle this problem and if there's a common approach I've missed.

sentences:
Physics.CheckSphere never returning true despite being called to where a hitbox is I'm trying to create a random level generator where I have a load of rooms 16x10 and I generate them when the player enters the room. I want to check the space where I want to place a room, in this case up for if there's already a room there. I've written this code to do that but it doesn't appear to be working. Currently it should ALWAYS return true (and not run the code) because the object it is on has a hitbox. I want it to hit triggers because then I don't need a physical block in the centre of every room (hard when the rooms are even both ways)

Can you see what's wrong here? The code does spawn a block in the correct place.

if (!Physics.CheckSphere(new Vector2(transform.position.x, transform.position.y), 1f, 6, QueryTriggerInteraction.Collide))
        {
            //Get list of open bottoms
            getList("Assets/Room Lists/bottom.txt");
            //Make a random number from the list
            int newRoomIndex = random.Next(0, prefabObjects.Count);
            //Get that object
            GameObject newRoom = prefabObjects[newRoomIndex];
            //Place it in the world in the correct position
            Instantiate(newRoom, new Vector3(transform.position.x - 8, transform.position.y + 15, transform.position.z), Quaternion.identity);
        }

sentences:
Reading a Binary File in Unity I am trying to display the first two bytes of a binary file as a test. I have the following code.

 void DisplayValuestext(){
  Stream s = new FileStream("Assets//testbinary.bin", FileMode.Open);
  BinaryReader br = new BinaryReader(s);
  int dataVal = br.ReadUInt16();
  Debug.Log(dataVal);
 }

The first 2 bytes of the binary file are "1E44" which the function ReadUInt16() should read. However, it reads the first byte of data, "1E" rather then the first 2 bytes "1E44". I believe it is because it reads 2 characters, rather than 2 bytes. When I display the 16 bit unsigned integer "dataVal" in the console, I get 25905. The value I am trying to get is 17438 which is "1E44" little-endian encoded value converted to decimal.

I have also attempted to use the function "ReadUInt32". This method should read the first 4 bytes, however it instead displaces by 4 characters, which is 2 bytes "1E44". The console displays "875849009".

Why do I get these strange values "25905" and "875849009" and how can I resolve this to get the desired value of 17438?

sentences:
How to prioritize related game entity components? I want to make a game where you have to run over a bunch of zombies with your car. When moving around, the zombies have a few things to take into consideration:

When there's no player around they might just roam about randomly. And even when some other component dictates a specific direction, they should wobble to the left and right randomly (like drunk people). This implies a small, random, deviation in their movement.
They should avoid static obstacles. When they see they are headed towards a wall, they should reorient themselves.
They should avoid the car. They should try to predict where the car will be based on its velocity and try to move out of the way.
When they can, they should try to get near the player.

All these types of decisions they have to do seem like they should be implemented in different components. But how should I manage them? How can I give different components different weights that reflect the importance of each decision (in a given situation)?

I would need some other component that acts as a manager, but do you have any tips on how I should implement it? Or maybe there's a better solution?...

sentences:
How to make the paddle stop at the screen edge in my Pong clone? Well, I'm obviously very new to game dev and Android. I've got a ball bouncing around (successfully detecting screen edge collisions so that the bitmap stays within screen) and a paddle that the user can move left and right with their finger.

At the moment there's a few things wrong with my method, but I will post it as is:

(current method from my paddle class that I use to manage touchevents:)

public void onTouchEvents(MotionEvent e, int viewW, int viewH){
        //DETECT PRESS
        if (e.getAction() == MotionEvent.ACTION_DOWN){
            // delegating event handling to the paddle
            handleActionDown((int)e.getX(), (int)e.getY());
        }
        //MOVE GESTURES
        if (e.getAction() == MotionEvent.ACTION_MOVE){
            if (isTouched()){
                //paddle is being dragged
                //Log.i(TAG, "paddle is being dragged");

                //SETTING NEW POSITION
                boolean collision = false; // to check wall collisions

                if (speed.getxDirection() == Speed.LEFT
                        && getX() - (bitmap.getWidth() /2) <= 0)
                {//Left wall collision
                    collision = true;
                    Log.i(TAG, "left wall col");

                }
                if (speed.getxDirection() == Speed.RIGHT
                        && getX() + (bitmap.getWidth() /2) >= viewW)
                {//right wall collision
                    collision = true;
                    Log.i(TAG, "right wall col");

                }

                if(collision == false){ //No wall collisions, no problem
                    setX( (int)e.getX() );
                }

            }
        }
        //PRESS RELEASED
        if (e.getAction() == MotionEvent.ACTION_UP){
            if (isTouched()){
                //no longer being dragged
                setTouched(false);
            }
        }
    }

At the moment when my paddle hits the right side of the screen it stops where it should (without the bitmap going off screen) but the user is unable to drag it back, presumably because collision is now stuck set at "false"  so setX is never called again.

Oddly, when the paddle hits the left side of the screen the bitmap can just be continued to be dragged off screen and the collision is never detected.

Obviously I can recognize that there are two different issues here and I've had several ideas of how to solve the first, still can't figure out whats wrong with the second.

To solve the first I've tried getting rid of the collision variable all together. I've tried putting setting the x position back at various points

//eg. (after right wall collision detected)
setX( (int)e.getX() - 1);

or using my toggle x direction method, the same I got working with my ball object

//eg ( xDirection = xDirection * -1; )
speed.toggleXDirection();

I've tried all kinds of re-positioning of the code that I could think of that would possibly get it working as intended but I haven't been able to figure it out, any help would be appreciated.

sentences:
Moving objects colliding when using unalligned collision avoidance (steering) I'm having trouble with unaligned collision avoidance for what I think is a rare case. I have set two objects to move towards each other but with a slight offset, so one of the objects is moving slightly upwards, and one of the objects is moving slightly downwards.

In my unaligned collision avoidance steering algorithm I'm finding the points on the object's forward line and the other object's forward line where these two lines are the closest. If these closest points are within a collision avoidance distance, and if the distance between them is smaller than the two radii of the two object's bounding spheres, then the objects should steer away in the appropriate direction.

The problem is that for my case, the closest points on the lines are calculated to be really far away from the actual collision point. This is because the two forward lines for each object are moving away from each other as the objects pass. The problem is that because of this, no steering takes place, and the two objects partially collide.

Does anyone have any suggestions as to how I can correctly calculate the point of collision? Perhaps by somehow taking into account the size of the two objects?

sentences:
Godot raycast colliding too high I am making an fps that uses a raycast for shooting. I used some suggestions taken from a few reddit pages, but it's mostly my own code. It was working properly, until I noticed that when you shot up above the enemy, it still registered as a hit. Does anyone know why this might be happening? code:
func use_weapon():
Raycast.force_raycast_update()
if Raycast.is_colliding():
    var collider = Raycast.get_collider()
    if collider:
        if collider.has_method("takedamage"):
            collider.takedamage(10)

sentences:
XNA Rendering vertices that only appear within the cameras view I'm making a game in XNA and I recall hearing that professionally made games use a technique to only render the polygons that appear within the cameras projection. I've been trying to find something on this to do something similar in my game, could anyone point me in the right direction? Right now all I have is a plane/grid of vertices that you can set the X/Y on which is drawn using DrawUserIndexedPrimitives, but I plan to make a bunch of props as scenery items and I can imagine myself running into issues later on if I don't address this now.

Thanks

sentences:
How do I create a fire sphere (fireball) in opengl? (opengl Visual C++) I'm making an evil Pacman in OpenGL and I need to make my spheres look like a fireballs, does anyone know how I do that?

And what material colour should I use?

Also, is there a colour palette to change the colour of my materials?

This is how I create a sphere:

GLfloat mat_ambient[] = { 0.25, 0.25, 0.25, 1.0 };
GLfloat mat_diffuse[] = { 0.4, 0.4, 0.4, 1.0 };
GLfloat mat_specular[] = { 0.774597, 0.774597, 0.774597, 1.0 };
GLfloat mat_shine = 0.6;

glMaterialfv (GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv (GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialf (GL_FRONT, GL_SHININESS, mat_shine * 128);

glPushMatrix();
glTranslatef(x,y,0);
glutSolidSphere(size, 20, 10);
glFlush();
glPopMatrix();

sentences:
Android NDK - moving .so files from one project to another I have a small project I've coded for Android that uses a small about of NDK/JNI code. I'd like to share this code between two projects but I'm having little luck so far. First off, I've tried to refactor off the NDK specific code into a library which I think link to both projects using

'project->java build path->source->link source'

and specifying the native library in there. Sounds good but it's wrong. The project from which I refactored the code still requires the .so library file in

MyOriginalProject\libs\armeabi\MyNativeLibrary.so

Removing that from the original project whilst still linking the source of the refactored library fails.

Secondly, creating a new project and attempting to use the NDK library I wrote by both including the source of the library and copying over the .so files from 'obj' and 'libs' into the root directory of the new project fails. It seems to pass

System.loadLibrary("MyNativeLibrary")

At least, it didn't assert.

The code gets as far as my first NDK call and then crashes without being caught by my exception handler.

Any hints would be welcome - such as foolproof ways to get NDK to load a library, typical gotchas and NDK debugging techniques.

Thanks in advance,

Tim.

sentences:
Why is my depth buffer texture so bright? https://www.youtube.com/watch?v=QuvAEqgHrMY&feature=youtu.be

https://www.youtube.com/watch?v=5ob1JsPIGAs&feature=youtu.be

gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 1.f); //values used for first video
gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 2000.f);//values used for second video, the further z clip value seems to improve the depth rendered, but far from example images below.

I set my projection matrix with gluPerspective.

This seems to happen when I try gluPerspective; when I set my projection matrix to first person.

The type of image I would like to get is

Is the visual result I am getting correct? Then are the listed examples of depth buffer images are merely a result of refining post rendering process, that are simply added in order for humans to see it better?

sentences:
What C++ features should I know about for a graphics programming job interview? I really don't want to be boring, I searched a lot but didn't found a focused answer to this question. I wanted to focus on the role of C++ in graphics programming.

Can  somebody explain, which are most likely/ most often used  C++ features (such as data structures), which are used in graphics programming? I am supposed to have an interview on this topic, so please shed some light on the features I should emphasize for an interview specific to C++ graphics programming.

sentences:
Moving large group of units 1 by 1 takes too long, how can I improve this? I use use Unity's own NavMesh/AI system and I think it works pretty well. The only problem I have is that when I move large groups of units, they will find a path one by one, but it takes a really long time as you can see in the video:

https://gfycat.com/blankhalfdartfrog

To set destinations I use this:

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

I know I could wait until they all have pathPending == false, but that would mean the entire group moves with a huge delay. Is there some way I can improve or fix this issue?

Edit: It is quite simple to recreate (if you have some basic knowledge on Unity NavMesh): simply create a "click to move"-script that moves a List of units to where you clicked using the code above (just fill the list in Start on each unit). Put down a few obstacles and you're done.

sentences:
Switching renderer off/on for an object in unity using C# I have a GameObject called 'Stone' that is rendered on Game Play. I have attached a C# script called RenderOff to to make 'Stone' invisible on Game Play.

RenderOff.cs

using UnityEngine;
using System.Collections;

public class RenderOff : MonoBehaviour {

    void Start () {

        this.gameobject.renderer.enabled = false;

    }

}

It has errors - Type 'RenderOff' does not contain a definition for gameobject' and no extension methodgameobject' of type `RenderOff' could be found.

What does that mean ?

sentences:
Should I use Box2D for collision-detection only (not simulating physics)? I'm using Box2D only to check collisions and for no physical simulation. I create bodies (and shapes for them) and use my own code to move them, by setting their velocities and positions every frame. I only fetch collision data from the Box2D world.

Is this a good idea? For example, can it cause undefined behaviour from Box2D? Is there a more performance friendly way of dealing with different shape collision detections?

Do better methods exist for this?

sentences:
How should I arrange storage for components referenced in a quad tree? I like the Unity's entity-component-system approach, I'm working on something similar. However I'm not sure where and how I should store the components.

An easy answer would be: "store the components in the corresponding system" - this is logical (who else is interested in the component if not the handler system?), and cache-friendly (continuous memory, so iterating through the collection would/could cause less cache miss).

However there are two major problems with this approach. Actually it's only one which generates the other. The generated problem is the simpler, I start with that:

A Behaviour (aka. custom user script) component can be added to the GameObject (aka. entity). The Behaviour must be able to get other components which are added to this object (similar to Unity's MonoBehaviour). However the object is not storing any component directly, so we have to query the component from the corresponding system. In a simple world, this query can be done only once after the required component is created, because its address won't change until its actually removed. This way, the Behaviour component can query other components in its constructor/init function and everyone is happy. But what if the other component's address can change? Actually this is the root cause of this problem and it's generated by the next one:

Storing components in an array can be a good thing because it's memory(bus) friendly. However it's not ideal in some cases, eg. when I have a spatial partitioner tree (QuadTree right now). I have two choices:

1)

I can keep the "global" continuous array representation and store pointers only in the QuadTree. However, this way when I query the components which belongs to a QuadTree node and iterate on the result, cache misses are introduced (jumping back and forth in the memory).

// pseudo-code

// "global" storage
pool<RigidBody> rigidBodies;
pool<Mesh> meshes;
// etc.

QuadTreeNode
{
    // only pointers to the "global" array elements
    vector<RigidBody*> rigidBodies;
    vector<Mesh*> meshes;
}

2)

I can use node-based component array which means the iteration is more cache-friendly. But when the component has to be moved to a different QuadTree node, it must be removed from the current node and must be copied to the new one. This means the component's memory address is changed which also generates my first problem (cannot query only once, because the address can change).

// pseudo-code

// not-partitioned components
pool<Behavior>

QuadTreeNode
{
    // these are not pointers, but the actual data
    pool<RigidBody> rigidBodies;
    pool<Mesh> meshes;
}

I probably pick the 1st solution, because the cache-miss is probably less noticable than the constant remove-copy and query operations (at least for "moving" components).

However, I'm interested in any better representation/storage of the components which is both cache-friendly and operation-friendly.

sentences:
How can I parent an object whilst animating? Much like in Blender where you can parent an object to another, or the Armature, is it possible to parent an object to another, so when animating, the child object moves with the parent?

I've tried dropping the object I want influenced onto the character's parent object in the hierarchy and accessed it via the Animation tab. I added the object as a property and adjusted it's position, but the results have been pretty mixed.

How can I have an object automatically follow the animation without manually adjusting its curves for each frame?

sentences:
What do sandbox games usually do when generating new terrains? I am trying to make a minecraft. In my game, when the player moves to the boundary, new chunks will be generated.

What I do is creating new chunks in my main thread and generating a new VBO to store them. But I find that it's quite inefficient and you can obviously feel the FPS is decreasing.

What do these kinds of games usually do when generating new terrains? Do they use multi-threads or some specific efficient algorithms or compute shaders (I still don't know much about OpenGL)? I once tried to generate my new terrains in another thread. But I found I can't use GL operation to generate VBO in another thread. I am thinking about pre-generated some VBOs in my main thread. Is that the right way?

I want to know what most people do in this situation.

sentences:
Get Final output from UDK ( sorry for my bad english in advance :D )

I'm trying to get a .exe setup output, from my UDK !( with my own maps and scripts which I made within MyGame)
I tried UnrealFrontEnd! But It made a setup , that after installation I can see my .udk maps, my packages and etc.
But It's not a real output that I can show to my customers. I don't want, other can use my resources !

So... How can I get a binary-like output from UDK as a real Game-Output ? ( like what we see in all commercial games )
Is there any option in frontend that I missed ?

sentences: How to render depthmap image in 3d? I'm new to game development and XNA. I have this depthmap image and I want to render it in 3D, how do I do it, any tutorial or blog post would be helpful.

sentences:
Lightwight cross browser library for server side push? I am looking for a lightweight javascript library that allows the server to push update information to the client reliably and regularly. We use a fixed turn time of 300ms and often there are only about 20 bytes of changes. So doing polling using XMLHttpRequest would imply a huge overhead (3-way tcp handshake, http request headers, http response header).

There area number of alternatives, but they have limited browser support:

streaming <script>-tags in another frame (does this work on IE?)
MIME multipart/x-mixed-replace responses (Firefox, Safari, Opera only?)
WebSockets (removed from recent beta version of Firefox and announced to be removed from Opera 11 because of security issues)
Server-sent events (only Opera?)
Java / Flash relays (requires the users to have those plugins installed)
Polling using XMLHttpRequest (huge overhead)

Is there a website which has recent information on which technology works in which browser?  Are there javascript libraries which provide a common cross browser interface that hides the messy details? (Yes, i know that it still requires me to write multiple server sides, but that is rather easy. And more important it is easy to write automatic tests for the server sides).

sentences:
What can I do with the 4th component of gl_Position? When I set gl_Position I usually assign it such as gl_Position = vec4(in_position, 1.0) where in_position as a vector of three components representing a vertex of my model.

But looking up tutorials and such I cannot find anything explaining what the 4th component of the gl_Position vec4 is doing aside from making the vector big enough so matrix transformations can be applied to it.

Q: What can I do with the 4th component of gl_Position / what does it influence in the rendering process?

sentences:
Using multiple shaders in OpenGL3.3 guys, I got a question on how to use multiple shaders in my app. The app is simple: I have a 3D scene, say, simple game and I want to show some 2D GUI in the scene. I was following this tutorial on how to add font rendering to my scene. One difference is that I am using Java and lwjgl, but everything is implemented as in the tutorial.

So I have 2 sets of shaders (2 programs). 1st that handles the 3D models and scene at all. I added the second set of shaders, I just copied them from the tutorial. Here are they:

vertex:

#version 330
in vec2 position;
in vec2 texcoord;
out vec2 TexCoords;
uniform mat4 projection;

void main() {
    gl_Position = projection * vec4(position, 0.0, 1.0);
    TexCoords = texcoord;
}

and fragment:

#version 330
in vec2 TexCoords;
out vec4 color;

uniform sampler2D text;
uniform vec3 textColor;

void main() {
    vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);
    color = vec4(textColor, 1.0) * sampled;
}

I compile shaders, link them into a separate programs. (so I have modelProgram and fontProgram). However, when I run my application, I see errors in the console (however, the application runs fine):

WARNING: Output of vertex shader 'TexCoords' not read by fragment shader
ERROR: Input of fragment shader 'vNormal' not written by vertex shader
ERROR: Input of fragment shader 'vTexCoord' not written by vertex shader
ERROR: Input of fragment shader 'vPosition' not written by vertex shader

As you can see TexCoords is an out variable in font.vs.glsl and the other 3 are in variables in model.fs.glsl. So they belong to the other set of shaders, other program.

My question is why this happen? It looks like the pipeline tries to combine one program with another, although the application runs smoothly.

The other problem I have is that I do not see any text rendered. I don't know whether this is caused by this or it happens because something else. Any help will be appreciated!

Thank you

sentences:
storing user data for rpg I'm creating a single player Web rpg that will store a decent amount of information about the player, items,  map,  npcs,  etc.

I have been developing html5, javascript, php, and the mysql database approach and saving/retrieving with json.

Someone mentioned for my purposes,  using 'localStorage' persistent user storage would remove much complexity and help with performance.

Is localStorage the better way to go here?  If I wanted to find out information about my players, or ensure that esch player profile is saved... can I rely on localStorage?

What are the pros and cons of each?

sentences:
Getting the bounding box of a sphere I have a sphere with values center,radius and I need to convert the sphere to a bounding box with values min,max.

How do I convert a sphere into a bounding box?

sentences:
Using Java on mobile, should I avoid object construction to reduce GC overhead? I new to both Java and game development and working on my first LibGDX game targeting mobile systems.

How problematic is the garbage collector in a mobile environment? Should I try to reuse as many class instances as possible (e.g. with the object pool pattern), or only do it for the classes that I use most (like projectiles)?

How what instantiation rate warrants this optimisation? Or is the compiler “sufficiently smart” to effectively nullify this problem?

sentences:
Help me adjust this RPG logarithmic leveling formula! I'm trying to find a formula that's fits the way I want my player to gain experience and level up. I know this is primarily opinion based but I hope someone can help me!

I've used the following formula as a base, I found it here:

//Calculate level
Level = Math.Max( Math.Floor(6.7f * Math.Log(Experience + 455f) + -40f), 1 );

//Calculate experience for level
Experience = (long)(Math.Exp((Level - -40f) / 6.7f) - 455f);

I wrote a script that will show what it will look like, which is this:

I want to find a way to make it very easy for the player at early levels (let's say until level 15~), and then slowly harder. I'm not sure how to change the formula or if it's even possible! Hope you can help!

sentences:
Top down space game control problem As the title suggests I'm developing a top down space game.

I'm not looking to use newtonian physics with the player controlled ship. I'm trying to achieve a control scheme somewhat similar to that of FlatSpace 2 (awesome game). I can't figure out how to achieve this feeling with keyboard controls as opposed to mouse controls though. Any suggestions?

I'm using Unity3d and C# or javaScript (unityScript or whatever is the correct term) works fine if you want to drop some code examples.

Edit: Of course I should describe FlatSpace 2's control scheme, sorry. You hold the mouse button down and move the mouse in the direction you want the ship to move in. But it's not the controls I don't know how to do but rather the feeling of a mix of driving a car and flying an aircraft. It's really well made. Youtube link: FlatSpace2 on iPhone

I'm not developing an iPhone game but the video shows the principle of the movement style.
Edit 2
As there seems to be a slight interest, I'll post the version of the code I've used to continue. It works good enough. Sometimes good enough is sufficient!

using UnityEngine;
using System.Collections;

public class ShipMovement : MonoBehaviour
{
    public float directionModifier;
    float shipRotationAngle;
    public float shipRotationSpeed = 0;
    public double thrustModifier;
    public double accelerationModifier;
    public double shipBaseAcceleration = 0;
    public Vector2 directionVector;
    public Vector2 accelerationVector = new Vector2(0,0);
    public Vector2 frictionVector = new Vector2(0,0);
    public int shipFriction = 0;
    public Vector2 shipSpeedVector;
    public Vector2 shipPositionVector;
    public Vector2 speedCap = new Vector2(0,0);

    void Update()
    {

   directionModifier = -Input.GetAxis("Horizontal");

   shipRotationAngle += ( shipRotationSpeed * directionModifier ) * Time.deltaTime;

   thrustModifier = Input.GetAxis("Vertical");

   accelerationModifier = ( ( shipBaseAcceleration * thrustModifier ) ) * Time.deltaTime;

   directionVector = new Vector2( Mathf.Cos(shipRotationAngle ), Mathf.Sin(shipRotationAngle) );
   //accelerationVector = Vector2(directionVector.x * System.Convert.ToDouble(accelerationModifier), directionVector.y * System.Convert.ToDouble(accelerationModifier));
   accelerationVector.x = directionVector.x * (float)accelerationModifier;
    accelerationVector.y = directionVector.y * (float)accelerationModifier;
   // Set friction based on how "floaty" controls you want

    shipSpeedVector.x *= 0.9f; //Use a variable here
    shipSpeedVector.y *= 0.9f; //<-- as well
   shipSpeedVector += accelerationVector;

   shipPositionVector += shipSpeedVector;

   gameObject.transform.position = new Vector3(shipPositionVector.x, 0, shipPositionVector.y);
    }

}

sentences:
Unusual Lighting Effects - Random Polygons Coloured I am working on creating an object loader for use with iOS, I have managed to load the vertices, normals and face data from and OBJ file, and then place this data into arrays for reconstructing the object. But I have come across an issue with the lighting, at the bottom is a video from the simulation of my program - this is with the lighting in the following position:

CGFloat position[] = { 0.0f, -1.0f, 0.0f, 0.0f };
glLightfv(GL_LIGHT0, GL_POSITION, position);

This is specified in both the render method each frame and the setup view method which is called once at setup.

Various other lighting details are here, these are called once during setup:

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
CGFloat ambientLight[] = { 0.2f, 0.2f, 0.2f, 1.0f };
CGFloat diffuseLight[] = { 1.0f, 0.0f, 0.0, 1.0f };
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
CGFloat position[] = { 0.0f, -1.0f, 0.0f, 0.0f };
glLightfv(GL_LIGHT0, GL_POSITION, position);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);

The video of the issue can be found here:

http://youtu.be/dXm4wqzvO5c

Thanks,

Paul

[EDIT]

Normals are also supplied by the following code, they are currently in a large normals array or XYZ XYZ XYZ etc...

// FACE SHADING
glColorPointer(4, GL_FLOAT, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);
glNormalPointer(GL_FLOAT, 3, normals);
glEnableClientState(GL_NORMAL_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3*numOfFaces);
glDisableClientState(GL_COLOR_ARRAY);

[ANSWERED!]

I have solved the issue but can't post the answer as I have too little reputation, but it was simply down to a typo!

glNormalPointer(GL_FLOAT, 3, normals);

should read

glNormalPointer(GL_FLOAT, 0, normals);

as all the normal data is in a single un shared array, so it does not need to skip values..

sentences:
Best way to test if some point on a line if in front of another point on the same line in 3D I have a line in 3D defined by point P0 and direction vector D.
For given input point P on a line defined as above, I want to test if P is in front of point P0. The code will be used in GLSL fragment shader.

So far, my best solution is following GLSL function:

bool IsInFront(vec3 P, vec3 P0, vec3 D)
{
  float d = length(P - P0);
  vec3 Pp = P0 + d * D;
  return (length(Pp - P) < 1.0E-4);
}

Explanation is simple. d is distance between P and P0, and there are only two possible positions on a line where a point with distance d from point P0 can be on a line: in front, or behind point P0. Then I just check if positive point is same as input P.

However, this code uses precision 1.0E-4, and recalculation of input point P. Is there a faster and numerically more stable way to do this?

Regards

sentences:
4-player arena game networking model : dedicated servers? So my question is not technically limited to 4-player games, but there has been a lot of games on steam lately (brawlhalla, duck game etc) that seem to be quite popular lately.

My question is, are these games hosted on a separate server, or do one player host the game, and the game developers just providing a match-making service?

If it's hosted by one of the player, how do they get around with NAT issues? If hosted by some server somewhere - that sounds like it's super expensive to run?

Also, for these games, what kind of networking model is "standard"? Are there any articles about this I can read?

sentences:
Generating a town layout in a grid I want to generate a town layout in a square grid (rendered isometrically, but that doesn't matter) using the following elements:

2x2 Houses
Roads, 1 unit wide
Canals, 1 unit wide

Sample layout:

I always have a specific number of houses, and as many roads and canals as necessary to connect them all.
The houses need to have two pieces of road in front of their front door (which is always pointing to the right)
It would be nice to have fields of grass (emptiness) inbetween.

Is there a ready-made algorithm for this? If not, what direction should I be thinking of to implement this?

sentences:
Sprite Kit - keeping character level with the terrain 2d endless runner I've been trying to figure this out exhaustively for the past few days and still haven't found an answer.  I have an endless runner built using swift where the character is fixed and the terrain moves to the left.  I have edge physics bodies on the terrain, and edge physics bodies that go up and down slopes.

The problem is, if I want my character to collide with the ground without being pushed back by it, since the only thing that can make contact with an edge is a dynamic volume.

My goal is to keep the character level with the terrain, (assuming they're not jumping).  Even on slopes.

I've tried ray casting using enumeratebodiesalongraystart, but can't seem to figure out how to get coordinates of where it intersects with the ground.  I've tried having an edge body that is vertical, that intersects with the ground(two edge bodies cannot make contact in sprite kit).  I've tried dynamic volumes.  I've tried Static volumes.  Nothing works.  I'm not posting code here since I'm really just looking for a general answer to sort of point me in the right direction, but I'm coding in swift.  Thanks in advance.  Also I have the character in a different bitmaskcatagory than the terrain catagory and they are set up to recognize each other, and do if one of them is a dynamic volume physics body.

sentences:
Blender: How to merge two faces? Initial Situation
Using Blender 2.6, I often come to the same problematic setting: There are two faces on one straight line.

My Aim
I want to keep just one of the two selected faces, which you can see above. And all of the vertices adjoining the one face should be merged [Alt + M in Vertex Select Mode] with the apt vertex adjoining the other face.

Summary
I just simply need a tool working like Vertex Merging [Alt + M in Vertex Select Mode] for faces.
How can I do that easily?

sentences:
Reading messages from a certain client in Lidgren I'm setting up a game with Lidgren, and I was wondering if there was a way to read a message from a certain client instead of just from the server as a whole, such as-

//Why doesn't this exist?
NetIncomingMessage message = server.Connections[0].ReadMessage();

This way I would be able to split up reading data from each client into it's own thread and have a separate thread for sending data to each client. Currently there is only one loop in my server, which reads packets and I fear is favoring one client more than others, as some movements made by players take a while to be received by other players. I believe reading messages separately from each client would solve this issue. With simple TcpClients, you can read from each client's stream instead of the server as a whole, and I like this functionality but also rely on the simplicity of sending packets through Lidgren and was wondering if there was a similar functionality with Lidgren.

sentences:
How do i protect my game assets as an individual? For my first games, they will be well made, complete, but extremely simple, while i father enough funds to actually fund a game company.

But because I plan on releasing quality content under {insert my name here} Studio (trademark)(c)

and of course all of my games will be superseded by a (c), despite the fact I haven't even registered anything.

But the real question is, what steps do I need to take to make sure my content does not get stolen while im financially stable enough to file all the paperwork needed to maintain proper copyrights?

I'd also like to release a major title, but I'm scared to, because I know someone is going to try and steal it.

sentences:
LibGDX Textfield has no pointer cursor or blinking on hover / focus stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    Gdx.input.setInputProcessor(stage);
    TextField.TextFieldStyle style = new TextField.TextFieldStyle();
    style.font = font;
    style.fontColor = Color.BLACK;
    style.cursor =
    style.selection = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    style.background = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    text = new TextField("Name", style);
    text.setWidth(500);
    text.setHeight(37);
    text.setPosition(50, 50);
    stage.addActor(text);

When I draw my stage, I can see my textfield, but when I hover it, my cursor doesn't change, and when I focus I can't see that blinking " | " at all, like normal textfields have.

What did I do wrong? Is it because style.cursor is null? If yes, how can I set it to the default cursor that libgdx uses?

sentences:
What is the process for getting a dev-kit for Xbox 360 to allow native coding I'm curious about the process of getting a Xbox 360 dev-kit.

What are the requirements? Do you have to have a track record in game development. Can indie gamers get one. How much does it cost? Is there special hardware?

sentences:
Libgdx distorted texture size I'm just starting to learn LibGDX and have been having some troubles getting my world size to match with my texture size and box2d bodies. I have a texture 64x64 that I am trying to display but it takes up half of the window, both on desktop and android. I've tried scaling the texture down also. I am wondering if this has anything to do with my two variables FRUSTUM_WIDTH and FRUSTUM_HEIGHT being used in the creation of my camera.

  int FRUSTUM_WIDTH = 8;
int FRUSTUM_HEIGHT = 15;
World world;
Box2DDebugRenderer debugRenderer;

@Override
public void create () {
    batch = new SpriteBatch();
    img = new Texture("player.png");

    player = new Sprite(img);
    player.setPosition(5, 5);
    //player.scale(.8f);

    camera = new OrthographicCamera(FRUSTUM_WIDTH, FRUSTUM_HEIGHT);
    camera.position.set(FRUSTUM_WIDTH / 2, FRUSTUM_HEIGHT / 2, 0);

    world = new World(new Vector2(0, -50), true);
    debugRenderer = new Box2DDebugRenderer();

    setUpBox2D();

}

private void setUpBox2D()
{
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;

    bodyDef.position.set(4, 10);

    Body body = world.createBody(bodyDef);

    CircleShape circle = new CircleShape();
    circle.setRadius(1);

    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = circle;
    fixtureDef.density = 0.1f;
    fixtureDef.friction = 0.1f;
    fixtureDef.restitution = 0.5f;

    Fixture fixture = body.createFixture(fixtureDef);

    BodyDef groundBodyDef = new BodyDef();

    groundBodyDef.position.set(new Vector2(0, 1));

    Body groundBody = world.createBody(groundBodyDef);

    PolygonShape groundBox = new PolygonShape();

    groundBox.setAsBox(camera.viewportWidth, 1.0f);
    groundBody.createFixture(groundBox, 0);
}
@Override
public void render () {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    drawScene();
    updateScene();
}

private void drawScene()
{
    debugRenderer.render(world, camera.combined);
    camera.update();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    player.draw(batch);
    batch.end();
    world.step(1/60f, 6, 2);
}
private  void updateScene()
{

}

I do have a resize method but it is currently empty.

The window size is 480 by 800. I looked at a game called Super Jump on Github which helped fix my camera issue, but I am still having issues with the giant textures

sentences:
Why does OnControllerColliderHit not work while Physics.CheckSphere() does? Using the following code below, when my character hits a crate and goes over it, it ends up floating in the air, while jumping is no issue. That successfully lands on the ground.
using UnityEngine;

public class Testing: MonoBehaviour
{
    public CharacterController Controller;
    //speed of the character
    public float Speed = 12f;
    // earth gravitational value
    public float Gravity = -9.81f;
    Vector3 velocity;
    //hit point of character
    float hp = 90;

    bool Grounded = true;

    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        Grounded = true;
        hp -= velocity.magnitude;
        velocity.y = 0;
        Debug.Log(hp);
    }

    public void OnControllerColliderExit(ControllerColliderHit hit)
    {
        Grounded = false;
    }

    public void Checkstatus()
    {
        if (Grounded == false)
        {
            velocity.y += 0.5f * Gravity * Time.deltaTime;
        }
    }

    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space) && velocity.y == 0)
        {
            velocity.y = 12;
            Grounded = false;
        }

        //check if it grounded
        Checkstatus();
        Controller.Move(velocity * Time.deltaTime);
    }
}

Here's an image showing the floating player:

And why does the code below (using Physics.CheckSphere()) have no issue? Feels like the above code is better (if working correctly), as it doesn't need to waste resource on checking the condition of Grounded (like in checkstate1()) every frame.
using UnityEngine;

public class NewPlayerMovement : MonoBehaviour
{
    public CharacterController Controller;
    public float Speed = 12f;
    public float Gravity = -9.81f;
    Vector3 velocity;
    public LayerMask groundmask;
    float hp = 90;

    bool Grounded = true;
    // Update is called once per frame

    void checkstate1()
    {
        Grounded = Physics.CheckSphere(this.transform.position, 0.85f,groundmask);
        if (Grounded==true)
        {
            hp -= velocity.magnitude;
            Debug.Log(hp);
            velocity.y = 0; }
     }

    public void Checkstatus()
    {
        if(Grounded==false)
        {
            velocity.y += Gravity * Time.deltaTime;
        }
    }
    void Update()
    {
        checkstate1();
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space)&&Grounded==true)
        {
            velocity.y = 12;
            Grounded = false;

        }

        Checkstatus();
        Controller.Move( velocity * Time.deltaTime);

    }
}

sentences:
set which display on which monitor in unity I'm working on a project that has multi screen to show environment. the question is options not working when there is multi screen. for example in single screen you can set which screen shows the game but it seems there is not such option.

how can I set which display or which camera get displayed on which monitor in script? for example: camera display 1 to screen 2 and....?

thank you for helping

sentences:
Find format of data from Steam API using Python I have some user data downloaded using the Steam API (I am following the approach described here) and I need to find the format for each entry of the CSV file I generated (available here).
Using Python, the solution I came up with is the following:
import pandas as pd
import sys

df1 = pd.read_csv("./data/csgo_cheater_data_01_14_21_full.csv")
for ii in range(189):
    print(df1.columns[ii], type(df1[df1.columns[ii]].values[0]))

Running this snipped, the result is that most variables are float64, plus a few int64. Does it make sense? Is this the real format of the data or are they somehow converted when retrieved using the API?

sentences:
Help with dual quaternion skinning I'm trying to convert my code to use dual quaternion skinning instead of matrix skinning because i just can't get the skinning matrix created correctly from bones+weights using matrices.

Edit: just to clarify, if each vert has only one bone the matrix version did skin correctly.

But it's just not working and i really don't understand why, i'm using code i found here:

http://www.chinedufn.com/dual-quaternion-shader-explained/

http://donw.io/post/dual-quaternion-skinning/

I've looked at the assorted papers often brought up in the answers to these questions, but for the most part i just don't understand them.  I'm not even entirely sure how the [x, y, z, w] of a glm::quat correspond to the [1, i, j, k] of a quaternion--I think that w might be the scalar because it goes first in the actual byte order of the glm::quat struct, but i'm not sure.

Anyway, in my shader bindings i have:

void gltfShader::bindBones(const std::vector<glm::mat4> & bones)
{
    std::vector<glm::fdualquat> dual_quats(std::min<int>(bones.size(), 64));

    glm::quat r;
    glm::vec3 t, s, sk;
    glm::vec4 pr;
    glm::fdualquat dq;

    for(size_t i = 0; i < dual_quats.size(); ++i)
    {
        glm::decompose(bones[i], s, r, t, sk, pr);

        dq[0] = r;
        dq[1] = glm::quat(t.x, t.y, t.z, 0) * r * .5f;

        dual_quats[i] = dq;
    }

    glUniformMatrix2x4fv(u_bones, dual_quats.size(), GL_FALSE, (float*) &dual_quats[0]);
}

In the vertex shader:

mat2x4 GetBoneTransform(ivec4 joints, vec4 weights)
{
    float sum_weight = weights.x + weights.y + weights.z + weights.w;

    // Fetch bones
    mat2x4 dq0 = u_bones[joints.x];
    mat2x4 dq1 = u_bones[joints.y];
    mat2x4 dq2 = u_bones[joints.z];
    mat2x4 dq3 = u_bones[joints.w];

    // Ensure all bone transforms are in the same neighbourhood
    weights.y *= sign(dot(dq0[0], dq1[0]));
    weights.z *= sign(dot(dq0[0], dq2[0]));
    weights.w *= sign(dot(dq0[0], dq3[0]));

    // Blend
    mat2x4 result =
        weights.x * dq0 +
        weights.y * dq1 +
        weights.z * dq2 +
        weights.w * dq3;

    result[0][3] += int(sum_weight < 1) * (1 - sum_weight);

    // Normalise
    float norm = length(result[0]);
    return result / norm;
}

mat4 GetSkinMatrix()
{
    mat2x4 bone = GetBoneTransform(a_joints0, a_weights0);

    vec4 r = bone[0];
    vec4 t = bone[1];

    return mat4(
        1.0 - (2.0 * r.y * r.y) - (2.0 * r.z * r.z),
              (2.0 * r.x * r.y) + (2.0 * r.w * r.z),
              (2.0 * r.x * r.z) - (2.0 * r.w * r.y),
        0.0,

              (2.0 * r.x * r.y) - (2.0 * r.w * r.z),
        1.0 - (2.0 * r.x * r.x) - (2.0 * r.z * r.z),
              (2.0 * r.y * r.z) + (2.0 * r.w * r.x),
        0.0,

              (2.0 * r.x * r.z) + (2.0 * r.w * r.y),
              (2.0 * r.y * r.z) - (2.0 * r.w * r.x),
        1.0 - (2.0 * r.x * r.x) - (2.0 * r.y * r.y),
        0.0,

        2.0 * (-t.w * r.x + t.x * r.w - t.y * r.z + t.z * r.y),
        2.0 * (-t.w * r.y + t.x * r.z + t.y * r.w - t.z * r.x),
        2.0 * (-t.w * r.z - t.x * r.y + t.y * r.x + t.z * r.w),
        1);
}

EDIT: video of the results:

https://youtu.be/8jIt_Xhhffk

The one on the left is supposed to be a walk cycle, the one on the right is supposed to be this:

https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Monster

sentences:
Unity Physics.Raycast give false positive while using layer mask I'm very new to Unity so please excuse my question if this sounds very basic to you.

I'm following various tutorials and I have a small question regarding Physics.Raycast:

if (Input.GetButton("Fire1")) {
        // check ground hit first
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, LayerMask.GetMask("Ground"))) {
            Debug.Log("[PlayerMotion]: Hit" + hit.collider.name + " " + hit.point);
            agent.SetDestination(hit.point);
        }
}

Here, even tough I expressively set the layer mask to "Ground", I still get a hit with the Player game object itself (the ground hit is working fine). I thought ok maybe I put the "Ground" layer as well on the player by mistake but I checked several times and it's not the case.

I'm attaching a gif so you can see what's the issue exactly

There's an easy by checking the collider.name but I still find it odd that the Raycast gives me a false positive with the player hit. Any idea what's going on ?

sentences:
Intersperse 2D with 3D opengl I want to be able to draw 3D objects as well as 2D objects in an openGL environment. Normally, I would draw my 3D stuff, disable the depth buffer and depth mask, then draw my 2D stuff.

However, this creates a hassle. What if I have a single draw() function that is supposed to draw 3D and 2D? I would need to separate it, which I really don't want to do. I want to be able to do stuff like draw3D(...); draw2D(...); draw3D(...);

So is there a common way of doing this? I can think of a few solutions but would prefer to do it a standard way.

Here's a visual of the problem. My 2D text is interfering with my 3D environment:

sentences:
Collision from the underside of a cylinder (Unity C#) A quick introduction to my problem at the moment: I am currently having trouble with checking whether or not a cylinder is grounded. I am using a mesh collider (octagonal prism) as my main collider for the object, however I can't seem to get a reliable ground detection beneath it. I have tried using a trigger and raycasting, but neither seem to work correctly.

It would be a great help if you could either provide a method of correctly raycasting the cylinders base, or an alternate method (bearing in mind the object rotates on all axis). Many thanks in advance. (terrible diagram below)

sentences:
Component-Entity Systems Code Generation I'm really enjoying component entity approach (I'm currently using ASH haxe, but particular language/framework doesn't really matter).

However the problem is - there're way too many elementary classes that need frequent update.

So I'd like to have something like yml config file for components and nodes, and actual classes to be generated from it. Is there any already existing solution that utilizes such codegen, or maybe some generic codegen solution that should be easy to configure for such task?

sentences:
What's the current preferred method for serving/storing game data on html5 games Given all the recent improvements on web platform (webgl, websockets, etc.), it should be now possible to see great games on web. However my biggest concern so far has been around serving and storing the game assets. AFAIK the webstorage only supports a few megabytes and it is not enough for the majority of the games. Even if I work around that limit by providing a ton of different origins, is it possible to claim that it's a safe method? For desktop games we have a lot of anti-cheat mechanisms (steam has one, most A+ have them builtin) If I store my game assets using the webstorage can I claim that they won't be modified by the user?

My game has assets around 800 mbs and I would love to get some feedback on how to serve them and store them properly. I'm trying to satisfy the following:

People shouldn't be forced to download all of the assets every time they want to play the game [unless there's a patch, etc.]
It shouldn't be trivial to make client side hacks and change configs to get all the good stuff without playing/paying for them [greasemonkey!]
Ideally, the solution should work on all the browsers [latest version of IE, Chrome, FF and Safari][no mobile is OK]

sentences:
Why do physics engine use impulses to solve collisions? Usually, in most physics engines that are out there, the way that collisions are solved is by applying some impulse to both colliding bodies.

While I understand that impulses are just force that is already integrated into time, and will result into velocity added at the end of the frame, why not simply project both bodies out of collision and removing their velocity component that is going towards the collision?

I'm not really sure, but it really looks like classic platformers only stopped the character instead of adding impulse to it. Is this right?

And if yes, why the added complexity of using impulses in modern engines?

sentences:
How to make changes to Pawn.cpp Unreal? I am trying to figure out a problem related to CableComponents.

As part of my learning and problem identification I'm trying to place some UE_LOGs/Debug Messages within Pawn.cpp and CableComponent.cpp

These changes are not reflected when the c++ code is compiled within unreal. which is consistent with Unreal only building project code.

So My question is, how can I make these changes to the source code and have them be used?

Alternatively, is there a better way to do what I'm trying to do?

The reason i'm trying to do this

I'm trying to figure out how often the dynamic data of UCableComponent is recalculated compared to the rendering update of APawn.

sentences: Unity - How to change editor play/stop button positions for dual monitor layout Is it possible to change the play/stop buttons positions in editor? I am trying to make a layout for Dual-Screen, however the buttons are right in the middle of the two screen. So, it makes it hard to click the buttons.

sentences:
How reimport a package in UDK with command line? sometimes ago, I saw a command to re-import a UDK package content without opening the UDK Editor.
(Especially, it was used for reimporting a Flash package in a scaleform tutorial, but it doesn't matter now )

It's very useful, because every time I change my .swf file, I should open the heavy UDK and just press re-import.

So, can anyone give me that solution again  ?

sentences:
How can I add a trigger variable negation in Animation machine's transition in Unity? How can I add a trigger variable negation in Animation machine's transition in Unity?
I have two transitions.
First happens if jump == false && grounded == true && duck == false && shoot, second happens if jump == false && grounded == true && duck == false && run == false. I want to change the second to the jump == false && grounded == true && duck == false && run == false && !shoot, i.e. add the trigger variable negation in the end.
How can I achieve this?
First

Second

sentences:
What can I use to make my unique music ideas a reality? I have several different music ideas for my game BGMs, but I do not have the musical skills nor the equipment to make them. The most I can do is beat-box them or make a drum beat (had I a drum). Is there a program or some other way to make my music real?

For instance, I've recently been trying GarageBand's Musical Keyboard to create the music but they don't have the exact beats I'm looking for, like a particular tap of a drum for example.

sentences:
Collision detection with moving objects I searched a lot about this problem. I found many answers here in Stack Exchange but none of them really answers when positions for objects get updated.

For a game with fixed size map and that has all the time:

200+ moving objects with different sizes (bullets, players, NPCs, etc.)
100+ static objects with different sizes (obstacles, health packs, etc.)

I am looking for an efficient way to do collision detection. Here is the pseudo code:

in each game loop (15 ms):
   collect movement commands and apply force on objects of those commands
   loop with very small physics time steps (0.1 ms):
      for object in movingObjects:
         get objects that might collide with current object   // --> 1
         check if any collision occurs
      for object in movingObjects:
         update position of object (based on command collected) // --> 2

So:

I get the objects that might collide with given object. It is done using a data structure like quadtree or spatial hashing grid (or something else that makes more sense).
Object's position is updated. Now, how do I inform the data structure that this object's position is updated? I don't want to remove and insert. That is not efficient at all.

I feel like quad tree and spatial hash implementations all over the internet are avoiding this problem.

I would also appreciate if you tell me my pseudo code above is problematic. I have the feeling this uses too much CPU.

sentences:
Only part of my model animates, the rest stays still I made an animation for when my character grabs a ledge, which has him set his arms and head into a position, and have him swing his legs back and forth, however only his legs move and his arms and head stay in the default resting position of the model.
I have a video of what's happening. you can see the intended animation on the bottom right, and you can see what happens instead in the video.
Video link: https://youtu.be/PwrBdEsvgpY

sentences:
Changing the sprite position: Modify VBO data or translate it? I am beginning with VBO and I want to know if it's better use GL_STATIC_DRAW to make a quad and them translate it, or use DYNAMIC_DRAW and modify the vertex position data directly.

Also when I modify the data of a static VBO the rendering really change!
Why does this happen?
It is supposed to make STATIC object right?

sentences:
Unity 2D graphical glitch cuts sprite diagonally While making a game in unity, we found a graphical glitch that only happens on one of our mobile devices (a htc) where the screen will be oddly sliced by a triangle as shown in this image;

I've searched online but found no problem. We're using unity 2D, it only does it on the HTC but we have no idea why.
The background is a 3D quad with a texture wrapped around it (so we can make it move with the character when the character is running, without having one large background).
Any help would be greatly appreciated.
Thanks

sentences:
Multiple image objects extracted from spritesheets or one-two object for all? Let's say I want to make a 2D game and I'll use a spritesheet containing all of the animation frames and a texture-atlas for static sprites such as walls, non-animated decorations...etc.

Should I create separate image objects for all the static sprites and for all animation-rows or should I just pass the on-texture-atlas (or on-spritesheet) coordinates for them?

Which solution, or "direction" is considered elegant in game-development?

Thanks for the help! :)

Some pseudocode:

Separate image objects:

Class StaticSprite {
  Image texture;

  // ...

  public Image getImage() {
     // ...
  }

  public static final CheckedWall cw = new CheckedWall( -- checked wall grid extracted from the texture-atlas -- )
  public static final WoodWall ww = new WoodWall( -- wood wall grid extracted from the texture...
}

Or:

class StaticSprite {
 int texX, texY, size;

 // ...

 public Image getImage() {
    // gives the part of the spritesheet
 }

 public static final WoodWall ww = new WoodWall( -- coordinates for the texture-atlas -- )
}

Assuming that the spritesheet is accessible for all these sprite-related classes.

sentences:
Create circular platform out of tiles I am creating a 3d game. In this game I have a 3d model for a tile which I render in different locations using instancing.

I want to create a number of these tiles arranged so as to approximate a circle, similar to this:

I need to create an array of 3d vectors representing the position of the tiles in order to create this circle pattern with a given radius.

Here is the code I use to generate a square platform.

ENG_U is a constant representing a "Unit" in the game.

t is the array of positions passed to the renderer.

int rad = 16;

  t = new glm::vec3[(rad+rad+1)*(rad+rad+1)];
  int c = 0;
  for (int i =0;i < (rad+rad)+1;i++)
  {
    for (int j =0;j < (rad+rad)+1;j++)
    {
    t[c] = glm::vec3(i*ENG_U*1.7*2,0,j*ENG_U*1.7*2) - glm::vec3(ENG_U*1.7*2*rad,0,ENG_U*1.7*2*rad);
    c++;
    }
  }

sentences:
Can I release any sort of app or game on the PlayStation Store? I'd like to develop a game, and try it out mainly on the Playstation 4.

Can I build any game, or app, and release it on the Playstation Store? Or does Sony only allow what it wants in the store, much like Apple and the AppStore? Note that I'm not asking how to build a game, but whether or not there are restrictions that would prevent me from releasing certain kinds of games or applications to the Store.

sentences: Is it possible to make desktop visible behind drawn object using SDL2? I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is it possible to make with SDL2?

sentences:
View matrix in opengl Sorry for my clumsy question.
But I don't know where I am wrong at creating view matrix.

I have the following code:

 createMatrix(vec4f(xAxis.x, xAxis.y, xAxis.z, dot(xAxis,eye)),
 vec4f(  yAxis.x_, yAxis.y_, yAxis.z_, dot(yAxis,eye)),
 vec4f(-zAxis.x_, -zAxis.y_, -zAxis.z_, -dot(zAxis,eye)),
 vec4f(0, 0, 0, 1)); //column1, column2,...

I have tried to transpose it, but with no success.
I have also tried to use gluLookAt(...) with success.
At the reference page, I watched the remarks about the to-be-created matrix, and it seems the same as mine. Where I am wrong?

sentences:
What is a good algorithm for fractal-based procedural city layout? Background

I run a minecraft server where I'm going to design a starter city of fairly large scale. I have a series of things, like rule signs and mob cages, I would like to put in buildings there. The city itself will be extremely large and spread out, preferably up to 1000 by 1000 blocks in size.

The buildings themselves will be have cube or rectangular footprints that are based on a certain base cube, like all multiples of 3 blocks. The streets and distance between the buildings will be preferably 5-11 blocks wide, depending on the importance of the street.

When I begin the plan for the city, I will know exactly how big I want the buildings to be and how many there will be.

The Problem

The problem is designing the layout for the city. Obviously with something of such a scale, and me coming from a programming background rather than an urban planner background, it's quite challenging to even begin to wrap my head around the problem.

The problem specifically is that I want the city to look as natural as possible. Of course this would be fairly easy to build on a simple grid pattern, but I want to avoid a grid, or anything that looks like a grid, as much as possible.

The Question

What algorithms might I be able to pursue to be able to help me design it using code? I was thinking that it would look most natural if I used fractals in some way, as minecraft uses fractals already in its terrain generation, and a city seems to grow in a fractal pattern naturally.

I think it's similar in some ways to a tetris playing algorithm, so if anybody has solutions that exist down that direction then it would help also. I'm picturing something where I'll be able to define the shapes that I want to use, and the software then iterates until it finds the most "optimal" solution for even distribution of buildings.
Does something already exist to help me solve this problem using python, preferably in a visual way using pygame?

Naturally this also has interesting implications for city generation in general in game design, so I'm very excited to see what the best solution is.

edit
To be clear, I'm just looking for the layout at this point as the buildings will be designed and built in game.

sentences:
Cursor position to a 3D ray using angles I've been stuck for a month trying to get gluUnProject working. After my attempts to use gluUnProject failed (as well as attempts to implement gluUnProject functionality manually) I implemented method to get ray using angles.

 float RadToDeg = 180.0f / (float)M_PI; // conversion coefficient to degree
 float DegToRad = 1 / RadToDeg; // conversion coefficient to radians

 float DeltaX = tan(fovy/2 * DegToRad) * 2 * (Width / 2 - winX) * zNear / Height;
 float DeltaY = tan(fovy/2 * DegToRad) * 2 * (Height / 2 - winY) * zNear / Height;
 float AngleX = atan(DeltaX / zNear) * RadToDeg;
 float AngleY = atan(DeltaY / zNear) * RadToDeg;

 float DeltaXY = sqrt(DeltaX*DeltaX + DeltaY*DeltaY);
 float AngleXY = atan(DeltaXY / zNear) * RadToDeg;
 float AxisAngle = atan(DeltaX / DeltaY) * RadToDeg;
 vec3 RotationAxis = rotate(Camera->X, AxisAngle, Camera->Z);
 if (DeltaY < 0) { RotationAxis = -RotationAxis; }

 vec3 ray = rotate(-(Camera->Z), AngleXY, RotationAxis); //getting ray direction
 ray = vec3(ray.x * scale, ray.y * scale, ray.z * scale); //scale ray if needed

 vec3 RayEndPoint = Camera->Position + ray;

The main idea behind my method is to rotate ray pointing perpendicularly from the middle of the screen (like in first person shooters) to position where you clicked.

Necessary values are fovy angle (field of view in vertical direction), zNear (distance from Camera to near plane) and Camera Transformation Matrix(Camera->X, Camera->Y, Camera->Z, Camera->Position - 1st, 2nd, 3rd and 4th columns). Difference between Camera Transformation Matrix and View Matrix here.

Besides we need some method rotate(vec3 vector,float angle,vec3 axis) that will rotate any vector at any angle around any arbitrary axis.
Explanation how it works will consume too many lines (check photo of my calculations).

Q: Is any easier or better way to do it? Any information or links welcomed.

sentences:
How to put basic scripting/variable changes into dialog xml files? I have a simple XML structure for my dialog between the player and NPCs.
What I'd like to do is put variable changes (and maybe other things) directly into the XML.  So, for instance, if you select a certain conversation option the character gives you gold.  Like this:

<story>
  <segment id ="1">
    <dialog>
      <speaker>Fred</speaker>
      <text>Do you like futurecrew?</text>
    </dialog>
    <choice>
      <prompt>Yes</prompt>
      <target>2</target>
      <command>$gold-10</command>
    </choice>
    <choice>
      <prompt>No</prompt>
      <target>3</target>
      <command>$relationship-20</command>
    </choice>
  </segment>
</story>

In exploring this issue I have written a really terrible brute force command parser, but it just feels wrong at so many levels:

public class Command
    {
        string commandText;
        Symbol symbol;
        Field field;

        public Command(string _commandText)
        {
            commandText = _commandText;
        }

        public void Execute()
        {

            //look for operators
            int test = -1;
            int location = -1;
            int amount = 0;

            test = commandText.IndexOf("-");
            if (test != -1)
            {
                symbol = Symbol.Minus;
                location = test;
            }
            test = commandText.IndexOf("+");
            if (test != -1)
            {
                symbol = Symbol.Plus;
                location = test;
            }
            test = commandText.IndexOf("*");
            if (test != -1)
            {
                symbol = Symbol.Multiply;
                location = test;
            }
            test = commandText.IndexOf("/");
            if (test != -1)
            {
                symbol = Symbol.Divide;
                location = test;
            }
            string variable = commandText.Substring(0, location);
            amount = Int32.Parse(commandText.Substring(location + 1));

            if (variable.ToUpper() == "$GOLD")
                field = Field.Gold;

            if (field == Field.Gold)
            {
                Logger.log("Gold before {0}", Game.Instance.Gold);

                if (symbol == Symbol.Minus)
                    Game.Instance.Gold -= amount;
                if (symbol == Symbol.Plus)
                    Game.Instance.Gold += amount;

                Logger.log("Gold after {0}", Game.Instance.Gold);
            }
        }
    }

If I have 30 different variables I want to "expose" to the XML "scripting" it looks like I'll be writing a lot of stupid achey breaky code.

I have searched around and found people asking/answering about conditions, which I see as  simpler than this.  I have also seen suggestions for CodeDom for realtime compiling but this is in unity C# so I don't anticipate that will work.  I looked into LUA for .NET and IronPython but that seems overkill when really I just want the ability to change variables on my Game singleton.

Any ideas or direction would be much appreciated!

EDIT: I found UniLua https://github.com/xebecnan/UniLua for a unity safe pure c# implementation of lua.  I haven't decided yet if I'll use it, but my presupposition that I couldn't use Lua turned out to be false.

sentences:
How do I get the areas enclosed by an arbitrary 2D shape? In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap.

For example:

I want to detect the presence of any game object in the green areas above.

I know how to detect whether a point is within a given polygon, but how do I tell where the polygons (green areas) are from just the points in the line?

sentences:
Loading font in Monogame This question is probably a duplicate but I'm still asking it since it's all yesterday that I'm trying to get this done without any success. I followed many solutions and tried even more libraries which were either outdated or they simply didn't work.
Right now the most reasonable method I found is

Open the Content Pipeline;
Create a new Content if there isn't any;
Right click on Content -> Add -> New item -> SpriteFont Description
-> Give it a name;
Click Build;
Go to the output directory, grab the XNB file that was created and
put it in some folder of the project, under Content;
Change the properties to Content and Copy if newer;

And I use it like this:

private SpriteFont font;

font = Content.Load<SpriteFont>("NameOfXNBFile");

spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Global.Camera.TranslationMatrix);

spriteBatch.DrawString(font, "Some Text", new Vector2(100, 100), Color.White);

spriteBatch.End();

I don't have any errors, the text is simply not shown. I think I could be close to a solution since one and only one single time the text appeared, but as the fool I am I happily closed the tabs of countless tutorials and made some changes which led the text to never show again.

sentences:
Unity ads showing only 3 or 4 times I have published a game on googleplay that uses Unity rewarded ads. Once the player dies, they have an option of reviving by watching a rewarded ad. However when I try this, the ad shows only 3 or 4 times and then nothing happens after that(when I click the revive button). Here is the ad manager script:
string GooglePlay_ID = "123456";
bool test_mode = false;
string myPlacementId = "rewardedVideo";

void Start()
{
   Advertisement.AddListener(this);
   Advertisement.Initialize(GooglePlay_ID, test_mode);
}

public void DisplayVideoAD()
{
    Advertisement.Show(myPlacementId);
}

public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{

    if (showResult == ShowResult.Finished)
    {
      GameManager.instance.ReceiveReward();
    }
    else if (showResult == ShowResult.Skipped)
    {

    }

    else if (showResult == ShowResult.Failed)
    {
        Debug.LogWarning("The ad did not finish due to an error.");
    }
}

 public void OnUnityAdsReady(string placementId)
{

    if (placementId == myPlacementId)
    {

    }
}

public void OnUnityAdsDidError(string message)
{

}

public void OnUnityAdsDidStart(string placementId)
{

}

Here is the ReceiveReward() function that's in the game manager. This function seems to work fine as after clicking the button, the game restarts with the score before the player died.
public void ReceiveReward()
{
    savedScore = (int)playerScore;
    UpdateUI(GameStates.Start);
    SceneManager.LoadScene(1);
}

I'm not sure what's going wrong as the ads work a few times...Can someone please help?

sentences:
Saving score in Unity I have the following script which I use for calculating the score

public class Score : MonoBehaviour {

    Score sc;

    void Start()
    {
        GameObject obj = GameObject.Find("ScoreSystem");
        sc = obj.GetComponent<Score>();

    }

    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == "Ball")
        {
            sc.score++;
        }
    }
}

and this is the class where I increase the value

public class Score : MonoBehaviour {

    public int score;

    void Start()
    {
        score = 0;
    }

}

But the problem I have is that the value always stays 0 when I switch to a different scene. I even used this code to store the value and display in the next scene but it didn't work

void Update()
{
    PlayerPrefs.SetInt("score", score);
    PlayerPrefs.Save();
}

and this code for taking the value

score = PlayerPrefs.GetInt("score");

How can I store the latest value inside an Int and display it in the next scene and when I leave that scene it reverts back to 0?

sentences:
Most efficient way to implement walls and shadows in 2d I am making a 2d top-down programming game similar to robocode. There will be up to 1000 walls (lines) in the arena, and up to 50 robots. Each robot can see in a 90 degree arc, and cannot see through walls. I need an efficient way to calculate what each robot can see (other robots and walls). I already have a grid of bins implemented. I was wondering what is the most efficient way to tackle this problem.

It would be nice if the method also includes a way to draw the shadows for visualization, but this is not necessary.

I am using C++ and the Qt framework.

Summary: The main question is how to generate a list of robots and walls that each robot can see. For example:

Robot 1 can see:
    Robot 6
    Robot 15
    A wall from (50,60) to (70,80)

Robot 2 can see:
...

sentences:
Rain effect using DirectX 9 capabilities Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and do not require a heavy programming load (e.g. not more than two hard weeks of programming for one single person)?

It would be nice if the answer could also contain a pro/con phrase for the proposed idea (e.g. postprocessing rain shader vs. a particle based effect).

sentences:
I imported a blend file into unity which contained 3 animations but I can only see one [Unity] and I need three I can only see one in unity:
But there are three in blender:
I thank thee answers.

sentences:
How is load balancing achieved in MMOs? I believe it's a common requirement of MMOs that processing for a single shard or realm can be done over several servers to ease the load. I'm curious as to how this can be done whilst maintaining a unified consistent world where all the players, and all the NPCs can interact.

My question is how is load balancing achieved in MMOs?

Any links, books or general information on how to improve my knowledge on this subject is also appreciated.

sentences:
How to start in animating my model? I got a model from TurboSquid. Which is an archer and when i imported the model I got all the textures to be put on properly.  The thing is the actual character has no children nodes, is it possible to still animate this model.  I have looked throughout the files and there are a bunch of textures, but I don't happen to see any animations.

Along side that the asset comes with an Avatar, I looked on the docs and still a little confused as to what that is about.  If I cannot animate this model how could I force it to animate somehow or how could I make my own model.

I am not a artist at all and just focus on the gaming logic and and programming, and I am working solo.  Just wondering what are some options to get a game up and running with some decent graphics.  So, far I use the model to get the game play down, but now I want to make it visually appealing.

sentences:
How can I Intercept object with a circular motion I am creating a 2d space game and need to make the spaceship intercept a planet. I have working code for straight line intercepts but cannot figure out how to calculate the planets location in a circular orbit.

The game is not scientifically accurate so I am not worried about inertia, gravity, elliptical orbits, etc.

I know the spaceships location and speed and also the planets orbit (Radius) and speed

sentences:
How do I create a sound manager? I have a basic entity system in place. Now I want to add audio. I want to make a database class that watches over entities, pulls data out of them, and creates audio streams whenever necessary.

I'm using C++ and SDL2. What is a simple approach to this?

sentences:
How to create shockwave of objects in other shapes than circle? Basically, I'm making a bullethell / I wanna be the guy inspired game for where I'm currently creating different methods of spawning bullets into the game. One of the few methods I've created is creating a shockwave of bullets with defined number of bullets in a circular shape. The method works excellently with a for-loop and is very simple to use.

for (double angle = (0 + rotation); angle < (Math.PI * 2 + rotation); angle += Math.PI / (numberOfBullets / 2))
{
     Bullet nextBullet = new Bullet(bulletDef, position, speed, acceleration, rotation, texturePriority, color, bulletID);
     nextBullet.speed.X = (float)Math.Cos(angle) * speed.X;
     nextBullet.speed.Y = (float)Math.Sin(angle) * speed.Y;
     nextBullet.acceleration.X = (float)Math.Cos(angle) * acceleration.X;
     nextBullet.acceleration.Y = (float)Math.Sin(angle) * acceleration.Y;
     nextBullet.position = position;
     nextBullet.isRemoved = false;
     Data.tempEntities.Add(nextBullet);
}

However, I wanted to extend this method a little further with the ability of creating shockwaves in other shapes, like Triangle, Square, Pentagon and Hexagon. I however have no specific idea of how to set this up with a for-loop.

The only lead I have so far of what I could do is calculate the amount of sides each shape have (they're all going to be equilateral as having differently long sides would be a waste of time to program) so we'll take a Triangle for example; has 3 sides. We'll decide that this triangular shockwave will shoot 6 bullets so we'll define what the first two bullets speed will be with these (probably wrongly written code).

int calculateBullets = (numberOfBullets / 3);
int divider = numberOfBullets % calculateBullets;

I tried using this in a for-loop, but it gave me OutOfMemory error without any explaination of what I did that was wrong. What would be the best way to approach this predicament? Should I still use a for-loop and how will I need to set it up? Or should I attempt to use something else?

sentences:
Which is better a computer science degree or a Software engineer degree? I'm asking here so since you all have experience in or around game programming, that's what I want to do, and I’m trying to find as many options as I can before my senior year, which is next year. So do you have any opinions on the matter of which would give me a better education in programming?

Please no talking about anything other than the two degrees because I know of game programming degrees out there but I like to see which of these would provide the best alternate choice.

sentences:
Is there a way to create a cellular automaton mod for Minecraft? I basically want to create a mod for Minecraft that does the following:

if(a sand block is next to lava block) {
   change the sand block to a glass block
}

Is it possible to create a mod like this without editing multiple Java classes?

sentences:
How to correctly draw a line in Unity I'm working on a game which requires me to draw a few lines from a single point that is more formally said

Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates named as xi,yi. Given the LineRenderer capabilities inside Unity3D I was unable to draw more than one line from a particular point with it since it renders only polylines.

I'm currently using the Debug.DrawLine() method which successfully renders the line. I have tried using GL.Begin() as it is shown in the Unity example but I cannot see my lines being drawn.

My question is : are there any other methods for doing this? If not, can you tell me how can I show the line that is being drawn with Debug.DrawLine() inside play mode? I've saw that I could use Gizmos.DrawLine() but I didn't quite understand it's usage.

sentences:
How can I ensure a radius variable doesn't get reduced below 0? For some reason when I'm using the mouse to change the radius in the Update, the minimum radius is -1 even if I set the range in the top of the script to be 0,50 and even if I check that the xradius is be 0 or higher it's still getting to -1.

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;

    public bool circle = true;
    [Range(0, 50)]
    public float xradius = 15;
    [Range(0, 50)]
    public float yradius = 15;
    LineRenderer line;

    public float drawSpeed = 0.3f;

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();

        line.positionCount = (segments + 1);
        line.useWorldSpace = false;
    }

    private void Update()
    {
        if (xradius >= 0)
        {
            if (Input.GetAxis("Mouse X") < 0)
            {
                xradius = xradius + 1;
                CreatePoints();
            }
            if (Input.GetAxis("Mouse X") > 0)
            {
                xradius = xradius - 1;
                CreatePoints();
            }
        }
    }

    private void CreatePoints()
    {
        if (circle == true)
            yradius = xradius;

        float x;
        float z;

        float change = 2 * (float)Math.PI / segments;
        float angle = change;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(angle) * xradius;
            z = Mathf.Cos(angle) * yradius;

            line.SetPosition((int)i, new Vector3(x, 0.5f, z));

            angle += change;
        }
    }
}

In the Update I did:

if (xradius >= 0)

But yet when using the mouse for the minimum radius it set both xradius and yradius in the sliders to -1 not sure how can it be -1 if I set the range in both xradius and yradius to be 0,50

You can see in the screenshot in the Inspector in the right both Xradius and Yradius are -1

sentences: HLSL defined render states As described in this article you can define render states such as ZFunc inside of the HLSL shader. You can also set these from application code. If you set the same state (e.g. ZFunc) in both application and HLSL, which one wins and gets used? Does it always use application over HLSL?

sentences:
Unity: add InputTracking to my script I'm new to unity and 3D world developement so I'm following Unity's tutorial for beginners right here. And I'm in the section with title "Camera Nodes" where they gave me a c# script to attach it to the camera object.
I did attach it to the camera but the problem with the script when I debug it I get an error of undefined class:

The name 'InputTracking' does not exist in this context

And this is the script:

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

public class UpdateEyeAnchors : MonoBehaviour {

    GameObject[] eyes = new GameObject[2];
    string[] eyeAnchorNames = { "LeftEyeAnchor", "RightEyeAnchor" };

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        for (int i = 0; i < 2; ++i)
        {
            // If the eye anchor is no longer a child of us, don't use it
            if (eyes[i] != null && eyes[i].transform.parent != transform)
            {
                eyes[i] = null;
            }

            // If we don't have an eye anchor, try to find one or create one
            if (eyes[i] == null)
            {
                Transform t = transform.Find(eyeAnchorNames[i]);
                if (t)
                    eyes[i] = t.gameObject;

                if (eyes[i] == null)
                {
                    eyes[i] = new GameObject(eyeAnchorNames[i]);
                    eyes[i].transform.parent = gameObject.transform;
                }
            }

            // Update the eye transform
            eyes[i].transform.localPosition = InputTracking.GetLocalPosition((VRNode)i);//--the error is this line
            eyes[i].transform.localRotation = InputTracking.GetLocalRotation((VRNode)i);//--and this one
        }
    }
}

This is the link of the class InputTracking in Unity's API, but I don't know how to add it to my script :)
Thanks in advance.

sentences:
OpenGl: Error, The loaded object takes the same colors and style of the Texture? I'm new to OpenGl Faced this problem:

Draw function:

void Renderer::Draw()
{

    glUseProgram(programID);
    shader.UseProgram();

    mat4 view = mat4(mat3(myCamera->GetViewMatrix()));
    glm::mat4 VP = myCamera->GetProjectionMatrix()*myCamera->GetViewMatrix();
    shader.BindVPMatrix(&VP[0][0]);

    glm::mat4 VP2 = myCamera->GetProjectionMatrix() * myCamera->GetViewMatrix() * floorM;
    model13D->Render(&shader, scale(100.0f, 100.0f, 100.0f)); // scaling the skybox

    t2->Bind();
    model3D->Render(&shader, scale(2.0f, 2.0f, 2.0f)); //scaling aircraft

    glUniformMatrix4fv(VPID, 1, GL_FALSE, &VP2[0][0]);

    mySquare->Draw();

}

The code of loaded:

    shader.LoadProgram();
    model3D = new Model3D();
    model3D->LoadFromFile("data/models/obj/Galaxy/galaxy.obj", true);
    model3D->Initialize();
    myCamera->SetPerspectiveProjection(90.0f, 4.0f / 3.0f, 0.1f, 10000000.0f);

    model13D = new Model3D();
    model13D->LoadFromFile("data/models/obj/skybox/Skybox.obj", true);
    model13D->Initialize();
    // Projection matrix :
    //shader.LoadProgram();

    // View matrix :
    myCamera->Reset(
        +0.0f, +0.0f, 5.0f,// Camera Position
        +0.0f, +0.0f, +0.0f,// Look at Point
        +0.0f, +1.0f, +0.0f // Up Vector
        );
    //////////////////////////////////////////////////////////////////////////
    std::string Images_names[6];

    Images_names[0] = "right.png";
    Images_names[1] = "left.png";
    Images_names[2] = "top.png";
    Images_names[3] = "bottom.png";
    Images_names[4] = "back.png";
    Images_names[5] = "front.png";
    t = new Texture(Images_names, 0);
    t2 = new Texture("arrakisday_dn.tga", 1);

sentences:
Vibration/Rumble with PS4 Pad and LPDIRECTINPUTDEVICE8 I actually try to make my PS4 Pad rumble.
I get the pad capabilities with

DIDEVCAPS capabilities;
capabilities.dwSize = sizeof(DIDEVCAPS);
ps4pad->GetCapabilities(&capabilities);

the next step is to check if the flag DIDC_FORCEFEEDBACK is ok

But capabilities.dwFlags & DIDC_FORCEFEEDBACK always return false.

As my pad is a ps4, I know it support feedback.

Have you an idea why it's return false, what I missed?

sentences:
How can I support many point light sources in a dynamically-generated level in Unity? I'm currently working with a dungeon game which is similar to Dungeon Keeper by Mythic Entertainment. I'm using Unity and developing this game for Ipad 2 and above. Player can modify his dungeon, and I'd written a dungeon generator which creates it. In this case, I can't use lightmaps, because the dungeon has been created dynamically and player can tweak it. I also devised a way to combine separate game objects in a single mesh, so imagine that the entire dungeon (except special objects such as pillars, statues and mobs) is the single mesh. There's many point light sources (10-15 and above) on the stage, but Unity don't allow to use more than 8 light sources per object.

So, if all dungeon cells are separated objects, I can use the diffuse or even vertex-lit lighting, but if the entire dungeon is a single mesh, there's the hardware limit appears.

Ways to solve this problem I'd divised:

Use separated geometry (tried) - bad, because it harms berformance because there's many-many-many drawcalls (16-17 fps on Ipad 4).
Use deffered shading (tried) - bad, because it harms performance even more than separated geometry.
Use a custom shader (haven't tried) - I don't know how.
Don't unite all cells in the single mesh but unite groups of cells to reduce the number of separated objects (haven't tried)
Use the light manager (haven't tried) - I don't know how.
???

How can I deal with it?

sentences:
How to detect the border of the screen and bounce back? if (bucket.x > 0) {
                rect.x += 200 * Gdx.graphics.getDeltaTime();
            }
            if (rect.x < 0) {
                rect.x = 0;
                rect.x += 200 * Gdx.graphics.getDeltaTime();
            }

            if (rect.x > Gdx.app.getGraphics().getWidth() - 30) {
                rect.x -= 200 * Gdx.graphics.getDeltaTime();
            }

I have a rectangle, it has a width of 30 px, I want to move from it's x point till the edge of the screen, when it gets there I want it to go back to the other edge. it's only moving till it hits one edge and it stops.

This might be a basic question but I'm new to Libgdx and I can't find documentation. If I add a while (true ) loop the app would stop working. Basically I want it to move infinitely along the x axis back and forth from right edge to the left edge.

I tried something like

`if (rect.x > 800 - 30) `

it won't work either and I don't like specifying the width of the device explicitly. Basically it's moving but never detecting the right edge of the screen

sentences:
When using Unity 5, is there a way to print/save/identify the last n lines of code that were executed at a specific point? So, here is what I am after. Is there a way to identify which were the last n lines of code that were executed in Unity 5 (with C#) at a given point of the game?

I know I can use Debug.Break() to set break points to help identifying problematic parts of the code. However, when the codes escalate and multiple functions interact, it is sometimes difficult to identify what came immediately before the break point.

Therefore, my question. Is there a way to retrieve the lines of code that were executed for instance before a break point?

sentences:
Recording the gameplay in the game itself? I'm presently working on a 3D car racing game for the iOS platform. I had to implement a replay system and then record that replay in a video file to upload it to YouTube.

I'm only having issues with the recording part, the rest is done. What I'm doing is using the glReadPixels() command of OpenGL ES 1.1 to capture the framebuffer content and creating a video from these frames during runtime (using AVFoundation framework).

The problem I'm facing is that I have to call glReadPixels() in each update which is very slow . It decreases the FPS from around 30 to only 2-3...
Is there any alternative to the glReadPixels() command?
Or did anyone create a replay system and recorded to video?

sentences:
How do I implement group formations in a 3D RTS? I managed to get pathfinding work for a single unit, and I managed to avoid agent-agent collision, but now I need to be able to send a group of agents to some location.

This is my set-up so far:

Waypoint pathfinding
The minimum distance between two nodes is a little bigger than the
biggest bounding sphere radius allowed for an agent.
Agents avoid collisions with other agents by doing some steering behaviour I based on clearpath

So now I need to send my agents somewhere in group. I have read some posts saying that some way to do it is to create a group leader and give the other units offsets to his position.

But then the problem is, what if the group formation cannot be achieved?
e.g. you want to form a rectangle, but at the target position there is a structure nearby which prevents you from creating a rectangle setup.

sentences: Camera rotation according to target direction I am facing issue when camera is following to my target and target rotates to 90 degree or -90 degree than camera is not rotating.i want smooth rotation according to target when target is change the direction of movement.please help me if you can..thanks in advance.

sentences:
Restrict camera movements I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem

sentences:
Scaling textures with nearest neighbour without having to use seperate sprite batches I'm interested in being to scale textures up via nearest neighbour. I can do this via a SpriteBatch.Draw() overload however this means that any other sprites drawn within that batch will also have the scaling.

What happens if I have 50 objects I want to to scale, and another 50 objects I don't want to be drawn using nearest neighbour. Assuming they alternate depths, that's 100 calls to to spriteBatch.End() in order to get depth drawn correctly. Now also let's say each object has it's own texture.

One way is to you use Texture2D.SetData() to manually scale up the textures but this could get messy, very quickly.

Any tips?

sentences:
How do I query a LibGDX Box2DLights "light" and "dark" regions? I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered.

How can I find which areas are lit or dark?

My PointLights and Body look like this:

sentences:
SDL: How would I add tile layers with my area class as a singleton? I´m trying to wrap my head around how to get this done, if at all possible. So basically I have a Area class, Map class and Tile class. My Area class is a singleton, and this is causing some confusion. I´m trying to draw like this: Background / Tiles / Entities / Overlay Tiles / UI.

void C_Application::OnRender()
{
    // Fill the screen black
    SDL_FillRect( Surf_Screen, &Surf_Screen->clip_rect, SDL_MapRGB( Surf_Screen->format, 0x00, 0x00, 0x00 ) );

    // Draw background

    // Draw tiles
    C_Area::AreaControl.OnRender(Surf_Screen, -C_Camera::CameraControl.GetX(), -C_Camera::CameraControl.GetY());

    // Draw entities
    for(unsigned int i = 0;i < C_Entity::EntityList.size();i++)
    {
        if( !C_Entity::EntityList[i] )
        {
            continue;
        }

        C_Entity::EntityList[i]->OnRender( Surf_Screen );
    }

    // Draw overlay tiles

    // Draw UI

    // Update the Surf_Screen surface
    SDL_Flip( Surf_Screen);
}

Would be nice if someone could give a little input. Thanks.

sentences:
How do I implement a quaternion based camera? UPDATE The error here was a pretty simple one. I have missed a radian to degrees conversion. No need to read the whole thing if you have some other problem.

I looked at several tutorials about this and when I thought I understood I tried to implement a quaternion based camera. The problem is it doesn't work correctly, after rotating for approx. 10 degrees it jumps back to -10 degrees. I have no idea what's wrong. I'm using openTK and it already has a quaternion class. I'm a noob at opengl, I'm doing this just for fun, and don't really understand quaternions, so probably I'm doing something stupid here. Here is some code: (Actually almost all the code except the methods that load and draw a vbo (it is taken from an OpenTK sample that demonstrates vbo-s))

I load a cube into a vbo and initialize the quaternion for the camera

protected override void OnLoad(EventArgs e) {
    base.OnLoad(e);

    cameraPos = new Vector3(0, 0, 7);
    cameraRot = Quaternion.FromAxisAngle(new Vector3(0,0,-1), 0);

    GL.ClearColor(System.Drawing.Color.MidnightBlue);
    GL.Enable(EnableCap.DepthTest);

    vbo = LoadVBO(CubeVertices, CubeElements);
}

I load a perspective projection here. This is loaded at the beginning and every time I resize the window.

protected override void OnResize(EventArgs e) {
    base.OnResize(e);

    GL.Viewport(0, 0, Width, Height);

    float aspect_ratio = Width / (float)Height;

    Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64);
    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadMatrix(ref perpective);
}

Here I get the last rotation value and create a new quaternion that represents only the last rotation and multiply it with the camera quaternion. After this I transform this into axis-angle so that opengl can use it. (This is how I understood it from several online quaternion tutorials)

protected override void OnRenderFrame(FrameEventArgs e) {
    base.OnRenderFrame(e);

    GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

    double speed = 1;
    double rx = 0, ry = 0;

    if (Keyboard[Key.A]) {
        ry = -speed * e.Time;
    }

    if (Keyboard[Key.D]) {
        ry = +speed * e.Time;
    }

    if (Keyboard[Key.W]) {
        rx = +speed * e.Time;
    }

    if (Keyboard[Key.S]) {
        rx = -speed * e.Time;
    }

    Quaternion tmpQuat = Quaternion.FromAxisAngle(new Vector3(0,1,0), (float)ry);
    cameraRot = tmpQuat * cameraRot;
    cameraRot.Normalize();

    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadIdentity();

    Vector3 axis;
    float angle;

    cameraRot.ToAxisAngle(out axis, out angle);
    //////////////////////////////////////////////////////////////////////
    // THIS IS WHAT I DID WRONG: I NEED TO CONVERT FROM RADIANS TO DEGREES
    //////////////////////////////////////////////////////////////////////
    //BEFORE
    //GL.Rotate(angle, axis);
    //AFTER
    GL.Rotate(angle * (float)180.0/(float)Math.PI, axis);
    GL.Translate(-cameraPos);

    Draw(vbo);
    SwapBuffers();
}

Here are 2 images to explain better:
I rotate a while and from this:

it jumps into this

Any help is appreciated.

Update1: I add these to a streamwriter that writes into a file:

    sw.WriteLine("camerarot: X:{0} Y:{1} Z:{2} W:{3} L:{4}", cameraRot.X, cameraRot.Y, cameraRot.Z, cameraRot.W, cameraRot.Length);
    sw.WriteLine("ry: {0}", ry);

The log is available here: http://www.pasteall.org/26133/text. At line 770 the cube jumps from right to left, when camerarot.Y changes signs. I don't know if this is normal.

Update2 Here is the complete project.

sentences:
Looking for a game engine to make a game like "Ikariam" or "Ogame" I'm an IT student and currently in my spare time I want to start a project. I would like to make a game that resembles a browser games like "Ikariam" or "OGame". I don't want this game to be a browser game, but It has to work like the games above with a couple of players.
What game engine would you suggest?

sentences:
Turn-based browser game I want to try to build a multiplayer turn-based browser game.

What technologies do you recommend me to use for server side considering I plan to host it on a shared host? Would PHP be fast enough?

sentences:
Two Points Rotating Around Circle? Currently I am working on a 2D game just like duet game, it is my first game
(Unity 2D).

When I press left key both points rotate fine. But when I press right, the points are not rotated.

So my problem is why do both points rotated only in one direction

Code:

public class TouchControll : MonoBehaviour
{
  float movespeed = 3;
  float angle = 45;

  void Update()
  {
    if (Input.GetKey(KeyCode.LeftArrow))   // when i m press leftarrow both point should be rotate fine
    {
        transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Horizontal") * angle * movespeed);
        Debug.Log("moveleft");
    }

    if (Input.GetKey(KeyCode.RightArrow))  // problem is here when i m press right arrow key both point are not rotated
    {
        transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Vertical") * angle * movespeed);
        Debug.Log("moveright");
    }
  }
}

Output:

create a empty gameobject:

first circle

second circle

sentences:
Coarse Collision Detection in highly dynamic environment I'm currently working a 3D space game with A LOT of dynamic objects that are all moving (there is pretty much no static environment). I have the collision detection and resolution working just fine, but I am now trying to optimize the collision detection (which is currently O(N2) -- linear search). I thought about multiple options, a bounding volume hierarchy, a Binary Spatial Partitioning tree, an Octree or a Grid. I however need some help with deciding what's best for my situation. A grid seems unfeasible simply due to the space requirements and cache coherence problems.

Since everything is so dynamic however, it seems to be that trees aren't ideal either, since they would have to be completely rebuilt every frame. I must admit I never implemented a physics engine that required spatial partitioning, do I indeed need to rebuild the tree every frame (assuming that everything is constantly moving) or can I update the trees after integrating?

Advice is much appreciated - to give some more background: You're flying a space ship in an asteroid field, and there are lots and lots of asteroids and some enemy ships, all of which shoot bullets.

EDIT:
I came across the "Sweep an Prune" algorithm, which seems like the right thing for my purposes. It appears like the right mixture of fast building of the data structures involved and detailed enough partitioning. This is the best resource I can find.

If anyone has any suggestions whether or not I'm going in the right direction, please let me know.

sentences:
How do I set up the microphone for an Android device in Unity? I'm developing a simple android app that needs to use the microphone. I'm able to load my app on my Android phone using developer mode, but I do not understand how to enable the mic. How can I enable the microphone and use the input?

I started with a brand new Unity 2D project. I created a TextMeshPro Text object to display logs and set this reference on the script via the inspector. I have attached the following script to the Main Camera.

using UnityEngine;
using UnityEngine.Android;
using TMPro;

public class RequestPermissionScript : MonoBehaviour
{
    public TextMeshProUGUI logs;

    void Start()
    {
        if (Permission.HasUserAuthorizedPermission(Permission.Microphone))
        {
            // The user authorized use of the microphone.
            logs.text = "has authorized";
        }
        else
        {
            // We do not have permission to use the microphone.
            // Ask for permission or proceed without the functionality enabled.
            logs.text = "has not authorized";
            Permission.RequestUserPermission(Permission.Microphone);

        }
    }
}

I then Build and Run this as Android and the app is loading on my Android phone attached via USB.

I expect a pop-up to appear asking for permissions to the mic, but this does not happen and the logs says "has not authorized". What am I missing or doing wrong?

sentences:
What is the easiest way to Implement a 3rd Person Camera in C++/DirectX9 I'm pretty new to C++ and DirectX9 and I want to Implement a Third Person Camera. After some reading about Quaternion-based Cameras I decided to try Implementing it. But it really blow my mind, so I ask here what is the easiest way to Implement a TP-Camera?

Here are the things the Camera should do:

Follow coordinates stored in a 3DVector (x, y, z)
Rotate around the Object (Smooth)
Maybe some type of 'spring' = Slowly moving back to the normal Pos behind the Object after Rotating

Apologise for my bad english: I'm german and still in school!

Thanks in Advance!

EDIT:

After some trying I've got it.

The biggest problem I considered was the right extracting of the "direction" Vector from the World-Matrix.

During my research I've found mostly something like this:

D3DXVECTOR3 direction;
direction.x = worldMatrix->_13;
direction.y = worldMatrix->_23;
direction.z = worldMatrix->_33;
D3DXVec3Normalize(&direction, &direction);

That does NOT work for me! Instead I did this:

D3DXVECTOR3 direction;
direction.x = worldMatrix->_13;
// Consider the .y after the .z!
direction.z = worldMatrix->_23;
direction.y = worldMatrix->_33;
D3DXVec3Normalize(&direction, &direction);

For scaling:

// The tenfold of the average distance
D3DXVec3Scale(&direction, &direction, 10.0f);

Setting the Positions:

cameraPos = targetPos - direction;
// For a top-view
cameraPos.y = targetPos.y + 5;

For Rotations you should create a temporary world-Matrix (from the position of the target) and rotate it how you want and extract the direction.

The Smoothing of the Rotation really depends on YOUR game!

This sort of 3rd Person Camera is really easy to make and it does it's job!

Really GREAT thanks to "jheriko" who gave me the right answer!

sentences:
Changing colour while keeping gradient I'm making a Flash game with ActionScript 3 and I have a square with a gradient applied to it. I am trying to programmatically changing the colour of the square depending on time, for example, some times it is orange, some times it is red, but it must always fade to black at the bottom.

The problem is, I'm using ColorTransform (as per here) but it seems to overwrite the gradient and simply fill the square with the solid colour. This isn't what I want. I want the colour that is chosen to fade to black at the bottom, like the original gradient.

How can I do this? Is there a way to only change the "hue" of the symbol (IE: not filling the entire thing with a solid colour), or will I have to reapply a gradient programmatically, with the desired colours?

sentences:
How do I target a tank turret with an offset barrel? I have a tank model consisting of multiple parts, a body, a turret and the barrel of the gun. The turret is offset from the body origin and can rotate around the Y axis(up). The barrel is connected to the turret and can rotate around the X axis of its connecting point to the turret.

I was wondering, given a target in 3d space and the position of the tank, how to calculate the correct rotations to give to the parts in order for the barrel to align itself to fire at the target.

The position of the tank cannot change, only the rotations given to the turret and the barrel. I would know how to solve this if the barrel is aligned with the z axis of the turret but I am having difficulty solving this problem if parts are offset from each other. Eventually I want to expand this so that multiple joined parts can get the end part (firing point) facing a target. I am using XNA C#.

EDIT:

Below is an example of what I mean, a turret connected to the body at the blue point. The barrel is connected to the turret at the red point:

sentences:
How is the density of a collider determined? I read here that, once determining the density of a Buoyancy Effector, "Colliders with a higher density sink, those with a lower density float, and those with the same density appear suspended in the fluid." However, I did not find a density field in my CircleCollider2D. What I found is that:

If I increase the mass of the attached RigidBody2D, then the body sinks into the fluid - since apparently its density increases.
If I keep the mass but decrease the size of of the circle collider, then again the body sinks into the fluid - indicating that its density increases.

So my conjecture is that the density is calculated by the mass of the rigid body, divided by the volume of the collider. But I did not find the formula in the Unity manual. Is this correct?

sentences:
How can I prevent other applications from interrupting my game's exclusive fullscreen mode? I am developing a game using D3D 11.

When I  got a pop-up message from a chat client (HipChat), my game's full screen mode is disabled because IDXGISwapChain::Present returns DXGI_STATUS_OCCLUDED. How can I avoid or prevent this? I don't want my game's exclusive full-screen access interrupted.

sentences:
Moving 2d camera in the y direction I'm developing a simple game for the iphone and am struggling to work out the best way for the camera to follow the main character. The following picture hightlights the three main components:

There are 3 components to this:

Circle - the main character
Green line - terrain
Black background

The terrain is simply made from an array of points (approx 20 points per screen width). The terrain is moved in the x direction relative to the black background in order to keep the circle in its position shown. The distance to move the terrain is simply:

movex = circle.position.x - terrain.position.x

with a constant to fix the circle at some distance from the left of the screen.

I am struggling to determine the best way to position the terrain in the y plane keep the focus in the character. I want to move the terrain in the y direction smoothly and not fix it to the position of the circle, so the circle can move in the y plane.

If I take the same approach as the x positioning, the character is fixed at a point on the screen and the terrain moves. I could sample some terrain points either side of the character and produce an average, but in my implementation this was not smooth. I thought another approach might be to create a camera 'line' that is a smooth version of the terrain line and make the camerea follow this, but I'm not sure if this is the optimum solution. Any advice is much appreciated!

sentences:
Effective Methods to utilize 3d Scanners to produce game development resources Once upon a time I was quite passionate about game development.  About four years ago at the height of my game development aspirations, I was involved in a number of activities. I worked with a team of students at my college to build a game using XNA.  I wrote a basic cross platform 3d engine using OpenGL/GLUT, and I wrote a simple tank game for Android using OpenGL ES 2.0.

For better or worse, since that time I've been swept up in the winds of corporate profit, and for the past few years I've been mostly preoccupied with building corporate applications and websites and I've done very well by it.

Even so, I've been trying to build games on the side, and one of the major limiting factors has always been the acquisition of quality resources (models, textures, sprites, audio) to support the game itself.

Basically what I am trying to say is that given an individual whose greatest strength is the programming, and is mediocre at best at developing graphical and media assets, what do you think some techniques I could use in conjunction with a 3d scanner to help me produce realistic or at least decent 3d models and/or 2d renders of scanned objects?

The catalyst for this thread is that I recently came across a kickstarter for a relatively affordable high quality scanner called 'Robocular'.  Aside from being excited about the project as a huge nerd, I am quite frankly intrigued by the possibilities introduced by having the ability to cheaply manipulate a medium and subsequently scan it as a model.  Although a device like this seems most suited to scanning terrain assets, I can't help but wonder whether it may be feasible to utilize multiple scanner runs to produce model animations, or perhaps scan individual body parts and cobble them together, applying animations later by manipulating the pieces in Blender.  Or perhaps simply using a physical object as the initial base for the model manipulation.

Either way it seems way to potentially save a huge amount of time compared to how long it would have taken me to produce a model myself.  I know there are a lot of free or affordable resource packs online, but one problem I've always had with them is that they don't necessarily combine with each other well.  I.E.  That cheap pack of humanoid models just doesn't quite work with the vehicle pack I purchased, or the free weapon pack I found, etc.  It's often the case that the art style or level of detail from one pack to another just doesn't match up... But like I said I haven't been very active in the game dev scene for a while, so I'm not sure if a 3d scanner is necessarily going to provide as much of a shortcut as simply purchasing model packs...

It's just that the concept is so cool and open ended that it's difficult not to be excited about it.

Basically I was hoping to spark a discussion on the practical applications of such a tool.  Given the high precision of the scanner and the fact that it supports color, it seems like you could do a lot with it.

Some of the initial ideas I had are:

Play Doh or clay + Paint
Wooden models + Paint
Soap models + Paint
Construction Paper or paper mache' + glue/tape
Purchasing toys as base models, then augmenting the toy with clay or play doh to produce something unique
Casting objects in wax, then carving details in the wax shape

I'm confident that some of these techniques could be significantly faster than using the actual 3d modeling tools, at least to start off.  Anyone have some killer ideas on how to utilize a 3d scanner to create assets?

sentences:
Darkness Emitting Light Source Unity I was wondering if it was possible to create a light source in Unity, one that "sucks" light from the environment.

Negative value does not seem to work in Unity, as pointed out by many.

It is quite surprising that there is nothing that I could find that has information on this topic. All year old posts that mentioned this contained only dead links.

sentences:
Which consoles may I target with OpenGL? I'm thinking on technical design for a game/game engine using OpenGL, and I wonder if there is any recent consoles (Xbox360, PS3, Wii U, Xbox one and PS4) that I could work with if I do so.

I found plenty of conflicting answers through forums. The only straight answer seems that it is impossible for Xboxes because Microsoft forbid to use something else than DirectX, its own product.

So, finally, does anyone know for sure which consoles can support an OpenGL-based game?

sentences:
How to modify VBO data I am learning LWJGL so i can start working on my game. In order to learn LWJGL I got the  idea to implement the map builder so I can get comfortable with graphics programming. Now, for the map creation tool I need to draw new elements or draw the old one's with different coordinates.

Let me explain this:

My game will be a 2D scroller. The map will be consisting of multiple rectangles ( 2 strip triangles). When I click my left-mouse button i want to start the rectangle and when I release it I want to stop the rectangle bottom-right at that position.

As I want to use VBOs I want to know how to modify data inside the VBO based on user input.
Should i have a copy of a vertex array and then add the whole array to the VBO at each user input? How is usually implemented the VBO update?

sentences:
How can I reference the frontmost part of a mesh in my Unity code? (and help making FPS projectiles seem more real) I have started making a PC game using Unity. It's just a test project, where I'm making as basic as possible FPS shooter.

I'm using the FPS Controller prefab, and I have also a rifle model attached to it. The result is pretty much what I wanted.

Now I'm considering how I want to create projectiles for the gunfire. I think it will be best for me to create each bullet as just being a ray from the gun barrel heading forwards, OR I might create rigidbodies from the gun barrel I'm not sure yet.

My question is: What is the proper way to reference the point in space in which the gun barrel current ends? At the moment, I am thinking just attach ANOTHER gameObject to the gun model, and just manually position it where the barrel finishes. But this seems 'cheaty' and I think perhaps there is a better way (something like mesh.position.z + mesh.length, but I can't seem to find anything like mesh.length).

I haven't posted code at all, because I haven't really written any on this project yet.

I would also be very interested to hear the pro-tip version of how best to simulate this gunfire (ie. is it best to use rigidbodies? or somehow use raycast or something? or some better way that I haven't even dreamt of)

sentences:
Windows-Linux cross platform game The answers to this cross-platform related question are useful, however I want my (C++) game to run on Windows and Linux (and be packaged for Ubuntu) only. I'm not interested in platforms like mobile or consoles.

Are there any specific tips or suggestions for this case?

Also, if I get the game to work on linux, is it difficult to add support for OSX?

Updating with more information:

It will be a 3D game simulating the motion of spacecraft in the solar system. We will use Ogre3D for the graphics. We're still in the design phase, so there's no code written yet.

sentences:
EventSystem.current is null private void OnEnable()
{
    Debug.Log(EventSystem.current);
    EventSystem.current.SetSelectedGameObject(gameObject);
}

Very simple script for selecting a UI element on enable. However, EventSystem.current prints null to the console.
Unity 2019.3.15f1
I have an Rewired event system in the scene.
Also tried putting this in an IEnumerator and waiting a frame before logging to the console - no change.

sentences:
How does Unity pick which sprite atlas to load? I plan to use sprite atlases for my 2D game. All my animation is sprite animation so I'm going to use sprite atlases for my characters' sprites.
My question is, if I put the same sprite in two different atlases, how does Unity decide which atlas to load?
EX:
I have a sprite atlas per level that contains the background for that level.  Sometimes, there's space left over in the atlas.  So, if I want to put a sprite, which already exists in another atlas, in the empty space for that level's atlas, how does Unity know not to load both atlases?

sentences: 2 component unit vector Is it possible to store a 3d unit length vector with only 2 components, for example as coordinates on a unit sphere? It seems possible but I have never seen anyone do this. Would this be at all practical?

sentences:
Do you need a license for weapon models? When creating your own model for a weapon, say the M4 carbine, and using the model in your game. Do you need a license to use it commercially?
I know that racing games like GT5 has a license for each and every car, but the same apply for weapons?

sentences:
Matching collider to character mesh size in different postures What's the optimal method in Unity to match the size of a Capsule Collider to the actual size of the game object it is part of?

To understand what I'm trying to do let me give an example:

I have a 3D player character with a Capsule Collider that is used to check collision. The character can go into various postures, e.g. crouch, prone, jump. I'm having difficulties to match the height of the collider to the height of the character when crouching or jumping because depending on the used animations the character's height is smaller by various amounts when crouched or jumping.

All I could do so far is set a multiplier for a specific posture by that the collider scales but this is very inefficient, especially when the character tries to jump onto a higher ground.

There seems to be no way of knowing the exact size of a mesh. I'm not sure if it might help to loop through all child meshes (torso, hair, etc.) in a game object and obtain their bounds through SkinnedMeshRenderer.

sentences:
Is it possible to update the livetile in XNA WP7 game? ( I'm not sure if this question belongs here, but since it is related to game development and I have no idea where else I should post this, I will post this here )

As the title says, what I am basically asking is if it is possible to update the livetile of an pure XNA game ( not SL + XNA hybrid )?

I've been thinking something like that whenever user launches the game, I would create an texture dynamically and then update the livetile to show that texture. Even better would be if I could schedule this code to run for example once a day, without requiring user to even launch the game.

Is this possible in WP7 or in WP8 ( is the WP8 SDK even publicly released yet? ) in pure XNA game? What about in XNA + SL hybrid?

sentences: Is there a site where people discuss game concepts and questions in general? I like making game concepts for fun, as a hobby. I don't think that all my game concepts are amazingly awesome and have to be created and would revolutionize the industry. I just want some people to talk to that have the same hobbies as I do. To be able to discuss ideas and point out the pros and cons.

sentences: Game Characters vs Characters in other medias How do a characters designed for a game differ from characters made for books or movies? When a book or a movie is converted into a game, what are the differences and similarities that have to be addressed? Are there pitfalls in character design when jumping between these different medias?

sentences:
How to remap world space to screen space? I am noob to game development, and while using a simple graphics library in Python to make a 2D game, I noticed that the coordinate system of the library had its upper left corner as (0,0), whereas conventionally (at least in math) the lower left corner is set as (0,0).

I want to keep the world space in my physics calculations, but want to map the world space coordinates into the screen space. Furthermore, I want the world space sizes to be a scale of 10 larger than the screen space sizes.

In terms of programming methodology, how should I go about doing this in the most modular fashion?

sentences:
Flickering / tearing with glfwSwapBuffers I recently separated my logic and rendering threads to fix this problem:

GLFW window freezes on title bar hold/drag

This means the logic and rendering are no longer running in lock-step as they were before, so it is possible that the logic has not finished executing by the time we are ready to render. To handle this case, the rendering thread will keep sleeping for 1ms until the logic has finished executing.

Pseudo-code

Logic thread

while (!exiting) {
    timeBefore = now();
    updateGame();
    renderingDue = true;
    timeElapsed = now() - timeBefore;
    sleep(MS_PER_FRAME - timeElapsed);
}

Rendering thread

while (!exiting) {
    if (renderingDue) {
        render();
        renderingDue = false;
        GLFW.glfwSwapBuffers(window);
    } else {
        // Not yet ready to render, but try again in a short while
        sleep(1);
    }
}

This seems to work fine for me, at least with vsync disabled. When I tested with vsync enabled I encountered stuttering, which I suppose is because if we miss a rendering frame, we have to wait until the next monitor refresh interval before we can catch up.

However, on some other systems, in particular low-end laptops, there is a lot of flickering / tearing during gameplay. I don't understand what would cause this, since we are always calling glfwSwapBuffers() after rendering, not during.

Is there something fundamentally wrong with my approach?

I know ideally the rendering thread should take a delta value so that it can render the state "between" logic threads (yes, I have read Fix Your Timestep!), but I am nonetheless curious about what is happening here.

sentences:
Making Scene at editor mode On Button click at editor mode I am trying to make a scene of selected Hierarchy game-object but the problem is as i click the button new scene
     become upon and I lost the scene where i were selected the Game-object. My code given below:

 if (GUILayout.Button("Generate Scene"))
        {
            Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);;
            SceneManager.MoveGameObjectToScene(Selection.activeGameObject, newScene);
            EditorApplication.SaveScene("Assets/RegionScene/" + gameObjectSelected[gameObjectSelected.Count - 1].name + ".unity"); //newScene

        }

sentences:
Why the break point is not working with the unity3d editor? The visual studio version is : 16.8.3 Visual studio community 2019
The editor version is : 2019.4.15f1 personal
On other project I have opened it's working fine. It also worked fine on this project but then something went wrong now not sure why the break point/s are not working with this project !
In the editor I did double click on a script attached to gameobject and it opened the visual studio then I clicked on the left side to add a break point and did Attach to Unity but the break point on the left is broken with yellow warning.

I tried to close and re open both visual studio and the editor.
In the editor I did : Edit > Preferences > External Tools and this is the settings :

I also clicked on the Regenerate project files.
But nothing worked so far.

sentences:
How to make an object covers a specific distance before moving in other direction for same distance? Suppose there is a small tile and I want an object to move on x axis on that tile back and forth.
How can I make that object in that specific tile.
My code is :
 Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
    rb.velocity = new Vector2(-3f, 0);
}

As of now object moves left but I want it to start moving right and not go of the tile.

sentences:
How make animation only consider the final position? I'm trying to make an energy indicator for a puzzle, and i decide to user animation to set the position of the red indicator(photo).

My first ideia is to make 9 animations, and for every black arrow i set the final position to the red indicator. And organizer in the animation controller.

But the main problem is, after every animation, the red indicator got to the first position, in the case the first arrow black, and then go the final position, because all the animation have the same position in the begin (0s).

How can i animation the trasition of red indicator to only got to the end position? Like, if the position of the red indicator was in the 7th black arrow and then go to 3th arrow. Is possible with animation?

sentences:
Rotate sphere in Javascript / three.js while moving along x/z plane I have a sphere/ball in three.js which I want to "roll" around on the x/z plane. For the z axis I could simply do this no matter what the current x and y rotation is:

sphere.roll_z = function(distance) {
      sphere.position.z += distance;
      sphere.rotation.x += distance > 0 ? 0.05 : -0.05;
    }

But how can I roll it along the x axis? And how could I properly do the roll_z? I've found a lot about quaternion and matrices, but I can't figure out how to use them properly to achieve my (rather simple) goal.

I'm aware that I have to update multiple rotations and that I have to calculate how far to rotate the sphere to match the distance, but the "how" is the question. It's probably just lack of mathematical skills which I should train, but a working example/short explanation would help a lot to start with.

Here is an example of how the rotation goes wrong (WASD movement): http://js.blockheaven.net/simple.html

sentences:
How To Animate A JavaScript Function I've been making this game where one of the characters, The Bandit, runs away from you mistaking you for a zombie. However, I can't seem to be able to animate the bandit. Is there a way I could use this w3schools example and make it fit with this canvas function?

The code for bandit is here or the second site:

   function drawBanditFacingDown(){
        //His face
    ctx.fillStyle = "#FFDE7A";
    ctx.fillRect(banditX, banditY, 25, 25);
    //His left eye (your left not his)
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 5, 5, 8);
    //His right eye (again your right)
    ctx.fillRect(banditX + 15, banditY + 5, 5, 8);
    //His bandit thing on his mouth? I don't know what it's called
    ctx.fillStyle = "red";
    ctx.fillRect(banditX, banditY + 15, 25, 10);

    //His shirt
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 25, 16, 25);

    //His arms
    //His right arm (YOUR RIGHT!!!!)
    ctx.fillStyle = "#FFDE7A";
    ctx.fillRect(banditX + 21, banditY + 25, 8, 20);
    //His left arm (On your left side)
    ctx.fillRect(banditX - 3, banditY + 25, 8, 20);

    //His pants
    //His right pant leg (ur right)
    ctx.fillStyle = "#11226B";
    ctx.fillRect(banditX + 12, banditY + 49, 8, 20);
    //his left pant leg
    ctx.fillRect(banditX + 5, banditY + 49, 8, 20);
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 11, banditY + 53, 3, 15);
    //his shoes
    //200 LINES!!!!!!
    ctx.fillStyle = "black";
    ctx.fillRect(banditX + 5, banditY + 68, 15, 5);
    }

sentences:
How to integrate Javascript into C# and run scriptcode step by step We are currently working on a Pokemon MMO trying to figure out how to implement an asynchronous scripting language the best. We don't want to work with threads or tasks, but the goal was to wait for specific commands like the messageBox("Hello World")-Command and stuff like that.

Is there any general solution for our problem?

sentences:
Why does my game look different on my mobile device than in the editor? I am new to Unreal Engine. My game in mobile looks totally different than in Unreal Engine editor.
In Editor:
In Mobile:
Is this a symptom of something obvious? How can I make it so that what I'll see in the editor will be the same thing that I'll see on my mobile device?

sentences:
Sliding movement on a grid I'm trying to implement "sliding" movement on a simple grid, where the movement vector is continuous (floating point direction) but the grid is discrete (boolean blocked or open on integer axes).
The "destination" tile is found by adding the rounded movement vector to the current tile. That part is naive and works well enough.
For example, here:

blue is the current (source) tile
the yellow arrow is the movement vector
green is the destination tile

But this movement ends up being restrictive and I'd like to enable "sliding" to approximate player intent. My goal is that if the destination tile is blocked, the "next best" tile is used instead, provided it is available. I don't know how to calculate that.
As you can see, the naive destination tile (where the yellow arrow lands) is blocked. As a result, I'd like to pick the green tile above as the destination tile.

However, crossing a diagonal should be allowed either, so the following case should result in the movement being blocked:

Finally, I'd like this algorithm to be as permissive as possible, so even the smallest component of the movement vector could win if no better alternative is found. For example, the movement should carry upwards in that case:

This sounds like a fairly simple problem and there may be existing algorithms for it, but I don't know what it's called, so I'm having trouble finding resources on it.

sentences:
Understanding dot notation Here's my interpretation of dot notation:

a = [2,6]
b = [1,4]
c = [0,8]
a . b . c = (2*6)+(1*4)+(0*8) = 12 + 4 + 0 = 16

What is the significance of 16? Apparently it's a scalar.

Am I right in thinking that a scalar is the number we times a unit vector by to get a vector that has a scaled up magnitude but the same direction as the unit vector? So again, what is the relevance of 16? When is it used? It's not the magnitude of all the vectors added up.

The magnitude of all of them is calculated as follows:

sqrt( ax * ax + ay * ay ) + sqrt( bx * bx + by * by ) + sqrt( cx * cx + cy * cy)
sqrt( 2 * 2 + 6 * 6 ) + sqrt( 1 * 1 + 4 * 4 ) + sqrt( 0 * 0 + 8 * 8)
sqrt( 4 + 36 ) + sqrt( 1 + 16 ) + sqrt( 0 + 64)
sqrt( 40 ) + sqrt( 17 ) + sqrt( 64)
6.3 + 4.1 + 8
10.4 + 8
18.4

So I don't really get this diagram:

Attempting with sensible numbers:

a = [1,0]
b = [4,3]

a . b = (1*0) + (4*3) = 0 + 12 = 12

So what exactly is a . b describing here? The magnitude of that vector? Because that isn't right:

the 'a.b' vector = [4,0]
sqrt( x*x + y*y )
sqrt( 4*4 + 0*0 )
sqrt( 16 + 0 )
4

So what is 12 describing?

sentences:
When an animation involves movement, where is the movement better to implement? For context, I am using Blender and Unity. Regarding the question, as an example, in some games, when you get hit, your character tucks a bit and gets knocked back a few distance. The tucking animation I want to implement in Blender but how about the knockback distance? Do you move your model in Blender (tuck and knockback), or do you do the tuck animation only (tuck in place) and then handle the knockback in Unity (basically triggering the tuck animation and then moving the model backwards a bit).

My question basically is, what's commonly done and if there's any specific reason, why?

sentences:
cocos2d Merging box2d bodies i'm using cocos2d to build an iphone game.

my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him.

the main character and the item are both box2d bodies. i can detect the collision between the two. what is want is to make the item body stick to the main character body when they meet, that way any movement of the main character would also affect the item.

any suggestions on how to implement this?

thanks!

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

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

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

sentences: How to implement Ragdoll physics to 2D characters in XNA? I'm starting a new project with XNA. I want to create a game where the main character is subject to ragdoll physics when killed. I was wondering if anyone can give me any tips on how should I implement the character class and apply these ragdoll physics before I start coding so I don't have to refactor my code later. No code is necessary, just a basic overview of an algorithm and some tips. I've found a lot of information about ragdoll physics in 3D but nothig about 2D in XNA.

sentences:
How can I prevent 2D teleportation from teleporting through solid objects? In my 2D game, the player is able to teleport to any place on the screen with the click of the mouse button. What I am trying to prevent is the ability to teleport across solid objects. If the point from the player and the mouse click position is across an object then I want the player to teleport next to that object instead of across it.

I am currently trying to achieve this with raycasting. The code I wrote somewhat works but only if the mouse click is on an object, if the mouse click is across another object, it still teleports me accross the object without it registering that there is an object between the player and the mouse position.

My code:

Vector3 player_position = Camera.main.WorldToScreenPoint(transform.position);
Vector3 to_object_vector = transform.position - Camera.main.transform.position;
Vector3 linear_distance_vector = Vector3.Project(to_object_vector, Camera.main.transform.forward);

float distance_to_camera = linear_distance_vector.magnitude;
Vector3 mouse_position = Input.mousePosition;
float dist = Vector2.Distance(player_position, mouse_position);
Vector3 dir = (mouse_position - player_position).normalized;
mouse_position.z = distance_to_camera;

RaycastHit2D hit = Physics2D.Raycast(new Vector2(player_position.x, player_position.y), new Vector2(dir.x, dir.y), dist, 0);
if (hit.collider != null) {
     Debug.Log(hit.point);
     mouse_position = new Vector3(hit.point.x, hit.point.y, mouse_position.z);
}

Is there a better approach to this problem?

sentences:
How to animate objects with bobbing up and down motion in Unity? I have created a 2D platform game with Unity and C# where I have collectable items that can be picked up by the player. What I want is to give the items more focus by having them bobbing up and down.

I came up with the following version:

Vector2 floatY;

public float FloatStrength; // Set strength in Unity

void Update () {
    floatY = transform.position;
    floatY.y = (Mathf.Sin(Time.time) * FloatStrength);
    transform.position = floatY;
}

But, this makes the object float in the middle of the level instead of where the object is positioned. How can I fix that?

Here is a screenshot of the prototype of the game:

The player can collect the wood stumps which should be bobbing up and down in space just above the ground.

sentences:
How to draw sprite according to Player position when button is pressed? How do I draw a sprite right at my Player sprite's position when I pressed Spacebar?

protected void playerInput() {
        KeyboardState key = Keyboard.GetState();

        if (key.IsKeyDown(Keys.Escape)) this.Exit();
        if (key.IsKeyDown(Keys.Up))     playerPos.Y -= 5;
        if (key.IsKeyDown(Keys.Down))   playerPos.Y += 5;
        if (key.IsKeyDown(Keys.Left))   playerPos.X -= 5;
        if (key.IsKeyDown(Keys.Right))  playerPos.X += 5;
        if (key.IsKeyDown(Keys.Space))  bSpawnSandbag = true;
    }

protected override void Update(GameTime gameTime) {
        playerInput();
        base.Update(gameTime);
    }

 protected override void Draw(GameTime gameTime) {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(player, playerPos, Color.White);

        if (bSpawnSandbag) {
           spriteBatch.Draw(sandbag, new Vector2(playerPos.X + 3, playerPos.Y + 3), Color.White);
        }

        spriteBatch.End();

        base.Draw(gameTime);
    }

If I use the code above, the "sandbag / the sprite I want to draw" will move with my Player position and I don't want that. I want it to draw at THAT specific position my Player was once at when I press Spacebar for 1 time. Any clue? O_O
I want it to be...

Let say, player position = (10, 10) Player pressed Spacebar, draw Sandbag at 10,10 (permanently) Even though Player moved to 12, 10 & not pressing Spacebar , the Sandbag would still be at 10,10

sentences:
Backtracking in A Star Hello, can anyone tell me how can i implement backtracking in a a star search algorithm?
I've implemented the a star search according to wiki, but it does not backtrack, what i mean by backtrack is that if the open list(green cells) contains 2,0 and 3,3 as shown in the picture, upon reaching 2,0 the current node would "jump" to 3,3 since the cost is now more than 3,3 and continue the search from there, how can it be done so that it would backtrack from 2,0->2,1->2,2... all the way back to 3,3 and continue?

sentences:
Kickstarter and 2D smartphone games I am about to launch a Kickstarter project as, after 14 months of full time development on my first iOS game, I run out of money. I developed an iOS game that needs few more months to be ready (the game structure is there but haven't yet worked on balancing the difficulty of the various levels).

I have a feeling that most of the computer games founded on Kickstarter are for console, PC or Mac and not for smartphones. The category that many people seem to like is RPG style games.

I have done tons of work over a year and collaborated with musicians and illustrators to get top quality graphics and music. The game looks cool to be an iOS 2D game but, compared to what I've seen on Kickstarter, I feel so little and humbled.

I have searched for smartphone game projects on Kickstarter but haven't found many. I believe that the reason is that people are not keen in backing an APP that is normally sold for 0.99$ as they perceive is not something big. Am I the only one having this feeling?

Could anyone please share a list of references to some successfully backed kickstarter smartphone game projects? (In this way the question will not become a "chat" and will fulfill the requirements to be a gamedev question).

Any other article or authoritative answer will be welcome.

sentences:
Developing a 2D Android game on Unity - Pros and Cons Depending on your experiences, if you have created a 2D game on Android using Unity, was it painful? Have you ever said "I wish I have used X instead of Unity!"?

Tell me the Pros, Cons and the name of "X" please.

Edit: Consider it for a commercial shoot em up game. The programming language can be anything.

sentences:
javascript efficient collision detection I have a processing game where I am having serious lag problems with collision detection. I am using the most effective code I can think of however after about 9 levels in The game gets unbearably laggy. I would show you the code but site wont handle my less thans.

If you want to check the program out you can find it here:
https://www.khanacademy.org/computer-programming/tanks-v1245/6637554186715136
under the tankMelee function ~line 160

sentences:
Normal maps in 3dsMax - OgreMax - how to view associated tangent vectors? Reading this post I found out that 3dsMax might not use the same tangents when rendering normal mapped objects. In my case, I was using Ogre and OgreMax to analyze results and they were very inconsistent with what Max was showing. I am able to "colour map" the tangent space in Ogre using shaders, but in Max I can't find out how it is computed wrt to the actual geometry. I also posted the question on the Ogre forums, but nobody answered. Has anyone encountered such an issue up until now? How did you go around it?

For further information, this is the Ogre post.

sentences:
Null instance on manager class extending from singleton class I have four classes:

class A, which is abstract and partial extending from singleton class C.
class A1, which is partial and extending from class A .
class B,  extending from class A.
class C, a singleton which has code to throw an exception if the instance is null, and otherwise uses DoNotDestroyOnLoad().

In scene view, I add class B to the scene. It works, but throws a null instance exception for class A, as it's instance is not present in scene. I think this is because class A extends from a singleton class, and it has ability to throw exceptions when the instance is null. I can not add the class A to the scene because it is abstract.

What can I do to in order to add the class A component to the scene, or otherwise not to get this error?

sentences:
Looking for collision detection algorithms for broad and narrow phases between non-convex polyhedrons I have some experiences on particle system simulation (namely DEM - Discrete element method), in which an individual particle with realistic shape (convex and non-convex) is approximated by gluing 3D spheres together (non-overlapping or overlapping), and act like rigid body. The collision detection is performed by the simplest sphere-sphere contact.

Nevertheless, for particle shape representing by polyhedrons, almost all the collision detection algorithms for broad and narrow phases are based on convex polyhedron (e.g. GJK). For non-convex/concave shapes, convex decomposition is required to divide the concave object into many convex components (e.g. V-HACD).

At this point, I really want to know the details on:

  1) how to store the concave objects via many convex components into memory (like BSP tree?);

  2) collision detection and contact forces calculation between
  convex-concave, concave-concave objects.

I have searched quite a few relevant books like "Real-time collision detection" and "3D game engine design", etc,  unfortunately I haven't find any details on this topic yet. Could some veteran game developers give some advice or insight on how to implement collision between concave objects?

Cheers,

David

Update 1:

Seems the physics engines likes Bullet3 and reactPhysics3D are able to simulate collision of non-convex objects. Can someone give some rough idea on how to do this? before I dig into the source codes, since i have only some academic experiences on molecular dynamics / DEM simulations mainly based on 3D spheres.

sentences:
How do I load real-world map terrain? I'm new to game development and want know how to make or load a terrain from OpenStreetMap or Google Maps in your current city. (I'm using Unity3D.)

My idea is just load or generate a map of the current location, without collisions or anything else. A good example could be the Google's game "Ingress".

I found a few tutorials but only for a static city or mountain.

sentences:
Help creating combat for collection type game sorry for my odd terminology, I am rather new to all this

I'm creating a collection/pokemon type game. as of right now I have created a separate GameObject prefab for every monster/character in the game. Each gameobject contains a script with enumerated values for it's stats. When combat begins It calls a random monster from a pool of gameobjets. The problem is at this point I'm not sure how to have it create a new instance of the enemy in a way where it retains the values in it's public floats from the prefab or have it's level be adjusted as it enters. And I don't know how I can derive it's stats and properties for scripts outside the function that spawned it. as the function that creates the new duplicate won't remember the new creature after the function resolves.

so In short, How can I reference the enumerated integers of a newly duplicated gameobject

I was asked to include some more information on what I've coded:

public List<baseMonsters> allMonsters = new List<baseMonsters> ();

public void EnterBattle(Rarity rarity)
{
    // this code swaps camera view to the battlefield from the overworld map
    playerCamera.SetActive(false);
    battleCamera.SetActive(true);

    // call function to determine which monster appears
    baseMonsters battleMonster = GetRandomMonsterFromList(GetMonsterRarity(rarity));

    // returns which monster was chosen
    Debug.Log (battleMonster.name);

    // prevents the player from moving after combat begins
    player.GetComponent<PLayermove>().isAllowedtoMove = false;

    //Creates the defending monster
    GameObject dMon = Instantiate (emptyMon, defencePodium.transform.position, Quaternion.identity);
    //Ensures scale from original is preserved
    dMon.transform.localScale = battleMonster.transform.localScale;

    Vector3 MonLocalPos = new Vector3 (0, 1, 0);
    dMon.transform.parent = defencePodium;
    dMon.transform.localPosition = MonLocalPos;

    //Adds the stat components of the original prefab
    baseMonsters tempMon = dMon.AddComponent<baseMonsters> () as baseMonsters;

    tempMon = battleMonster;

    dMon.GetComponent<SpriteRenderer> ().sprite = battleMonster.image;
    bm.ChangeMenu (BattleMenu.Selection);

}

the issue that I see with the code is that it's transforming an already existing object into what the prefab monster is, not copying it. what method can I use to copy the prefab in a way I can easily reference in the same function to change it's level?

-Update-

ok so changing everything over to instantiating a GameObject is what I want. now there is the other part from the code before:

public List<baseMonsters> GetMonsterRarity(Rarity rarity)
{
    List<baseMonsters> returnMonster = new List<baseMonsters> ();
    foreach (baseMonsters Monster in allMonsters)
    {
        if (Monster.rarity == rarity)
        returnMonster.Add (Monster);
    }
    return returnMonster;

}
public baseMonsters GetRandomMonsterFromList(List<baseMonsters> monList)
{
    baseMonsters mon = new baseMonsters ();
    int monIndex = Random.Range (0, monList.Count - 1);
    mon = monList [monIndex];
    return mon;
}

I was following a tutorial when I created this code, I am starting to understand more and more how spaghetti it is.
sorry for all the Alike Terms, baseMonsters is a class that houses things like the rarity and stats of the monster. These functions are searching by and for that script. How can I convert these codes over to searching the class from a list, to a Gameobject from a list, and still be able to read baseMonsters of each respective GameObject and it's rarity int?
 as of right now, one workaround I can think of is to create a seperate list for each rarity. that way I can skip needing to read the rarities in the baseMonsters script entirely. But I will still need to know how I can call that class script for other things like determining level of the monster and what it's attacks will be?

sentences:
Search app store for similar games on pc I want to search the app store for similar games so I can see how much competition there will be for any apps I am thinking of designing.

Knowing how many clones/similar games there are plus there prices and success rate would go a long way in deciding which ideas to take forward.

Is there anyway to do this easily on a pc (I do not have an iPhone)

sentences:
Where's the line between homage and copyright infringement? My current WIP game contains a music note collectible mechanic which allows players to play short tunes if collected in the right order (usually very obvious by the layout of the collectibles).
So far, I've kept it at references to Mozart or Beethoven, as this is what fits my game's theme. However, I was thinking of hiding, say, the first few notes of the Mario theme, or of Star Wars' Imperial March, in certain locations, as an homage.

Is this copyright infringement? I assume that having a whole copyrighted song reconstructed note by note like so would constitute a breach of copyright, but how about 10 recognisable notes?

Thanks! :)

sentences:
Creating a player that can hold different items I am making a game using Java, LibGDX and Box2D. What would be the best way to create a player that can hold:

no item
one item from group A
one item from group B
one item from both groups

Items from group A can only be used to attack, and are held in the right hand.
Items from group B can only be used to defend, and are held in the left hand.

Should I add the item to the player class and render/update the item in the player class? Or is there any best way to this that I am not aware?

This is the best way I know how to do it:

I would also be interested in any design pattern that could be applied to this situation.

sentences:
I am looking to create realistic car movement using vectors I have goggled how to do this and found this http://www.helixsoft.nl/articles/circle/sincos.htm I have had a go at it but most of the functions that were showed didn't work I just got errors because they didn't exist. I have looked at the cos and sin functions but don't understand how to use them or how to get the car movement working correctly using vectors. I have no code because I am not sure what to do sorry.

Any help is appreciated.

EDIT:

I have restrictions that I must use the TL engine for my game, I am not allowed to add any sort of physics engine. It must be programmed in c++. Here is a sample of what i got from trying to follow what was done in the link I provided.

if(myEngine->KeyHeld(Key_W))
    {
        length += carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_S))
    {
        length -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_A))
    {
        angle -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_D))
    {
        angle += carSpeedIncrement;
    }

    carVolocityX = cos(angle);
    carVolocityZ = cos(angle);

    car->MoveX(carVolocityX * frameTime);
    car->MoveZ(carVolocityZ * frameTime);

sentences:
I'm implementing a sort of isosurface extraction and theres a bunch of holes i'm implementing a isosurface extraction algorithm losely based on dual contouring but theres a bunch of holes it looks like what i want though other than that
can you look at code and fix it maybe it's not much code
basically i'm looping through all the blocks and finding all of the changes in sign the interpolating the vertex and averaging all those out (as opposed to qef ) the problem is the second part of the code looking for vertexes to connect up get messed up ones when i have no changes in the block of the first code (i tested that with that bit of commented out code it just looks really jagged though)

darray3d<glm::vec3> verts(sidel);
    LOOP3D(sidel-1){
        glm::vec3 changes[12];
        size_t inc=0;
        LOOP2Da(1){
            if ((getpt(i+ia, j+ja, k+0,data,sidel)>0) != (getpt(i+ia, j+ja, k+1,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+ia,j+ja,k+0),glm::vec3(i+ia,j+ja,k+1),getpt(i+ia, j+ja, k+0,data,sidel),getpt(i+ia, j+ja, k+1,data,sidel));
                inc++;
            }
            if ((getpt(i+ia, j+0, k+ja,data,sidel)>0) != (getpt(i+ia, j+1, k+ja,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+ia,j+0,k+ja),glm::vec3(i+ia,j+1,k+ja),getpt(i+ia, j+0, k+ja,data,sidel),getpt(i+ia, j+1, k+ja,data,sidel));
                inc++;
            }
            if ((getpt(i+0, j+ia, k+ja,data,sidel)>0) != (getpt(i+1, j+ia, k+ja,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+0,j+ia,k+ja),glm::vec3(i+1,j+ia,k+ja),getpt(i+0, j+ia, k+ja,data,sidel),getpt(i+1, j+ia, k+ja,data,sidel));
                inc++;
            }
        }
        glm::vec3 pos=glm::vec3(0.f);
        for (size_t ia = 0 ; ia < inc ; ia++)
            pos+=changes[ia];
        pos/=float(inc);
        //if (inc > 0)
            verts(i,j,k)=pos;
       // else
           // verts(i,j,k)=glm::vec3(i+0.5f,j+0.5f,k+0.5f);
    }
    LOOP3D(sidel-1){
        if (i > 0 && j > 0){
            bool solid1 = getpt(i, j, k + 0,data,sidel) > 0;
            bool solid2 = getpt(i, j, k + 1,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i - 1, j - 1, k),
                    verts(i - 0, j - 1, k),
                    verts(i - 0, j - 0, k),
                    verts(i - 1, j - 0, k),tris,solid2);
            }
        }
        if (i > 0 && k > 0){
            bool solid1 = getpt(i, j + 0, k,data,sidel) > 0;
            bool solid2 = getpt(i, j + 1, k,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i - 1, j, k - 1),
                    verts(i - 0, j, k - 1),
                    verts(i - 0, j, k - 0),
                    verts(i - 1, j, k - 0),tris,solid1);
            }
        }
        if (j > 0 && k > 0){
            bool solid1 = getpt(i + 0, j, k,data,sidel) > 0;
            bool solid2 = getpt(i + 1, j, k,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i, j - 1, k - 1),
                    verts(i, j - 0, k - 1),
                    verts(i, j - 0, k - 0),
                    verts(i, j - 1, k - 0),tris,solid2);
            }
        }
    }

picture of holes:

sentences:
How can I make the camera that follows my character position also follow the character rotation? So I've tried to make the camera also follow my character rotation, I tried using the same process that I did for the position follow, using quaternion and transform.rotation but it was giving me some errors. Since I'm pretty new, I will ask for the best solution for my problem, here's the code:

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

void LateUpdate()
{
    transform.position = player.transform.position + followPos;
}

sentences:
What are some common FOV for third person games? I am trying to decide on a field of view (FOV) for a third person game and I really don't know where to start. It would be very helpful to have some points of reference from recent TPS games and the FOV they use by default. The trouble is many third person games (or at least those I have tried) do not have any settings or information about what their default FOV is. I have had a look at Uncharted 4, Hitman (2016), The Division and GTA 5 but cannot find information about their FOV anywhere.

I understand that each game is different and the type of gameplay will determine the FOV choice here, but it would be very useful for me to have some existing examples as a starting point. Is there any good place to find this out?

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

public var smooth : float;

private var newPosition : Vector3;

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

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

    newPosition = positionA;

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

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

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

sentences:
LibGDX buttons bounds are wrong I am making a simple gui in libgdx and run into this problem ; when you click on the button it's bounds (?) are wrong since if I click under it, the game registers it as a click.

On the other end, if I click it at the top it won't get the click. It seems like the bounds are a bit under the button. I tried to set manually but nothing.

Also i tried changing sizes.

Looked here : too this is almost the same but no answer..

tabl = new Table();
    stage =new Stage();
    tabl.setSize(stage.getWidth()/2, stage.getHeight()/2);
    tabl.defaults().size(500, 40);

    g = game;

    Gdx.input.setInputProcessor(stage);

    skin = new Skin();

    TextureAtlas te = new TextureAtlas(Gdx.files.internal("uiskin.atlas"));

    skin.addRegions(te);
    skin.add("default-font", new BitmapFont());
    skin.load(Gdx.files.internal("uiskin.json"));

    Pixmap r = new Pixmap(100,100,Format.RGBA8888);
    r.setColor(0xff0000ff);

    r.fillRectangle(1, 1, 13, 13);
    Texture s = new Texture(r);
    SpriteDrawable s1 = new SpriteDrawable(new Sprite(s));

    TextButton gam = new TextButton("new games",skin);

    gam.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
                int pointer, int button) {
            // TODO Auto-generated method stub
            //g.setScreen(null);
            new Logger("e").setLevel(10);
            return true;
        }
    });

    /*super.getS*/
    LabelStyle tt = new LabelStyle(new BitmapFont(), Color.BLUE);
    Label l = new Label("d",tt);

    tabl.add(gam);

    tabl.setDebug(true);

    stage.addActor(tabl);

sentences:
Why is Y up in many Games? I learned at school that the z-axis is up. It is the same in modeling software like Blender. However in many games the y-axis is up.

What is the reason?

sentences:
Very slow motion smooth rendering - cocos2d-x I have a a white circle that I move on a black background very slowly. When I look very carefully, I see that the while moving the edge of the circle is jittering. In my opinion it is because the next row/col of pixels becomes white from black where the circle should be rendered and as the pixel has some width I see some abrupt advance of the edge toward the direction. Ideally, this should not be visible if I would not have pixel discretization. But on the other hand a have a video sample with such a slow motion and my monitor renders it without any jumps on the edge. Hence, I think that it is because of not the fact that pixel have finite sizes but I render wrongly. How I can solve the problem? Any trick, flag?

EDIT: Here is the code I have used:

Sprite* bg = Sprite::create("gfx/letter_background.png");
addChild(bg, 100);
bg->runAction(MoveBy::create(80, Vec2(500, 500)));

wherer the .png I have used is a white circle attached below:

You don't see the image above as it is white :)

sentences:
Making dialogue different with each playthrough I'm making a little demo game where roughly half of the NPCs in a little town have a profession, as well as a personality. I'm trying to have the game procedurally create dialogue,
so when an NPC is talking about what they do, they describe it with some personality.

So for example, I may have a farmer who's an over achiever. He may have dialogue like this: "I farm from sun up to sun down. And I have the most cows around!"
In another incarnation, a brainiac farmer may say, "Hi, my farm has exactly five cows, and is run very efficiently."

In the demo, the town will be procedurally generated, with a small number of townsfolk (around ten or twelve). Some will be peasants, others will be farmers. One or two will be merchants/shopkeepers. When the player talks to some of these folk, the NPC may greet the player and say something about what they do. Or they may describe themselves, as well as something about their town. On occasion, the NPC will also say something about their family.

I have thought of using a templating system, where it would fill in some of the dialogue. But I would like the sentences to vary with each playthough.
I have also thought of using parts of speech so as to create sentences. The problem with using parts of speech (at least with using NLTK) is that I need some form of grammar to string them all together,
and this is mainly meant for a small demo. Another option is to use a natural language generator (NLG), but that's getting into the realm of advanced AI. And I would like to steer away from that.

So should I use a templating system for the dialogue (I have tried using Rant, but I got into some really complicated syntax with that)? Or, should I use a dialogue system that uses parts of speech, and strings them together with some kind of grammar?

For what it's worth, I'm restricting the NPCs to a group of personalities. Also, some of what they say is based upon their stats. So if their intelligence is low, yet their charisma is high, maybe they'll be a xenophobe, or an over achiever.

sentences:
How can I cleanly separate the UI from the game logic in my Cocos2d game? I've been working on a little game for the last few months, trying to approach it as a software engineer and employ best patterns and practices in my coding. I have gotten to the point where I have to distinct elements in my game.

The Game Logic: aka business logic. Its the meat of the game rules. It contains all information about game objects (such as Character, Weapon, and Item class definitions). It contains the game world as far as rules are required; mainly so Characters are aware of the world they are in, and who else is in it. It contains a chunk of logic use to determine how Fighting is resolved between Characters, as we as other game actions requiring rules. It contains my AI implementations. So in reality it's a combination of Class definitions and Service logic.

As it stands, the Game Logic can actually play out a game without any interface. All I need to do is create a World, add some Characters to it, assign some AI's to them, then in a loop tell their AIs to run. The result of each AIs action is reflected in the states of the Characters (eg, if damaged, health is reduced), and a summary of what happened is returned by the execution (which is intended for the UI to make sense of what happened).
The Game UI: which is using Cocos2d-xna for WP7. It contains definitions of all the different animations. It takes in inputs and sends the to the Game Logic, and renders its results.

As it stands, as well as all UI components for a Character (textures, sprites, animations) a UI Character also contains a Begin method which executes a Cocos2d Sequence (ccSequence) to do two things 1) Execute AI and render result for this Character 2) Re-Execute the sequence (essentially its own call back loop for executing actions).

The problem I keep running into is, the more I try to keep these two layers separate, the more they need to come together. E.g., my UI Character which is used to render what the Game Logic character is doing, so it needs a reference to the Character object from Game Logic. When this Character's AI attacks someone in the Game Logic world, the UI needs to know what happened. This works fine for rendering its own Animations based of its results, but to know what to do for other Characters affected by this action is difficult as I dont have reference to them. At the moment I do this by queuing up Pending Animations in the other character's Game Logic Character and render it when that character next executes, but this is anti SoC (Separation of Concerns) as it now contains something specific for the UI to focus on.

I don't want the two projects to merge into one where a Game Logic Character contains all things UI as well, such as animations and actions. Is there a nice clean way that is used for this separation? Ideally something that works nicely with Cocos2d's Action pattern?

sentences:
How should I attenuate sound in a 2D game where you can zoom in and out? In my 2D game, I have some ambient sounds like the noise of a waterfall or the humming of a generator. However, it is not practical to play these sound all the time at full volume as in a large level the overlap of many of such noises would be quite unpleasant to the ear.

I am currently thinking about a system that modulates the volume of certain sounds depending on their distance to the player. However, this is partly not a great solution as (for example) in a zoomed state the player might be quite far away from the sound source (like a water fall) but still be able to see it on screen but not hear it (due to the distance) which is quite awkward.

Is there a solution for such a problem?

sentences:
I need to access a variable from another script in Unity I have been trying to aimlessly make a unity game around a 3d aim trainer and I have been trying to set up the targets that pop up. For now, I just wanted to create targets that pop up once every second at a maximum of 3 targets at one time ever. I have already set up the random spawn of the targets and the removal of them with the help of raycast shooting and made a max of 3 targets, however, to make the max of 3 targets I used an integer with a simple targetCount += 1 and the deletion of the target is being done on a different script as seen below. My problem is making the targets respawn once being shot after spawning the first 3 targets. I tried to use getComponent to reach the targetCount variable in my Target code to just simply targetCount -= 1 every time I delete a target so that as long as the variable doesn't reach 3, it will continue to spawn targets however I was having some troubles.
Please let me know if you have any ideas
This is my target spawning code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateEnemies : MonoBehaviour
{
    public GameObject theTarget;
    public float xPos;
    public float yPos;
    public int targetCount = 0;

    void Start(){
        StartCoroutine(TargetDrop());
    }

    IEnumerator TargetDrop()
    {
        while (targetCount < 3)
        {
            xPos = Random.Range(-6, 11.5f);
            yPos = Random.Range(2.4f, 9);
            Instantiate(theTarget, new Vector3(xPos, yPos, 13.5f), Quaternion.identity);
            yield return new WaitForSeconds(1);
            targetCount += 1;
        }
    }
}

And this is my Code attached to my target
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Target : MonoBehaviour, IDamageable
{
    [SerializeField] private TargetStats targetStats;

    private int currentHealth;
    /*
    public GenerateEnemies generateEnemies;

    private void Awake()
    {
        generateEnemies = GetComponent<GenerateEnemies>();
    }
    */
    private void Start()
    {
        currentHealth = targetStats.maxHealth;
    }

    public void DealDamage(int damage)
    {
        currentHealth -= damage;
        CheckIfDead();
    }

    private void CheckIfDead()
    {
        if(currentHealth <= 0)
        {
            Destroy(gameObject);
            /*GenerateEnemies.targetCount -= 1;*/
        }
    }
}

sentences:
Recursively find neighbors I'm making a Bubble Shooter game in Unity. I came to the point where I can hit another bubble and it destroys all of its neighbors.

Now I'm trying to use recursion to destroy all of its neighbors neighbors and it causes a stack overflow.

private List<Bubble> FindAllRecursiveNeighbors(Vector2Int originPosition)
{
    List<Bubble> allNeighbors = FindNeighbors(originPosition);
    List<Bubble> result = new List<Bubble>();

    foreach (Bubble bubble in allNeighbors)
    {
        if (result.Contains(bubble)) { continue; }
        result.Add(bubble);
    }

    // Recursion starts here.
    foreach (Bubble bubble in result)
    {
        List<Bubble> neighbors = FindAllRecursiveNeighbors(FindPositionOfBubble(bubble));
        foreach (Bubble neighbor in neighbors)
        {
            if (result.Contains(neighbor)) { continue; }
            result.Add(neighbor);
        }
    }
    return result;
}

sentences:
Direction vector in raycasting When I read about how to get the direction vector in raycasting, for example on this site: http://www.daimi.au.dk/~trier/?page_id=98

They first render the mesh with front face culling and then with back face culling. And then subtract the backface from the front to get at a direction vector for each pixel.

But is this not to much work to get the direction vector, is it not more simpler and faster to just take the vertex position(in world coordinates) and subtract the camera position in the fragment shader to get the direction vector? This should give the exact same answer but we skip the backface and frontface rendering.

sentences:
Is implementing your own scripting language viable? I am coding a beat 'em up game in C++ and the time has come to implement scripting for events, triggers, cutscenes etc.
I have read around on the internet and gotten a fair bit of information. My first choice solution would be to implement my own scripting language like the one in Cave Story.
I have seen this suggested but most poeple suggest lua but that does not seem to fit my type of programming.

Have you made your own scripting language? Why did you chose to roll your own instead of using an existing one? What resources did you consult during the development?

sentences:
Dynamic 2d terrain loading / stitching in Unity I'm currently working on a top down 2d game (in Unity 2d) where I'd like to build a huge terrain for the player to explore.
My question is - do you have any good practices or ideas on how to chunk the terrain, work on it in Unity (should I work on terrain chunks in different scenes etc.) and finally load it dynamically and efficiently in runtime ?

sentences: If I own the rights to a third party game on a defunct console, can I republish it without the permissions of the console manufacturer? Suppose I owned the rights to a third party game published on the NES. Could I make a ROM of it and sell the emulated version?

sentences:
Transparency on pixel level? I'm using java and I do pixel-by-pixel rendering (a pixel array from an ARGB BufferedImage). So a color is 0xAARRGGBB. Now how can I render a transparent color? I guess that I should manipulate the existing pixel and not overwrite it. I can make color addition simply:

public static int additiveColor(int c1, int c2) {
        int red = (c1 & 0x00ff0000) + (c2 & 0x00ff0000);
        int grn = (c1 & 0x0000ff00) + (c2 & 0x0000ff00);
        int blu = (c1 & 0x000000ff) + (c2 & 0x000000ff);
        return 0xff000000 + (red > 0x00ff0000 ? 0x00ff0000 : red) + (grn > 0x0000ff00 ? 0x0000ff00 : grn) + (blu > 0x000000ff ? 0x000000ff : blu);
    }

So to set a pixel to a sum of two colors I just do this:

pixels[i] = additiveColor(c1, c2);

How can I do transparency?

sentences:
Game development for multiple Microsoft platforms I intend to develop games for Microsoft's Windows Store, however, I'm confused between their platforms, so please clarify those questions:

Is there any technology (XNA, DirectX), so a game can be distributed to Xbox360, Windows Store, Windows Phone?
What are the differences between Xbox360 and Windows?
What is a good approach for 2D games?
Does a Windows Store game work for Windows Phone just by recompiling it?
Are the Windows Store and Windows Phone store separated?

sentences:
compiler optimixation interfering with threaded function I'm making a block game in c++ that stores voxels in a octree and because, at least in my implementation, editing the octree is slow, I'm generating the chunks of land in a separate thread.

I manage the thread with my ThreadManager class. Every frame I loop through the threads and see if they have finished and remove them. When the ThreadManager object goes out of scope(it is the first game object to go out of scope) it waits for every thread to finish in the destructor. My problem is that when O2 or O3 compiler optimizations are turned on(O and O1 are fine) the threads never finish and I have to force quit the program.

I know that making variables volatile can stop the compiler from optimizing away variables used as conditions that are changed in another thread, but that doesn't seem to be the problem here. What fixes it is printing something in the loop of the generateChunk function or making the height value a constant instead of using Worldgenerator::getTerrainHeight() (see below) Could anyone think of a way to make sure that I can keep the loops from getting the call to Worldgenerator::getTerrainHeight() from being "optimized" this way without using O or O1? (without at least O2 the chunk generation is quite slow and I'd not like to remove possibility of further increasing speed everywhere else for the sake of this one part)

ThreadManager:

class ThreadManager{
public:

    ~ThreadManager(){
        std::cout << "destroying threads\n";
        for(int i = 0;i < threads.size();i++){
            std::cout << i << "\n"; //never makes it past index 0 with O2 or O3 flags
            threads[i].get();
        }
        std::cout << "threads destroyed\n";
    };

    void addThread(std::future<void> newThread){
        threads.push_back(std::move(newThread));
    }

    void pollThreads(){//called every frame
        for(int i = 0;i < threads.size();i++){
            if(threads[i].wait_for(std::chrono::milliseconds(0)) != std::future_status::timeout){
                threads[i].get();
                threads.erase(threads.begin()+i);
                i--;
            }
        }
    }

    int getNumThreads(){
        return threads.size();
    }

private:
    std::vector< std::future<void> > threads;

};

This is the function executed in a another thread:

void Game::generateChunk(Chunk& chunk){
    //std::cout << "generate\n";
    Octree& tree = chunk.getTree();

    for(double x = tree.getX();x < tree.getX()+CHUNK_WIDTH;x+=1.0){

        for(double z = tree.getZ();z < tree.getZ()+CHUNK_WIDTH;z+=1.0){
            //std::cout << "height\n"; when this is uncommented the threads end when .get() is called on it
            double height = worldGenerator.getTerrainHeight(x*100000,z*100000)*40;
            //double height = 40; if this line replaces the preceding line it works as well

            for(double y = tree.getY()+CHUNK_WIDTH-1.0;y >= tree.getY() && y > height;y-= 1.0){
                tree.setBlock(tree.coordsToLoc(x,y,z,1.0), Voxel{BLOCK_TYPE_AIR});
            }

        }
    }

    chunk.generated = true;//std::atomic<bool>

    voxelInstanceDataMutex.lock();

    quickMesh(chunk.getPos(), vulkanApp);

    needsVoxelInstanceBufferUpdate = true;//std::atomic<bool>
    voxelInstanceDataMutex.unlock();
    return;
}

How the threads are created:

//future objects are std::move()ed to put them into the ThreadManager
for(auto newPos : newChunkPos){
    chunks.emplace(newPos, Chunk{newPos,CHUNK_WIDTH});
    Chunk& c = chunks.find(newPos)->second;
    threadManager.addThread(std::async(std::launch::async,&Game::generateChunk, this, std::ref(c)));
}

sentences:
Fix Pixel Shader "Stage did not run. No output" I'm trying to set up a minimal D3D11 renderer but fail to get the pixel shader stage to run. The available answers here or the ones I found through Google couldn't help me, unfortunately.

Using Visual Studio's Graphics Debugger I could verify that my vertices are set correctly and the vertex shader also runs as expected. The debug layer doesn't report any issues either. As a test I disabled depth testing, stencil testing and backface culling as shown below with no changes.

I made sure that the viewport is set correctly as well as this seems to be a common source of this problem.

At this moment I can't think of any other cause for this issue and would be happy about any advice of what else to look out for.

Disable depth/stencil test:

D3D11_DEPTH_STENCIL_DESC dsstate_desc = {};
dsstate_desc.DepthEnable             = false;
dsstate_desc.StencilEnable           = false;
dsstate_desc.DepthFunc               = D3D11_COMPARISON_ALWAYS;
dsstate_desc.DepthWriteMask          = D3D11_DEPTH_WRITE_MASK_ALL;
dsstate_desc.BackFace.StencilFailOp  = D3D11_STENCIL_OP_KEEP;
dsstate_desc.BackFace.StencilPassOp  = D3D11_STENCIL_OP_KEEP;
dsstate_desc.BackFace.StencilFunc    = D3D11_COMPARISON_ALWAYS;
dsstate_desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
dsstate_desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
dsstate_desc.FrontFace.StencilFunc   = D3D11_COMPARISON_ALWAYS;
d3d11device->CreateDepthStencilState(&ds_state, &this->ds_state);
d3d11context->OMSetDepthStencilState(this->ds_state, 0);

Disable backface culling:

D3D11_RASTERIZER_DESC rasterizer_desc = {};
rasterizer_desc.AntialiasedLineEnable = false;
rasterizer_desc.CullMode              = D3D11_CULL_NONE;
rasterizer_desc.DepthBias             = 0;
rasterizer_desc.DepthBiasClamp        = 0.0f;
rasterizer_desc.DepthClipEnable       = false;
rasterizer_desc.FillMode              = D3D11_FILL_SOLID;
rasterizer_desc.FrontCounterClockwise = true;
rasterizer_desc.MultisampleEnable     = false;
rasterizer_desc.ScissorEnable         = false;
rasterizer_desc.SlopeScaledDepthBias  = 0.0f;
d3d11device->CreateRasterizerState(&rasterizer_desc, &this->rasterizer_state);
d3d11context->RSSetState(this->rasterizer_state);

Pipeline view in debugger:

Vertex shader transformation:

Vertex shader:

struct VertexIn
{
    float3 position : POSITION;
    float3 normal   : NORMAL;
    float4 color    : COLOR;
};

struct VertexOut
{
    float4 color    : COLOR;
    float4 position : SV_POSITION;
};

VertexOut main(VertexIn i)
{
    VertexOut o;
    o.position = float4(i.position, 1.0f);
    o.color = i.color;
    return o;
}

Pixel shader:

struct FragmentIn
{
    float4 color    : COLOR;
    float4 pos      : SV_POSITION;
};

float4 main(FragmentIn i) : SV_TARGET
{
    return float4(1.0f, 0.0f, 0.0f, 1.0f);
}

sentences:
c++/openGL 3D Bouncing Cube I'm trying to write a little program with a bouncing cube but I can't find the right values for it.
I have these lines:
modelMatrix = glm::mat4(1)

modelMatrix *= Translate(x, y, z)

modelMatrix *= RotateOZ(angle)

RenderMesh(mesh["cube"], shaders["V"], modelMatrix)

I add/sub the y in a interval and the angle too.I have a problem because I don't really know with which values to increment/sub these values.

I want the same effect as in the image but at all angles [0 - 180].
EDIT++
So I want my cube to bounce while it's rotating like in the image. First the cube will have the arrow down to show what's his position first at y0 and x0. Then he will rotate in the [0 - 90] range. I want the cube to have the arrow up meaning that the cube will be rotated at 90 angle when he will hit y1 and x1/2. Then he will start to descend at an angle [90 - 180] so he will be at y0 but with at x1.
I tried incrementing the x, y and the angle with a small value like 0.1 and then decreasing the y when it hit a point. The result is close but I can see that it's not perfect.
I hope that made sense.
Thank you for your time!

sentences:
Do you extend Java, to make games, or can you just use JFrame? I'm starting to create my own side scroller, in Java. I think I've read that, when you create a game in Java, there is something you can extend your class with, like GamePanel.

Is this true, or can you just use JFrame for your Java games?

sentences:
Lua or C++ in Cococ2d-x I am going to use Cocos2d-x to make a game for Android and ios, but my question is, do I use the Lua integration or only c++, I see Lua useful here because the compilation thing.

Or do I use only Lua for the configuration, save data and things in runtime?

I don´t know if using Lua for the whole game is the right thing :/

Can anyone help me with this question and why use it or not?

Thanks

sentences:
Controlling noise density I'm trying to fake terrain blending by using an opacity mask on my road mesh to reveal the grass underneath. I'm currently multiplying some Perlin noise by a Rectangle node displaying my texture at 80% width which is giving me the following:

Obviously this doesn't look great for reasons that should be apparent. The blotches are unnaturally spaced and they abruptly end with a sharp line at the end of the texture. What I would like to do is generate noise that looks more along the lines of this:

Is there a way to apply some sort of gradient to my noise to achieve this? I know I can just use the texture itself but I would like to be able to adjust properties like the extent of the noise during runtime.

sentences:
Tessellation Texture Coordinates Firstly some info - I'm using DirectX 11 , C++ and I'm a fairly good programmer but new to tessellation and not a master graphics programmer.

I'm currently implementing a tessellation system for a terrain model, but i have reached a snag. My current system produces a terrain model from a height map complete with multiple texture coordinates, normals, binormals and tangents for rendering. Now when i was using a simple vertex and pixel shader combination everything worked perfectly but since moving to include a hull and domain shader I'm slightly confused and getting strange results. My terrain is a high detail model but the textured results are very large patches of solid colour.

My current setup passes the model data into the vertex shader then through the hull into the domain and then finally into the pixel shader for use in rendering. My only thought is that in my hull shader i pass the information into the domain shader per patch and this is producing the large areas of solid colour because each patch has identical information. Lighting and normal data are also slightly off but not as visibly as texturing.

Below is a copy of my hull shader that does not work correctly because i think the way that i am passing the data through is incorrect. If anyone can help me out but suggesting an alternative way to get the required data into the pixel shader? or by showing me the correct way to handle the data in the hull shader id be very thankful!

cbuffer TessellationBuffer
{
    float tessellationAmount;
    float3 padding;
};

struct HullInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    float3 tangent : TANGENT;
    float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
};

struct ConstantOutputType
{
    float edges[3] : SV_TessFactor;
    float inside : SV_InsideTessFactor;
};

struct HullOutputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
    float2 tex2 : TEXCOORD1;
    float4 depthPosition : TEXCOORD2;
};

ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3>        inputPatch, uint patchId : SV_PrimitiveID)
{
    ConstantOutputType output;

output.edges[0] = tessellationAmount;
output.edges[1] = tessellationAmount;
output.edges[2] = tessellationAmount;
output.inside = tessellationAmount;

return output;
}

[domain("tri")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ColorPatchConstantFunction")]

HullOutputType ColorHullShader(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
{
   HullOutputType output;

output.position = patch[pointId].position;
output.tex = patch[pointId].tex;
output.tex2 = patch[pointId].tex2;
output.normal = patch[pointId].normal;
output.tangent = patch[pointId].tangent;
    output.binormal = patch[pointId].binormal;

    return output;
}

Edited to include the domain shader:-

[domain("tri")]

PixelInputType ColorDomainShader(ConstantOutputType input, float3 uvwCoord :    SV_DomainLocation, const OutputPatch<HullOutputType, 3> patch)
{
    float3 vertexPosition;
    PixelInputType output;

// Determine the position of the new vertex.
    vertexPosition = uvwCoord.x * patch[0].position + uvwCoord.y * patch[1].position + uvwCoord.z * patch[2].position;

    output.position = mul(float4(vertexPosition, 1.0f), worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);

    output.depthPosition = output.position;

     output.tex = patch[0].tex;
     output.tex2 = patch[0].tex2;
     output.normal = patch[0].normal;
     output.tangent = patch[0].tangent;
     output.binormal = patch[0].binormal;

    return output;
}

sentences:
Unity: Object is underneath another object but shouldn't be I have a simple collision detection program. The red object is controlled by the user and the yellow object is always moving up and down:

However, when the objects are supposed to collide, the red object ends up being underneath the yellow object. I wrote code that should destroy the red object on collision. This is a 2D game project, so I'm not sure how that works. They both have 0 set value for Order In Layer field.

Movement code for red object:

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        //GetKeyDown checks if a button is clicked, but GetKey checks if a button is held down.

        //LEFT
        if (Input.GetKey (KeyCode.LeftArrow))
        {
            transform.Translate(-1 * Vector2.right);
        }

        //RIGHT
        if (Input.GetKey (KeyCode.RightArrow))
        {
            transform.Translate(Vector2.right);
        }

        //UP
        if (Input.GetKey(KeyCode.UpArrow))
        {
            transform.Translate(Vector2.up);
        }

        //DOWN
        if (Input.GetKey(KeyCode.DownArrow))
        {
            transform.Translate(-1 * Vector2.up);
        }
    }
}

Movement code for yellow object (contains collision event):

using UnityEngine;
using System.Collections;

public class EnemyMovement : MonoBehaviour {

    private bool moveUp;

    // Use this for initialization
    void Start () {
        moveUp = true;
    }

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

        if(transform.position.y == 30)
        {
            moveUp = false;
        }
        else if(transform.position.y == -30)
        {
            moveUp = true;
        }

        if (moveUp)
        {
            transform.Translate (Vector2.up);
        }
        else
        {
            transform.Translate (-1 * Vector2.up);
        }
    }

    void OnCollisionEnter (Collision col)
    {
        if(col.gameObject.name == "player_character")
        {
            Destroy(col.gameObject);
        }
    }
}

Also, I'm a complete newbie with Unity, so sorry if I'm asking something that should be obvious.

sentences:
Position/orient parent to place child at a particular position/orientation I have a GameObject for which I know its world position and rotation.
From another app, I receive a new rotation and position, which should represent the local position and rotation of my GameObject.
How can I compute the position and rotation of the parent object knowing the (world) position, the (world) rotation, the localPosition and the localRotation of its child? How can I find the necessary transform to obtain the second pair of coordinates from the first pair of coordinates?

sentences:
Rotations of a Rubik's cube I made a Rubik's cube by arranging smaller cubes. Now I want to apply animations to it. For that I am choosing to use the Rotate class and set the angle of rotation and the axis of rotation,like this

ar[12].setRotationAxis(Rotate.X_AXIS);//The array elements refer to the small cubes which make up the Rubik's cube.These elements represent the left face.
        ar[13].setRotationAxis(Rotate.X_AXIS);
        ar[14].setRotationAxis(Rotate.X_AXIS);
        ar[15].setRotationAxis(Rotate.X_AXIS);
        Rotate rotation1 = new Rotate(90);
        rotation1.setAxis(Rotate.X_AXIS);

Then I am applying the rotations as an animation,like this

Timeline timeline = new Timeline(
                new KeyFrame(Duration.seconds(2), new KeyValue(ar[12].rotateProperty(), 90)),
                new KeyFrame(Duration.seconds(2), new KeyValue(ar[13].rotateProperty(), 90)),
                    new KeyFrame(Duration.seconds(2), new KeyValue(ar[14].rotateProperty(), 90)),
                    new KeyFrame(Duration.seconds(2), new KeyValue(ar[15].rotateProperty(),  90)));
            timeline.stop();

            timeline.setCycleCount(Timeline.INDEFINITE);
            timeline.setAutoReverse(true);
            timeline.play();

 The inner black sides are coming out.
What mistake am I making and how to fix this ?
Basically, I am getting this for each single cube

But I need this for each cube

sentences: What's the difference between an "SDK" and an "engine?" In delving into game programming, I have encountered both "SDKs" and "game engines". What are their relationships and differences to each other?

sentences: Is it good to use 24 fps animation in 60 fps game? Is it normal to use 24 fps animation in 60 fps game or it will hurt perfomance or create bugs?

sentences:
OpenGL ES 2. How do I Create a Basic Fading Streak Effect? For the iPad app I am writing using OpenGL ES 2 I have a single quad - shaded using GLSL - that is dragged around the screen. Very basic. This works fine. But is rather boring.

I want to increase the coolness a bit in the following way: when the user drags the quad it leaves a streak behind that fades over time. Continuous dragging would be a bit like a streaking comet across the night sky.

What is the simplest way to implement this?

Thanks.

sentences:
FBX model from Blender doesn't show it's surface in Unity3D I've create a model from Blender and exported it as .FBX file. However when I import this into Unity, the surface is missing.how can i fix?

Screenshot attached:

in Blender it look like this:

in Unity it look like this which only shows it inside:

sentences:
Interpolation between two 3D points? I'm working with some splines which define a path a character follows (you can see a gameplay video here to get a better understanding of what's going on: http://www.youtube.com/watch?v=BndobjOiZ6g). Basically the characters 'forward' look direction is set to the 'forward' direction of the spline and when players tilt their phone left and right the character is strafed along its 'right' coordinate.

The issue with this is (rather obviously) in performance, interpolating over a spline to find the nearest position and tangent relative to the player is an incredibly costly operation. To get by this I cache a finite number of positions in what I call 'SplineDetails', the class is as follows:

public class SplineDetails
{
    public SplineDetails()
    {
        Forward = Vector3.forward;
        Position = Vector3.one * float.MaxValue;
        Alpha = -1;
    }
    public float Alpha; // [0,1] measured along length of spline where 0 is the initial point and 1 is the end point of the spline
    public Vector3 Position; // the point of the spline at this alpha
    public Vector3 Forward; // the forward tangent of the spline at this alpha
}

I populate this with say 30 coordinates and I can give a rough estimate of a coordinate and 'forward' based on a position past in. It's not as accurate but it's much faster.

But now I'd like to make the system work better by estimating positions and 'forward' directions by interpolating between two of the cached points though I'm stuck trying to figure out some logic.

My first problem is, how can I determine between which two points the object is? Given each point can be placed at different intervals along the spline it could mean that two points in front or behind the object can be closer to the object.

The other problem is to figure out the proportion between the two paths it's between, i.e. if there is a point a at coordinate (0,0,0) and point b at coordinate (1,0,0) if the object is at position (0.5,0,0) then the result it should give is '0.5' (as it is equal distance away from point a and point b). That's a simple example, but what if the object is at coordinate (0.5,3,0) for example?

sentences: How to transform Unity terrain coordinates My map creator created some terrain in Unity, but all my scripts are based on the X-Y axis. Is there an easy and smart way to transform them into Z-Y, or do I have to change all the vector variables to Vector3 and move the coordinates to (0,Y,Z)?

sentences:
How to "merge" multiple intersecting circles so that only the outer edges of each show? In my RTS (In Unity) each unit or building has strategic circles in a similar fashion to SupCom. If you have multiple units or buildings selected it looks like the picture to the left. I want to make it look like the picture to the right, where anything inside the outer edges of their circles is no longer shown.

I draw these using vectrosity, mentioning this just in case vectrosity provides a way of doing this, or can be modified to do this.

The circles are essentially just an array of points with lines drawn in between them. How would I go about "merging" the circles inside of their overlapping area?

This is similar to: How to make unit selection circles merge?, however I am not interested in a shader solution.

Edit: To re-explain the above.:

I'm not seeing how the answers are applicable. I've read through the other thread before posting, which is why I posted it here to avoid this exact thing (being marked as a duplicate). I have an array of points with straight lines in-between them to create a circle-like effect. This is not a true circle, but a really granular polygon. I am interested in solutions that are achievable in C# within Unity, not with shaders or with rendering mechanics.

Edit2: Another picture based on one of Roberts suggestions

This seems viable, though computationally expensive. If I have a circle made up of 250 points, and 50 circles all intertwined that's 615,500 checks in a worst-case scenario.

sentences:
How do I test for collisions between two concave shapes decomposed into collections of convex polyhedra? I am using convex decomposition with SAT (separating axis theorem) and I generate two arrays of convex pieces, How do I submit my arrays to my collision detection method which only takes two arguments.

public MTV testCollision(BroadPhasePair pair) {
    Entity entity = pair.getBody();
    Entity id1 = pair.getBody();

    List<Convex> entityConvex = ConvexDecomposer.decompose(entity);
    List<Convex> id1Convex = ConvexDecomposer.decompose(id1);
    return null;
}

private MTV testCollision(Convex body,Convex id1) {
    float overlap = Float.MAX_VALUE;
    Vector3f smallest = null;
    Vector3f[] axis1 = body.getAxis();
    Vector3f[] axis2 = id1.getAxis();

    for(Vector3f axis : axis1) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) return null;
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;

        }
    }

    for(Vector3f axis : axis2) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) {
            return null;
        }else {
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;
            }
        }
    }

    MTV mtv = new MTV(smallest, overlap);
    return null;

}

I want to be able to somehow submit my array into the testCollision method.

sentences:
How to invisible first window on click unity3d I have a window called "red window" on scene1. When i click on the hello world button it should displays another window called green window and the first window should invisible. How it possible.

using UnityEngine;
using System.Collections;![alt text][3]

 public class window : MonoBehaviour {
 private bool render = false;
 public Rect windowRect0 = new Rect(20, 20, 120, 50);
 public Rect windowRect1 = new Rect(20, 100, 120, 50);
 void OnGUI() {
     GUI.color = Color.red;
     windowRect0 = GUI.Window(0, windowRect0, DoMyWindow, "Red Window");
     GUI.color = Color.green;
    windowRect1 = GUI.Window(1, windowRect1, DoMyWindow1, "Green Window");
 }
 void DoMyWindow(int windowID) {
     if (GUI.Button (new Rect (10, 20, 100, 20), "Hello World")) {
         }

       //GUI.DragWindow(new Rect(0, 0, 10000, 10000));
   }
  void DoMyWindow1(int windowID) {
 if (GUI.Button(new Rect(10, 20, 100, 20), "Hello World"))
     print("Got a click in window with color2222222222 " + GUI.color);
 //GUI.DragWindow(new Rect(0, 0, 10000, 10000));
 }

sentences:
PNG image as a level map for 2d game I've been using a tilemap editor for making levels, but I was wondering if there was a way to use PNG images as the level map, as maps created in tiled editor are graphically uninteresting.

Background: I've recently started 2d game development and have learned basics i.e collision, game loop etc. I am developing game in JavaScript for Windows 8, but c#/c++ would work for me also.

sentences:
Algorithmically fracture a mesh in Unity3D? I want to create a plugin which shatters/fractures meshes, so I can make every object destructible if I want to. Like in Unreal's built-in feature.

My quick approach to this problem is randomly generating cuts (planes):

every cut divides the mesh into 2 groups: left side of the cut and right side of the cut,
at the points where it intersects the mesh, I add vertices to both groups.
and add 1-1 face to each group with these new vertices.
create the new mesh.

Is there a better way? What do you recommend? Is my way even possible? If yes, what API methods should I use?

sentences:
Square Grid Polygonal Terrain Query algorithm? I have a square, fixed-grid terrain with one terrain type per grid unit in my game, and I want to do an arbitrary polygonal terrain query which returns all of the grid units enclosed/intersected by the polygon. Can anyone point me towards an algorithm for this?

I'll be using this to make sure that my actors aren't going through invalid terrain when they move.

Thanks!

sentences:
How should I access frame buttons from a controller in an MVC approach? I'm developing an italian card game using the mvc pattern. I have the class GameFrame that contains the view. The user's card are buttons (JButton objects). I have 3 controllers:

GameController: to control the game in general. Contains the game loop.
HumanPlayerController: to control the user input
ComputerPlayerController: contains the AI of the computer
PlayerController: is an interface with the makeTurn() method. It's implemented by HumanP.C. and ComputerP.C.

HumanPlayerController implements ActionListener too. But what is the right way to access to the GameFrame buttons? I need it for understand which card was chosen.

GameFrame and HumanPlayerController are in different packages. Should i make the JButtons public?

sentences:
MMORPG game balancing I've seen a couple of examples of some game balancing techniques in books yet they are not comprehensive and not particularly aimed at MMORPGs but I'm looking for practical examples of game balancing techniques for MMORPGs. I am interested to know if anyone has documented the techniques used in popular games with proven success in this area. Ideally, any resource would cover most common types of stats and include layman mathematical models or techniques used to balance game mechanics found in advanced MMORPGs (I know it's a cliché, but WoW style)

Any help would be great!

sentences:
How to handle multiple game sessions where players turn can timeout, using Python and Socket.IO? I want to make a multi player card game, allowing several people to play with each other (each game session should be able to have between 5 - 10 players).

I'm doing this in Python (Django and Socket.IO).

Because you have to wait for all players to finish before you can move on to the next round, issues will arise if one player leaves his computer or is disconnected, thus leaving all the other players waiting.

To solve this, I want to give each player a time limit to act within.

If there are 1,000 games going on at the same time, and 5 players in each game, that would hypothetically mean that at one point, you could have 5,000 timers counting down at the same time (or if not timers, some other way of dealing with this issue).

What is the best way to do this in Python?
Spawn loads of threads with timers?
Have something more complex like a dictionary with 100 games in each dictionary, and for every second, iterate through the list and check each player? (seems a bit finicky)?

I really want to hear what the best approach to this would be.

sentences:
TMX crashes in Tablet 10″ Android 7.0 with Andengine I've developed a video game that has worked fine so far. When testing it in a Samsung Galxy A6 tablet (10" resolution with Android 7.0), I get the following error and the map won't load:

  Blockquote
  12-09 12:49:20.940: E/AndroidRuntime(9369): Process: cam.main, PID: 9369
  12-09 12:49:20.940: E/AndroidRuntime(9369): java.lang.NullPointerException: Attempt to read from field 'org.anddev.andengine.opengl.texture.region.TextureRegion org.anddev.andengine.entity.layer.tiled.tmx.TMXTile.mTextureRegion' on a null object reference
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.layer.tiled.tmx.TMXLayer.drawVertices(TMXLayer.java:220)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.shape.Shape.doDraw(Shape.java:102)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java:991)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.shape.Shape.onManagedDraw(Shape.java:120)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDraw(Entity.java:875)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDrawChildren(Entity.java:1008)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDrawChildren(Entity.java:1000)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onManagedDraw(Entity.java:993)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.scene.Scene.onManagedDraw(Scene.java:233)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.entity.Entity.onDraw(Entity.java:875)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.engine.Engine.onDrawScene(Engine.java:517)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.engine.Engine.onDrawFrame(Engine.java:509)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.RenderSurfaceView$Renderer.onDrawFrame(RenderSurfaceView.java:154)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:617)
  12-09 12:49:20.940: E/AndroidRuntime(9369):     at org.anddev.andengine.opengl.view.GLSurfaceView$GLThread.run(GLSurfaceView.java:549)
  12-09 12:49:21.531: E/ApplicationPackageManager(4011): checkSettingsForIconTray value : 0

Rest of screens that are Android native work well. Please help!

sentences:
Is Unity 2017 random number generator deterministic across platforms given the same initial seed? Is unity engines random number generator deterministic across platforms given the same initial seed or should I implement my own?

I know there have been some modifications to the random number generator recently.

Answers are appreciated, I don't have the devices on hand to perform any tests and I haven't yet found a direct statement on the matter.

sentences:
What is the metrics of vectors in XNA? When exporting a model from 3ds Max as FBX to import it into XNA, what metrics should I choose to make 1 unit in 3ds Max equal to 1 unit in XNA?

For example: I have a sphere model with 1m radius exported to XNA. When drawing I use:

Matrix[] transforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in model.Meshes)
{
    foreach (BasicEffect be in mesh.Effects)
    {
        be.EnableDefaultLighting();
        be.World = mesh.ParentBone.Transform * Matrix.CreateScale(radius)
                    * TransformMatrix;
        be.View = camera.view;
        be.Projection = camera.projection;
    }
    mesh.Draw();
}

Radius is defined in my class as float.

This will draw a ball smaller than 1.

sentences:
How can I efficiently render lots of 2D quads? I have lots of 2D quads. I write their local vertex position info to a buffer (accompanied with a world transform matrix) which gets sent to the render thread.

I then pass the world transform matrix as a uniform into the vertex shader which applies itself to each vertex and works fine. I however have to make a call to glDrawElements() for each quad I want to render because each one has a different world transform.

What is the most efficient way for me to render all of these quads? Should I do what I'm already doing, or should I calculate the world position for each vertex on the CPU before I write them to the buffer, so I can attempt to batch more quads into a single glDrawElements() call? Or is there another approach?

sentences:
Rotate entity to match current velocity I have an entity in 2D space moving around, lerping between waypoints. I would like to make the entity rotate around its own origin to face the current direction that it is going, I.E. towards the next waypoint in the list.

In case the waypoint movement code is needed, I'm using the following (this is contained inside of the entity that is following the waypoints) :

    private void GoToWaypoint() {
        if (waypointList.Count > 0) {
            Vector2 origin = helper.GetOrigin(position, width, height);
            int nodeWidth = 50;
            int nodeHeight = 50;

            if (moveToPosition != waypointList[0]) {
                moveToPosition = waypointList[0];
                moveToPositionOrigin = helper.GetOrigin(moveToPosition, nodeWidth, nodeHeight);
                distanceToPosition = moveToPositionOrigin - origin;
            }

            if ((Math.Ceiling(distanceToPosition.X) < 0)) {
                position.X -= moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X + moveSpeed);
            }
            else if ((Math.Floor(distanceToPosition.X) > 0)) {
                position.X += moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X - moveSpeed);
            }

            if (Math.Ceiling(distanceToPosition.Y) < 0) {
                // Check if the entity moves below the top boundary
                if (position.Y > 0) {
                    position.Y -= moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y + moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }
            else if (Math.Floor(distanceToPosition.Y) > 0) {
                // Check if the entity moves below the bottom boundary
                if (position.Y < 550) {
                    position.Y += moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y - moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }

            // If the entity gets in the waypoint, or the distance to the waypoint is 0 on both axis (which can occur due to screen boundaries)
            if ((helper.InNode(position, moveToPosition, width, height, nodeWidth, nodeHeight)) || ((distanceToPosition.X == 0) && (distanceToPosition.Y == 0))) {
                waypointList.RemoveAt(0);
            }
        }
    }

I know this may have been asked elsewhere, and the bit of searching that I did on this type of problem, didn't really help me. I'm slightly math retarded, so I don't understand the explanations that don't really explain what the math is exactly achieving. So any help that breaks down the math and functions needed to achieve this would be greatly appreciated.

Thanks.

sentences:
glDrawArrays draws nothing I am trying to draw a triangle using shaders in LWJGL, but nothing is being drawn on the screen, and no error is being produces. I can't figure out what I'm doing wrong.
To create a vao, I use:
int buffer = glGenBuffers();
int vertexArray = glGenVertexArrays();

ByteBuffer data = ByteBuffer.allocateDirect(6 * 8).order(ByteOrder.nativeOrder());
data.putFloat(-0.5f);
data.putFloat(0.5f);

data.putFloat(-0.5f);
data.putFloat(-0.5f);

data.putFloat(0.5f);
data.putFloat(-0.5f);

glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW);

glBindVertexArray(vertexArray);
int positionAttributeLocation = glGetAttribLocation(program, "position");
glEnableVertexAttribArray(positionAttributeLocation);
glVertexAttribPointer(positionAttributeLocation, 2, GL_FLOAT, false, 8, 0);

and then I draw using:
glUseProgram(program);
glDrawArrays(GL_TRIANGLES, 0, 3);

Here's my vertex shader:
#version 110

in vec2 position;

void main(void) {
  gl_Position = vec4(position.xy, 1, 1.0);
}

and fragment shader:
#version 110

void main(void) {
  gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}

sentences:
How to write depth texture and read values from it I am new in Unity and specializing in another field. But now I have to rapidly study it for a new project. I will be very thankful if anyone explain me how to read values of the depth buffer.
I wrote a shader, which creates depth image:
Shader "Custom/MyDepthShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}

    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert // compile function vert as vertex shader
            #pragma fragment frag // compile function frag as fragment shader

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;
            sampler2D _CameraDepthTexture;

            fixed4 frag (v2f i) : SV_Target
            {
                float depth = tex2D(_CameraDepthTexture, i.uv).r;
                depth = Linear01Depth(depth);
                depth = depth * _ProjectionParams.z;
                return depth;
            }
            ENDCG
        }
    }
}

Now I need to get depth information into a texture and save float values of this texture to for example txt  file for further processing.
I didn't found yet answer to this question after two days of googling and reading guides.
For testing this shader I am using OnImageRender(RT src, RT dst, material).

sentences:
Animate on tap in XNA (Windows Phone) I'm trying to convert a AS3 game to C# / XNA and I'm looking for a way to animate a sprite.

More precisely, I want the sprite to rotate and scale a bit, then return to its starting position.

In AS3 I just use a tweening library and add a touch listener to the sprite, but I haven't been able to find something like this for XNA. How would you do something like that in C#?
Thanks in advance!

sentences: Is there a 3D equivalent of hex tile maps? Probably the biggest advantage of a hex-based versus square-based map tiling is that the center of each hex has the same distance to all its neighboring hexes. Is there a similar shape that tiles this way in 3D, and an engine that supports such a model?

sentences:
Trying to understand 3D transforms by making an aircraft control script. How would you implement 3D transforms correctly in this example? I'm struggling to understand 3D transforms in Godot. (I know, I know...)
I'm trying my best to implement an aircraft control script, and I've gotten myself into gimbal lock hell. My controls work pretty well until the Y direction decides to flip, and now my controls to pull up make the plane go down, etc...
I've read the godot 3D transform documentation, but I still find myself looking for an "Aha!" moment.
I figured a good way for me to learn would be to post what code I have and see how others would implement the movement code using transforms correctly.
Thanks for any help in advance.
extends Spatial

# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var camera = $Camera
const SPEED = 7
const ROTATE_SPEED = 1.25
const MIN = 0.9
var rx = 0
var ry = 0
var rz = 0
# Called when the node enters the scene tree for the first time.
func _ready():
    pass

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    self.transform.basis = Basis()
    if Input.is_action_pressed("movement_forward"):
        ry -= 1
    if Input.is_action_pressed("movement_backward"):
        ry += 1
    if Input.is_action_pressed("movement_left"):
        rx += 1
    if Input.is_action_pressed("movement_right"):
        rx -= 1
    if Input.is_action_pressed("rotate_left"):
        rz += 1
    if Input.is_action_pressed("rotate_right"):
        rz -= 1
    self.transform.orthonormalized()

    self.rotate_z(deg2rad(rz))
    self.rotate_x(deg2rad(ry))
    self.rotate_y(deg2rad(rx))
    self.transform.origin += -self.transform.basis.z * SPEED * delta
```

sentences:
Points evenly spaced along a bezier curve I have looked around for a while and I can't find a solution to this problem.
Let's say I have a cubic bezier curve (defined by 4 points) and I want to get a set of points that are spaced evenly along the curve. Think of placing a text along a curve for an example.

Now the problem is that if I input t (interpolation value from 0-1) with a constant increment the points are not evenly spaced. The distance along the curve is smaller when the curve makes a turn and longer when the curve is straight.

So how do I place points evenly along a bezier curve?

sentences:
Can I set a texture as the wallpaper of an iOS device? I have a game in Unity which creates drawings.

I need to have a button which sets the drawing as the wallpaper (with permission from the user of course).

Is it possible?

sentences:
Cannot implicitly convert type 'UnityEngine.Vector3' to 'Vector3' I've defined an abstract method in an abstract class with a generic return type. However, when I try to use the generic type as a Vector3 (or any other variable) I get this error :
Cannot implicitly convert type 'UnityEngine.Vector3' to 'Vector3'
this is my code :
the error is in the line
return direction;

using UnityEngine;

public class DashAbility : Ability
{

    public Vector3 direction;

    public override Vector3 getAbilityData<Vector3>()
    {
        return direction;
    }

    public override bool trigger(pointerData pointer)
    {
        return InputMaster.tryPointer(rollInputTest);
    }

    bool rollInputTest(pointerData p)
    {
        return (p.phase == pointerPhase.Dragging) && p.startHit.collider.CompareTag("Player");
    }
}

and this is the class I'm deriving from:
using UnityEngine;

public abstract class Ability : MonoBehaviour
{
    public abstract bool trigger(pointerData pointer);
    public abstract T getAbilityData<T>() ;
}

sentences:
Resolution problems with global illumination in Unity I am pretty new to Unity and after hours of searching I have finally figured out how to set everything up for (baked) global illumination to work for my model.

However the model is an export from a CAD program and so the mesh is rather bad quality (it seems it is optimized by the CAD program for minimum number of triangles). At least I am implicitely assuming that this is a bad quality mesh because it would by standard of finite element meshes, which of course doesn't directly apply here.

So what I am observing is three resolution problems (see images):

1) the lighting in the scene is somewhat "cloudy" although the faces are evenly colored and there are no lights that could explain the patterns (see eg. area inside drawn red rectangle)

2) there are slight jumps in brightness visible at the edges of the triangles of the mesh (see red arrows and, for comparison image of mesh)

3) the shadows are pixelated (see red ellipse, yes I have already tried to change shadow quality to high in the project settings, but to no avail)

Because there are so many settings that affect lighting, I assume it will take me hours if not days with trial and error to figure that out.

Which settings are likely to be responsible for these three problems?

I found a display mode of the scene view, called: Baked Global Illumination->UV Charts that probably explains the first problem, but I don't know how to interpret it, see third image below:

sentences:
Finding cells between two points (along line) to finding obstacles My game is in 3D environment partitioned with 2D grids in 2 dimensioned array

So I can get any cell/node by passing row and col like  return _nodes[r][c].

When the an attacker attacks an enemy with ranged weapon, I want to check if there is any obstacle in between the two points.

Without using mesh collision methods, I want to achieve it by checking all the cells which falls between the source and target points and check if there are any obstacles.

I want to write this in a routine which will return false as soon as it finds an obstacle and returns true if it finds no obstacle in any of the cells between the source and target

From the above picture, I want to get yellow that falls between the two end points

Can some one suggest me the approach?

sentences: Unity: Is it possible to copy a rig from one model to another Lets say I have a model with a ready humanoid rig and a humanoid model with no rig. Can I somehow copy the bones from the rig to the model with no rig in unity?

sentences:
How do you handle scripting in multithreaded environment In my experience, two approaches are preferred when people want to handle scripting in multithreaded environment.

Synchronize every accesses to scripting module with one coarse-grained lock.
No Synchronization - Scripting module should be used by just one logic thread.

Of course, both solutions are not scalable in multi-core perspective.

Question - Is there any other (multi-core) scalable solution?

sentences:
How to measure packet latency? In the context of lag compensation, one needs to know when the command is instantiated on the client (this can be named as "command execution time" as well). AFAIK, there can be 2 methods for this:

Client sends a timestamp with the command.
Client doesn't send any timestamps, but server does a smart thing to calculate the command's instantiation time.

About #1:

Is this safe in terms of cheating?

About #2:

According to Valve's paper, command execution time is as following:

  Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

This means, server must know the packet latency.

Another paper from Valve confirms this and says:

  Before executing a player's current user command, the server:

  Computes a fairly accurate latency for the player
  ...

How can the server compute "fairly accurate latency for the player"?

Most naive and easiest approach would be sending pings regularly (less frequent than game commands and updates though) to find out an average of the latency and use it. Busy network traffic, latency fluctuation and naiveness of this method makes me feel there must be a more elegant way.

EDIT: Would UDP vs TCP change anything in this context?

sentences:
Using external music mp3 in flash game sorry for my english.
Im relative new to flash game development,
Im creating a game and I need some big size mp3 files.
If I add them into flash, .swf file will be too big.
I guess I need to host mp3 files somewhere and use URL Request?
Where can I upload mp3 files so they are always ready for use?

sentences:
Why do console versions of multiplayer games support fewer players than PC versions? source
http://answers.yahoo.com/question/index?qid=20111205162848AAb1sl9

  64 Players on P.C ( 32vs32)

  & bigger maps with more vehicles & buildings.

  24 on Consoles ( 12vs12)   ( It was planned to have a 32 player
  limit, but was later reduced to 24).

Why does the console version have a maximum of 24 players? Is it hardware related?

One of the reason was that players can host games themselves. If thats true its very sad that you cannot play 32x32, because one or two guys want to host games.

sentences:
Cocos 2D putting things on the cocos thread or not? We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.

What is the recommended practice?

sentences:
Converting 2d path to 3d path What is the procedure to convert 2d path to 3d one. Maybe it's a silly question, but for example:

Let's assume that I have a path from point A to point B. And I have all X and Y coordinates of that path. Is it possible to convert that to a 3d path, so for example to animate a car driving along that path but in 3D.

sentences:
How can I make a tendril flame like aura visual effect? I am a bit new to UE4 and I'm trying to get a tendril flame like aura like the picture below.

Does anyone know how I would go about this?

Should I use post processing or particles?

sentences:
Trying to 'stamp' an arbitrary assortment of pixels to a texture2d that may be rotated at an arbitrary angle This one is hard to explain but I'll try to not to overcomplicate it. Engine is Unity, for reference.
I have a system where an object has a 2d texture to display a custom splat map. The user can 'paint' to this texture, which uses world space coordinates of the mouse to see which pixel should be painted to. They can also paint larger shapes, which are essentially just implementations of square / circle drawing algorithms that choose what pixel coordinates to paint to based off the starting world space coordinates.
This works fine while the object/texture are unrotated, but if I rotate the object an arbitrary amount of degrees (say, 45 for the most extreme result), like squares and circle etc are drawn to the texture with missing pixels. I assume this is because the 'grid' of the texture is now rotated, and because I'm still trying to 'stamp' the shape in the original world space orientation (without respect to the rotation), the pixel 'sizes' or coordinates aren't the same?
I can't post screenshots as I'm at work, but this is what my desired output would be (Ignore the pixelisation, had to use an online crappy paint program), where the first square is the object in its original rotation, with a red square stamped on to it as expected. The second square is after the object is rotated 45 degrees, and the yellow square stamped on it is what I want (and what is currently appearing with missing pixels in my implementation).

EDIT: And here is the actual result I'm getting, pixels per unit is 16. The first square was stamped, the rect then rotated 135 degrees, and then the second square was stamped (shown with the missing pixels):

Anyone have any idea how I would go about drawing onto a rotated texture like this without ending up with missing pixels? I can post code snippets / build images later.
EDIT:
This is the code executed on the object to register a single pixel draw (very loosely), which uses the RotatePointAroundPivot function to get the pixel on the original pixel grid location in world space by rotating the point against the transforms current rotation. This works perfectly for individual pixel draws from mouse position clicks, but with the larger shapes I end up with the issue described
void DrawToTex(Vector2 worldPos) {
    worldPos = RotatePointAroundPivot(worldPos, transform.position, transform.rotation.eulerAngles)

    (xPixelCoordinate, yPixelCoordinate) = GetPixelCoordinatesFromWorldPos(worldPos);

    pixels[xPixelCoordinate, yPixelCoordinate] = color;
}

public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles) {
    return Quaternion.Euler(angles) * (point - pivot) + pivot;
}

public void DrawSquare(Vector2 worldPos, int size) {

    (int startXCoord, int startYCoord) = GetPixelCoordinatesFromWorldPos(worldPos);

    // Literally just gets an array of the correct size
    int[,] squareMatrix = GetSquareMatrix(size);

    sizeHalved = size / 2;

    pixelWorldSize = 1f / pixelsPerUnit; // pixels per unit is 16 in my build

    for(int x = 0; x < size; x++) {
        for(int y = 0; y < size; x++) {
            int newX = startXCoord - sizeHalved + x;
            int newY = startYCoord - sizeHalved + y;

            Vector2 pixelWorldPositionToDraw = worldPos + new Vector2((newX - startXCoord) * pixelWorldSize, (newY - startYCoord) * pixelWorldSize);
            DrawToTex(pixelWorldPositionToDraw);
        }
    }
}

(int, int) GetPixelCoordinatesFromWorldPos(Vector2 worldPos) {
    float xMin = bounds.min.x;
    float yMin = bounds.min.y;
    float distFromStartX = worldPos.x - xMin;
    float distFromStartY = worldPos.y - yMin;
    float xScaled = distFromStartX * pixelsPerUnit;
    float yScaled = distFromStartY * pixelsPerUnit;
    int xPixelCoordinate = (int) xScaled;
    int yPixelCoordinate = (int) yScaled;

    return (xPixelCoordinate, yPixelCoordinate);
}

sentences:
How to render a retro-like pixel graphics from 3d models? I was wondering if there's a possibility to render a retro-pixel-like graphics from 3d model in real time?

I'm talking about the Starfarer-like graphics.
I know it's hand drawn, and it's 2d.
But if I need a 3d objects with the same aesthetics?

I'm currently working with Flash. But I don't need any ready-solutions, I just want to understand the principle from any other platform if there is one.
So if anybody met anything like this I would appreciate your help.
(If it's not possible to do in real time, I could at least pre-render a sequence of sprites. It would be much better than creating hundreds of hand-drawn ones)

sentences:
Need help with using Player Prefs to save number of coins collected I'm using unity 3D to make a game where the character collides with coins in order to collect them. When playing the game, the player should start out with zero coins and each time he collides with a coin, the amount should increase by one. On a main menu scene, the total number of coins (that have been collected across multiple games) should be displayed. The total number of coins is being displayed on the main menu but once in the gameplay scene, the total number of coins is being displayed there too (where it's supposed to start at 0 and then increase by 1 each time a coin is collected). Here is the script I use for when the player collides with a coin:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CoinScript : MonoBehaviour
{
    void OnTriggerEnter(Collider target)
    {
        CoinScoreManager.coinAmount += 1;
        Destroy(gameObject);
    }
}

Here is the script I use to manage the UI and coin number in the game play scene:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CoinScoreManager : MonoBehaviour
{
    public static int coinAmount;
    public Text coinText;

    void Start()
    {

        coinAmount = PlayerPrefs.GetInt("CoinAmount");
    }

    void Update()
    {
        coinText.text = coinAmount.ToString();
        PlayerPrefs.SetInt("CoinAmount", coinAmount);
    }
}

Here is the script I use to manage the UI and total coin number in the scene with the main menu:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MainMenuController : MonoBehaviour
{
    int coinAmount;
    public Text coinAmountText;

    void Start()
    {
        coinAmount = PlayerPrefs.GetInt("CoinAmount");
    }

    void Update()
    {
        coinAmountText.text = coinAmount.ToString();
    }

}

I think the problem is in the second script shown above. In the Start function I'm calling the coinAmount which is the same variable used to show the total coin number. I think that's the problem but I'm not really sure how to fix the problem as I'm still kinda of new to Unity and programming. Please let me know if there's anything else you need to know about the game in order to figure out how to fix this. Thanks for your help!

sentences:
IL2CPP Vector.Dot inconsistency I get inconsistent results when I run this code as standalone Windows on Mono and IL2CPP backends.

var a = new Vector3(-1.26998901f, 0, -0.849998474f);
var b = new Vector3(20.0799999f, -1, 164.580002f);
var dot = Vector3.Dot(a, b);
var mydot = (float) ((double) a.x * (double) b.x + (double) a.y * (double) b.y + (double) a.z * (double) b.z);

+-------+----------------+-------------+
|       | Mono or Editor |   IL2CPP    |
+-------+----------------+-------------+
| dot   | -165.394135    | -165.394119 |
| mydot | -165.394135    | -165.394135 |
+-------+----------------+-------------+

Take a look at the dot result on IL2CPP backend in the table above.

My mydot implementation should be equivalent to Vector3.Dot(Vector3, Vector3) according to dotPeek in Rider.

Decompiled Vector3.Dot(Vector3, Vector3)

/// <summary>
///   <para>Dot Product of two vectors.</para>
/// </summary>
/// <param name="lhs"></param>
/// <param name="rhs"></param>
public static float Dot(Vector3 lhs, Vector3 rhs)
{
  return (float) ((double) lhs.x * (double) rhs.x + (double) lhs.y * (double) rhs.y + (double) lhs.z * (double) rhs.z);
}

Unity version: 2018.4.12f1

What causes Vector3.Dot(Vector3, Vector3) to give a different result on IL2CPP?

sentences: Capping neighbour height difference on heightmap? I am generating a heightmap with some basic perlin noise but I need to cap the differences between each neighbouring value. A cardinal neighbour can only be -1, 0, +1 in difference while diagonal neighbour can range from -2 to +2. What is a good approach to make sure the map is generated within these rules? Does perlin or a small extension help me do this or should I make 2nd pass after the map is generated by perlin or simplex? I am currently doing the latter where I go over each tile and change it's cardinal neighbours according to it's own value but it is going over the same position/number very often.

sentences:
Which is the best network solution for MMORPG? we are developing a mmorpg with a small team. There are 2 structures we can create on the server side for managing clients and processing packages. I wonder what structure is better. I would be very happy if there is a good structure that you can recommend.

First Structure

In this structure, idle sessions (IdleSessionQueue) are initially created and there is a thread (NetworkListenerThread) that listens to the network and accepts users. This thread takes a session from idle sessions when a new user arrives and adds the session to the active sessions table (ActiveSessionMap) using the values of SessionId and Session. then creates a thread (ClientListenerThread) to listen to the session added to the table. a ClientListenerThread occurs for each user.  When the client has disconnect, it is added back to IdleSessions again.

When the client sends a request (Packet), that request is added to TaskQueue. A certain number of workersThreads are created in advance. As long as there is a package in TaskQueue, WorkerThreads receives the package and processes it and adds the new package to SendQueue. SenderThreads receives and sends each packet in SendQueue to client.

Second Structure

In this structure, idle sessions (IdleSessionQueue) are initially created and there is a thread (NetworkListenerThread) that listens to the network and accepts users. This thread takes a session from idle sessions when a new user arrives and adds this session to the active sessions table (ActiveSessionMap) using the values of SessionId and Session. then creates a thread (ClientListenerThread) to listen to the session added to the table. a ClientListenerThread occurs for each user. When the client has disconnect, it is added to IdleSessions again. When the client sends a request (Packet), that request is processed by ClientListenerThread and the result is sent to one or more clients.

Which one is better solution or what is the best solution for this problem?

sentences:
calculating occlusion in cube voxel engine This is more a conceptional (approach) question then the search for an implemented solution, since I was unable to find proper hints via google or similar.

The problem is as follows:

Given you have a 3D world that is encoded as voxels. So basically you have your 3D matrix were each position in the matrix is either solid or void ( for simplicity ). Now you look with your camera onto this cloud form a given ( in my case fixed for an isometric perspective ) angle. For each non void coordiante I draw an isometric projected block ( due to my choosen fixed camera angle ), while leaving void coordinates empty.

Of corse I want ot omit to draw coordiantes that are not vissible, so I alread exclude coordiantes that the camera would not see. But I also want to omit coordinates that would be hidden by other blocks, which are in the perspective closer to the camera.

I currently solve this by choosing a specifc camera angle that ensures that a block at coordiantes 0,0,0 would occlde a block at -1,-1,-1; -2,-2,-2; -3,-3,-3; and so on ( is that clear enought or should I add an image to explain? ). This is a rather cheap trick but it works and makes rendering faster as I have only to do a trace for each visible coordiante on the screen and draw the first non void coordinate in that trace. I saw this solution also used in Gnomoria for instance.

But I am wondering, if anyone has some keywords or hints if there is a more general approach to solve this occlusion problem without falling back using cheap camera tricks.

sentences:
Unity 2D: Position Child Object to center of Parent Object What I'm trying to achieve is snapping a child object to the center of its parent object after dragging and dropping it.

The moving object successfully follows the mouse, and drops. It also successfully selects a dynamic parent when it moves over a new node.

What it does NOT do is then snap to the center of its parent. It instead jumps all over the screen and snaps to nothing.

Here is all of my code:

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

public class Object_Moveable: MonoBehaviour {

 private Vector2 mousePos;
 public float moveSpeed;
 public float offset = 0f;
 private bool following;
 private GameObject SelectedNode;

 // Use this for initialization
 void Start() {
  following = false;
  offset += 10;
 }

 void Update() {

  if (Input.GetMouseButtonDown(0) && ((Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position).magnitude <= offset)) {
   following = true;
  }

  if (following) {
   transform.position = Vector2.Lerp(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), moveSpeed);
  }

  if (Input.GetMouseButtonUp(0)) {
   following = false;
   //Attach (Node, 0, 0);
   transform.localPosition = SelectedNode.transform.position;
  }
 }

 void OnTriggerEnter2D(Collider2D trigger) {
  if (trigger.tag == "pipenode") {
   transform.SetParent(trigger.transform);
   SelectedNode = trigger.gameObject;
  }
 }
}

sentences:
Where can I find 3d models of equipment for supermarket? Where can I find 3d models of equipment  for supermarket? I will use them in XNA.

UPD. I need equipment like this http://www.the3dstudio.com/product_details.aspx?id_product=419747 without products.

sentences:
How could I implement destruction of bases in Space Invaders type game? What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders?

The simplest approach could be to use a series of sprites that are replaced to show increasing deterioration after each missile hit.

A more advanced approach might be to randomize the deterioration pixel by pixel after each hit, but I'm not sure how to implement an approach like this. Does anyone have any suggestions for how to approach something like this?

sentences: How to remove a scene after the another one has loaded ]2[]3I'm having this problem in Unity where I load a new scene, but the original is still overlapping it. How would you remove the original scene?

sentences:
How to create spaceship 'ion trails' that can be curved in Unity? I'm working on a simple space combat game (single-player) with the goal of having 100+ fighters and capital ships in a single battle.  To keep system requirements down I'm using a minimum of effects.  One that I do wish to include, however, is that of 'ion trails' from the rocket engines of the spacecraft and missiles.  Ideally it would look something like the images below.  The trail won't have to be very long, but I do want it to curve to show the spaceship's path, acting as a visual aid in a dogfight.

My question is, how to implementing such trails efficiently?

sentences:
Should a server run all maps in one loop, or a thread/game loop per map? I'm working on a real time multiplayer browser-based game.
The game is top down on variable size tile based maps. There is no central map where all players come together, the entire game plays out in multiple maps. (Player chooses one on login, but has the ability to switch whenever they want).
Let's take the following loop that runs on the server side of things:
let tick_time = Duration::from_millis(500); // e.g. Tick 2 times per second.
let mut next_tick = Instant::now();

loop {
    let now = Instant::now();

    if now >= next_tick {
        // Parse user input
        // Update state
        // Update to state to users in map

        next_tick += tick_time;
    } else {
        let wait_time = next_tick - now;
        sleep(wait_time - Duration::from_millis(1)).await;
    }
}

In my 'map based' gameplay scenario, would it make sense to spawn a thread for every map where one of these loops runs? Or would it be recommended to have only a singular thread with a singular game loop that updates every map? Or is there perhaps a better, already existing, pattern for this?

sentences:
Map color collision problem Hello i'm doing a game in WPF, 2D version (top view)

I have the map and i'm trying to check for color collision in pixel each time the timer is activated

Well...with 1 object it works fine but with more objects at same time it just slow down the process

This is my code every time the dispatchertimer activates and i loop to check for collision on every object

CroppedBitmap cb = new CroppedBitmap(source, new Int32Rect(x, y, 1, 1));
int px = 1 * (source.Format.BitsPerPixel / 8);
byte[] pixels = new byte[px * 1];
cb.CopyPixels(pixels, px, 0);
Color c = Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
if (c.R == 255 && c.B == 255 && c.G == 255) {
   pixels = null;
   return true;
}

Any help to simplify the process? I really want to do it in WPF

PS: The map is 1018x731

sentences:
How do I write a simple 2-player server? I've recently started learning JavaScript and HTML and developed simple 2-player game such as tick-tack-toe, battleship, and dots & boxes. However, these 2P games can only be played on one computer (i.e. the 2 players must sit together).

I want them to be able to play with a friend on a different computer.

Would anyone have a general, simple working example of a web-game server?

sentences:
How to compensate for moving objects with client side prediction? I'm implementing a game server that supports Star Control-like melee. So you have ships flying and shooting, with super simple velocity/acceleration/dampening physics to drive movement.

I've read Valve, Gafferon and Gambetta and implemented Gambetta's algorithm for client prediction:

Client prediction works on the player ship by updating its position from the server as it comes and then reapplying the yet-unprocessed-by-the-server input to the player ship.

Unfortunately, it doesn't work well for my game. I believe it has to do with the fact that Gambetta's example doesn't take into account objects that are already moving, or commands that are updated on a step by step basis. (by "step" I mean frame). So in my game the player presses up to accelerate the (already moving) ship, which continues moving on the client, sends the command to the server and usually receives the world snapshot from the server on the next step. I get something more like:

The player command runs at client step 3, but on the server its only run at server step 5. By the time the world snapshot is received by the client at client step 6, the prediction is way off, especially in faster velocities.

The crux of the problem is that the client runs the command at step 5, but the server runs it at step 6. I thought about maybe sending the client step with the command, and have the server roll back and re-run the command with the client time step. That might lead to a slew of other problems though - like what happens to commands received since the rollback, or how cheating clients can exploit by changing the sent step.

Reading and watching videos like this one from Google mentions a different approach, where you gradually change player position to match that of of the snapshot over a few steps.

My questions:

Can you make Gambetta's algorithm work with constant step movement? Or is it conceptually incompatible with my game?
Is gradual interpolation over steps the correct way to go then? If so, how do you interpolate an already moving object from the client position to match that which was just received from the server?
Can these methods, gradual interpolation and Gambetta's algorithm work in tandem, or are they mutually exclusive?

sentences:
Looking for the reference tutorials for the joints in the Box2D for iphone I can't find the tutorials of joints class in the Box2D for iPhone. I am unable to run a Testbed for iPhone Box2D.

(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
       if (_mouseJoint!=NULL)return;
       UITouch *mytouch=[touches anyObject];
       CGPoint location=[mytouch locationInView:[mytouch view]];
       location=[[CCDirector sharedDirector]convertToGL:location];
        b2Vec2 locationWorld=b2Vec2(location.x/PTM_RATIO,location.y/PTM_RATIO);
 //ristrict the player within the ground limit  keep stucking the player with grounditself.....
if (_playerFixture->TestPoint(locationWorld))
{
    b2MouseJointDef md;
    md.bodyA=groundBody;
    md.bodyB=_playerBody;
    md.target=locationWorld;
    md.collideConnected=true;
    md.maxForce=100.0f*_playerBody->GetMass();
    _mouseJoint=(b2MouseJoint *)_world->CreateJoint(&md);
    _playerBody->SetAwake(true);
}
}

-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint == NULL) return;
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
if (location.y<240.00&&location.y>=20.0f)
{
    b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
    _mouseJoint->SetTarget(locationWorld);
}
}

- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint)
{

 _world->DestroyJoint(_mouseJoint);
    _mouseJoint = NULL;

  }

}

sentences:
Running subsystems at difference update intervals I want to update the rendering at 60fps, but the logic at some lower rate, say 15Hz. But if an object only moves when the game logic updates, then it would appear to stutter badly especially for lower frequencies. I guess the rendering system could interpolate an entity's vector and draw the model moving at a lower dt, but if the game logic causes the entity to change direction it will appear to teleport back, and so on. I can imagine many more problems.

How is this usually solved in games? Surely most engines want to decouple rendering from game logic, so there must have been some though put into this. Or does everyone just update all systems that have graphical effects at the same rate?

sentences:
Microphone sound into game propagation Had been any efforts made
to stream real-time sound from the microphone (user's voice)
into the game currently played?

This way you could hear echo of your own voice
when you walked into enclosed space,
strong or faint voices in a multiplayer game depending
on distances between players, ...

sentences:
Texturing (or seeing through) the back of a plane I've got a basic textured quad forming a plane. When I move the camera or rotate the plane to see the back of it, there is no texture there.

The effect I want is as if the plane were a clear piece of glass, so that I'd be seeing the texture from through the other side. I was hoping this was going to happen automagically. Is there an easy way to accomplish such a thing, or am I going to have to manually flip the texture and assign it to the back?

Thanks!

sentences:
Efficient removal and adding of Components in ECS i'm working with the Ashley Entity-Component-System (related to libGDX) to program a server-side simulation for an online game and i stumbled upon a serious performance drawback, that is probably caused by how it manages Entity-Sets:

"Family", these are basically descriptors for Entities with a specific set of components.
Removing a component is an costly operation because the Family-instance needs to search through an Array of entities that it manages and remove the Entity from that Array. This is O(n) for every single removal at worst.

And here's my problem:
I have a Family that describes all Entities that do have a position and a velocity component. If i want to remove the velocity-component, for example, to turn it into an static entity and re-add it later to make it move again, this completely eats up my budget of frame time (50ms->20fps) with only ~7000 Entities changing Family back and forth within a frame. At the same time, moving 100000 entities takes only about 15ms at max (without multithreading ~30ms).

I have thought of these options yet:

-Change the data-structure that the Entities are sorted into, this creates new problems, but may still be the most viable Solution, i thought of mapping the Entity IDs to Objects or keeping them in a sorted data-structure.

-Sort everything once after a System has finished execution, requires redesigning a lot of code but probably reduces the time-consumption greatly

-Changing the Entity System, i know of Artemis, but it would be great if you could point me at something else for Java if you know a library that does it better.

-This whole thing may not even become a bottleneck when running the final game-simulation, it might or might not, so just going on and thinking about this later may be acceptable, since I'm probably over-engineering again.

What do you think is the way to go?

sentences:
How to refer to a object that has just been hit by a ray cast? I would like to use RigidbodyConstraints.FreezeRotation;in order to freeze the rotation of an object that is picked up. The problem is I don't know how to refer (or call) the currently selected object. The script in it's currents state is below...

public class PhysGun : MonoBehaviour
{
    private GameObject Player;

    void Start ()
    {
       Player = GameObject.Find("Player");
    }

    // Update is called once per frame
    void Update ()
    {
        Vector3 fwd = transform.forward; // Equivalent to the code you had.

        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit, 10f))
        {
            hit.transform.SetParent(Player.transform);
            Debug.Log("We hit: " + hit.transform.name);
            hit.transform. = RigidbodyConstraints.FreezeRotation;
        }

    }

}

So, how do I call (or refer to) the object that is hit by the ray cast exactly?

sentences:
Which console systems can indie developers officially develop for? As an independent developer, I would like to know what platforms I can use to reach what consoles, and under what prices. I'm assuming a small team (1-3 people) and low or non-existent budget (under $1000).

For the purpose of this question, a "console" is "anything other than a PC." So this includes mobiles phones and other devices.

For this question to be useful and not a collection of every game engine and platform in the world, maybe we should restrict it to technologies that support at least two platforms.

sentences:
How should I design an easing class in C++? I'm currently struggling to find a good approach for an easing class for my game.

The class holds some easing effects, like elastic-in-out, and should be called by menu buttons, players and enemies to polish my animations a bit.
(think about a cool bouncing button that fades in)..

This is my very basic easing class so far:

class Easing {

protected:
    double currentTime;
    double startTime;
    double endTime;

public:
    virtual double ease(double t) { return 0.0f; }

};

class Easing_ElasticInOut : Easing {

public:
    virtual double ease(double t) override {
        t--;
        return sqrt(1 - t*t);
    };

};

In my menu I've got a bunch of buttons and I'd like to animate them to ease in when they appear.

void EditorMenu::render() {

    if (is_open()) {
         // Easing_ElasticInOut ???
         // Draw a button with circle_radius depending on the easing
    }
}

This render() method gets called all the time.

How would you design these effects? I'm not sure about how to only call them once and let them finish, especially when there are more buttons or things at once, that need to be animated...

sentences:
Video playback in games - formats & decoding What free / non-restrictive open-source solutions (not GPL) are available for decoding game videos?

The requirements are simple:

a relatively easy to use C API
encoded files must be quite small
there must be an application that converts videos from any format (whatever codec is installed on Windows or equivalent amount of internally decoded formats)
decoding has to happen fairly quickly
bonus points go to file formats that are popular / actively supported and
developed

sentences:
Random scene manager in Unity This may be hard to understand because this is hard to explain

I have 6 scenes and one 'start' scene.

The start scene will be where my scene manager is.

So I want function where when the player clicks on the the start scene it goes to a random scene (from the 6 scenes) and then it goes to start. Then when you click again it goes to random scene, but this time these random scenes will be between the remaining 5 (excluding the scene the player just went on) and then it goes back to start. Then it goes to a random scene time, this time these random scene will be between the remaining 4. And so one.

I already know how to go a random scene and back but I don't know how to do the remaining

sentences:
How can I check if component is enabled? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraInformation : MonoBehaviour
{
    public string currentCameraState;

    // Start is called before the first frame update
    void Start()
    {
        var components = new List<Component>();
        foreach (var component in GetComponents<Component>())
        {
            if (component != this)
            {
                var fullName = component.GetType().FullName;
                if (fullName.StartsWith("Cinemachine"))
                {
                    currentCameraState = component.
                }
            }
        }
    }

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

    }

    private void OnEnable()
    {

    }

    private void OnDisable()
    {

    }
}

At this line I want to assign the string the component status if it's enabled true or false.

sentences:
If I release code under GPLv3, can I specify what parts of users' code can be released under a new license? I have a few questions about what users of my engine could copyright in their own project. The way the engine would work would be that it would be a standalone program in Java that would load all of the scripts/assets/data from a folder that the game takes place in. The code could be written in Python or compiled to Java.

Onto my questions, the code that they write would access some parts of my engine through Jython, and so I assume those would have to be released under the GPL. But what about the rest of the game other than the code? Like could they copyright their own art?

I guess what I really want is that modifications of the code of the engine must be released under the GPL, but projects created using my engine can be released under any copyright, as long as they obey they distribute the engine itself under the GPL.

sentences:
How to resolve push block physics in a 2D side scroller puzzle I've been working on a 2D tile-based side scroller puzzle game in Unity with obstacles such as doors, keys, fans, portals, etc., but one type of obstacle, push blocks, is giving me some issues. Here is how it is supposed to work:

The player (an certain other obstacles) can push the block from either side, and it should move smoothly until it is either blocked by another obstacle or there is no ground beneath it
If it is pushed off an edge, it should fall into whatever hole is there, even if it is a snug fit. (left picture)
The top of the block should be flush with other blocks or surfaces when they are at the same level of height. There are no slopes in the tileset, so this would happen often. Motion across the combined surfaces should be smooth, with no way to wiggle between adjacent blocks. (right picture)
It must be able to respond to other forces in the game such as fans and gravity switches.

I have been using Unity's built-in physics engine, which has worked great for all other components of the game, but sometimes allows blocks to jump over holes, and sometimes blocks get stuck between other blocks when they shouldn't, so I have tried abandoning Unity's physics and made my own. It just made the rest of the game more glitchy and still failed to resolve the block problems.

If I change just the way the blocks physics work, I may be able to lock its position to a grid, where it cannot be left between tiles. That way I could get the more snug collisions to work. If I did this though, it would cause problems with the rest of the interactions. A floating block with a fan underneath it bounces around too much to be locked to a grid. Does anyone know a design that would allow all these requirements of be met?

sentences:
FlashPunk + Flashdevelop - How to use sponsor provided preloader I have developed a flash game using FlashPunk (on FlashDevelop). And now that I am trying to add a sponsor preloader and splashscreen to my game, I realize the flashpunk forums are down, and have been for over a week now :( Speak of bad timing.

I imagine some of you here do use FlashPunk. How have you managed to add such sponsor stuff to your game? I haven't had to deal with swf and fla at all until now.

The sponsor's preloader is an actual loading bar, at the end of which it also plays an animated splash screen.

Any help would be much appreciated.

Thanks!

sentences:
How do I implement melee hit boxes for a top-down game? For a 3D top-down game, how should I handle collision in melee combat? My game has no targeting system, so I can't use a simple distance check between attacker and target.

What I am thinking is have the character swing, generate a hit box, run the damage script for any characters in that hit box, and then delete the hit box. How should I handle this?

Also, I would like to use the same attack script for all players and NPCs in melee, even with different attack animations and hit boxes. However, really I can't figure out how to reliably assign who the attacker and who the target are within that script, or how to handle multiple simultaneous attacks.

sentences:
OpenGL Framebuffer Object issue I am struggling with implementing a proper Framebuffer Object .

glCheckFramebufferStatus is returning me:
 GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (36054).

What am i missing?

GLuint fbo, rboColor, rboDepth;

// Color renderbuffer.
glGenRenderbuffers(1,&rboColor);
glBindRenderbuffer(GL_RENDERBUFFER,rboColor);
// Set storage for currently bound renderbuffer.
glRenderbufferStorage(GL_RENDERBUFFER, GL_BGRA, _w, _h);

// Depth renderbuffer
glGenRenderbuffers(1,&rboDepth);
glBindRenderbuffer(GL_RENDERBUFFER,rboDepth);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, _w, _h);

// Framebuffer
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,     GL_RENDERBUFFER, rboColor);
// Set renderbuffers for currently bound framebuffer
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,GL_RENDERBUFFER,rboDepth);

 // Set to write to the framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER,fbo);

// Tell glReadPixels where to read from.
glReadBuffer(GL_COLOR_ATTACHMENT0);

GLenum e = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);//glCheckFramebufferStatus: check the completeness status of a framebuffer
if (e != GL_FRAMEBUFFER_COMPLETE) {
printf("\nThere is a problem with the FBO.");

}

sentences:
Use of FlxG.camera.follow to follow a character vertically I am developing a prototype for a game in Flixel in which a character floats upward continually to traverse the level. I would like to have a "tall" layout for levels and set the FlxG.camera to follow the character as he floats upward. My issue is in understanding the proper use of FlxG.camera. I have my game constructor coded as follows:

package
{
    import flash.display.Sprite;
    import org.flixel.*;

    [SWF(width="640",height="480",backgroundColor="#000000")]
    public class MyGame extends FlxGame
    {
        public function MyGame()
        {
            super(320,240,PlayState,2);
            forceDebugger = true;
        }
    }
}

In the override of create() in the PlayState.as file I attempt to set the camera to follow the player as follows:

public var TheClimber:BalloonHero;

        override public function create():void
        {
            /*set background color*/
            FlxG.bgColor = FlxG.BLUE;

            /*Set data for player*/
            TheClimber = new BalloonHero(FlxG.width/2-5,480);

            /*Add camera and set it to follow The Climber*/
        //which will automatically set the boundaries of the world.
        FlxG.camera.setBounds(0,1280,640,1280,true);
        FlxG.camera.follow(TheClimber,FlxCamera.STYLE_PLATFORMER);

            /*add player to the game*/
            add(TheClimber);
        }

I assumed this would set the camera bounds to twice the height of the SWF background(i.e. the FlxG height) and then scroll the background along with the specified FlxObject(TheClimber in this case) until it had reached the height of the game. However, I must be going about it incorrectly because when the zoom is 2 and the game height 720 the camera starts at the top of the screen with the player character not visible at the bottom of the game height.
Is there a way to start with the camera/game focused on the bottom of the game object(FlxG.height) ? Or am I going about this the wrong way and have other issues with the way I am using the camera? Thanks in advance.

sentences:
Does it require any license to use a real city landscape in a car racing game? I'm now planning a casual car racing game that want to model some real cities sight into it. I doubt if there is copyright of the landscape or city planning of those real cities in the world. Can I model such as existing city or I can't?

Thanks a lot.

sentences:
Player wont rotate properly So Small problem. I'm able to rotate my camera around my player AND rotate the player when the camera moves around it, but the controls don't seem to move with it. Example: W moves forward. If I look right then W should move forward in that direction. It doesn't, instead it will go left (the forward as it was before).

[SerializeField] GameObject GameCamera;

private void PlayerRotateWithCamera()
    {
        Quaternion CharacterRotation = GameCamera.transform.rotation;

        transform.rotation = CharacterRotation;
    }

private void FixedUpdate()
{
    PlayerRotateWithCamera();
    MovePlayer();
}

I only think the player is rotating cause it looks like it is, but if you look at the move tool the axis dont seem to move with the Player

Just in case my movement isn't getting along with the rotation:

private void MovePlayer()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");

        // more realistic ball movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I also have Tool handle rotation set to global because it's a ball, and well, those axis obvious go crazy while rolling around.

Any help at all would really be appreciated!

sentences: Fight with creativity burnout I have big creativity burnout :/ Do you have any ideas how can I fight with it ??

sentences:
canvas not found in game view with unity I am working on a GearVR app with Unity3D.I have an environement and I have placed a canvas in the scene.I have set the canvas Render mode to "World Space".But when I runned my project,the canvas is getting displayed on the scene view,but in the game view the canvas is not getting on the scene.But whereas in the camera view its showing the canvas.What will be the issue?.

When I set me canvas Rendere mode to Screen Space-Overlay the canvas is getting displayed in the scene but as the lookup change,the canvas is also moving along with the camera

Can anybody please help me out.

sentences:
Updating object's property on Start is visible for a second when game loads I have a world selection scene in which I have GameObjects representing worlds. The GameObjects have default properties when the scene is loaded. For example: the world name text is red and each world has a "locked" status. This initial state can be seen in the following screenshot:

On the Start() method I'm dynamically updating the properties on each GameObject based on values I'm reading from a save file. If a world is unlocked the name text is set to white. If a world is currently selected the name text is set to green. Here's what that looks like at run time:

The problem is that when the scene is loaded from another scene(e.g. by clicking a navigation button) the initial state of the GameObjects can be seen for a second and then they change to the proper values as dictated by the save file. How can I prevent this from happening? I was under the impression that anything that happens in the Start() method takes place before GameObjects are rendered.

Here's some slimmed down code of what my code looks like:

    var worldIcons = FindObjectsOfType<WorldIcon>().OrderBy(x => x.WorldNumber).ToList();
    var saveFile = GameSaveManager.GetSaveFile();

    if (saveFile == null)
    {
        Debug.LogError("Could not find save file while loading worlds");
        return;
    }

    foreach (var worldIcon in worldIcons)
    {
        var savedWorld = saveFile.Worlds.SingleOrDefault(x => x.Number == worldIcon.WorldNumber);

        if (savedWorld == null)
        {
            //add world to save file
            GameSaveManager.CreateWorld(worldIcon.Controller);

            //unlock first world by default
            if (saveFile.Worlds.Count == 0 && worldIcon.WorldNumber == 1)
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
        }
        else
        {
            worldIcon.DisplayName = savedWorld.Name;
            worldIcon.WorldNumber = savedWorld.Number;

            var button = worldIcon.GetComponent<Button>();

            if (savedWorld.Unlocked)
            {
                button.interactable = true;
                button.targetGraphic.color = Color.white;
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
            }
            else
                worldIcon.Unlocked = LevelMapController.LockedStatus.Locked.ToString();
        }
    }

sentences: How To generate spiky terrain in 2D? I am learning game design, and wanted to know how one can automatically generate spiky terrain (something like this: Cavernaut, notice, the terrain at the sides?). I have heard about midpoint displacement algorithm. But How can I apply that to my problem, given that I would also like to increase/decrease the randomness of the terrain. Also, Is there any helpful library for this in libgdx?

sentences:
How to implement OpenGL triple buffering of buffer objects to avoid stalls? I'm trying to implement the triple buffering described here. The intent is to gain higher frame rate by avoiding waiting for glBufferSubData() to finish.

My understanding is that this is how to implement triple buffer:

- make 3 buffers with glGenBuffers()
Current frame:
  - bind to buffer3
  - draw last frame
  - bind to buffer1
  - glBufferSubData for all the vertices,
  keep track of their texture/vertex count,blend function, etc
Next frame:
  - bind to buffer 1
  - draw last frame (bind texture, blend func, glDrawArrays)
  - and so on

There doesn't seem to be any performance gain between this and doing glBufferSubData() and then immediately calling glDrawArrays().

Am I missing something or misunderstand how triple buffer should work?

Also is there a way to know when glDrawArrays() stalls due to glBufferSubData() still not being finished?

sentences:
Implementations for storing entities in an ECS system I'm restructuring my model of entities, components and systems, where entities are:

const createEntity = (name, components) => ({
    id: genUniqueId(),
    name: name,
    components: components
});

And I came across a question, and would like to hear someone's experience about it. The question is what are the advantages and disadvantages of each of the following implementation approaches:

1 - Implement all entities in a single global object, and traverse this object by applying the systems in each entity, example:

const entities = {};
for(let key in entities)
    for(let system of systems)
       system(entities[key]);

2 - Create several global variables for each group that the systems serve, example:

const players = {};
const monsters = {};
const clouds = {};

for(let key in players)
       systems['input'](players[key]);

for(let key in monsters)
       systems['simpleAI'](monsters[key]);

for(let key in clouds)
       systems['wind'](clouds[key]);

3 - Create local variables within the systems to store the entities, and functions for each system to add and remove entities from their internal objects, example:

const windSystem = () => {
    const clouds = {};
    for(let key in clouds)
       ...
};

const addEntityInWindSystem = () => {...};
const delEntityInWindSystem = () => {...};

My intention with the question is just to look for other solutions or even understandings about the cons and advantages that each implementation can bring me during development.

sentences:
DirectX depth/order render issue I have what appears to be a depth or order rendering problem which I have never seen happen before. My terrain and water are rendered with my displacement shader, and at the moment all other models are rendered with my standard shader, and I am using deferred rendering.
Now, as you can see in the images, I have a sphere that is half cut off, as though d3d thinks that the water is somehow in front of the sphere, which it is not. If I move down to water level, you can see the whole sphere.
If I render the same sphere with my displacement shader, there is no problem at all. If I go into my displacement shader class, and cut out the hull and domain shader stages, then the terrain and water start to do the weird z buffer issue that the sphere is having.
Is there something conceptual anyone can think of without me having to post hundreds of lines of code? However, happy to post code if needed.

Thank you

UPDATE:
I've narrowed it down to the domain shader - the line that physically changes the output triangles' position. When I comment out this line, it solves the problem, although then I have no tessellation. Do I need to do some kind of manual depth writing after changes the position?

Domain Shader:

cbuffer cbDomainInfo
{
    float3 g_vEyePosition;
    float _padding;
};

struct PatchTess
{
    float flEdges[ 3 ] : SV_TessFactor;
    float flInside : SV_InsideTessFactor;
};

struct DomainInput
{
    float4 vPosition    : POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

struct DomainOutput
{
    float4 vPosition    : SV_POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

Texture2D g_texDispMap;
SamplerState g_samSampler;

[ domain( "tri" ) ]
DomainOutput DS( PatchTess input, float3 uvwCoord : SV_DomainLocation, const OutputPatch<DomainInput, 3> patch )
{
    DomainOutput output;

    output.vPosition = uvwCoord.x * patch[ 0 ].vPosition + uvwCoord.y * patch[ 1 ].vPosition + uvwCoord.z * patch[ 2 ].vPosition;
    output.vNormal = uvwCoord.x * patch[ 0 ].vNormal + uvwCoord.y * patch[ 1 ].vNormal + uvwCoord.z * patch[ 2 ].vNormal;
    output.vTexcoord = uvwCoord.x * patch[ 0 ].vTexcoord + uvwCoord.y * patch[ 1 ].vTexcoord + uvwCoord.z * patch[ 2 ].vTexcoord;
    output.vViewVec = uvwCoord.x * patch[ 0 ].vViewVec + uvwCoord.y * patch[ 1 ].vViewVec + uvwCoord.z * patch[ 2 ].vViewVec;
    output.flAlpha = uvwCoord.x * patch[ 0 ].flAlpha + uvwCoord.y * patch[ 1 ].flAlpha + uvwCoord.z * patch[ 2 ].flAlpha;

    output.vNormal = normalize( output.vNormal );

    float flMipInterval = 20.f;
    float flMipLevel = clamp( ( distance( output.vPosition, float4( g_vEyePosition, 1.f ) - flMipInterval ) ) / flMipInterval, 0.f, 6.f );

    float flHeightMap = g_texDispMap.SampleLevel( g_samSampler, output.vTexcoord, flMipLevel ).r;

    //TODO: Pass in height scale via cbuffer
    //This next line causes the problem:
    output.vPosition += float4( ( 20.f *( flHeightMap - 1.f ) ) * output.vNormal, 1.f );

    return output;
}

sentences:
Sampler referencing in HLSL - Sampler parameter must come from a literal expression The following method works fine when referencing a sampler in HLSL

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;
float depth;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}

// [Standard Depth Calculation]
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

If I try and do anything with the sampler reference outside the if statement then I get the following error:

Sampler parameter must come from a literal expression

This code demonstrates that

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}

// Rescale viewport to be [0, 1] (texture coordinate space)
P.x = 0.5f * P.x + 0.5f;
P.y = -0.5f * P.y + 0.5f;

// [Standard Depth Calculation]
float depth = tex2D(ShadowSampler, P.xy).x;
depth = 1.0 - depth;
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

How can I reference the sampler in this manner without triggering the error?

sentences:
How to make Line Renderer lines stay flat? I've noticed that as I add more vertexes to a Line Renderer line the line twists and stops being a smooth line.

.GIF Here: http://i.imgur.com/hRAhCXM.gif

All lines are on the same z level, even if I remove the materials the lines still seem to twist.

I have no idea why it does this, or how to go about resolving it, any suggestions?C#

sentences:
Camera view/projection issue I made a simple OpenGL program but I can figure out why the camera is not working, here it's a little fragment of the Camera class:

public Matrix4f getView() { // initializes the view matrix
    return new Matrix4f().lookAt(
            new Vector3f(0f, 0f, 1f), // camera position at 0,0,1
            new Vector3f(0f, 0f, 0f), // camera target at 0,0,0
            new Vector3f(0f, 1f, 0f)); // up axis set to "worldUp" (0,1,0)
}

public Matrix4f getProjection() {
    return new Matrix4f().perspective(
            (float) Math.toRadians(fieldOfView), // the fov has a value between 0f and 180f, by default I set it to 90°
            viewportAspectRatio, // the aspect ratio is equal to 1024 / 960 (screen height / screen width)... even if I've not understood what is it...
            0.1f, 1000f); // I've not really understood what near and far planes are...
}

public Matrix4f getMatrix() { // with this function I obtain the final camera matrix
    return getView().mul(getProjection());
}

And it's how I handle the camera Matrix in GLSL, created using camera.getMatrix():

gl_Position = camera * model * vec4(position, 1.0);

Without the camera all is fine: here's the program running using gl_Position = model * vec4(position, 1.0);:

(Yeah, it's a cube)

But using the camera in the way I showed you before, increasing the FOV, I get this:

Could anyone look at my code and tell me where I'm wrong? I would be really happy... D:

sentences:
Central logic in entity-component-architectures I've build a architecture based on the entity-component-system-idea.
So I got

Components - Just store Data
Systems - Operates isolated on Components
Scripts - Which are just objects from type Script and attached to a ScriptComponent. A ScriptSystem will execute the init() and update() functions on the scripts then.

However, I'm wondering where to place the central game logic since the I have to check a few things about the overall game process, holding the map, counting the points, checks the points if they are enough for the end-screen, etc. ...

Should I create a single entitiy with just such a script attached to it or are there better solutions out there?

sentences:
Dynamic body implementation I am writing a 2D game where one of the characters has some very particular requirements. This character is a body with no particular shape (similar to a fluid, but not so much), it has to be able to grow and shrink (as in actually growing, not just scaling), and it has to have collision detection (even if it's basic). Because of this requirements, it obviously can't be based on a sprite, so direct rendering of the shape should be the logical thing to do.

I assume this is no easy task, but I just couldn't find a good physics engine that covers these requirements (or at least no tutorial on how to do it; I particularly searched for Box2D tutorials).

Is there a way of doing this with Box2D, SDL, or any other physics or game engine out there?

If not, what's a good place to start? I am really clueless as far as soft-body physics are concerned.

sentences:
Raycasting Collision Detection I need to check for collisions when firing a bullet, but I have a few questions first. My game is 2D and tile based, it also uses the XNA framework. From what I've read raycasting or continuous collision detection is the way to go for high speed bullets. XNA has a method called Ray.Intersects which takes a bounding box, does this mean that I should be starting at a point and looping through all the tiles in a line to see which tile intersects like this?

Now that example required 10 checks and now I have the information I need to know where the collision is exactly, but wait what if a person jumps in line of the ray? Well now I need to be performing these checks every frame in order to determine if a player comes in line. Assuming my game has a solid 60 FPS I'm now up to 60 checks every second or 10 checks a frame. Maybe I've shot my weapon 5 times and the wall is 50 blocks away, that would be a lot of checks.

So if you couldn't figure out what I'm getting at here these are my questions.

In order to preform raycast collisions do I start at a point (barrel of weapon) and loop through all the tiles asking "does the ray hit this tile?" until I've hit something (a wall)?
How do I optimize it or does it even need optimizing?

Remember the system needs to...

be able to obtain all the necessary information such as where does the collision take place exactly?
account for players or obstructions getting in the path of the ray.

sentences:
How to use a mask texture with Kobold2D I am an iOS developer but I'm new to cocos2d. I'm working on new game, I use Kobold2D, have cocos2d installed too, and I want to make this effect:

I know how is done with Flash, but can't make it with Kobold2D. There's 2 images with the same size: one is a low-res image for the background and the second is a hi-res over the first one. When the "reticle" mask moves, it reveals the second image inside the circle and the background is visible outside only. I googled with no success, saw some Ray Wenderlich projects they weren't helpful.

sentences:
Can a Game Engine be built into a Game Engine? This confuses me as the title says "Mostly Civilized: A Hex-Based 4x Game Engine for Unity - Part 1"

Unity is a Game Engine, and he is building a game engine for a game engine.

Did he word this incorrectly, or is building a game engine into a game engine a real thing?

sentences: RenderPipleinManager.DORenderLoop_Internal() Taking Unusual Amount In profiler I am developing for WebGL and for optimization purposes I have converted to URP. After converting the tri count has dramatically improved but the problem is my FPS is not improving. I tried to profile and found that RenderPipleinManager.DORenderLoop_Internal() is taking 13%. Is this normal? An initial search brought that it was a bug and fixed in a later unity version. But even after converting to the latest lts 2019.4.20, i am getting the same issue.

sentences:
How can I record my vector graphics game without  blurring the graphics? A lot of people asked for a trailer for my game, because screenshots do not do it justice. I have tested PlayClaw, Fraps, CamStudio, VirtualDub, and some other minor tools; none have produced a viable result. My game uses vector graphics and is designed to run at 60fps, so lossy compression of a regular screen capture video destroys the graphical appeal.

How can I record gameplay without blurring my graphics and slowing down the framerate?

sentences:
GPU particle system using vertex texture fetch in Direct3D9 I've been reading up on particle systems amongst other stuff and one interesting approach uses rendertargets to store a particle's position, velocity, lifetime, etc. A pretty neat summary is given here, for example.

However, I'm wondering how to effectively use such a system? How would you create new particles, upload them to the GPU and how'd you determine what particles to draw? I mean, if you've got a 512x512 rendertarget storing particles, would you really just send a vertexbuffer with 262144 quads to the GPU and let the shader figure out which particles to draw and which to ignore?

Right now this sounds like a good idea for those bigger, continuous particle effects like weather or something... particle systems, which don't change often, can run for a while or where particle generation. I don't really see how they'd be performant enough to power dynamic one-off effects like explosions or something, because uploading new particles would basically require locking the rendertarget(s) and manipulating its (their) pixels, right?

sentences:
How do we apply different textures to different faces generated via geometry shader? I am trying to render a cube by starting of with one vertex into the shader, then geometry shader to expand into a cube, and then apply a different texture to each side. The part I am facing the issue with applying unique textures to each side.

So I am currently doing this by creating it via quads pushing the vertices, and applying the textures one by one. In fact, I drawIndexed() a set of vertices, then switch over to a different textures every 6 vertices. But pushing in so many vertices is expensive for higher FPS. So, I looked in to Geometry shader and it seems like it did the job. After studying it, I understand how to develop the vertices in the geometry shader. However, I don't know how to apply a different texture say every 6 vertices - since we are in the pipeline already.

sentences:
Unity won't Instantiate() outside of Start(), even though code is the same I am trying to add a gameobject to my game using a socket connection. I have a SocketHandler class, which simply connects to my NodeJS socket server, which can also call a method on another class, which will add a new gameobject to the game. Here is how it basically works:

void Start () {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = "Volkswagen";
}

This works fine and it adds the gameobject to the game upon starting. However, if I do something like this in my SocketHandler, it doesn't work:

var addCar = new AddCar();
socketio.On("addCar", (data) => {
    string str = data.ToString();
    Car data2 = JsonConvert.DeserializeObject<Car>(str);
    addCar.AddNewCar(data2);
});

and then inside my AddCar class, I have the AddNewCar() method:

public void AddNewCar(Car input) {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = input.name;
}

it does not work. If I do a Debug.Log(input.name) inside the AddNewCar() method, it does log the name the server sends. It should do the exact same thing, but the AddNewCar() doesn't get added to the game. It simply does nothing.

What could be wrong?

sentences:
How to synchronize two components? I have two components I'd like to connect them to each other.

PhysicalComponent
containing rigid body(position, rotation, velocity) and is holding body from physics engine.
GraphicsComponent
onscreen representation(position too, rotation too).

I'd like to sync this components, how to do it?

Read position, and rotation in GraphicsComonent from Physical comopnent.
Add one more component that sync them.

But problem is that I want to change on screen representation (other class such as PositionInerpolator do it, and it can work only with GraphicsComponent), and it must change physical body position. Is it a bad idea, and I must move physical body directly?

Thanks in advance.

sentences:
What alternatives are there for creating Keyboard/Mouse controls in LWJGL? So I'm currently working my way through openGL tutorials, using LWJGL to do all my work in. However as I get to the part on how to access Keyboard and Mouse events in this library, I stumble across this little gem:

public static void poll()

Polls the keyboard for its current state. Access the polled values using the isKeyDown method. By using this method, it is possible to "miss" keyboard keys if you don't poll fast enough...
(from http://www.lwjgl.org/javadoc/org/lwjgl/input/Keyboard.html#poll())

So in order to make use of Buffered Input (as the top answer in LWJGL multiple keyboard/mouse input checks calls it) you have to use this poll() method.

This means that no matter what I do, I will miss key presses if I use LWJGL for this. I have made a test with this bit of code:

while(Keyboard.next()) {
    int character = Keyboard.getEventCharacter();
    int key = Keyboard.getEventKey();
    String charName= Keyboard.getKeyName(key);
    System.out.println(charName+""+character);
}

When pressing the buttons Z X C V at the same time, an example output is as follows: Z122
V118
X120
C0
V0
Z0

As you can see the C press and X release aren't found in the buffer. In some cases a single keystroke had both the press and release missing from the buffer.

I need this to not be the case and polling faster doesn't solve the issue at all (why would that even be a solution?). So what are the alternatives for this system?

(P.S. Yes pressing those 4 buttons at the same time was properly recorded in other applications)

sentences:
Isometric displaying two different images in different positions I'm creating a simple Isometric game using HTML5 and Javascript, but I can't seem to get the display to work, at the moment i have 9 tiles that have X and Y positions and the player has a X and Y position, the players X and Y properties are set to 100, and the tiles are as shown

tiles[0] = new Array(3);
tiles[1] = new Array(3);
tiles[2] = new Array(3);
tiles[0][0] = new point2D( 100, 100);
tiles[0][1] = new point2D( 160, 100);
tiles[0][2] = new point2D( 220, 100);
tiles[1][0] = new point2D( 100, 160);
tiles[1][1] = new point2D( 160, 160);
tiles[1][2] = new point2D( 220, 160);
tiles[2][0] = new point2D( 100, 220);
tiles[2][1] = new point2D( 160, 220);
tiles[2][2] = new point2D( 220, 220);

Now I use this method to work out the isometric position

function twoDToIso( point )
{
var cords = point2D;
cords.x = point.x - point.y;
cords.y = (point.x + point.y) / 2;
return cords;
}
point2D is

function point2D( x, y)
{
this.x = x;
this.y = y;
}

Now this i'm sure does work out the correct positioning, but here is the output Isometric view

I just need to move my player position a tiny bit, but is that the best way to display my player position in the right position?

Canvas

P.S. the tile width is 120 and height is 60 and the player is width 30 by height 15

sentences:
Separating Game Engine from game code in similar games, with versioning I have a finished game, that I want to decline in other versions. These would be similar games, with more or less the same kind of design, but not always, basically things might change, sometimes little, sometimes big.

I would like the core code to be versioned separately from the game, so that if say I fix a bug found in game A, the fix will be present in game B.

I am trying to find the best way to manage that. My initial ideas are this:

Create an engine module/folder/whatever, that contains everything that can be generalized and is 100% independent from the rest of the game. This would include some code, but also generic assets that are shared among games.
Put this engine in its own git repository, which will be included in the games as a git submodule

The part I am struggling with is how to manage the rest of the code. Let's say you have your menu scene, this code is game-specific, but also most of it tends to be generic and could be reused in other games. I can't put it in the engine, but re-coding it for each game would be inefficient.

Maybe using some sort of git branches variation could be effective to manage that, but I don't feel like this is the best way to go.

Anyone has some ideas, experience to share or anything about that?

sentences:
Overdrawn pixels vs many polygons, which affects performance the most? I know that having overdrawn pixels is not desirable as well as having many polygons since they can decrease performance.
Often when I model I have an option to decrease the number of polygons by having disconnected polygons over. For example, considering this:
Let's imagine it has more turns that are not visible in this picture.
I can decrease the number of polygons by having a pathway as a single disconnected face:

As a result I would have less poly-count, but the bottom geometry would be overdrawn in many areas.

Or I can model this as a single continuous mesh. As a result I would have more poly-count, but no overdraw:

I very often have similar situations and I'm wondering which of these would be more performance efficient and cause less performance decrease on mobile devices?

sentences:
Game Development AI, NPC & Entities Definition using Scripting Languages i am developing a Multiplayer(actually MMORPG) architecture for learning purpose.

I do have some game developement background, but all my engines were very rigid and completly developed for the game itself.

That being said, i wanted to experiment so i designed a generic Entity/Component Model Architecture where i would like to extend the game logic, npc, ai, entities and game objects definition(monsters, characters, weapons, items, etc...) using a Scripting language for Code-Reuse and Hot Load/Reload purpose.

My questions are as follow: Considering that i want a scripting language with the best performance possible and that it need to be actually compatible with both .NET/Mono, what are my options? What would you suggest? I know Lua and Javascript are common, but how about performances? What would be my other options? What managed interpreter library would you use?

How would you proceed to implement such scripting language support in an engine? I plan to actually update the server-side simulation about 10 times per second.

Thanks in advance! ;)

sentences:
Setting effects variables in XNA I am currently reading a book named "3D Graphics with XNA Game Studio 4.0" by Sean James and have some questions to ask :

If i create a effect parameter named lets say SpecularPower and have in my effect a variable named SpecularPower , if i do something like

  effect.Parameters["SpecularPower"].SetValue(3)

That wil change the SpecularPower variable in my effect ?

And a second question, not regarding the book :
If i have a spaceship and i've created a "boost" functionality that speeds up my spaceship, what effects should i implement to create the impresion oh high speed ? I was thinking of making everything except my spaceship blurry but i think there would be something missing . Any ideas ?

Regards,
Alex Badescu

sentences:
XInputDotNet not working when building for UWP in Unity I am working on a game where a controller has to vibrate. I have found the XInputDotNet plugin which worked very well in the editor and a normal windows build, but if I build for UWP (both Xaml and D3D) the controller doesn't vibrate.

When building in unity for UWP it also gave me an error saying this:

Plugin 'XInputInterface.dll' is used from several locations:
Assets/Plugins/x86/XInputInterface.dll would be copied to
<PluginPath>/XInputInterface.dll
Assets/Plugins/XInputInterface.dll would be copied to
<PluginPath>/XInputInterface.dll
Plugin 'XInputDotNetPure.dll' is used from several locations:
 Assets/Plugins/x86/XInputDotNetPure.dll would be copied to
<PluginPath>/XInputDotNetPure.dll
 Assets/Plugins/x86_64/XInputDotNetPure.dll would be copied to
<PluginPath>/XInputDotNetPure.dll
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at
C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.HostView:OnGUI()

The only way I found to remedy this is by deleting one of the plugin folders.

I tried manually copying the ddl's to the build folder, but this didn't help. I tried using the 32 bit dll's and the 64 bit dll's, I tried building for x86 and x64 and I tried all three modes in visual studio(Debug,Master,Release).

I found some links to the Windows.Gaming.Input namespace, but I dont't know if it is possible to add this namespace to unity and if so how.

Does anybody have an idea how to fix my problem?

sentences:
How can I scroll sprites when swiping using Cocos2D? I'm adding 3 sprites (layers) to CCParallaxNode:

BGLayer = [CCSprite spriteWithFile:@"Layer.png"];
[_backgroundNode
    addChild:BGLayer
    z:2
    parallaxRatio:layer1Speed
    positionOffset:ccp(screenSize.width/2,screenSize.height/2)
];

How can I create the scroll when swiping?

sentences:
Debugging-Setting Consoles in Games Right now I have the graphical and input portions of a console for my game (command parsing hasn't been implemented yet). I was wondering how you would go about making changes to properties in game objects. For example, if I typed in the console:

skeletonMonster maxHP 20

That would change all of the existing in-game skeletons' max hit points to 20. After you parse this information what are some ways to change the value? How can I change the that member variable without directly accessing it (by making it public/global)?

I'd like to implement this so I don't have to change variables in the code and recompile every time while playtesting.

sentences:
Drag & Drop with a verifying system with BoxCollider2D I'm really struggling to create a decent Drag & Drop system. The game idea is that the player would drag images (at the left side of the screen) to different slots (at the center) to create an allegorical car, and then the game would give a score to what the player created.

But the problem is: the gameObjects have BoxCollider2D components (both of them have the IsTrigger on) and they don't interact with each other. The item slot doesn't detect that something has been dragged into it and which image was dropped.
This is the script of the gameObjects that are being dragged:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class DragDrop : MonoBehaviour, IPointerDownHandler, IPointerClickHandler,
                    IPointerUpHandler, IPointerExitHandler, IPointerEnterHandler,
                    IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler {

[SerializeField] private Canvas canvas;
private RectTransform rectTransform;
private CanvasGroup canvasGroup;
float spawnPositionX;
float spawnPositionY;
float spawnPositionZ;
float scaleX;
bool dragging = false;

private void Awake() {

    rectTransform = GetComponent<RectTransform>();
    canvasGroup = GetComponent<CanvasGroup>();
    spawnPositionX = transform.position.x;
    spawnPositionY = transform.position.y;
    spawnPositionZ = transform.position.z;

    scaleX = transform.localScale.x;
}

public void OnBeginDrag(PointerEventData eventData) {

    Debug.Log("Drag begin!");
    canvasGroup.alpha = .6f;
    canvasGroup.blocksRaycasts = false;

    dragging = true;
}

public void OnDrag(PointerEventData eventData) {

    Debug.Log("Dragging.");

    Vector3 screenPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, canvas.planeDistance);
    Vector3 worldPosition = Camera.main.ScreenToWorldPoint(screenPosition);
    transform.position = worldPosition;
}

public void OnEndDrag(PointerEventData eventData) {

    Debug.Log("Drag ended!");
    canvasGroup.alpha = 1f;
    canvasGroup.blocksRaycasts = true;

    dragging = false;
}

public void OnDrop(PointerEventData eventData) {

    Debug.Log("OnDrop");
}

public void Update() {

    if (dragging) {
        if (Input.GetKeyDown(KeyCode.R)) {
            scaleX = -scaleX;
            this.gameObject.transform.localScale = new Vector3(scaleX, 1f, 1f);
        }
    }
}

void OnTriggerEnter2D(Collider2D other){

    Debug.Log("Test 1.");
    if(other.gameObject.tag == "GameSlot"){
        Debug.Log("Test 2.");
        GameObject iconClone = Instantiate(gameObject, new Vector3(spawnPositionX, spawnPositionY, spawnPositionZ), Quaternion.identity, GameObject.FindWithTag("Canvas").transform);
    }else{
        Destroy(this);
    }
}

And this is the script of the slots which the images will be dragged into:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class ItemSlot : MonoBehaviour, IDropHandler {

public void OnDrop(PointerEventData eventData) {

    Debug.Log("OnDrop");

    if (eventData.pointerDrag != null) {

        eventData.pointerDrag.GetComponent<RectTransform>().anchoredPosition = GetComponent<RectTransform>().anchoredPosition;
        gameObject.GetComponent<Image>().color = new Color32(255,0,0,100);

    }
}

How do I solve this problem?

sentences:
Weird case of a key not working I finished a game in Java. It works perfectly fine on my computer.

Sent it to a friend. On his computer, for some reason, one of the keys that are used to play doesn't work inside the game. (It works in any other context, like a web browser).

He tried pushing this key with no other keys held. Still didn't work. So it's not a 'key combination' issue.

We both use Windows and the most updated JRE version.

What could it be? This is really weird. Thanks

sentences: Is there a 2d physics engine that can model fluids and gases? At this point the platform and programming language don't matter I would just like to know if something out there exists for this.  Any help is appreciated.

sentences:
Collision Detection/Response in Vector-based levels I have a 2D side scroller whose levels are stored as vectors (that is, a bunch of lines) which looks like this:

How would I detect that I'm colliding with one of these lines, and react accordingly (say, slide down the slope, or stand still on a flat platform)? We can assume the player uses an AABB.

sentences:
How to avoid Singleton/Statics/Injection in my puzzle game I am developing a puzzle game in java with swing.
Purpose of the game to find the  all the correct pairs on the board without ur lifes reaching 0 , preety simple etc.

I have a class My_Button which extends JButton.
My game consists of 6 type of Tiles (square , circle etc)
All these type of tiles extend My_Button class and implements my_Actions interf.
my_actions interface has some methods, not crucial for the question.
I have my_board class which holds arraylist with buttons , initializes buttons, fills the array , checks for validity between pairs , delete pairs etc.
It contains all the game functions in a way.

Now my main problem is the actionListener implementation and logic.
In my ActionListener in simple words i add the button that got clicked to a temp array and when 2 buttons got added to this array i do certain actions.
for example: (pseudo)

ActionListener{
my_board.posible_pair.add(this);
my_board.click_counter++;
my_board.check_game_state();
}

!check_game_state() runs if's and updates all the info of the game like: tries,score,check_valid_pair,delete etc.!

Now my thinking and my  question laid out:

First case:
If i make every Tile class implement actionListener like the example above ill have to make my_board singleton to be able to have acess to all this variables outside of the my_board class.

Second case:
even if i implement actionListener inside the my_board class and add the actionlistener through anonymous classes to my button after i add them to the board it gives error ofc because the scope gets weird.

Third case:
full static class and variables, its really bad programming so id like to avoid.

QUESTION:

--How i can reconstruct my project to manage these problem without singletons/static ?

--How i can avoid putting the check_game_state() inside the ActionListener which also is a bad practice?

I checked infinite number of qestions on this forum , google , stackoverflow but nothing really helps on the specifics.
I have developed simmilar games before but i always follow the singleton tecqniques and id like to change that.

sentences:
two-part dice pool mechanic I'm working on a dice mechanic/resolution system based on the Ghost/Echo (hereafter shortened to G/E) tabletop RPG. Specifically, since G/E can be a little harsh dealing with consequences and failure, I was hoping to soften the system and add a little more player control, as well as offer the chance to evolve player characters into something unique, right from creation. So, here's the mechanic: Players roll 2 separate d12 against each of the two statistics for their character (each is a number from 2-11, and may be rolled above or below depending on the nature of the action attempted, rolling your stat exactly always fails). Depending on the success for that roll, they add dice to the pool rolled for a modified G/E style action.

The acting player gets two dice anyhow, and I am debating offering a bonus die for each success, or a single bonus die for succeeding on both of the statistic-compared rolls.

Once the size of the dice pool is set, the entire pool is rolled, and the players are allowed to assign the rolled dice to a goal and a danger, one to each. Assigned results are judged as follows:

1-4 means the attempted goal fails, or the danger comes true.

5-8 is a partial success at the goal, or partially avoiding the danger.

9-12 means the goal is achieved, or the danger avoided.

My concerns are twofold:

Firstly, is the two-stage action too complicated, with two rolls to judge separately before anything can happen?

Secondly, are the statistics involved going too far in softening the game? I've run some basic simulations, and the approximate statistics follow:

                 2 dice     (up to) 3 dice      (up to) 4 dice
failure          ~33%            ~25%               ~20%

partial          ~33%            ~35%               ~35%

success          ~33%            ~40%               ~45%

I'd appreciate any advice that addresses my concerns or offers to refine my simulation (right now the first roll is statistically modeled as sign(1d12-1d12), where >0 is a success).

sentences:
How a "Collision System" should be implemented? My game is written using a entity system approach using Artemis Framework. Right know my collision detection is called from the Movement System but i'm wondering if it's a proper way to do collision detection using such an approach.

Right know i'm thinking of a new system dedicated to collision detection that would proceed all the solid entities to check if they are in collision with another one.

I'm wondering if it's a correct way to handle collision detection with an entity system approach? Also, how should i implement this collision system?

I though of an IntervalEntitySystem that would check every 200ms (this value is chosen regarding the Artemis documentation) if some entities are colliding.

protected void processEntities(ImmutableBag<Entity> ib) {
    for (int i = 0; i < ib.size(); i++) {
        Entity e = ib.get(i);
        //check of collision with other entities here
     }
}

sentences:
Render to Texture Using Multisampling I have a DirectX11 application, which has multisampling / anti-aliasing enabled.  However, I want to add an effect that requires a render-to-texture step.  When I add this extra step, I lose all anti-aliasing.  Here's basically what I'm doing:

1) render scene to texture

2) render texture to screen (with some effect, say blurring or something).

I've tried enabling multisampling on the render texture, but i'm not sure how to get it to work.  I've made it use 8 samples and specified D3D11_DSV_DIMENSION_TEXTURE2DMS, but apparently that step required me to use Texture2DMS in the shader.  But now I don't know how to sample a Texture2DMS in the shader, because I can't just pass in the textures coordinates, I have to pass in a sample index, which I don't know how to calculate.

How to I use render to texture effects while preserving multisampling / anti-aliasing?

sentences:
Why doesn't Array.Copy to mesh.verticies work in Unity? I am rebuilding a mesh but something seems odd that I have to create a temp array just to hold the verticies rather than copy an array.

I'm not using list because this is used frequently and I do not want to resize list and instead just use height index boundary to prevent additional  garbage collection from resizing lists.

Doesn't work and results in no mesh showing:

Mesh mesh = new Mesh();
//copy myVerticiesArray to mesh.verticies. myVerticiesArray
//length has null values above verticiesIndexHeight but array copy height set in Array.Copy()
Array.Copy(myVerticiesArray, mesh.vertices, verticiesIndexHeight);
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

Also doesn't work and results in no mesh showing:

Mesh mesh = new Mesh();
//loop through built verticies array to mesh.verticies of correct size because myVerticiesArray
//length has null values above verticiesIndexHeight
mesh.verticies = new Vector3[verticiesIndexHeight];
for(int i = 0; i < verticiesIndexHeight; i++)
{
    mesh.verticies[i] = myVerticiesArray[i];
}
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

Works and renders mesh:

Mesh mesh = new Mesh();
Vector3[] tempVerticiesArray = new Vector3[verticiesIndexHeight];
//copy built verticies array to temp array of correct size because myVerticiesArray
//length has null values above verticiesIndexHeight
Array.Copy(myVerticiesArray, tempVerticiesArray, verticiesIndexHeight);
mesh.verticies= tempVerticiesArray;
[...] code to set UVs etc omitted
mesh.Optimize();
mesh.RecalculateNormals();
mesh.RecalculateBounds();
this.GetComponent<MeshFilter>().mesh = mesh;

sentences:
How can I export a .FBX file from Unity3D at runtime? I want to export an object as a .fbx at runtime in Unity3D.

I've made a C# script to export a mesh filter or skinned mesh renderer to a .obj file at runtime, but I want the animation and skin support that only .fbx supports.

After some research, using the Autodesk FBX SDK or some other external .dll seems like my best option. How do I call Autodesk's FBX SDK at runtime? Is there another external .dlls I could use for this?

Another option could possibly be to write the mesh information as a text file, then convert to .fbx to export.

sentences: Hardcoding C++ shader interop code When writing code that interacts with multiple shaders, is it best practice to hard code the use of each effect? I wrote a couple of hard-coded loops and then noticed that I accidentally ended the pass of the wrong shader, and this has me concerned that instead, I should be writing some sort of Shader class that generically executes a shader. Is this the right way to go?

sentences:
Compiling Quake 3 in Snow Leopard First of all I have Xcode 4 installed in Mac OS X Snow Leopard 10.6.8. I have downloaded the Quake 3 source code 1.32b release but I can't open the Xcode project that is inside the /macosx folder since it is in the old .pbproj format and therefore it throws an "incompatible version" error. Has anyone been able to convert this to a Xcode format or is there any other way to compile the source code in Mac OS X Snow Leopard?

Thanks

sentences:
Get mouse/touch position for NGUI event Since I am using NGUI, to capture mouse events I use their methods such as

void OnPress (bool isDown) {

}

How can I check the mouse/touch position that corresponds to this particular OnPress event?

sentences: How do I make an endless road in Unity? Basically I created 2 quads side by side and I added a road texture. I used transform.translate so that the road moves, but I am trying to make the road endless by making the 2 quads reposition themselves in front of the current quads repeatedly so that when I add a player the road is endless. Any way I could do this?

sentences:
Angular velocity from 2D Collision I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear velocity and create a collision manifold containing the collision points relative to each of the 2 objects involved in to collisions centre of mass (0, 0) along with the overlap etc. I also know each objects mass, speed etc.
I have been looking for a couple weeks now at every equation I can find and non of them seem to work returning incredibly high numbers for normal collisions.
My current algorithm pulled from an article in the game development section on tuts+ (linked here) is like so:

objectArray[i].angularVelocity += objectArray[i].inverseMass * CrossProduct(collisionInfo.collisionPointB, impulse);
objectArray[ii].angularVelocity += objectArray[ii].inverseMass * CrossProduct(collisionInfo.collisionPointA, impulse);

Could someone please explain how I can calculate the change in angular velocity and give me some example values for the equations as mine are probably in the wrong scale or something.

Thank you for any help,
Andy A

Other things to note, this engine is written in C# for XNA so if there are any language specific optimisations they have to work with C#, thank you.

sentences:
HLSL equivilant to "Object" data from "Texture Coordinate" node in Blender I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the group it behaves like a normal unlit frag shader but if I use the "object" node to give coordinates to the texture, it ignores the uv data and just maps the texture like an image overlayed onto the object.

This is actually the effect I want. However, I can't find a way to replicate this in HLSL. As far as I can see I can use TEXCOORD0 and POSITION as texture coordinates to produce uv mapping and world mapping respectively for a texture onto an object. Maybe what I want is object mapping?

And if it matters I'm using a generated texture

sentences:
OpenGL textures look poor I'm having some issues loading in textures in OpenGL, as my textures keep rendering incorrectly or coming out looking muddy. For instance, here I tried to load a 256x256 color spectrum image. On the left is how it looks in OpenGL and on the right is how it looks in an image viewing program:

As you can see, while the left image resembles the right image, the left image appears to squish the blues, and greens, and extend the pinks.

I also tried loading in this 512x512 image of a dog and the result came out like this (again, left is OpenGL, right is image viewer):

For this image, the image looks like it has lost a lot of its color, resulting in something that looks white washed and like it came out of a 1970s camera. (the fact that is flipped is fine however since the cube that I am drawing this on has some texture coordinates flipped to accommodate for a different image).

I load in these .BMP textures using SOIL, as such:
    glEnable(GL_TEXTURE_2D);

GLuint texID = 0;
glGenTextures(1, &texID);

int height = 0, width = 0;
unsigned char* imgData = SOIL_load_image(filePath.c_str(), &width, &height, 0, SOIL_LOAD_AUTO);

glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, imgData);
// set texture filtering, gen mip map

Then in my fragment shader I do the following to apply the texture:

#version 330 core
in vec2 TexCoord;

uniform sampler2D textureSampler;

void main() {
    gl_FragColor = texture2D(textureSampler, TexCoord);
}

sentences:
Rendering only a part of the screen in high detail If graphics are rendered for a large viewing angle (e.g. a very large TV or a VR headset), the viewer can't actually focus on the entire image, just a part of it. (Actually, this is the case for regular sized screens as well.)

Combined with a way to track the viewer's eyes (which is mostly viable in VR I guess), you could theoretically exploit this and render the graphics away from the viewer's focus with progressively less details and resolution, gaining performance, without losing perceived quality.

Are there any techniques for this available or under development today?

sentences:
How can shader code duplication be reduced in Unity? In our current Unity project we have a few shaders that are basically just supersets of another shader. For example, we have a shader that performs lighting calculates with diffuse, normal, specular, and gloss maps, and a shader that performs lighting calculations with a diffuse, normal, specular, gloss, and glow map. The first is a subset of the second, but for performance reasons we've decided to separate them. This leaves us with heaps of duplicated code.

On top of this, I need to add stencil buffer operations to some of these materials, which is about 3 lines, but from what I can see, requires the entire shader file to be copied again.

How can we reduce this code duplication? In an object orientated language we'd used inheritence and polymorphism. What can we do here?

sentences:
Choosing frame rate in PyGame with keyboard input Using PyGame, I want to create a moving square which moves in a grid, controlled by keyboard presses of the arrows. So, pressing the "up" key moves the square to the cell directly upwards, pressing the "right" key moves the square to the cell directly to the right, etc.

In my loop, I use pygame.time.wait(x), to pause for x ms. However, choosing the correct value for x is proving difficult. If x is too large (e.g. 1000), then the square does not respond immediately, and I actually have to hold down the key to get it to move. But if x is too small (e.g. 10), then the square will move several times in a row whenever I press a key. But I just want the square to move once for every key press. How can I do this? Thanks!

Below is the important part of my code:

    x = 100
    current_pos = [0, 0]

    while True:

        pygame.event.pump()  # process event queue
        is_key_pressed = pygame.key.get_pressed()

        if is_key_pressed[pygame.K_UP]:
            current_pos[1] -= 1

        elif is_key_pressed[pygame.K_RIGHT]:
            current_pos[0] += 1

        elif is_key_pressed[pygame.K_DOWN]:
            current_pos[1] += 1

        elif is_key_pressed[pygame.K_LEFT]:
            current_pos[0] -= 1

        show_map(current_pos)

        pygame.time.wait(x)

sentences:
How can I support more than one resolution/language on WP7/8? I want that my Windows Phone game runs on the following three resolutions: 480x800, 768x1280 and 720x1280. And maybe later on 1920x1080.
But in the XAP file information, it's just written "Resolution(s) WVGA". What can I support more resolutions than just WVGA?
In addition, I want to support more than one language. At the moment, I can just choose English in the Dev Center menu, but I want to support French, Spanish and German too. How can I support French, Spanish and German? I don't know how to add these languages.
I uploaded my XAP file in the Dev Center and it gives me the following informations:

Select a XAP above to view or edit its Store listing and other info.
XAP version number  1.0.0.0
XAP details detected from file
File name WindowsPhoneGame2.xap
File size 167 KB
Supported OS 7.1, 8.0
Resolution(s) WVGA
Language(s) EnglishNorthAmerica
Capabilities ID_CAP_NETWORKING
XAP's Store listing info
A XAP file can contain multiple languages. Select a language to add Store listing info specific for that language.
English
Description for the Store:

sentences:
Follow Player which moves over a sphere After hours of googling and pulling several hairs out, I decided to open this thread.

I want to make a game, in which the player walks around a sphere (like super Mario galaxy) and the camera should stay fixed over the player and point down on its head but I can't seem to get anywhere near of the right method. So, how can I realise this?

Thanks.

sentences: what is the best way to code an online multiplayer game? so i want to create a simple game that runs over a network but I am having trouble deciding what needs to be done in terms of what the server needs to do and what the clients need to do. I understand I should use UDP sockets but I am unsure how to implement it within a game and have all the clients be in sync. Should the server side have like a master copy of the game where i basically runs the game and accepts moves, plays them in itself, and then sends the current state of the object to the other clients?

sentences:
What is the most serious limitation of Unity? Having read this heated question about Unity vs. UDK vs. ID something, I'm curious to know: what the repeatedly-hit, most crippling limitation(s) of Unity?

In order to keep this question non-subjective, again, I'm talking about the top repeated offender(s) of Unity are. This is something that, as a Unity user, you really wish someone had told you about before you started using it.

I have heard from someone that Unity does not deal well with version control, since it generates a lot of binary files (which are un-diffable). This, to me, is not really crippling as I work alone.

Thoughts?

sentences:
How can I compile a Direct3D 9 effect from a file? I started working with shaders recently in DirectX9. I noticed that there is a D3DXCompileShaderFromFile function for IDirect3DVertexShader9 and pixel shader. Which compiles the shader and gives you the compiled code so you can put that into a file and then read it.

But is there a way to do it with the ID3DXEffect or is IDirect3DVertexShader9 the only way?

sentences:
Mob generation design - is creating a class for each mob efficient? I'm working on an RPG game for my coursework project. Everything is going fine but I've reached a stage where I do think that my project's code is not the most efficient.

Here I have a constructor of my class AbstractMob

public AbstractMob (String name, int hp, int attack, int defense, int magicAttack,
                        int magicDefense, int expBound, int goldBound, String folder, String idleAtlas, String attackAtlas) {

        abilities = new ArrayList<>();
        //setting variables
        this.attack = attack; //and so on

        idleAnimation = new Animation<>(
                0.070f, new TextureAtlas(Gdx.files.internal(
                        "sprites\\mobs\\" + folder)).findRegions(idleAtlas),
                Animation.PlayMode.LOOP);

        attackAnimation = new Animation<>(
                0.070f, new TextureAtlas(Gdx.files.internal(
                        "sprites\\mobs\\"+ folder)).findRegions(attackAtlas),
                Animation.PlayMode.LOOP);
    }

And here is an example of a class that inherits AbstractMob

public class FireElemental extends AbstractMob {
    public FireElemental() {
        super("Fire Elemental",
                400,
                12,
                10,
                18,
                15,
                50,
                20,
                "fireElemental\\fire.atlas",
                "firesprite",
                "firesprite"
        );
        //from AbstrctMob, declares any abilities the mob has
        abilities.add(new Fire()); //same design pattern as these mob creations,
        //I have a separate class for Abilities, and subclasses such as Fire
        //that inherit from Abilities

        setAbilities(abilities);
    }
}

Now, my question is - does it make sense to create a multitude of separate classes (i.e make more classes like FireElemental for different mobs) for each entity (whether that be abilities or mobs) for this game? How about utilising files/scripts to load them?

Thank you so much!

sentences:
Do "write once run anywhere" engines require platform specific code for multiplayer? I've been investigating the myriad selection of mobile game dev engines that allow compilation of your code onto multiple target platforms, but, something I can't seem to figure out is if multi-platform "write it once" development is possible when you bring multiplayer into the equation.

I've looked at Unity and Monkey mostly, so far, but aside from seeing threads on the Monkey forum such as "I've developed such and such networking library for Monkey"... I can't find a definitive answer. That example is one of many that causes me concern.

Is it the case that if you used a cross platform engine, you'd have to write platform specific code for the networking portion of your game/app? (Even if the rest of the game did work on your target platforms with no/minimal platform-specific "jiggery".

I'm not talking about cross-platform multiplayer, but I do presume that'd be a happy by-product of a write-once-deploy-anywhere (within reason) networking solution.

sentences:
Swept 3d capsule intersection with AABB, what am I actually supposed to use to accomplish this? I'm trying to figure out how to do continuous collision with a capsule (which would represent a collision volume for a player for example).
Given how common the capsule is in many game engines, and the fact it is merely a circle swept along a line, I would assume that even just normal collision between it any boxes, triangles/arbitrary facets would be abundant, however I'm having a hard time finding anything on capsule collision.
Some how I guess I could figure out the swept volume/object intersection (box + 4 capsule collision detection), and binary search my way down to an approximate collision, but this seems far from ideal, especially given the simple shapes involved.  I feel given the shapes I should be able to intersect directly and receive the results.  I'm not sure how to figure out "where" something intersected along a swept series with other methods (like GJK).
For my case, I'm currently focused on just AABB collisions and vertically oriented swept 3D capsules, which I hope to resolve (move capsule appropriately back with AABB collision).

sentences:
Animating 2d character which can wear items? In my game the player can control a character which can wear items.
Now it is not visible but I would like to make it visible like for example in Terraria, Starbound, etc.

In my game a player can only face right or left. (right is the mirrored version of left) Only the character's feet and arms are moving during the game.

Is there a simple way in Unity to stick the sprite of the items to "bones"?
(like in 3d modelling)
Or how could I implement this "equipment on character" system?

I found some assets but I dont have much money.

Thanks in advance! :)

sentences:
How should I generate and store the boundries of a cave? I am making a small cave copter game (seriously, where did this type of game come from anyway) and I am trying to figure out how to make and store the procedural generated walls. I am thinking about creating the walls by randomly picking two points away from the center of the screen. They will be no closer than the height of helicopter and no further than the edge of the screen, weighted to prefer to go in the same direction as the point prior so I end up with stalactites and stalagmites and not just noise, at set intervals of distance. To store, perhaps parallel arrays/lists, one for distance from center to top screen and one for distance from center to bottom.

Am I way off base with my thinking? I just want the cave to be varied and challenging, I just have never worked with generating data like this.

Edit: Woah, I just realized that my idea would lead to a player being able to stay in the middle of the screen and win. That isn't right at all. So the very basis of how I was going to generate is wrong.

Edit 2: I also realized I left out a very crucial point. Part of the mechanics of the game will let the player go backwards therefor the data structure should be continuous.

sentences:
Implementing a 4x4 Game Board I struggle with efficiency in code, and I want to start my game off on the right foot.

I have a game that I'm making a 4 x 4 map of 'tiles' that a user can build their 'town' on.  To keep track of the tiles, I'm planning on simply having a size-16 array of the type of my 'mapTile' enum. EX:

enum MapTiles { defaultTile, homeBase, farm1, farm2 /*...and so on...*/ };
static MapTiles playerMap[] = MapTiles[16] { /* ... default map setup ... */ };

Is there a way that is more efficient or more easy-to-extend way to implement such a map?

I'm using Unity and C# mostly, though i'm willing to work with any Unity-capable language if you have a clever answer.

sentences:
Using one GLSL shader program for textured and untextured rendering? Rather than have two separate shaders in my OpenGL code (one for when a texture is bound, one for when none is bound) I usually go for one shader program which handles both.  This is my usual fragment shader:

#version 330

uniform bool textured;
uniform sampler2D sampler;

in vec4 fColor;
in vec2 tCoord;

out vec4 final_color;

void main()
{
    vec4 texel = vec4(1.0, 1.0, 1.0, 1.0);
    if (textured)
        texel = texture(sampler, tCoord);
    final_color = fColor * texel;
}

In a modern OpenGL profile, this compiled but did not output anything but black pixels (alternatively in LWJGL legacy profile, it outputted regular colors if textured == false and textured if textured == true).  I don't see any reason that this wouldn't work, but what is a method which would work for both textured and untextured fragments?

EDIT:

My Shader Class
My Main CPP File

sentences:
Can I reset the `[DisallowMultipleComponent]` attribute in child classes in Unity somehow? Can I reset the [DisallowMultipleComponent] attribute in child classes in Unity somehow?
I want to create my base class:
[DisallowMultipleComponent]
public class MyCompanyClass : Monobehaviour {}

I want all my component scripts to inherit from the MyCompanyClass. So, I will be able to add only one instance of my component script to a game object at a time. I need it for most of my classes. But for some classes I still want to preserve the ability to add a few class instances to a game object, while still inheriting from the MyCompanyClass (because I am going to put some custom behavior into it, which is going to be used by all my component scripts).
So, I was trying to search for something like [AllowMultipleComponent], but found nothing. Is there maybe another way to achieve what I want?

sentences:
Multiplayer matchmaking algorithm I'm building a game in which there are tournaments.
During the tournaments we want players to play against each other in an efficient way.

What I'm looking for is a generic algorithm that will match players together in an optimal way in order to:

Have the lowest amount of games possible
Be reasonably sure that after all games are played, the highest-ranked player is the best

Tricky part:

Games can have 2, 3 or 4 players in a death match depending on the tournament.
Tournaments have two or more players, no other constraints.

Does such an algorithm exist?

Note: For the ranking, I will probably be using an ELO-based algorithm (unless you have a better suggestion).

sentences:
Slopes vs. Rectangles: Different Collision Points My platformer has both rectangular tiles and right-triangle slopes with rectangular hitboxes. My sprites are also rectangular.

Collision with only rectangular tiles works well. Even if there are multiple rectangular tiles, collision still works pretty well.

Sprites can collide with individual slopes correctly as well, however, they collide at a different point. In order for the character's feet to be walking down the slope instead of hovering over it, the collision point for slopes is the bottom-center point. For rectangles, it is either corner.

The problem is moving from a rectangular tile onto a sloped one. The sprite resolves by the corners first, since it is resting atop a rectangular tile. However, the center point is resting above the slope, and the sprite will not move onto the slope until it is entirely moved off of the rectangular tile.

Here's a diagram:

How can I reliably use two different collision points for different tiles in a way that allows sprites to walk between rectangular and sloped tiles?

sentences:
Making read from and write to databases I want to make a few simple databases for a sports game using Unity2D(C#).

One is a read-only google sheet where it takes the players from the pool and adds them into the game at the start.

Another one is a read and write database  where all 30 team's players will be saved as well as current stats( a lot of numbers), I don't know if i should make this online or local saves. I want to keep the cost at a minimal.

Generally new to making databases, can someone point me in the right direction?

sentences:
How can I create my own sky maps? What are the methods/tools for generating realistic skies with clouds and atmospheric shading?

FOSS alternatives and spherical projections get extra points.

sentences:
Isometric tile map format I've just knocked up a fairly basic isometric tile based game and I'm looking for the best way to store the level data.

Each tile coordinate is assigned one or more numbers that correspond to a tile from the tile set. At the moment I have a small level set up in the code but I'm looking for a quicker way to populate a level with tiles and load them into the game.

I was thinking just making XML files would be the way to go and if that's the case any ideas on how I should write them?

sentences:
Dynamic Tilemap size changer I have started coding this project using the library SFML a few months ago.

I have implemented a random map generation everytime I load the game thanks to Biome and the Perlin noise Algorithm.

I wish i could increase the TileMap size on the border of the map according to the player position  (Chunk system in minecraft) .

I have managed to do it on the bottom and the right of the map :

But this isn't dynamic.
There is a snap of my code where i add a new "chunck" :

void TileMap::AddChunckToTileSet(sf::Vector2i PlayerTile, char * direction)
{
    int previousWidth = _width;
    int previousHeight = _height;

    _height = _height + 24;
    _width = _width + 24;
    m_vertices.resize(_width * _height * 4);

    int tileNumber = 384; // ToDO

    // on en déduit sa position dans la texture du tileset
    int tu = tileNumber % (m_tileset.getSize().x / _tileSize.x);
    int tv = tileNumber / (m_tileset.getSize().x / _tileSize.x);

    if (direction == "Down")
    {

        for (int i = previousWidth; i < _width; ++i)
        {
            for (int j = previousHeight; j < _height; ++j)
            {
                // on récupère un pointeur vers le quad à définir dans le tableau de vertex
                sf::Vertex* quad = &m_vertices[(i + j * _width) * 4];

                // on définit ses quatre coins
                quad[0].position = sf::Vector2f((i - previousWidth) + PlayerTile.x * _tileSize.x, j * _tileSize.y);
                quad[1].position = sf::Vector2f(((i - previousWidth) + PlayerTile.x + 1) * _tileSize.x, j * _tileSize.y);
                quad[2].position = sf::Vector2f(((i - previousWidth) + PlayerTile.x + 1) * _tileSize.x, (j + 1) * _tileSize.y);
                quad[3].position = sf::Vector2f((i - previousWidth) + PlayerTile.x * _tileSize.x, (j + 1) * _tileSize.y);

                // on définit ses quatre coordonnées de texture
                quad[0].texCoords = sf::Vector2f(tu * _tileSize.x, tv * _tileSize.y);
                quad[1].texCoords = sf::Vector2f((tu + 1) * _tileSize.x, tv * _tileSize.y);
                quad[2].texCoords = sf::Vector2f((tu + 1) * _tileSize.x, (tv + 1) * _tileSize.y);
                quad[3].texCoords = sf::Vector2f(tu * _tileSize.x, (tv + 1) * _tileSize.y);

            }
        }
    }
}

I call the function AddChunckToTileSet like this :

void TileMap::Update(sf::Vector2i PlayerTile)
{

    if (PlayerTile.y + 15 > _height)
    {
        // Increase map on Down according to our X
        printf("Add Chunck Down\n");
        AddChunckToTileSet(PlayerTile, "Down");
    }

}

Do you have any hints on how I could achieve this correctly ?

sentences:
How do I export Physique animations without breaking them? I've been trying to export a simple footstep animation that I made in 3ds Max, but it either fails to export or is broken (imports into unity missing a few frames, or appears to have imported but won't play) every single time.

I've tried .fbx and .3ds, but neither works. I'd rather not use the Skin modifier, because it would require starting from scratch and learning a new system. Any ideas?

sentences:
Screen space decals, converting world to decal space I'm trying to do screen space deferred decals following the presentation made by Pope Kim about SSDs in WH40K: Space Marine (link). I've gotten to the point where I can render a decal if the bounding box is placed at the world space origin (0, 0, 0). The moment I move the bounding volume the decal is still trying to render at the world space origin and can be seen if you look "through" the bounding volume. The red planes in the picture are the bounding volume rendered for reference, the circular patch is the decal.

Picture showing a decal rendered correctly at world space origin

Picture showing a decal clipped when rendered offset from world space origin

Decal as seen "through" offset bounding volume.

My code is fairly similar to that off Kim, with minor differences accounting for the D3D to OpenGL transition.

Vertex shader:

#version 430

layout (shared) uniform PerFrameBlock
{
    mat4 gView;
    mat4 gProjection;
};

uniform mat4 modelMatrix;
uniform vec3 decalSize;

layout ( location = 0 ) in vec4 positionIN;
layout ( location = 1 ) in vec4 normalIN;
layout ( location = 2 ) in vec4 tangentIN;
layout ( location = 3 ) in ivec4 boneIndices;
layout ( location = 4 ) in vec4 boneWeights;
layout ( location = 5 ) in vec2 uvIN;

out vec4 posFS;
out vec4 posW;
out vec2 uvFS;

void main()
{
    posW = modelMatrix * vec4(positionIN.xyz * 1, positionIN.w);
    //Move position to clip space
    posFS = gProjection * gView * posW;
    uvFS = uvIN;
    gl_Position = posFS;
}

Fragment shader:

#version 430
#extension GL_ARB_texture_rectangle : enable

in vec4 posFS;
in vec4 posW;
in vec2 uvFS;

uniform sampler2D gNormalDepth;
uniform sampler2D gDiffuse;

uniform float gGamma;

uniform mat4 invProjView;
uniform mat4 invModelMatrix;

vec4 reconstruct_pos(float z, vec2 uv_f)
{
    vec4 sPos = vec4(uv_f * 2.0 - 1.0, z, 1.0);
    sPos = invProjView * sPos;
    return vec4((sPos.xyz / sPos.w ), sPos.w);
}

layout ( location = 1 ) out vec4 diffuseRT;
layout ( location = 2 ) out vec4 specularRT;
layout ( location = 3 ) out vec4 glowMatIDRT;

void main()
{
    vec2 screenPosition = posFS.xy / posFS.w;

    vec2 depthUV = screenPosition * 0.5f + 0.5f;
    depthUV += vec2(0.5f / 1280.0f, 0.5f / 720.0f); //half pixel offset
    float depth = texture2D(gNormalDepth, depthUV).w;

    vec4 worldPos = reconstruct_pos(depth, depthUV);
    vec4 localPos = invModelMatrix * worldPos;

    float dist = 0.5f - abs(localPos.y);
    float dist2 = 0.5f - abs(localPos.x);

    if (dist > 0.0f && dist2 > 0)
    {
        vec2 uv = vec2(localPos.x, localPos.y) + 0.5f;
        vec4 diffuseColor = texture2D(gDiffuse, uv);
        diffuseRT = diffuseColor;
    }
    else
        diffuseRT = vec4(1.0f, 0, 0, 1);
}

I think my problem stems from the conversion from world space to decal space using the inverse model matrix. The model matrix is build by the following code:

        glm::quat rot;
glm::mat4 rotationMatrix;
glm::mat4 translationMatrix;
glm::mat4 scaleMatrix;

        rotationMatrix = glm::toMat4(rotation);
        translationMatrix = glm::translate(glm::mat4(1.0f), position);
        scaleMatrix = glm::scale(scaleX, scaleY, scaleZ);

       modelMatrix = translationMatrix * rotationMatrix * scaleMatrix;

To get the inverse I just use the following:

glm::inverse(modelMatrix)

What I'm wondering is if inverting the model matrix like this actually correct or am I doing something with it which would cause this kind of behaviour? I've tried offsetting the calculated local space position in the shader with no luck (probably because the distance gets borked) and I'm starting to run out of ideas.

Any help is much appreciated!

sentences:
Best practices for periodically saving game state to disk I'm working on an MMO. All of the player and environment data lives on a server and is kept in memory. There's a "world" object which keeps track of all of the maps, characters, etc. and their relations to each other.

To avoid data loss in case of a crash, I've been periodically serializing the world to disk. The trouble is, this object can be quite large, so when the server starts writing, there's noticeable in-game slowdown for a few seconds, which I'd like to avoid.

Any pointers on how to go about this in a more efficient way?

sentences:
Can't access core/assets in a Desktop-Only Libgdx Project I'm trying to use libgdx to set up a little quiz application for Desktop.

So I used the setup.jar to create a project and everything went fine (using Eclipse).

The problem is following:

Whenever I try to access the assets in core/assets, as you should do:
Gdx.files.internal(filePath)

I always get a NullPointerException:

java.io.FileNotFoundException: PATH\QuizApplication\desktop\questions.xml (The system cannot find the file specified)

My assets Folder in the desktop project is linked to the core project, and inside Eclipse, I can see the right contents. As you can see from the Exception, the application tries to read the desktop project instead of the core project.

In build.gradle in the desktop project, the link to the core assets folder is there too:

project.ext.assetsDir = new File("../core/assets");

Does anyone know how I might fix this problem, so that I can access the core/assets folder?

sentences:
What are the pros and cons of these voxel data file formats? .VXL
.VOX
.KVX
.KV6
.V3A
.V3B

I am trying to decide whether it's worth going with any of the above, or some other, or if I should roll my own. The deciding factors in order of importance are:

Animation support (I am aware this is a difficult aspect when it comes to voxels), using voxel deltas or numerical transform descriptions.
Simplicity (or at least a concise format)
Compression

From what I can tell, the Tiberian Sun VXL format is the only one which is designed for animation, but Ken Silverman of Voxelstein3D fame claimed that VXL does not support animation (in a single file, were his words). So I wonder if maybe there are not two different .VXL formats, since it seems an obvious choice of file extension for voxel data... could be from a medical imaging context.

I do need someone with solid experience of voxel formats to come and comment on the practical pros and cons, in their experience. Consider this question in the same way you might compare JPG to PNG to GIF.

sentences:
Can't change materials of model from FBX I was used 5.x before, and that version when I loaded FBX, Unity generated each material automatically, so I can change them like assigning textures or change shader.

And now I switched to 2017.3, and when I imported FBX, now Unity didn't generate materials anymore. I can see the properties of each material but every parameter is locked. It seems materials are inside of model and can't change like animation clips.

Some of model has multiple materials, so I can't generate manually and assign them. I'm creating mobile game so I really need to change the shader to mobile shader, not standard(PBR).

How to change materials of model from FBX in Unity 2017.3? Note that model created from Blender 2.7c and exported as FBX.

sentences:
Jitter during wall collisions with Bullet Physics: contact/penetration tolerance? I use the bullet physics engine through Panda3d.

My scene is still very simple, think 'Wolfenstein3d': tile-based, walls are solid cubes.

I expect walls to block the player, and I expect the player to slide along the walls in case of non-normal incidence.

What I get is what I expect, with one difference: there is some jitter.  If I try to force myself into the wall, then I see the frames blinking quickly between two positions.  These differ by about 0.04 units of distance, which corresponds to 4 cm in my game.

I noticed a 4 cm elsewhere: the bottom of my player capsule is 4 cm below ground, when at rest.

Does that mean that there is somewhere in the Bullet engine a default 0.04-units-long tolerance to differentiate contact from collision?  If so, what should I do ?  Should I change the scale of my game so that these 0.04 units correspond to 0.4 cm, making the jitter ten times smaller?  Or can I ask bullet to change its tolerance to a smaller value?

Edit

This is the jitter I get: 6.155 - 6.118 = 0.036

LPoint3f(0, 6.11694, 0.835)
LPoint3f(0, 6.15499, 0.835)
LPoint3f(0, 6.11802, 0.835)
LPoint3f(0, 6.15545, 0.835)
LPoint3f(0, 6.11817, 0.835)
LPoint3f(0, 6.15726, 0.835)
LPoint3f(0, 6.11876, 0.835)
LPoint3f(0, 6.15911, 0.835)
LPoint3f(0, 6.11937, 0.835)

I found a setMargin method.  I set it to 5 mm both on the BoxShape for the walls and on the Capsule shape for the player.  It still jitters by about 35 mm as illustrated by this log (11.117 - 11.082 = 0.035):

LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1169, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1175, 0.905)
LPoint3f(0, 11.0822, 0.905)
LPoint3f(0, 11.1178, 0.905)
LPoint3f(0, 11.0823, 0.905)
LPoint3f(0, 11.1183, 0.905)

The margin on the capsule did change my penetration with the floor though, I'm a bit higher (0.905 instead of 0.835).  However, it did not change anything when colliding with the walls.

How can I make the collisions against the walls less jittery?

Edit, the day after:

After more investigation, it appears that dynamic objects behave well.  My problem comes from the btKinematicCharacterController that I use for moving my character; that stuff is totally bugged, according to the whole Internet :/.

sentences:
Box2D fixed timestep updating is twitchy on constant FPS I'm messing around with libgdx and box2d and I'm trying to implement sidescroller movement with fixed timestep logic according to the famous Fix Your Timestep! tutorial/guide. However, logic updating seems to be twitchy and I'm not exactly sure why.

Here's the render method where the issue lies:

public void render() {
    handleCameraInput();
    handleTestBodyInputImpulse();
  //handleTestBodyInputVelocity();

    accumulator += Math.min(Gdx.graphics.getDeltaTime(), STEP);

    int logicStepCount = 0;
    while (accumulator >= STEP) {
        world.step(STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
        accumulator -= STEP;
        ++logicStepCount;
    }

    Gdx.graphics.setTitle("FPS: " + Gdx.graphics.getFramesPerSecond() + ", Logic steps: " + logicStepCount + ", Test body vel: " + testBody.getLinearVelocity());

    cam.update(); // update box2d world camera
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.render(world, cam.combined); // renders box2d bodies
}

From what I've noticed the logic while loop responsible for updating the physics sometimes doesn't execute (counter goes from 1 to 0 for one frame) and that seems to be causing the twitching. This is weird to me since delta time added to the accumulator is clamped and since the FPS is constant 60 on my machine I'd assume that the loop should always execute once. Am I doing something wrong? Is this behavior normal and is it something I am supposed to solve during rendering with interpolation?

Complete minimal example can be found here on Gist and can be run on any LibGdx project with Box2d dependency.

sentences: How do you lock the camera down in ZBrush? I'm trying to sculpt a tileable mesh on a flatplane and I keep inadvertently moving the camera when I go off canvas. Is there a way to lock the camera in place?

sentences:
Shadowmap first phase and shaders I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps.
I have a framebuffer with a depth attachment and a cube map texture.

My question is how to design the shaders for the first pass, when creating the shadowmap.

This is my vertex shader:

in vec3 position;

uniform mat4 lightWVP;

void main()
{
    gl_Position = lightWVP * vec4(position, 1.0);
}

Now, do I even need a fragment shader in this shader pass? from what I understand after reading http://www.opengl.org/wiki/Fragment_Shader, by default gl_FragCoord.z is written to the currently attached depth component (to which my cubemap texture is bound to).

Thus I shouldnt even need a fragment shader for this pass and from what I understand, there is no other work to do in the fragment shader other than writing this value.

Is this correct?

sentences:
License for a casino game with virtual money (chips) Do I need a specific license for operating a casino game (lets say poker Hold'em or video slots) that players are supposed to play with virtual money (chips) only? I am speaking about games like Zynga poker, Poker Deluxe, Slotomania and the hundreds other similar games on iTunes or Google Play. Players start with a certain amount of chips and if they run out they can rebuy a bundle of coins to keep playing. The users may not exchange those collected virtual funds (chips) for products or services, or cash out for real money, but just keep on playing for a fun.

Do I need any license for operating such a game?

sentences:
CW/CCW Rotation of a Vector Considering that I have a vector A, and after an arbitrary rotation I get vector B. I want to use this rotation operation in others vectors as well, but I'm having problems in doing that.

My idea do that is to calculate the perpendicular vector C of the plane AB (by calculating AxB). This vector C is the axis that I'll need to rotate. To discover the angle I used the dot product between A and B, the acos of the dot product will return the lowest angle between A and B, the angle ang. The rotation I need to do is then:
-rotate *ang*º around the C axis.

The problem is that I dont know if this rotation is a CW or CCW rotation, since the cos of the dot product does not give me information of the sign of the angle. There's a tip discover that in 2D ( A.x * B.y - A.y * B.x) that you can use to discover if the vector A is at left/right of vector B. But I dont know how to do this in 3D space. Can anyone help me?

sentences:
Unity Giving following error : NullReferenceException: Object reference not set to an instance of an object im going to probably look really stupid and i will be no means admit this is my code however i cant seems to get it to work so i was wondering you you might be able to?

I'm getting the following error when trying to break a block with the left click button in unity:
"NullReferenceException: Object reference not set to an instance of an object
Player.Update () (at Assets/Scripts/Player.cs:67)"

the code that is causing the error is below:

if (Input.GetMouseButtonDown(0))
        {
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(mousePos, Vector2.zero);
            if (hit.collider.gameObject != null)
            {
                Destroy(hit.collider.gameObject);
            }
            else
            {
                Debug.Log("hit nothing");
            }
        }

i've searched around for other ways to do this and after many itterations i cant seem to get it working still so i have come to the forms.

Sorry line 67 is: Camera.main.ScreenToWorldPoint(Input.mousePosition);

i know it looks simular to other questions however i have looked at the link that was attached to this being a duplicate and i cant see anything in there that will help me so i am still stuck with the same issue.

sentences:
Simple cartoon water shader shoreline I'm currently attempting to create a cartoon-ish water shader with a shoreline. After looking around trying to find out how other games do it i figured out it has something to do with getting the distance from the depth map (which doesn't include the water when it's render queue is set to transparent) and the and the world position of the current pixel.

From certain angles i'm actually getting very close to the desired result as show here:

The topmost island almost has the desired result, but as you can tell, the closer it gets to the camera, the more out of place the effect becomes.

here's a zoomed out top down view illustrating the problem

as per request, here's what the terrain looks like beneath the water surface (animated gif)

and of course, here is my shader code:

Shader "Custom/CartoonWater" {
 Properties {
     _Color ("Color", Color) = (1,1,1,1)
     _Glossiness("Smoothness", Range(0,1)) = 0.5
     _ShoreFade("Shoreline Distance", Float) = 1
 }
 SubShader {
         Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
     LOD 200

     CGPROGRAM
     // Physically based Standard lighting model, and enable shadows on all light types
     #pragma surface surf StandardSpecular

     // Use shader model 3.0 target, to get nicer looking lighting
     #pragma target 3.0

     sampler2D _CameraDepthTexture;

     struct Input {
         float3 worldPos;
         float4 screenPos;
     };

     half _Glossiness;
     fixed4 _Color;
     float _ShoreFade;

     void surf (Input IN, inout SurfaceOutputStandardSpecular o) {

         o.Albedo = _Color.rgb;
         o.Smoothness = _Glossiness;

         fixed4 depth = tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(IN.screenPos));

         o.Albedo = _Color;
         if (distance(LinearEyeDepth(depth), distance(_WorldSpaceCameraPos, IN.worldPos)) < _ShoreFade) {
             o.Albedo = fixed4(1, 1, 1, 1);
         }

     }
     ENDCG
 }
 FallBack "Diffuse"
 }

any help is greatly appreciated :) thanks in advance.

sentences:
How should I replan A*? I've got a pathfinding boss enemy that seeks the player using the A* algorithm.  It's a pretty complex environment, and I'm doing it in Flash, so the search can get a bit slow when it's searching over long distances.  If the player was stationary, I could just search once, but at the moment I'm searching every frame.  This takes long enough that my framerate is suffering.

What's the usual solution to this?  Is there a way to "replan" A* without redoing the entire search?  Should I just search a little less often (every half-second or second) and accept that there will be a little inaccuracy in the path?

sentences:
Create and use a Button class on AS3.0 I am currently working on a game and it is all going well.
On the shop screen there are several buttons that affect the player's stats for when the player restarts the game.

The button's names (with a text on the left), however, are rather cryptic and it's hard to figure out what they do unless you test or something.

So the solution I came up with, is to create an InfoBox with an InfoText inside so that when the cursor is over the button it appears with the description, cost and etc.

This I managed to do too however, the way I was about to do it would mean that I had to create 3 event listeners per button (CLICK, ROLL_OVER, ROLL_OUT) and, obviously, 3 functions connected to each event listener.

Now, I don't mind much about having 1 event listener per button, for the click, but since the other events are just to make a box appear and disappear as well as display some text, I thought it was way too much of a mess of code.

What I tried to do: I created a new class called InfoBoxButton, and this is the class' code:
    package  {

import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.events.MouseEvent;

public class InfoBoxButton extends SimpleButton
{
    public var description:String;
    public var infoBox:InfoBox;

    public function InfoBoxButton(description)
    {
        this.addEventListener( MouseEvent.ROLL_OVER, displayInfoText, false, 0, true);
        this.addEventListener( MouseEvent.ROLL_OUT, hideInfoText, false, 0, true);
    }

    private function displayInfoText()
    {
        infoBox.infoText.text = description;
        infoBox.visible = true;
    }

    private function hideInfoText()
    {
        infoBox.infoText.text = "";
        infoBox.visible = false;
    }
}

}

But now I don't have an idea how to associate it with the button, I have tried this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

The SoonButton is a button I made on the shopscreen, SoonButton is it's instance name, but I can't think of a way of associating one button to the other... I have been fiddling with the code for like 3 hours yesterday and no luck... can anyone give me some pointers on how I should go about doing it?

--EDIT--

I tried to trace the SoonButton after it is created like this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

and I got an error saying:
    1120: Access of undefined property SoonButton.

if I separeted the first line a bit to:
    public var SoonButton:InfoBoxButton;
    SoonButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

I would get the same error but two times, for each SoonButton... so clearly it must be the InfoBoxButton that isn't being created... what am I missing?

sentences:
How can I render a 2D image to my screen using Direct X 11? I am trying to render an image to my window using Direct X but I don't really want a "3D" world as such, and I don't really want to set up all the vertex/index buffers as I won't need them. I am performing all of my calculations and operations using compute shaders which returns me an image. As the file io is quite a bottleneck, I am looking to just render the image directly to the screen to increase performance. My question is, how would I go about this using Direct X 11? I have looked at some examples already such as rastertek and other questions on SO but they are either over-complicating the matter, or they want a solution to font drawing etc.

At the moment I am able to produce a blank screen using the following code and the screen size is the size of the image retrieved from the GPU. I am looking to draw this entire image to my back buffer or some render target, and then display it.

void Application::Draw()
{
    float ClearColor[4] = { 0.5f, 0.125f, 0.3f, 1.0f };
    context->ClearRenderTargetView(_pRenderTargetView, ClearColor);

    // compute shader operations, retrieve image data from gpu
    // draw image to back buffer/render target then present

    swapChain->Present(0, 0);
}

From Why can't I write to my render targets?, I have tried the solution using

ID3D11Resource * backBufferResource;
_pRenderTargetView->GetResource(&backBufferResource);//backbuffer render target
context->CopyResource(backBufferResource, gpuResource);

This doesn't seem to throw any errors, but it doesn't change the output on the screen. It is mentioned that the back buffer must be the exact same format as the image we're trying to copy to it so this may be the issue. My swap chain desc is as follows

DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory(&sd, sizeof(sd));
sd.BufferCount = 1;
sd.BufferDesc.Width = _WindowWidth;
sd.BufferDesc.Height = _WindowHeight;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;//FORMAT DIFFERENT
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = _hWnd;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;

and my image format is

DXGI_FORMAT_R32G32B32A32_FLOAT

If I try to change the swap chain format it throws a memory access violation.

sentences:
Components in a client/server network game? Behavior and logic are executed on the server.  The clients are mostly for rendering, audio, and gathering input.

It looks as though most of the a components architecture benefits are only realized on the server.

Is it still beneficial to design the client with an component based architecture?  Or is there a different approach that better fits a client.

sentences:
How can I make item interactable for action? In this script when there is a detection I'm setting the flag detect to true and using in with other scripts. And using the clickForDescription flag and OnGui to display text description for each interactable item if there is a text for it.

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public bool interactableObject = false;
    public Transform parentToSearch;
    public static bool detected = false;

    private RaycastHit whatObjectHit;
    private bool clickForDescription = false;
    private bool clickForAction = false;
    private int layerMask = 1 << 8;

    private void Start()
    {

    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            clickForDescription = true;
            clickForAction = true;
        }

        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee, layerMask))
        {
            detected = true;
            objectHit = whatObjectHit.collider.gameObject.name;
            interactableObject = true;
            print("Hit ! " + whatObjectHit.collider.gameObject.name);
        }
        else
        {
            detected = false;
            clickForDescription = false;
            print("Not Hit !");
        }
    }

    private void OnGUI()
    {
        if (clickForDescription == true)
        {
            ProcessOnGUI(parentToSearch);
        }
    }

    void ProcessOnGUI(Transform parent, int level = 0)
    {
        foreach (Transform child in parent)
        {
            if (child.GetComponent<ItemInformation>() != null)
            {
                ItemInformation iteminformation = child.GetComponent<ItemInformation>();
                if (child.name == objectHit)
                {
                    var centeredStyle = GUI.skin.GetStyle("Label");
                    centeredStyle.alignment = TextAnchor.UpperCenter;
                    GUI.Box(new Rect(
                          Screen.width / 2 - 50 + 20 * level, // <== INDENTATION
                          Screen.height / 2 - 25, 100, 50),
                        iteminformation.description, centeredStyle);
                }
            }

            // Process next deeper level
            ProcessOnGUI(child, level + 1);
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

This is the ItemInformation:

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

public class ItemInformation : MonoBehaviour
{
    [TextArea]
    public string description;
}

Once object is tagged for Interactable and the ItemInformation is attached to it it will display some description for the item.

Now I want to do something for action. For example if the item is Interactable and a script name ItemAction is attached to it do some action, For example move the object from side to side or rotate the object. The logic should be like the Information. It's just with the Action there might be many options then just displaying text.

I'm not sure how to make some logic and how to work with the ItemAction.

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

public class ItemAction : MonoBehaviour
{

}

sentences:
Which technique should I use to create procedurally generated planets I am working on a personal project to create a game, in which you can fly in space to various planets and land on said planets.
I was originally using a script to create an IcoSphere which I stored using recursive chunks which worked as a LOD.
The results looked good from space, however, after creating a player on the planet, the triangles were still very large. The IcoSphere was only subdivided 5 or 6 times due to the lengthy processing times.
I was going to base the texturing of the magnitude of the point on the sphere taking into account various factors.
Is there a better method to generate planets without these processing times?
EDIT
I am only interested in generating the planet surface, not the positioning in the galaxy/universe
I have done research online into different techniques. I've seen people using cube spheres however that looked to have caused a lot of distortion around the corners. I've also seen Octohedrons which were subdivided but I think that'd give the same problems as my icosphere technique

sentences:
OnMouseClick not detected I created "main script" and in Start() created simple cube:

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3 (1,2,1);
cube.GetComponent<Renderer>().material.color = new Color(0,0,255);
cube.AddComponent<CubeScript>();

and then in CubeScript I have empty Start() and Update() but in onMouseDown() just Debug.Log("click detected");

and I can never see log despite clicking on cube.. Any advice? did I missed something?

sentences:
Ground for 2D AndEngine game with physics I am using AndEngine to create a 2D Game for Android platform using Java and AndEngine.

I have learned how to use Tiled editor to create tiled maps. The only problem I am having is that I don't know how to place an object such as a character on the ground, and have it count as the ground.

How do I go about doing this or what is the best way to do this?

sentences:
Complex, yet simple crafting system model I'm working on some arcade shooter/slasher, and the main logline is "Kick'em with everything you want". There's not so many enemies in GDD, main focus is on tons of weapons and gadgets to cause mayhem.
To get weapon, you need to craft it, and now crafting system looks simple, like:

1) You got three slots for weapon parts (like A, B, C)
2) You collect misc weapon parts, and when you got atleast one for every slot, you can craft a weapon (for example, if you got A1, B1, B2, B3 and C1, you can craft such models - A1B1C1, A1B2C1, A1B3C1)

As for me, this crafting system is too simple, because weapon parts will just fall from the top of screen, often enough. That's why I'm thinking about adding some more crafting system levels, like resources (collect 10 scrap pieces to make part A1 or C3), etc.

My question is:
How can i add some more complex, still simple, transparent levels in crafting system?

upd. For example, in Minecraft or Terraria, first 5-10 crafting recipies quite transparent and simple IMHO. But then it turns into huge mess to understand, how to craft this or that (for example, fishing rod)

upd. Okay, somehow i've figured out mechanics like this:
1) Player gather resources (while playing game, automatic gathering from loot)
2) When there's enough resources to craft some weapon part, dedicated icon flashes, so player can craft weapon part in one click (automatic crafting)
3) Having several weapon parts, player can adjust different parts to create weapon (manual crafting)

I think, this will be complex and simple enough, now over-weighted by to many buttons and receipes, still, enough of freedom and manual creativity, trying to mix this and that.

sentences:
Transformation movement by using Accelerometer data Is It possible to make transformation movement by using Accelerometer data or Accel + Gyro ?
as we know, we can make rotation by using Accel or Gyro data.
However, how can we make transformation movement?
I know this is still problematic and experimental. but there must be some ways to reach.

Is there any algorithm or math formula solving this problem?

sentences:
how do I make an enemy target an ally unit? I have 2 different classes, a EnemyFighter class, and a EnemyBomber class. both are planes that I have that can fly around the map.( i also have AllyFighter, and AllyBomber)

So far they can follow me, and eachother, but how would I set up a target variable or something?

like I could set up a target variable for the enemyfighter

AllyFighter target;

and a variable holding the location of the allyfighter as a Vector2.

but then what if I want to target an AllyBomber? do I have to make 2 variables? or is there some other approach I should take?

Thanks

EDIT:
Maybe a better question would be how can I target different enemy types (ones with different classes)? or at least hold there information in a 'target' variable

sentences: Textures not working on glTF Embedded Models. Picture Explains The Issue. (GODOT ENGINE) I wanted the tree to look a bit more stylized, or have a bit more to it than just flat planes. Yet when I tried to put this texture on it, it just looks completely wrong. Is this a model issue or a mapping issue?

sentences:
Triangle data structure not working for LoD algorithm I would like to implement a LoD algorithm to my 3D game in order to simplify meshes at certain distances from the player. My meshes are created / loaded using a VBO, so the vertex data is stored in a very large float array as

float[] vertices = {x1, y1, z1, x2, y2, z2, x3, y3, z3 ... xn, yn, zn};

How would I use this data in something like edge colapse? Would I need to convert this data into a more usable data structure such as a list of faces, or would it be possible to use this directly?

I feel like it would be very difficult to use the vertex array directly, so I have a simple class to represent a triangle using a Vector3f for each vertex, and an Edge class for each edge. The data structure for these are pretty simple, I dont feel that I need to show the whole code, so just a simple overview:

The Triangle class stores

3 Vector3fs to represent each vertex
3 Edges to represent each edge
an equals and hashcode implementation to be able to compare

And the Edge class stores

2 Vector3fs to represent each vertex
a float representing the length of the edge: abs(magnitude(subtract(v1, v2)))
an equals and hashCode implementation to be comparable

I have a method to convert the vertex array into a list of triangles, but it isn't working properly.

public static List<Triangle> vertexArrayToTriangles(float[] vertices, int[] indices)
{
    List<Triangle> result = new ArrayList();
    Vector3f[] vertexList = new Vector3f[vertices.length / 3];

    for (int i = 0; i < vertices.length / 3; i++)
    {
        vertexList[indices[i]] = new Vector3f(vertices[i], vertices[i + 1], vertices[i + 2]);
    }

    int i = 0;

    while (i < vertexList.length / 3)
    {
        result.add(new Triangle(vertexList[indices[++i]], vertexList[indices[++i]], vertexList[indices[++i]], new Vector3f(0, 1, 0)));
    }

    return result;
}

This just makes a spiky jumbled mess of triangles that is extremely laggy to render. Also, during rendering, the triangles are converted back into a float array of vertices.

How would I convert the vertex array into a List<Triangle> and keep the indices in order?

sentences:
How to make camera rotation independent from frame rate? I multiply the mouse movement by a given number to get camera rotation of a desired speed. But it only works at 60 FPS. When I don't limit the frame rate I get around 350 FPS and the camera rotation is significantly too slow.

In my calculation, I already consider the frame time.

rotateCamera(ivec2 deltaMouse, float deltaTime, float sensitivity)
{
    // apply multipliers
    deltaMouse *= deltaTime;
    deltaMouse *= sensitivity;

    // rotate camera by deltaMouse
    // ...
}

Is this approach wrong? Why isn't the mouse movement independent from the frame rate in my code? How to achieve that?

sentences:
What technique would I use to animate a 2D curling tentacle? I have played around in Cocos2D-X and I think I understand the limitations of sprite-based animation fairly well.

I want to have a game with some characters curling and extending a tentacle which varies in length and amount of curl depending on the terrain.

Maybe imagine a sloth swinging from a tree but with arms that stretch at times (Gumby character?).

Is there a name for such a technique?

Would this be a variant on Animating Bezier Curves as seen in Jason Davies's example or discussed in this blog on tweening control points?

I'm a very experienced polyglot programmer but relatively naive in games and graphics.

sentences:
How can I consistently map mouse movements to camera rotation? I am writing a OpenGL game engine and also an editor for the engine. In my editor, I can import 3D models from FBX/Collada as a scene graph. Now I want to implement the option for the user to rotate and the camera in the viewport using mouse.

I found many links to rotate the camera by some angle based on the delta x and delta y of the mouse. This is fine. But my problem is selecting the axis for rotation.

For example, if the user moves the mouse in the x axis, I am changing the camera's local rotation angle along y axis (the up axis). But this is not always working. In case if the camera node's parent node is rotated 90 degree in the x axis, when I change the camera's local y axis rotation angle, the scene is rotating in wrong direction. So in this case I have to rotate the camera's z axis angle.

This is my problem. So how can I ensure the camera always finally rotate left and right (whatever the parent nodes' angles are rotated) when the user moves the mouse horizontally?

Also I want to mention that when the user moves mouse up and down, I want the camera to rotate up and down always.

sentences:
Finding direction of travel in a world with wrapped edges I need to find the shortest distance direction from one point in my 2D world to another point where the edges are wrapped (like asteroids etc). I know how to find the shortest distance but am struggling  to find which direction it's in.

The shortest distance is given by:

int rows = MapY;
int cols = MapX;

int d1 = abs(S.Y - T.Y);
int d2 = abs(S.X - T.X);
int dr = min(d1, rows-d1);
int dc = min(d2, cols-d2);

double dist = sqrt((double)(dr*dr + dc*dc));

Example of the world

                   :
                   :  T
                   :
    :--------------:---------
    :              :
    :           S  :
    :              :
    :              :
    :  T           :
    :              :
    :--------------:

In the diagram the edges are shown with : and -. I've shown a wrapped repeat of the world at the top right too. I want to find the direction in degrees from S to T. So the shortest distance is to the top right repeat of T. but how do I calculate the direction in degreed from S to the repeated T in the top right?

I know the positions of both S and T but I suppose I need to find the position of the repeated T however there more than 1.

The worlds coordinates system starts at 0,0 at the top left and 0 degrees for the direction could start at West.

It seems like this shouldn’t be too hard but I haven’t been able to work out a solution. I hope somone can help? Any websites would be appreciated.

sentences:
How to animate a character from a sprite sheet? I'm making an online game, and I had been using a blank square as the character until recently. Now I want to add a real, animated character.

I downloaded a free sprite sheet which has 12 (3x4) character sprites.

What is the general method to animate the character?

I see why having all the character animations in one file can be useful, but I don't understand how it would be done. I don't want code or anything, I just want to know how you normally use the sprite sheet to animate a character so I code it afterwards.

sentences:
How to go about implementing pathfinding in Unity with Tiled2Unity map prefabs? I have created a map using Tiled application and have added collision boxes and used Tiled2Unity to import the map to Unity. The collisions are working with key inputs.

I want to implement pathfinding in my 2D tile game.

I have studied and written a A * pathfinding code with 2D array in C#, which is working. But with the map import I have no way to iterate through the tiles.

How to go about implementing pathfinding?

sentences: How to make ghosts AI chase Pac-Man in Java I'm beginner at Java and I want to make ghosts chase Pac-Man in game. I read some algorithm like A* or Dijkstra but I don't know how to implement them in my game. Please help me.

sentences:
SDL, SFML, OpenGL, or just move to Java I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!

sentences:
Rendering a Voxelized Mesh I've been reading many papers about how to voxelize meshes using different GPU techniques, but I've ran into a problem that I'm not sure how to solve properly.  I understand the process of how to convert a 3D mesh into voxels stored in a 3D texture, but I don't know a very efficient way to display the voxelized mesh after this.  Many of the papers I have read gloss over this part.

The one way I can think of accomplishing this is to draw an instanced cube, one for each voxel.  Each instanced cube would have texture coordinates that correspond to it's location in the 3D texture.  Every instanced cube would also go through a geometry shader.  If the texture's entry at the current coordinates was 0 (empty voxel), then the geometry shader simply wouldn't output any triangles.

Is this an efficient method/good idea?

sentences:
Room lighting in Unity I am trying to make a plain white room in Unity. I used six planes for the walls, but I can't figure out how to get the lighting to not look so harsh and uneven. The top picture is my best attempt using two directional lights, and the bottom picture is the look that I am trying to replicate. It is from a demo scene in the Google VR SDK 1.50 for Unity. It uses only a single point light, but when I turn it off in the scene view, it doesn't change the appearance of the room at all. How can I make my room look more like the Google VR demo?

EDIT: I made a big improvement by changing all my walls to be static so that they receive indirect lighting, and adding a single point light above the roof.

sentences:
Bartle taxonomy formula Anyone knows the formula inside the Bartle Test of players taxonomy?

I need to do the test, but I need the weight of each question to make something more accurate and trustworthy to the real test...

Some links to the online test:

http://matthewbarr.co.uk/bartle/
http://4you2learn.com/bartle/

sentences:
Manual response when 2 shapes made of rectangular volumes collide I have 2 compound objects made of rectangular blocks. One of them (the one that is moving) has a script that listens to OnTrigger callbacks. What I need is to position the moving compound object on the first compound object to make then not collide but stay in contact.

As an example you can thing of two "spheres" made of blocks. Both spheres are on the floor. Then I move one of the spheres (still on the floor) and I detect that it collides the other sphere, so, I need to push the moving sphere up to make it not collide with the first one but stay in contact.

I have a manual algorithm that make tests on the different blocks of the two groups to push it up enough to make them not collide but it is a bit intensive. Do anybody know if unity physic engine can help here? The main problem is that after I receive the collision I can not move the moving sphere up and recheck manually first of all because there's no Check for rectangles and on the other hand if I want to be notified by the physical engine after I move the moving sphere up (to see if it still collides)I need to wait a new frame which is not feasible in my case.

P.S. I'm using unity engine.

sentences:
How to use Input.GetAxis("Mouse X/Y") to rotate the camera? I want to make a first person camera that rotates with the mouse.

I looked at the Input.GetAxis Scripting API page and found a sample code, which I have included at the bottom of my post. Upon trying it out, I realized that although it has the same basic functionality I hoped it would have, it does not keep the camera parallel to the xz plane, particularly when moving the mouse in circles. After a while the camera would be at an odd angle, and the player would be completely discombobulated!

Is there a quick fix to this code that would restrict the camera movement somehow, or is there a better way to rotate the camera?

 using UnityEngine;
 using System.Collections;

     public class ExampleClass : MonoBehaviour {
         public float horizontalSpeed = 2.0F;
         public float verticalSpeed = 2.0F;
         void Update() {
             float h = horizontalSpeed * Input.GetAxis("Mouse X");
             float v = verticalSpeed * Input.GetAxis("Mouse Y");
             transform.Rotate(v, h, 0);
         }
     }

sentences:
Unity Ads. Is the Ad.show placementId parameter used anymore? I started a project a long time ago with the Unity ad api v1, now that they have moved onto Advert api v2 i'm wondering if they still use the placementId parameter.

I'm only wondering this because they used to support video and image based Ads. As far as I know they only do video now. They used to have examples similar to this:

Advertisement.Show("rewardedVideo", options);

Which specified which of the supported advert types you want, rewardedVideo for video and rewardedImage (or something similar) for images.

With the loss of images and the integration guide (behind the login screen) having been changed does the palcementId parameter still matter since I noticed that you can pass in only the callback stuff?

sentences: Gameobject with Canvas child (Unwanted inspector behavior) When I try to focus (by double clicking or pressing f) on gameobjects in my scene which have a Canvas as a child, the scene view zooms out to show the Canvas. I would like to be able to see the gameobjects themselves when focusing on them. Is there a way to do this?

sentences:
How to debug Direct3D resource leak? When I close my application, I get the following errors in the Direct3D Debug output:

Direct3D9: (INFO) :MemFini!
Direct3D9: (ERROR) :Memory still allocated!  Alloc count = 20
Direct3D9: (ERROR) :Current Process (pid) = 0000162c
Direct3D9: (ERROR) :Memory Address: 05fb7d0c lAllocID=50 dwSize=000170d8, ReturnAddr=0615e508 (pid=0000162c)
Direct3D9: (ERROR) :Memory Address: 08c86594 lAllocID=1046 dwSize=00004bc4, ReturnAddr=0614d5ea (pid=0000162c)
(...)
Direct3D9: (ERROR) :Memory Address: 08d0c31c lAllocID=1471 dwSize=00001a40, ReturnAddr=0615e784 (pid=0000162c)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 258932 bytes

I've carefully looked over my code and the one thing I found suspect was a texture and a surface I got from the texture. I realised that surface->Release() wasn't returning 0, which means, I believe, that someone else still has a reference to it. So just to try something, I released it several times in a while loop until it returned 0. Direct3D then returned the following error:

Direct3D9: (ERROR) :A level of a mip-map has been released more often than it has been add-ref'ed! Danger!!

I don't get it. That surface is somehow referenced more than once but hasn't been "add-refed" more than once? How can I debug who is holding a reference to it?

Thanks.

sentences:
Managing left and right direction buttons being pressed at the same time I am currently programming a Tetris clone. In Tetris, there is a system being used called DAS, or Delayed Auto Shift. It works similarly to the keyboard auto-repeat used in Windows. For example, if you press left, the block immediately jumps one Column to the left. Then a certain amount of time goes by till it jumps a second time, and the following jumps move at a constant rate. I have this implemented as moveHorizontal(boolean moveRight), and can call it with a boolean that determines the direction the movement is going in.

However my main problem is handling the left and right direction buttons at the same time. More specifically, the state where you hold down one button, while pressing another button. The more recently pressed button should overwrite the old one, and the DAS should be reset once it switches directions. I feel like I can't really get a grasp on how to implement this kind of logic.

How do I logically change the state so as to correctly respond to the user input as I have described?

I hope I explained the problem in enough detail. If I didn't, please let me know, so I can provide more information.

sentences:
Copyright infringement in game title I'm a wanna-be indie developer, and I am working on my first flash game. But, before I even start with the code, I want to know this: When determining the title of my game, how can I decide if it is copyrighted or not?

For example, at first I thought about "Into the Void" for the title. When I Googled it, I found out that it is a name of a song by Black Sabbath. Is it okay if I use this title, or is it copyright infringement?

sentences:
Unity + Kinect - Current, and active wrapper options? What are some current wrapper solutions for using the Kinect with Unity? The initial primesense one seems not to be in active development.

I'm aware of the Zigfu one, however are there any open-source alternatives?

sentences: How to get started with game development? I m a engineering student. I have intermediate knowledge of programming languages. I know how to program in C and C++, and i have no experience regarding graphics, sound or implementing physics in programs. But i am really interested in game development and want a little guidance on how to begin.

sentences: Lerp UI Color outside update method? I'm able to Lerp the color of a UI panel within the Update method. However I'd like to trigger behavior a single time when needed. If I put it in a method and call it it only changes for a brief time and doesn't fully complete. I could probably set a bool flag within the update method but that seems sloppy.

sentences:
How can I use ImGui to render simple text instead of using stb_truetype directly? Since ImGui builds on top of stb_truetype for its font rendering, I thought it could be nicer to use its already built font-processing capabilities (ImGui::GetIO().Fonts), and render with those, instead of using stb_truetype directly.

However, I've been having trouble figuring out how to do this, specifically how to get quad position/texture coordinates for a given string to use with the preloaded texture at ImGui::GetIO().Fonts->TexID.

I'm not looking to draw buttons/text inside ImGui windows, all I want to do is to use ImGui to build vertex data for a given string so that I can render it anywhere.

sentences:
Getting solid black color when texture is added to GLSL I'm trying to apply the default badlogic.jpg image to a .obj I have. I'm currently loading the texture from AssetManager and creating a material with a texture attribute (as a diffuse).

In my fragment shader, I try to get the texture value and output it but it just results in a solid black. I outputted v_texCoord (as a vec4) and I could see different colors that resemble what they should be (which should mean that the texture coordinates are correct). But yet
I still get a solid black color.

I don't understand why the texture is not coming through. Am I missing something?

Code:

/.../
model = assetManager.get("mesh/Sting-Sword-lowpoly.obj", Model::class.java)
texture = assetManager.get("badlogic.jpg", Texture::class.java)

val m = ModelInstance(model)

val mat = Material()
mat.set(TextureAttribute.createDiffuse(texture))
m.materials[0] = mat

/.../

Vertex Shader:

attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec2 a_texCoord0;

uniform mat4 u_projViewWorldTrans;
uniform sampler2D u_diffuseTexture;

varying vec3 v_normal;
varying vec2 v_texCoord;

void main()
{
    v_texCoord = a_texCoord0;
    v_normal = normalize(a_normal);
    gl_Position = u_projViewWorldTrans * vec4(a_position, 1.0);
}

Fragment Shader:

uniform sampler2D u_diffuseTexture;
varying vec2 v_texCoord;

void main()
{
    //Get color
    vec4 color = texture(u_diffuseTexture, v_texCoord);

    gl_FragColor = color;
}

sentences:
Kinematics of a die roll? I'm working on a simple 3D game. In the game, sometimes the players have to roll die (a D8 to be exact). I wish to represent the rolling die with a 3D model, and I'd like to animate it in 3D space as if it was really rolled.

Can anyone help me describe the way the die spins around in real life?

PS: I'm working on this in WPF, using Storyboards and Rotation3DAnimationUsingKeyFrames

sentences:
How can I load an image into the back buffer? How can I load and display an Image?...
I have tried something but it didnt.. worked.. this is what I've tried..

File : StrikeOps_main.cpp .. void : render_frame :

Intro::DisplayIntro(d3ddev, introPath.c_str(), Surface, BackBuffer);

File : Intro.h

class Intro
{
public:
    static void Intro::DisplayIntro(LPDIRECT3DDEVICE9 d3ddevice, LPCSTR path, IDirect3DSurface9 *Surface, IDirect3DSurface9 *BackBuffer);
};

File : Intro.cpp

void Intro::DisplayIntro(LPDIRECT3DDEVICE9 d3ddevice, LPCSTR path, IDirect3DSurface9 *Surface, IDirect3DSurface9 *BackBuffer)
{
    D3DXIMAGE_INFO Info;

    D3DXGetImageInfoFromFile(path, &Info);
    d3ddevice->CreateOffscreenPlainSurface(Info.Width, Info.Height, Info.Format, D3DPOOL_SYSTEMMEM, &Surface, NULL);

    D3DXLoadSurfaceFromFile(Surface, NULL, NULL, path, NULL, D3DX_FILTER_NONE, 0, NULL);

    d3ddevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);
    d3ddevice->UpdateSurface(Surface, NULL, BackBuffer, NULL);
}

then on StrikeOps_main.cpp , void : CloseD3D :

Surface->Release; and BackBuffer->Release; (yes they are declared as globals on StrikeOps_main.cpp

sentences:
Tiled based pathfinding in a 1- or 2-dimensional array As far as I know all tile based map editors export a JSON object containing one dimensional arrays. While most pathfinding libraries/tutorials are only provided for two dimensional arrays.

Also if for example I would like to do pathfinding in this one dimensional array and this array is huge i'm geussing this would cause performance issues.

So why is it that most tile based map editors output a one dimensional and how should I handle those regarding pathfinding?

example tile editor:

http://elias-schuett.de/git/Online-Tile-Map-Editor/#

Just google pathfinding to find all the two dimensional patfhfinding tutorials

sentences:
Scale my pixel art files when designing them or when rendering? If I create pixel art files that need to be scaled up on the screen later, so that a single pixel becomes a box of 4 pixels. Should I create my pixel art with 2x2 pixels or should I create it with 1x1 pixels so that I can I 1:2 scale it later in XNA to 2x2 pixels?

I tend to believe that 1:1 would result in too much detail rather than the pixel art effect, thus I want the end result in 2:1 style where a 1x1 pixel of my intended sprite will take 2x2 pixels on the screen.

sentences:
Question of tilesheet efficiency For a 2d side scrolling game made in Java, should I make a sprite sheet for my character walking left and for walking right, or should I just do the one, and flip it when it loads?

Also, the way I've been doing it, both left and right would be in the same image file, if that makes any difference.

sentences: How should a programmer get started with creating 2D Sprites? I am a programmer. Given a sprite sheet, I can code game as per the requirements. But I do not know how to create these sprites. I use Cocos2D. And I do not know where to begin. I have never done anything art-related before. I am aware of TexturePacker. But it only packs already created sprites. So how do I get started with creating 2D sprites? Are there any dedicated softwares for this purpose? Main main concern is about creating assets for Retina Displays.

sentences:
What is a good way of handling shaders? I'm currently reading this book and are at the chapter about the rendering subsystem of a game engine.

Now, the book suggests that a material is a structure that provides information on how to shade a mesh. So the material contains visual properties and also what information to send to the shader prior to rendering.

My question is: What is a good tructure/syntax of such a material model?

My current ideas are that the material holds info such as specularity, diffuse colors, textures and so on. The (to me) tricky part comes when a shader needs multiple render passes.

A simple material could be something a long the lines of:

Transform info:
ModelMatrix : get_from_model
ViewMAtrix: get_from_camera
ProjectionMatrix: get_from_camera

Textures:
diffuse: get_from_file
normalmap: get_from_file
glossmap: get_from_file

Lighting:
direction: get_from_somewhere
.
.
.

But for instance, if I want to render the reflection of a mirror,  need a good way to tell the engine that I want to render the scene with the camera flipped in the mirror plane, and perhaps with a lower LOD. Is there a well know good way to encode this in the interface between user-data and the shader program?

Also, in general, are there well proven methods for mapping in-game data to shaders without too much manual instruction on where to find the data?

Thanks in advance : )

sentences:
Is Tetris public domain? is the concept for Tetris in the public domain or is there someone who is still collecting royalties on the concept? I mean, if I were to write a variant of Tetris would I owe somebody some money?
Thanks.

sentences:
To move an object forward an exact distance and then stop I am using this script below to move an animated object in unity with no root-motion. it simply walks across the terrain and has a timer so it waits 60 seconds until starting.

void Update ()
{
    if (Time.timeSinceLevelLoad > 60)
    {
        transform.Translate(0, 0, Time.deltaTime);
    }
}

I want the object to travel a certain distance or certain amount of steps and then stop at an exact point and stay there, is there a simple way to add to the above code to do this? does it entail xyz position reached maybe?

sentences:
How do I scale my spell target indicator to match the radius of OverlapSphere I have a spell system in which some spells have an Area of Effect. To get the targets I use Physics.OverlapSphere. I show the player an indication of the spell's radius by spawning a Unity plane primitive at the target position and scaling it to match the radius of the spell.

How would I scale my spell target indicator visual to correctly match the radius of OverlapSphere?
I have tried setting the scale of the plane's X,Y,Z to radius * 2, but this does not seem to align with the overlap sphere radius.
data.indicatorInstance.transform.DOScale(data.parent.radius * 2, 0.5f);

And just for completeness sake, below is the OverlapSphere call.
Physics.OverlapSphere(targetPosition, data.parent.radius)

sentences:
How to link the game class to the main menu class in XNA? So I got my game in another class and my main menu in another class.

This is the update method in my Main menu class

MouseState mouse = Mouse.GetState();
            switch (CurrentGameState)
            {
                case GameState.MainMenu:
                    if (btnPlay.isClicked == true) CurrentGameState = GameState.Playing;
                    btnPlay.Update(mouse);
                    break;

                case GameState.Playing:

                    break;

            }
            base.Update(gameTime);

This is the draw method in my Main menu class

spriteBatch.Begin();
            switch (CurrentGameState)
            {
                case GameState.MainMenu:
                    spriteBatch.Draw(Content.Load<Texture2D> ("MainMenu"), new Rectangle (0,0, screenWidth, screenHeight),Color.White);
                    btnPlay.Draw(spriteBatch);

                    break;

                case GameState.Playing:
                    break;
                                    }

            spriteBatch.End();

But now I don't know how to link/call the actual game file..
Would someone be able to help me with this please?

sentences:
How to make sure there's always a walkable path for enemies in a tower-defense game? I am making a 2D tower defense game. So far I have a 2d array which acts as a grid for my game. I'm able to place towers on it, run enemies and some dragging and tower firing stuff.

Now I am facing a problem in tower placement logic. I want that there's always a walkable path for enemies, meaning that the user should not be able to block the way completely by placing towers. Eg. if the user places towers vertically on a map, the algorithm must prevent the placement of a tower that will complete the vertical line. Or in any other way there must be at least one free (walkable) space so that the enemy can escape.

My current logic checks in all directions whenever tower has placed. If there is a tower upwards it calls the same function again on that upper tower until it hits a wall. It returns 1 for upward wall and 5 for downward wall and returns function(up/down tower) if there is a tower. here is the code:

int checkCollision(tower)
{
    if( there is a  tower up)
    return checkCollision(up tower);

    if(there is a tower down)
    return checkCollision(down tower);

            ......all directions.....

    if( there is a wall on UP )
        return 1;

    if( there is a wall DOWN )
        return 5;

        ....all walls......

    return 0;
}

Now what I want is, simultaneously check if there is a northern wall and southern wall or check any other directions with any other possibility (like up-down, up-diagonal, down diagonal... and so on) to not let the user place a tower as there should be one place left for enemy.

I am unhappy with my code at the moment. I mean my code tells me that a wall is found but how can I check that a wall is found in one direction and a wall also found in another direction? I dont want to go into possibilities like:

if(checkCollision(tower) == 1 && checkCollision(tower) == 5)
  "You cannot place"

I want something like:

    if( any combination of more than 2 wall found and there is entry/exit point in between)  //so it is wall to wall
    "You cant place"

I have also tried pre-calculating flags if there are walls on two sides (like up-down, up-diagonal etc.) then don't let the user place the tower but that still doesn't work.

sentences:
Enumerating full game tree for small board game I am trying to list all the possible positions in a small board game (nannon) (using C++)

So far I have decided to split it into two parts, the pieces that are in home positions and end positions (which aren't on the board) and the pieces that are in play (on the board).

Now, I can list the positions when the pieces are on the board with the  STL algorithm next_permutation (on a 6 point structure like : point_1 = "White", point_2="empty"......point_5="Black", point_6="empty")

I am left with how to list all the positions of pieces which are off the board.

I have decided to have a set of bins:

white in home position
white in end position
White in play
black in home position
black in end position
black in play

white has three pieces that can be put in any of these bins (e.g 2 in home bin and 1 in play bin), same goes for black, like this:

white in home position = 2
white in end position = 0
White in play = 1
black in home position = 0
black in end position = 1
black in play = 2

Any ideas of how I go about this?

p.s: (i tried just adding the home/end/in-play bins to the "board" structure and running next_permutation but that gives nonsensical positions like black pieces in the home bin. I guess I could just list them ALL and then prune the nonsensical ones but that seems like over kill)

sentences:
How can I stop this fixed update from executing so I want this FixedUpdate() Method to stop executing when the Method OnMouseDown() is executed.
A bool doesn't work a if() statement also doesn't work
Please use my whole code
Please help :)
Thanks,

 private void FixedUpdate()
    {
            int random = Random.Range(1, 4);
            if (random == 1)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.green;
            }
            if (random == 2)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.blue;
            }
            if (random == 3)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.yellow;
            }

    }
    private void OnMouseDown()
    {
        shouldexecute = false;
    }

sentences:
Is it must to use 3rd party framework to use to develop adobe stage3d game I was searching for tutorials to develop games using stage3d. Every where I came across the articles/tutorials using the frameworks.

Is it compulsory to use the frameworks? or its very difficult to do it without frame works?

sentences:
Static body bridging two other static bodies I have two box2d bodies like below,

What I need is to create another body that kind of bridges this two bodies. I am not looking for a box2d joint, but a body that will be like a bridge touching the rightmost point of the first body and the leftmost point in the second body, like in this image (excuse my paint skills).

Problem is, looks like I am not getting the co-ordinates and angles on how to create the third (bridge) body. Here's my code below,

  Body body1, body2, bridge;

BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.StaticBody;
bodyDef.position.set(350 / Constants.PIXELS_TO_METERS, 0 / Constants.PIXELS_TO_METERS);

body1 = world.createBody(bodyDef);

PolygonShape shape = new PolygonShape();
shape.setAsBox(300 / Constants.PIXELS_TO_METERS, 300 / Constants.PIXELS_TO_METERS);

FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = shape;
fixtureDef.density = 1f;
body1.createFixture(fixtureDef);

BodyDef bodyDef2 = new BodyDef();
bodyDef2.type = BodyDef.BodyType.StaticBody;
bodyDef2.position.set(1600 / Constants.PIXELS_TO_METERS, 0 / Constants.PIXELS_TO_METERS);

body2 = world.createBody(bodyDef2);

PolygonShape shape2 = new PolygonShape();
shape2.setAsBox(300 / Constants.PIXELS_TO_METERS, 500 / Constants.PIXELS_TO_METERS);

FixtureDef fixtureDef2 = new FixtureDef();
fixtureDef2.shape = shape2;
fixtureDef2.density = 1f;
body2.createFixture(fixtureDef2);

BodyDef bodyDef3 = new BodyDef();
bodyDef3.type = BodyDef.BodyType.StaticBody;

Vector2 a = new Vector2(body1.getPosition().x + 300 / Constants.PIXELS_TO_METERS, body1.getPosition().y + (300 + 50 / 2) / Constants.PIXELS_TO_METERS);
Vector2 b = new Vector2(body2.getPosition().x - 300 / Constants.PIXELS_TO_METERS, body2.getPosition().y + (300 + 50 / 2) / Constants.PIXELS_TO_METERS);

float distance = a.dst(b);
Vector2 bridgePos = new Vector2(a.x + distance / 2, a.y + 50 / 2 / Constants.PIXELS_TO_METERS);

bodyDef3.position.set(bridgePos);

float angle = (float) Math.atan2(a.y + 50 / Constants.PIXELS_TO_METERS, b.x);
bridge = world.createBody(bodyDef3);

PolygonShape shape3 = new PolygonShape();
shape3.setAsBox(distance / 2, 50 / Constants.PIXELS_TO_METERS);

FixtureDef fixtureDef3 = new FixtureDef();
fixtureDef3.shape = shape3;
fixtureDef3.density = 1f;
bridge.createFixture(fixtureDef3);
bridge.setTransform(bridgePos, angle);

This doesn't give the correct position or angle for the bridge, as it works for some body sizes and sometimes don't (yes, I have accounted for the hardcoded values for every change). I am not exactly sure what I am doing wrong. Any help?

sentences:
What are some current techniques for rendering deformable landscapes? What are the current techniques than can be used for efficiently rendering 3D heightmap-based deformable landscapes?

For example, in the non-deformable landscape problem, ROAM used to be the way to these landscapes, but as GPUs advanced it lost favour to the newer geomipmapping/clipmaps (which is not as CPU-bound; but still had big enough wins for current generation GPUs).

Has there been any advancement in terms of deformable landscape rendering?  Not only in terms of rendering, but also throughput during deform operations.

Although I am personally targeting SM3.0/DirectX 9.0c, please don't restrict your answers to that.

sentences: How to get all points within a box? What is the fastest way to get all of the points within a bounding box? If I had an ArrayList<Point>, and they weren't mapped to coordinates, would I have to loop through every point to see if it is in those bounds? Is there a faster way?

sentences:
Alternatives to storing all my entities in an SQL database I've been trying to build my entity system based on pure SQL data storage as explained in this post series. The idea is that every entity or component is stored in an SQL table. I created my framework to manage that, only to realize that many SQL queries took more than 10ms, which is unsuitable for use in a game loop.

I first thought the delay was I/O-bound, so I created an in-memory MySQL cluster. This was better, but still not real-time enough for a game loop.

Has anyone built an SQL-based entity system? If so, how did you manage to keep query times manageable?

If an SQL database isn't feasible for performance issues, what data structure could I use to retain the entity system idea and the possibilities of direct SQL requests on components?

I've heard of many MMOs running on SQL. Do they use it for only part of the data or a full entity system? How to separate database-stored and classical memory-stored structures in that case?

Edit for clarification: Yes, all game data is stored in the database. If say I run my physics system it will first get data from SQL, then do its stuff, then insert the updated data back to the database.

sentences:
How to alter image pixels of a wild life bird? Hello so I was hoping someone knew how to move or change color and position actual image pixels and could explain and show the code to do so.

I know how to write pixels on a surface or screen-surface

usigned int *ptr = static_cast <unsigned int *> (screen-pixels);

int offset = y * (screen->pitch / sizeof(unsigned int));

ptr[offset + x] = color;

But I don't know how to alter or manipulate a image pixel of a png image my thoughts on this was

How do I get the values and locations of pixels and what do I have to write to    make it happen?

Then how do I actually change the values or locations of those gotten pixels and how do I make that happen?

any ideas tip suggestions are also welcome!

  int main(int argc , char *argv[])
    {

        SDL_Surface *Screen = SDL_SetVideoMode(640,480,32,SDL_SWSURFACE);

        SDL_Surface *Image;

        Image = IMG_Load("image.png");

        bool done = false;

        SDL_Event event;

        while(!done)
        {

            SDL_FillRect(Screen,NULL,(0,0,0));

            SDL_BlitSurface(Image,NULL,Screen,NULL);

                while(SDL_PollEvent(&event))
                {

                    switch(event.type)
                    {

                            case SDL_QUIT:
                            return 0;
                            break;

                    }

                }

                SDL_Flip(Screen);

        }

    return 0;

}

sentences:
How are "2.5D" art assets created? By "2.5D" I mean the art style in games such as Roller Coaster Tycoon, Age of Empires 2 or Fallout 1 and 2:

Everything in the games appears to be created with a "pixel art"-like tool. Am I correct?

How are the moving characters are created though? Take AoE2: For much of my childhood I was convinced that the soldiers, villagers and other characters were 3D!

Could someone explain:

What dimensionality are the characters?
What sort of software package could I use to create them?

sentences:
Use an instance or a class for game resources (wood,iron,gold) So I'm making a game where you can send ships to locations to sell or buy resources like wood, iron, gold, etc.

Now I was wondering how the resources should be created in de game. I came up with 2 options

Create a class for each resource:

public class ResourceBase {
    private int value;
    // other base properties
}

public class Gold : ResourceBase {
     public Gold {
         this.value = 40 // or whatever
     }
}

Create instances of a Resource class

public class Resource {
    string name;
    int value;

    public Resource(string name, int value) {
        this.name = name;
        this.value = value;
     }
 }

// later on...

Resource gold = new Resource("Gold",40);

With the second option it's possible to fill the game resources from a resources.json file, I kinda like that structure.

New ideas / design patterns / structures are always welcome!

EDIT: It's a little bit like Assassins Creed Black Flag's companion app. See the resource bar on the image below

EDIT 2: I've done some more research on the "load items/resources from JSON file" and found this blog: Power of JSON in Game Development - Items. It shows the best of option 1 and option 2. You're still able to add functionality to each resource :)

sentences:
Building View Matrix in Direct3D11 Am I doing it right? I converted this.

m_ViewMatrix = XMMatrixLookAtLH(XMLoadFloat3(&m_Position), lookAtVector, upVector);

to this one.

XMVECTOR vz = XMVector3Normalize( lookAtVector - XMLoadFloat3(&m_Position) );
XMVECTOR vx = XMVector3Normalize( XMVector3Cross( upVector, vz ) );
XMVECTOR vy = XMVector3Cross( vz, vx );

m_ViewMatrix.r[0] = vx;
m_ViewMatrix.r[1] = vy;
m_ViewMatrix.r[2] = vz;
m_ViewMatrix.r[3] = XMLoadFloat3(&m_Position);

m_ViewMatrix.r[0].m128_f32[3] = 0.0f;
m_ViewMatrix.r[1].m128_f32[3] = 0.0f;
m_ViewMatrix.r[2].m128_f32[3] = 0.0f;
m_ViewMatrix.r[3].m128_f32[3] = 1.0f;

m_ViewMatrix = XMMatrixInverse( &XMMatrixDeterminant(m_ViewMatrix), m_ViewMatrix );

Everything looks fine when I run it. Another question is, I saw on this site(http://webglfactory.blogspot.com/2011/06/how-to-create-view-matrix.html) that he subtracted lookat from position in his vector vz. I tried it but gave me wrong view matrix. Can anyone check my code. I'm studying linear algebra right now. Sucks my course doesn't have one.

Thank you,
Balls

sentences:
Java Game Loop Efficiency I'm quite new to java.

I was watching 2 video tutorials on how to make java game and read a couple articles about game loop. However, I'm still confused about how game loop actually works.

The first tutorial used code that looked like this (I modified some codes from the tutorial and commented on top):

/*
 * Game Loop of the game. It uses fixed timestep.
 * Optimal time represents time needed to update one frame.
 * Update time represents time actually taken to update one frame.
 *
 * By calculating the difference between optimal and actual time,
 * we can let Thread to sleep for the exact time we are aiming for, which is 60 FPS.
 */

public void run() {
    long now;
    long updateTime;
    long wait;

    final int TARGET_FPS = 60;
    final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

    while (isRunning) {
        now = System.nanoTime();

        update();
        render();

        updateTime = System.nanoTime() - now;
        wait = (OPTIMAL_TIME - updateTime) / 1000000;

        try {
            Thread.sleep(wait);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

This is quite easy to understand and I have no problem with using this game loop. However, the second tutorial used more complex game loop that I had a hard time understanding it:

public void run() {
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0 ;
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while (delta >= 1) {
            tick();
            delta--;
        }
        if(running)
            render();
        frames++;

        if(System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            System.out.println("FPS: " + frames);
            frames = 0;
        }
    }
    stop();
}

I do not understand the use of timer and frames variable and how delta is being used. Is timer and frames simply used for printing out the FPS on the console screen? Also, help me clarify the use of delta variable in this code.

The use of delta variable is quite different from the other game loop that I know of. From the articles that I read, I've seen a different use of delta. Here is what I tried to come up with on my own after reading the articles:

/*
 * Delta is ratio of how fast computer is running.
 * It is achieved by calculating:
 * (actual time) / (optimal time)
 *
 * This is passed to update method to calculate time taken
 */

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

    while (isRunning) {
        long now = System.nanoTime();
        long updateTime = now - lastLoopTime;
        lastLoopTime = now;

        double delta = updateTime / (double) OPTIMAL_TIME;

        update(delta);
        render();
    }
}

Will the above code be fine as it is?

Out of these three sets of codes, which game loop would be the most optimal to use? I feel like the first set of code is too simple that it might not be as efficient as other two (not that it actually is, but just a feeling that I get).

sentences:
Turning model from 3ds max file into sprite I'm planning to buy animated 3D assets to render and use as 2D sprites in my game, but i don't know anything about 3ds max or own any software. How do i render the animations (i need top-down ones) to turn them into a bunch of pngs?

From there i already know how to create a spritesheet.

I assume there is a more streamlined way of doing this than opening each file in the 3D software, looking at each animation frame, and capturing the screen?

sentences:
Why does my object "jump" immediately as the game starts? I'm having a problem where, when I start my game, my game object (a 3D plane) immediately jumps 300 pixels or so. I suspect this has something to do with my joystick handling code that I've written to move this game object:

 xMin1 += Input.GetAxisRaw("LeftRight");
 yMin1 += Input.GetAxisRaw("UpDown");

 //_targetPlane is my game object
 _targetPlane.transform.position = new Vector3(xMin1, yMin1, 2.5f);

The object jumps even if I don't touch the joystick. Am I doing this wrong?

sentences:
Is there already an accepted way to measure the "enjoyment/entertainment value" of a certain game? I don't know if the question is legit, but I've tried my best. I've found this post here about measuring the creative/entertainment value of video game requirement. I've done some reading but I can't see if there already exists a specific way to measure such.

This one is research study about a model for evaluating player enjoyment. I don't know but, is it outdated? The study was conducted way back 2005.

Is there any any studies or researches you know that is somewhat related to this or some other way?

sentences:
Why do games dynamically link to the CRT? Almost all big titles that I have played require you to install the MSVC runtime. There have been numerous questions about "statically vs. dynamically linked CRT" on StackOverflow, the reasons for dynamic CRT generally boil down to:

Reduced memory usage if other programs are using the same libs
Can update the libraries independently.

But I wonder, how often are these reasons related to game development?

Most games spend at least a hundred MB of RAM and it's not like saving some KBs really matter. Besides, games are supposed to capture the user's sole attention so he'll probably not be running other programs to share the CRT.
I don't think I have seen a game needing to upgrade its CRT in its life-cycle.

So, why don't games statically link their CRT so they can reduce the extra step of installing MSVC runtime?

sentences: Moving IK target with Unity's New Input System I'm currently converting our 2D game from the old input system to the new input system in the hopes of making it available to more people in the future. Currently I am using the mouse position to aim a flashlight by moving the IK target of that arm to the mouse position by getting the vector of the mouse cursor and converting it using screentoworldpoint. My question is, how can I implement a similar function using the new input system with a joystick? Currently I am getting a vector2 from the joystick which ranges from (-1,-1) to (1,1) depending on the position and angle of the joystick. I would like to have the same code for both inputs so I don't have to use an if else statement and determine what input is being used but if that is unavoidable I understand. I would just like to know the best way to go about aiming an IK target using a joystick with the new input system.

sentences:
Pixel perfect clickable picture in OpenGL/C++ So I have a picture(for easier understanding of problem like this: http://www.lib.utexas.edu/maps/europe/europe_95.jpg).

My goal is to click on any of the countries and get what country I clicked. The picture is full of colors, not just simple lets say Germany is purple. Also if I hover above a country I could also do things, like highlight it, write some text in a bar, etc.

What solutions popped in my mind:

Draw every slice into a mesh, and ray trace the click. (making lots of meshes is a lot of time)
Draw a single quad with texture, make a pixelmap, and get the coordinates clicked, then look up in the table.(I have to make a map for every resolution)

Is there any better way of doing this? Or are there any algorithms for it?

sentences:
Exporting scene during gameplay to FBX In Unity is there a way to add a menu button during gameplay that allows the player to export the current scene as an fbx file?
My googling and research shows that its possible to do this while developing the game but wondering if there is a way to add this functionality for the gameplay itself.
Any suggestions on how/if this can be done?

sentences: How to programmatically disable sprite renderer and mesh renderer in Unity3D? In my game, I have an empty GameObject that has a sprite and a TextMesh as child. I want to access the child (sprite and the text mesh) and turn off the sprite renderer and mesh renderer of the sprite and the text mesh programmatically and be able to then turn it back on, but I don't know how. Some help and/or sample code would be much appreciated. Thanks.

sentences:
Why do some games have different builds in different platforms/regions? I'll try to keep things brief and provide some context. I was playing MineCraft one day and this question popped into my head. I was thinking about some of the things that the Bedrock edition of the game had for example, yet the Java edition lacked. One example would be that Java doesn't allow for the use of dyes with cauldrons, but in Bedrock? No problem. Conversely, the "Illusioner" mob from the illagers can be found in Java, yet is exempt from Bedrock.
To provide another example, I recently stumbled across a mobile game called Seven Knights, created and developed in South Korea, later ported and localized for global release. It is my understanding that the Korean version of the game is quite a' ways ahead of the global release. From the number of heroes, to the length of the narrative, and the number of items, the Korean version is planned fairly far ahead. I find this to be a rather odd thing to do.
So I'll ask, why is this done? Why do developers have different builds of the same game in different platforms/regions? Would it not make more sense to simply port everything as is and then localize it if need be? Why split up the builds or only port/localize part of the content?

sentences:
GLM: Camera attached to model moves in opposite direction from the model I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform = ParentsWorldTransform * LocalTransform).

This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4.

All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's.

Transformation Component Update Code

m_world_transformation = m_local_transformation;
// If we have a parent object
if (m_parent_transform_component)
    m_world_transformation = m_parent_transform_component->GetWorldTransformation() * m_world_transformation;

Camers position buffer being updated

BufferData.view = m_transformation_component->GetWorldTransformation();
m_camera_buffer->SetData();

I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.

sentences:
Point vs Convex Hull I'm trying to implement a simple collision response to a point intersecting a convex hull.

So far I can detect if the point is inside the hull.

But now I want a collision response that translates and rotates the hull away from the point so it no longer intersects.

I'd like the simplest algorithm possible, I don't want to implement a physics engine or rigid bodies.

Can someone point me in the right direction?

sentences:
Limiting Framerate and Input So I have been learning HTML5 canvas recently and ran into a bit of a snag. I created a proof of concept that builds a block based 2d map that you can move a character inside of using arrow keys. This works well because everything is free moving (character moves 1 pixel per frame, so the movement is fluid and looks good).

I am trying to fork off of this code to create another concept that forces grid based movement (like in a typical roguelike). I have updated my movement code to move in chunks equal to tile size.. but the issue is that the refresh rate is so fast that it just seems like the character is moving at super speed.

Here is a snippet of my code that handles animations:

function gameLoop() {
        ctx.clearRect(player.x,player.y,PLAYER_SIZE,PLAYER_SIZE);
        getInput();
        ctx.fillStyle = '#000000';
        player.draw(ctx);
        window.requestAnimationFrame(gameLoop);
}

Is using requestAnimationFrame() for this sort of movement not a good idea? Is it better to just setInterval() for this sort of thing? I found a article via Google that talks about using variables for time, delta, fps, etc to limit the framerate... but Im not sure I understand how to do that in conjunction with requestAnimationFrame(). Should I somehow hold my gameLoop() from hitting requestAnimationFrame() until some time interval is hit? That seems like it would just be a waste because I would need to force a loop of some kind... doesnt seem too elegant

sentences:
Places to Test Player Interest In Storyline I am working on an iPad game, and have a few different intro story lines. I would like to get gamer feedback on the intros.

What websites or techniques have others used to get such feedback?

sentences:
Compile-time checking for component-based, data-driven games This is not a specific question, but rather someone who is looking for opinions about a typical design problem. In a component based data-driven games, I've often seen something similar to the following when accessing attributes:

int* health = mOwner->get< int >( HEALTH_ATTRIBUTE );

if (health)
    *health -= 10;

Or, alternatively:

if (mOwner->hasAttribute( HEALTH_ATTRIBUTE ))
{
    int health = mOwner->get< int >( HEALTH_ATTRIBUTE );
    mOwner->set( HEALTH_ATTRIBUTE, health - 10 );
}

Where mOwner is a pointer to the parent game object. In this example, assume that the game object stores a map of attributes which are downcasted to the correct type at runtime.

There are some problems with this approach. Mainly, it is prone to bugs since it requires the programmer to know the the type of the attribute they are after. If I was working on a small team or by myself, this wouldn't be an issue. However for my requirements, this is undesired.

The only way to have compile-time checks is to create a helper function for each attribute that returns the proper type, so our code would then look like:

int* health = Attributes::getHealth( mOwner );

Where Attributes is declared as a namespace. Because the type is known at compile time, this gives us several advantages. In addition to the compile-time check, we gain the flexibility to easily declare certain attributes as constant, or that can't be modified outside the game object, etc. Of course, the downside is that it becomes necessary to manually create a new function for each and every attribute in the game.

Thoughts? Opinions?

EDIT:

After thinking it through a little more, I realized there is a way to define the function once using templates to avoid code duplication. For example:

template <typename Type, int ID>
class Attribute
{
public:
    typedef Type type;

    static int getID()
    {
        return ID;
    }

    static type getData( const GameObject* obj )
    {
        return obj->getAttribute < type >( ID );
    }

};

And then for each attribute we have in our game,

typedef Attribute< std::string, MODEL_NAME > ModelName;
typedef Attribute< Vector3, POSITION > Position;
typedef Attribute< int, HEALTH > Health;

/// ... and so on ...

And when we want to access an attribute:

int health = Health::getData( mOwner );

Or alternatively, if we want to:

Health::type health = Health::getData( mOwner );

If we don't know the health attribute exists or not:

int* health = Health::getData( mOwner );

if (health)
   // ....

I think this approach gives a lot of flexibility while still maintaining type safety.

sentences:
Looking for specific "textured quad" openGL tutorial in c++ I'm new to openGL and I've been googling around for the old and simple textured quad tutorial in openGL but I haven't been able to find one that suits my needs.

OpenGL3.X compatible
OpenGL|ES 2.0 compatible
AND
Only uses core openGL library (no GLUT, GLEW...)

I'm creating the window and the openGL context with SDL2.

I only need the most basic stuff to draw quads. I'm not interested in any of the new OpenGL features, just in compatibility and cross platformness (Windows, OSX, Linux, Android and iOS).

sentences:
How do I rotate a single object in HLSL? I have a World with a 3D model of a head in it and that World rotates, like such:

protected override void Update(GameTime gameTime)
{
    //other stuff

    angle += 0.00005f;

    //more other stuff
}

protected override void Draw(GameTime gameTime)
{
    //other stuff
    Matrix rotation = Matrix.CreateRotationY(3 * angle);
    effect.Parameters["World"].SetValue(rotation * Matrix.CreateScale(10.0f));

    // other stuff
}

And then in my Effects file I create a spotlight:

float4 SimplePixelShader(VertexShaderOutput input) : COLOR0
{
    float4 lightDirection = { 1, 1, 1, 0 };
    float theta = 10.0f;
    float phi = 30.0f;
    float4 color;
    float4 lambert = DiffuseColor * 0.2 * max(0, dot(input.Normals, input.lambertLightDir));

    float angle = acos(dot(input.lightDir, normalize(lightDirection)));
    if(angle > radians(phi))
        color = AmbientColor * AmbientIntensity;
    else if(angle < radians(theta))
        color = lambert;
    else
        color = max(AmbientColor * AmbientIntensity, smoothstep(radians(phi), radians(theta), angle) * lambert);

    return color;
}

And naturally this spotlight also rotates with the world. However, I dont want it to rotate. I tried everything, multiplying, adding, subtracting the rotation matrix and/or the angle from the different lightdirections and angles and nothing works.

Now I could rotate just the model and not the world, that would even be a sensible thing to do, but I have no clue how :P So I'm either looking for a good way to rotate the model or a way to 'counter rotate' the spotlight so it seems to stand still.

Edit: my vertexshader:

VertexShaderOutput SimpleVertexShader(VertexShaderInput input)
{
//some other vertexshaderstuff

    float4 lightPoint = {-3, -2, -2, 0};

    output.lightDir = normalize(input.Position3D) - lightPoint;

    output.lambertLightDir = float4(30, 30, 20, 0);

    return output;
}

sentences:
LWJGL - Continuous key press event without delay I am checking for key presses and then based on the keys pressed I am moving a square around the screen. I am setting booleans for the keys WASD. But , Whenever I try to keep the key down , it takes a while till it moves continuously (Just a half second stop after a single move.) Any way to get rid of that and make it be "smooth"?
Code:

 up = false;
 down = false;
 left = false;
 right = false;
 reset = false;

 while(Keyboard.next()){
     if (Keyboard.getEventKeyState()) {
        if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){
             reset = false;
        }
         if(Keyboard.isKeyDown(Keyboard.KEY_W)){
            up = true;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_S)){
            down = true;
         }
         if(Keyboard.isKeyDown(Keyboard.KEY_A)){
            left = true;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_D)){
            right = true;
        }
     }
}

sentences:
Artifacts when draw particles with some alpha I want to draw in my game some particles. But when I draw one particle above another particle, alpha channel from this above "clear" previous drawed particle.
I set in OpenGL blend in this way:

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

My fragment shader for particle is very simple:

precision highp float;
precision highp int;
uniform sampler2D u_maps[2];
varying vec2 v_texture;
uniform float opaque;
uniform vec3 colorize;
void main()
{
    vec4 texColor = texture2D(u_maps[0], v_texture);
    gl_FragColor.rgb = texColor.rgb * colorize.rgb;

    gl_FragColor.a = texColor.a * opaque;
}

I attach screenshot from this:

Do you know what I made wrong ?

I use OpenGL ES 2.0.

sentences:
Bounding box should rotate - Skews instead I have a method to rotate a sprite's bounding box around the center of the sprite (the sprite rotates and I need the bounding box to rotate with it. The sprite is rectangular).

Instead of being rotated, the bounding box is skewing wierdly. When the angle is 0 - the bounding box is a perfect rectangle. But when the angle changes, the bounding box is getting gradually skewed.

All of this happens in the object's move() method. This method is called every cycle of the game-loop. What I'm trying to do is this:

Move the sprite in the direction the user chose. (x += dx, y += dy).
Get the coordinates of the new center of the sprite.
Get coordinates for the four vertices of the not-rotated-version
of the sprite.
Manipulate these coordinates, so they are now the vertices of the
rotated sprite.

The coordinates that step 4 gives me, are used to create the bounding box (and temporarily draw it on the screen so I can see).

Somewhere, this fails. As I said, the bounding box doens't rotate. Instead, it skews (and maybe also rotates, not sure).

What could be the problem?

Code:

public void move(){

// Advance sprite.
x += dx;
y += dy;

// Get the new center point of the sprite.
centerx = x + width/2;
centery = y + height/2;

// Get the 4 vertices of the non-rotated version of the sprite.
xcoo[0] = (int) x;
xcoo[1] = (int) (x + width);
xcoo[2] = (int) (x + width);
xcoo[3] = (int) x;

ycoo[0] = (int) y;
ycoo[1] = (int) y;
ycoo[2] = (int) (y + height);
ycoo[3] = (int) (y + height);

// Manipulate each vertex, so it fits the rotated sprite.
for(int z=0;z<4;++z){

    xcoo[z] -= centerx;
    ycoo[z] -= centery;

    xcoo[z] = (xcoo[z] * Math.cos(Math.toRadians(angle)) - ycoo[z] * Math.sin(Math.toRadians(angle)));
    ycoo[z] = (xcoo[z] * Math.sin(Math.toRadians(angle)) + ycoo[z] * Math.cos(Math.toRadians(angle)));

    xcoo[z] += centerx;
    ycoo[z] += centery;

}

}

Help would be very appreciated. Thank you

sentences:
Overlaying grid for pathfinding My game is not grid-based, so units can be at any arbitrary coordinate and move at different speeds. My obstacles are all rectangular and axis-aligned, so naturally it makes sense for me to overlay a grid over the map for pathfinding. Each unit will take up a grid cell (floor(unit.x / CELL_SIZE), floor(unit.y / CELL_SIZE)). I will then run standard A* grid-based pathfinding on the grid.
The problem is that although the path is grid-aligned, the unit movement is not. Thus, in the midst of moving, the unit might end up colliding with a cell that is blocked, and get stucked. Here's a picture to illustrate:

I'm trying to get from point A to point B. B is the center of the grid cell, since it is a waypoint from the found path. A is the point the unit is currently at. The pathfinder thinks A to B is valid movement, since it takes the grid cell of A as the start point and the diagonal neighbour B is not blocked. But moving from A to B might result in position C, which is blocked.
I thought of using a soft collision radius for pathfinding, but it has its problems. The pathfinder will not return any paths where there's a soft collision. So if the current location of the unit already has a soft collision, the unit cannot move! It seems that it is necessary to keep the pathfinding collision and physics collision identical...
How do I resolve this problem, and what is the standard way to overlay a grid for pathfinding?

sentences:
OpenGL lighting with dynamic geometry I'm currently thinking hard about how to implement lighting in my game. The geometry is quite dynamic (fixed 3D grid with custom geometry in each cell) and needs some light to get more depth and in general look nicer.

A scene in my game always contains sunlight and local light sources like lamps (point lights). One can move underground, so sunlight must be able to illuminate as far as it can get.

Here's a render of a typical situation: The lamp is positioned behind the wall to the top, and in the hollow cube there's a hole in the back, so that light can shine through.

(I don't want soft shadows, this is just for illustration)

While spending the whole day searching through Google, I stumbled on some keywords like deferred rendering, forward rendering, ambient occlusion, screen space ambient occlusion etc. Some articles/tutorials even refer to "normal shading", but to be honest I don't really have an idea to even do simple shading.

OpenGL of course has a fixed lighting pipeline with 8 possible light sources. However they just illuminate all vertices without checking for occluding geometry.

I'd be very thankful if someone could give me some pointers into the right direction. I don't need complete solutions or similar, just good sources with information understandable for someone with nearly no lighting experience (preferably with OpenGL).

sentences:
How can I compress resources into a single file in Java? Today I've finished my game, but there's a problem. There're more than 500+ images in my resources folder and I want to compress them into a single file, like other games do (for example put everything in a .pak file). I've searched on the internet, but I can't find something that tells about how to do it with Java.

There's maybe a library that I can use to avoid that problem?

Thanks.

sentences:
OOP implementation of BUFFS and Stats. Suggestion I am developing an MMORPG server using NodeJS.

I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap...

Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat.

After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell).

Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it?

I have read this What's a way to implement a flexible buff/debuff system? but this implements only a percentage system, which buffs can only say "+10%, +20%, etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat :/

Thanks for suggestions :)

sentences:
How to create an extensible rope in Box2D? Let's say I'm trying to create a ninja lowering himself down a rope, or pulling himself back up, all whilst he might be swinging from side to side or hit by objects. Basically like http://ninja.frozenfractal.com/ but with Box2D instead of hacky JavaScript.

Ideally I would like to use a rope joint in Box2D that allows me to change the length after construction. The standard Box2D RopeJoint doesn't offer that functionality.

I've considered a PulleyJoint, connecting the other end of the "pulley" to an invisible kinematic body that I can control to change the length, but PulleyJoint is more like a rod than a rope: it constrains maximum length, but unlike RopeJoint it constrains the minimum as well.

Re-creating a RopeJoint every frame using a new length is rather inefficient, and I'm not even sure it would work properly in the simulation.

I could create a "chain" of bodies connected by RotationJoints but that is also less efficient, and less robust. I also wouldn't be able to change the length arbitrarily, but only by adding and removing a whole number of links, and it's not obvious how I would connect the remainder without violating existing joints.

This sounds like something that should be straightforward to do. Am I overlooking something?

Update: I don't care whether the rope is "deformable", i.e. whether it actually behaves like a rope, or whether it collides with other geometry. Just a straight rope will do. I can do graphical gimmicks while rendering; they don't need to exist inside the physics engine. I just want something a RopeJoint whose length I can change at will.

sentences:
Unity 2D detect if swipe goes through an object I am developing a game in unity with flying arrows that the user tries to deflect by swiping through them (changing their direction). I can get the arrows to move with the swipes, but they move no matter where the swipes occur. I want them to only move (be affected) iff the swipe goes through the arrow. Here's what I have so far:

public class swipe : MonoBehaviour
{

private Vector2 leftFingerPos = Vector2.zero;
private Vector2 leftFingerLastPos = Vector2.zero;
private Vector2 leftFingerMovedBy = Vector2.zero;

public float slideMagnitudeX = 0.0f;
public float slideMagnitudeY = 0.0f;

bool touched = false;

void Update()
{
    if (Input.touchCount == 1)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            leftFingerPos = Vector2.zero;
            leftFingerLastPos = Vector2.zero;
            leftFingerMovedBy = Vector2.zero;

            slideMagnitudeX = 0;
            slideMagnitudeY = 0;

            // record start position
            leftFingerPos = touch.position;

        }

        else if (touch.phase == TouchPhase.Moved)
        {
            leftFingerMovedBy = touch.position - leftFingerPos; // or Touch.deltaPosition : Vector2
            // The position delta since last change.
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            // slide horz
            slideMagnitudeX = leftFingerMovedBy.x / Screen.width;

            // slide vert
            slideMagnitudeY = leftFingerMovedBy.y / Screen.height;

            if(touched)
            {
                //rigidbody2D.velocity = new Vector2(slideMagnitudeX, slideMagnitudeY)*20;
                rigidbody2D.AddForce(new Vector2(slideMagnitudeX, slideMagnitudeY)*5000);
                touched = false;
            }
        }

        else if (touch.phase == TouchPhase.Stationary)
        {
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }

        else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
        {
            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }
    }

}

void OnMouseEnter()
{
    touched = true;
}
}

The only way I have been able to find so far is using "onMouseEnter" which only works for very slow swipes.

How do I detect whether a swipe goes through an object?

sentences:
Cant get a Farseer Physics body’s rotation to follow the mouse Here is what’s in my HandleKeyboard() method that is called from the Game1 Update method.

        MouseState mState = Mouse.GetState();
        // the Vector2 that will hold the angle from the player to the mouse pointer.
        Vector2 mDirection = new Vector2(0, 0);

            // Get the current mouse position from the state update in the beginning of this method.
            Vector2 mPosition = new Vector2(mState.X, mState.Y);
            // Subtract the potsition of the player fromthe mouse pointer to get the exact angle in a vector2
            mDirection = mPosition - arrow.Position;

            // Control Rotation
            arrow.FixedRotation = true;
            // display the arrow in the rotation gathered above.
            arrow.Rotation = (float)Math.Atan2(mDirection.Y, mDirection.X);

From what I have read, this seems like the exact right thing to have the arrow look at my pointer. However when I rotate the mouse around the pointer it really doesn’t work properly.

It's hard to explain so here is a youtube video displaying what’s happening

I really hope you can tell me what’s going wrong.

sentences: Using Quaternion in libGDX Can someone give me an explanation about how to use the Quaternion class in libGDX to move my camera around a sphere or just set it up, manipulate it, and apply it general? I am trying to acheive orbiting my camera around a sphere without gimbal lock, and I'm not having any luck getting the camera to do anything by using quaternions...

sentences:
Achieving smooth movement curves & correct collision detection with a google app realtime multiplayer game server I'm an hobbist game developer. I'm trying to make a clone of a game like this: http://superhex.io/ to experiment with multiplayer online.

First of all I'm not sure if there is a better way to implement server-client comunication. So far I have implemented a server which updates the game state every 0.5 seconds and sends the information to all the clients.  You can try my current prototype here: https://hexpose.appspot.com

With respect to local development where the 0.5 seconds rounds are very regular, playing on the public server you see that the pace is not regular... I think this is due to a variable latency in server-client comunication.

Suppose I have many players moving on an arena like in this game. The superhex original gameplay is very fluid, you see enemies move on smooth curves. How this can be achieved? The position of enemies is known later (because of client-server-client latency) than the position of my player. But collision are anyway correctly detected. Is it just a matter of very slow latency and good server infrastructure or it depends on game logic implementation?

sentences: colliding 2 moving and rotating sprites in xna 2d I recently started making a game in windows phone XNA, I have a rocket in the middle that I can rotate and has a thrust to speed up in the direction it is facing and meteors coming out. The point is to survive as long as you can and avoid collision with the meteors. I can't manage to implement the collision between two moving and rotating sprites which are the rocket and a random meteor. I've seen rectangular collision which to me appears bad but maybe I am coding it a bit wrong and the pixel collision is way complicated :/ any help would be appreciated, thanks in advance :)

sentences:
Vertex ordering with THREEjs's exporter I'm using THREEjs's exporter to export a 2D polygon plane. The resulting JSON gives me the vertices. I'm trying to properly order these vertices as to make the actual polygon shape, without luck.

Right: Default vertex order

Left: Actual order

I manually put the needed order together and found it to be this.
0,1,2,3,4,5,6,7,8,9,11,13,17,16,15,19,21,22,23,25,27,29,39,38,37,36,35,34,33,32,31,30,28,26,24,20,18,14,12,10 (element represents index in default order).

Is there a pattern to this ordering? Does the JSON file reveal more information on how to properly order it? Seems the only other information in there is the faces array. I do not understand how to read it or what it represents.

sentences:
How to generate a "loop room" in a platformer game (by Unity)? I want to build a level with a room whose left edge is linked to right edge in a 2D platformer game in Unity.

My goal is let all objects disappear in one side will appear in other side of the room.
Just like this:

Both sides should have collision with other objects.

Right now I'm doing this by cloning objects on the other side, but it is too complicated. Is there any other good way to solve this?

sentences:
Pygame - implementing a scrolling camera I am currently making a 2d game in Pygame and have run into a roadblock trying to make a scrolling camera (follows the character).  I have seen some other answers to similar questions, but they have helped very little.  Also, I am purposely doing this without the use of Pygame's Sprite class, so that makes things a little more complex.  How should I approach this?

display_width = 800
display_height = 640
size = (display_width, display_height)
half_width = int(display_width / 2)
half_height = int(display_height / 2)

black = (0,0,0)
white = (255,255,255)

clock = pygame.time.Clock()
pygame.display.set_caption("My game")
screen = pygame.display.set_mode(size)

background = Surface((32,32))
background.convert()
background.fill(Color('#783131'))

x = 0
y = 0

platformlst = []
players = []

level = [
    "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P                    PPPPPPPPPPP           P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P    PPPPPPPP                              P",
    "P                                          P",
    "P                          PPPPPPP         P",
    "P                 PPPPPP                   P",
    "P                                          P",
    "P         PPPPPPP                          P",
    "P                                          P",
    "P                     PPPPPP               P",
    "P                                          P",
    "P   PPPPPPPPPPP                            P",
    "P                                          P",
    "P                 PPPPPPPPPPP              P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP",]

total_level_width = len(level[0])*32
total_level_height = len(level)*32
map_size = (total_level_width, total_level_height)
virtualwindow = pygame.Surface.get_rect(screen)

class Camera:
    def __init__(self, players):
        self.left_viewbox = display_width/2 - display_width/8
        self.right_viewbox = display_width/2 + display_width/10

    def follow(self, shift_x):
        virtualwindow.x += shift_x
        print virtualwindow.x
        for i in players:
            i.rect.x += shift_x

    def viewbox(self):
        if player.x <= self.left_viewbox:
            view_difference = self.left_viewbox - player.x
            player.x = self.left_viewbox
            self.follow(view_difference)

        if player.x >= self.right_viewbox:
            view_difference = self.right_viewbox - player.x
            player.x = self.right_viewbox
            self.follow(view_difference)

Basically, the player objects are added to a list, which is called out in the follow() function, which is called by the viewbox() function.  Then the follow() function should be adding the view_difference as shift_x to the virtualwindow.x.  Shouldn't this therefore scroll the map along its x axis relative with the characters movement?

Here is the full code:
https://github.com/tear727/Netse/blob/master/game.py

sentences:
Is A* efficient even when the obstacles are moving? I'm just starting to learn about path-finding and have been looking into the A* algorithm and my main concern is that it all of the examples I have seen show static obstacles that it computes around.

If I have moving obstacles, say other characters for example, moving around as well that the character must find their way around, I'm assuming I'll have to run the algorithm each frame, but I'm worried that will become rather expensive for the hardware to process each frame for each moving actor.

So is A* still efficient enough to use whenever the obstacles are moving too, or is there another method of path-finding that handles moving obstacles more eloquently?

sentences:
Why does my blur shader implementation produce this strange result? I tried to implement the blur shader shown here.

Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply this on a 3D plane:

struct v2f {
    float4 pos : SV_POSITION;
    float4 screenPos : TEXCOORD3;
    float3 uv;
};

v2f vert(appdata_full v)
{
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.screenPos = ComputeScreenPos(o.pos);
    o.uv = UNITY_PROJ_COORD(o.screenPos);
    return o;
}

// In the frag part there is the shader blur computation but based on XYZ, with Z = 0

Then I apply the blur and this leads to this when I zoom in:

Is there a way to avoid this effect?

sentences:
How to write a unit test in Unity? is there a tutorial and patterns to write unit tests in Unity ?

Should we use the classical c# way and test the code or should we test the interactions in UI ? If so how?

sentences:
How to disable animation root motion I downloaded some animations with root motion from Mixamo and the corresponding character model.

After created an animator with those animations and added it to the character game object, the root motion was causing the transform to move around, which was not supposed to happen.

I tried to uncheck "Apply Root Motion", and set "Motion - Root Motion Node" to "None", but neither of them worked.

The only thing that worked is checking "Loop Time - Loop Pose", but it doesn't make much sense to mess with root motion, someone even proposed it shouldn't disable root motion.

So, how to disable animation root motion?

Also I'm confused, is root motion optional? Must I get animations without root motion if it's not needed?

sentences:
What libgdx project files can I ignore from version control? In an automatically created libgdx project, what files can I safely tell Git (or other revision control systems) to ignore?

I'm considering these:

*-android/.settings/
*-android/bin/
*-desktop/.settings/
*-desktop/bin/
*-html/.settings/
*-html/gwt-unitCache/
*-html/war/WEB-INF/classes/
*-html/war/WEB-INF/deploy/
*-html/war/assets/
*-html/war/
*/.settings/
*/bin/

Am I missing some? Is there a complete list somewhere?

sentences:
Events aren't working (Allegro5) I've been using allegro for some time, and the timer event worked in all my previous projects, but I don't know what happened this time, I want to move a piece as long as the game is going, but it isn't moving at all, so the timer event isn't working, why is that? I've made sure all event sources are registered. Here is the code that reproduces the problem:-

int firstStuffXPos = 100;
int firstStuffYPos = 100;
ALLEGRO_EVENT_QUEUE *eventqueue;
ALLEGRO_DISPLAY *display;
ALLEGRO_TIMER *timer;
int width = 800;
int height = 600;
int FPS = 60;
 bool donePlaying = false;

class MyClass{
public:
int getXPos()
{
    return x;
}
int getYPos()
{
    return y;
}
int x;
int y;
 MyClass(int x, int y){
    this->x = x;
    this->y = y;
    stuffone;
}
ALLEGRO_BITMAP *stuffone;
};
MyClass stuff1[] = {
{ firstStuffXPos, firstStuffYPos},
};
void initialize(){
    al_init();
    if (!al_init()){
        std::cout << "Failed to initialize allegro5." << std::endl;
    }
    al_init_image_addon();
    if (!al_init_image_addon()){
        std::cout << "Failed to initialize image." << std::endl;
    }
    display = al_create_display(width, height);
    if (!display){
        std::cout << "Failed to create display." << std::endl;
    }
    al_install_keyboard();
    if (!al_install_keyboard()){
        std::cout << "Failed to install keyboard." << std::endl;
    }
    al_init_primitives_addon();

    eventqueue = al_create_event_queue();
    timer = al_create_timer(1.0 / FPS);

    al_register_event_source(eventqueue, al_get_display_event_source(display));
    al_register_event_source(eventqueue, al_get_keyboard_event_source());
    al_register_event_source(eventqueue, al_get_timer_event_source(timer));

    }
int main(){
initialize();
for (int nostuff = 0; nostuff < 1; nostuff++){
    stuff1[nostuff].stuffone = al_load_bitmap("blueblock.png");
}
    while (!donePlaying){
        al_clear_to_color(al_map_rgb(0, 0, 0));
        ALLEGRO_EVENT ev;
        al_wait_for_event(eventqueue, &ev);
        al_start_timer(timer);
        if (ev.type == ALLEGRO_EVENT_TIMER){
            firstStuffXPos += 5;
            firstStuffYPos += 5;
        }
        for (int i = 0; i < 1; i++){
            al_draw_bitmap(stuff1[i].stuffone, stuff1[i].getXPos(), stuff1[i].getYPos(), 0);
        }
        al_flip_display();
    }

    al_flip_display();
}

sentences:
Testing my game in the engine works fine, I export to HTML5 and try but all the tiles in tilemap have disappeared Here is a link to the live game:
https://44351-w21.github.io/one-screen-platformer-francescainfranca/
As the title says all the platforms in the tilemap do not appear when you run the game on the HTML5 export. I have no missing assets, and I made sure the filenames match where they are referenced. I have no idea why this is. Any help is much appreciated.
Error in the console:
**ERROR**: No loader found for resource: res://Assets/Platform/grassLeft.png.
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: core/io/resource_loader.cpp:286:_load() - Method failed. Returning: RES()
put_char @ tmp_js_export.js:8
tmp_js_export.js:8 **WARNING**: Couldn't load external resource: res://Assets/Platform/grassLeft.png
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: scene/resources/resource_format_text.cpp:175:_parse_ext_resource() - Couldn't load external resource: res://Assets/Platform/grassLeft.png

sentences: How to model walkable houses for Unity I created a house in blender which is a big cube with the upper face intended and pulled down back to the ground. The floors are other boxes and windows and doors are cut out using a boolean modifier. The problem is that the character controller from the Unity standard assets seems to get stuck between the floors and the walls. I have seen that counter strike maps are mostly not made out of cubes but a lot of planes put together. Is that the proper way to model walkable buildings?

sentences:
why doesn't spritecollide method work? In my code, I wanted to use the spritecollides method but I got the following error message:

Traceback (most recent call last):
File "/Users/lanik2009/Documents/pygame testing.py", line 76, in <module>
hits = pygame.sprite.spritecollide(player, obstacles, False)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pygame/sprite.py", line 1645, in spritecollide default_sprite_collide_func = sprite.rect.colliderect
AttributeError: 'pygame.Rect' object has no attribute 'rect'

My code:
import pygame

pygame.init()

white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
black = (0, 0, 0)
red = (255, 0, 0)

w = 500
h = 500

x = 15
y = 480

vel = 5
screen = pygame.display.set_mode((500, 500))

square = pygame.image.load(r'/Users/lanik2009/Downloads/square.PNG')
square = pygame.transform.scale(square, (46, 40))
triangle = pygame.image.load(r'/Users/lanik2009/Downloads/triangle.PNG')
triangle = pygame.transform.scale(triangle, (46, 40))

squareSprite = pygame.sprite.Sprite()
squareSprite.image = square
squareSprite.rect = square.get_rect()

triangleSprite = pygame.sprite.Sprite()
triangleSprite.image = triangle
triangleSprite.rect = triangle.get_rect()

def drawer():
    screen.fill(black)
    screen.blit(triangle, (100, 460))
    screen.blit(square, (300, 460))

jump = False

obstacles = pygame.sprite.Group()

obstacles.add(squareSprite)
obstacles.add(triangleSprite)

running = True

while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    keys = pygame.key.get_pressed()

    if keys[pygame.K_LEFT]:
        x -= vel

    if keys[pygame.K_RIGHT]:
        x += vel

    if jump == False:
        y = 480

    if keys[pygame.K_UP]:
        y -= 40
        jump = False

    if event.type == pygame.KEYUP:
        jump = False

    drawer()

    player = pygame.draw.circle(screen, white, (x, y), 10, 500)
    pygame.display.update()

    hits = pygame.sprite.spritecollide(player, obstacles, False)
    if hits:
        running = False

pygame.quit()

sentences:
How to control an Unity character with mouse clicks? I am trying to make a 2D RPG game in Unity with an isometric tile setup.

Using Unity/C#, how do I code the character's upward, right, left, down and diagonal animations and movements using mouse button as the controls (much like Red Alert 2). Normally, this can easily be done using keyboard inputs, however, what I am trying to do is control the character by clicking the mouse. For example, if I click in a diagonal location from the character, the character should follow the mouse and also do the diagonal animation.

sentences:
How to prevent OnCollisionEnter2D calling a function again and again? My current code makes a ball keep jumping whenever it hits the ground. But when it hits a vertical ground it keeps calling the jump function again and again. That is because OnCollisionEnter2D makes the isGrounded bool true as long as it is in touch with a vertical collider. I tried several ways for example this didn't work for me:

void FixedUpdate()
{

    if(isGrounded == true){
    Verticaljump();
    isGrounded = false;
    }
}
void OnCollisionEnter2D(Collision2D collision) {
    if(collision.gameObject.CompareTag("H-Ground")){
        isGrounded = true;
    }
}

As shown in the picture the OncollisionEnter2D starts and keep adding force on y-axis.Is there any way I can call a function only once even if the gameObject keeps colliding with a surface.

OnCollisionExit2D also does not work. So how can I call a function only once as it collides with ground and even if it keeps colliding with the ground?

sentences:
What is the most efficient method to load 2D dynamic chunks? Information/context

I'm writing a 2D sandbox game - similar to Terraria. The world is made up of many chunks, in a variable like this:

vector<Chunk> chunks;

There's no need to go too in depth about the Chunk class, but each chunk has these members:

int x, y;
Block blocks[256];

When a chunk is initialized, the blocks are all set (with a Perlin noise based algorithm.) There are 256 blocks per every chunk because a chunk is a 16x16 area filled with blocks. To the loading of the chunks, the members of the Block class are irrelevant.

Question

As the player walks around the world, I obviously need new chunks to load for them to explore. I don't think it needs saying but I shouldn't load every chunk in the world at once because:

It would be incredibly inefficient to render (even with my current system of block culling,) and
I don't know how many chunks will be in the world - there can be a huge amount, basically as many as the player wants to load.

I've tried a few different (but similar) ways to load and unload the chunks, but none of them worked very well. The main problem with both was that they sometimes gave segmentation faults.

What's the best way to dynamically load and unload chunks in a world?

By "best", I mean the most performance-efficient method.

Keep in mind I can easily load a chunk at any position - this isn't the problem. I just want a way of deciding which chunks to load.

sentences:
How to convert 3D coordinates to 2D Isometric Coordinates? I wanted to make an isometric game which has a bouncing ball.

I assume that there is a way I can "show" a jumping motion in isometric, since it has been done before, but I was unable to find the maths/formulae which will help me depict this (Z-axis)motion.

If you know how i could do this please share.

Thank you :D

PS: If this sounded a bit confusing to you, just ask me in the comments.

sentences:
Making sprite rotate smoothly I have a sprite that I want to rotate smoothly and face the opposite direction:

This is my render function:

public void render() {
    // Game Loop

    Gdx.gl.glClearColor(0.7f, 0.7f, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    spriteBatch.begin();

    if(bug.getX() >= (int)(Gdx.graphics.getWidth() - 100) && bug.getY() >= (int)(Gdx.graphics.getHeight() - 100)){
        bug.rotate(rotDeg);
        turn = !turn;
    }
    else if(bug.getX() <= 0 && bug.getY() <= 0){
        bug.rotate(rotDeg);
        turn = !turn;
    }

    if(!turn){
        bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime());
    }
    else{
        bug.translate(-(v.x * Gdx.graphics.getDeltaTime()), -(v.y * Gdx.graphics.getDeltaTime()));
    }

    bug.draw(spriteBatch);
    spriteBatch.end();
}

What my code does is that when it reaches the destination (top right corner, or bottom left corner), it immediatly turns facing the opposite direction. How would I make this turn smoothly?

sentences:
Creating a retro-style palette swapping effect in OpenGL I'm working on a Megaman-like game where I need to change the color of certain pixels at runtime. For reference: in Megaman when you change your selected weapon then main character's palette changes to reflect the selected weapon. Not all of the sprite's colors change, only certain ones do.

This kind of effect was common and quite easy to do on the NES since the programmer had access to the palette and the logical mapping between pixels and palette indices. On modern hardware, though, this is a bit more challenging because the concept of palettes is not the same.

All of my textures are 32-bit and do not use palettes.

There are two ways I know of to achieve the effect I want, but I'm curious if there are better ways to achieve this effect easily. The two options I know of are:

Use a shader and write some GLSL to perform the "palette swapping" behavior.
If shaders are not available (say, because the graphics card doesn't support them) then it is possible to clone the "original" textures and generate different versions with the color changes pre-applied.

Ideally I would like to use a shader since it seems straightforward and requires little additional work opposed to the duplicated-texture method. I worry that duplicating textures just to change a color in them is wasting VRAM -- should I not worry about that?

Edit: I ended up using the accepted answer's technique and here is my shader for reference.

uniform sampler2D texture;
uniform sampler2D colorTable;
uniform float paletteIndex;

void main()
{
        vec2 pos = gl_TexCoord[0].xy;
        vec4 color = texture2D(texture, pos);
        vec2 index = vec2(color.r + paletteIndex, 0);
        vec4 indexedColor = texture2D(colorTable, index);
        gl_FragColor = indexedColor;
}

Both textures are 32-bit, one texture is used as lookup table containing several palettes which are all the same size (in my case 6 colors). I use the source pixel's red channel as an index to the color table. This worked like a charm for achieving Megaman-like palette swapping!

sentences:
How can I find the opposite angle and position of the camera? In this project I have a character and a camera that follows it.

The camera has a position relative to the character that was defined as (x = 0, y = 0, z = 0) and also its rotation:

I found a value close to its position and opposite angulation, but not really the correct value:

By pressing the Q key, the camera shifts to the position and angulation that I have discovered. Releasing the Q key, the camera returns to its initial position:

IN GAME:

As you can see, the inversion is not 100% correct.

One of the ways I thought, is a way where I take this relative value from the camera (x = 0, y = 0, z = 0) and with that:

I put the character's mesh at the location (x = 0, y = 0, z = 0) at the level and so, as the camera will be (for example) x = -250, y = 0, z = 300, it's just I invert the value of x. The angulation is simpler to deduce, but it would be interesting for me to also derive its relative value (0, 0, 0).

EDIT 1 (Attempt that I did and that almost worked out)

By clicking the down arrow to the left of the values, you can select whether you want the variable to be Relative or World (I did not know that):

Before it was all 0, it now has a value:

Taking the minus sign, I was able to figure out the opposite position:

New position:

It happens that at the time of changing the angulation from relative to absolute, a conversion is not made:

I can not get absolute value equivalent to relative. What happens is that the value 0, 0, 0 is also defined for the absolute rotation. In the image below the camera was exactly in the same position as the VR camera:

I discovered by trial and error the equivalent angulation between relative and absolute:

BLUEPRINT:

The code works correctly, but I feel that again I did not get exactly the position and opposite angles.

Here are some screenshots of the game:

Local X with NORMAL CAMERA:

Local X with OPPOSITE CAMERA:

Local Y with NORMAL CAMERA:

Local Y with OPPOSITE CAMERA:

Note that in the opposite camera you can see the end of the world (sky) from wherever you are, which is not the case with the normal camera. I noticed this, and so, I think once again I did something wrong.

sentences:
UDP sending important data often - Should I use a reliable send or unreliable with resend? I'm making a multiplayer RPG. My problem is that I send player data very often (100 ms), that contains:

Position (float x, y, z)
Radius (float angle)
Animation (int16_t id)

And because the package is unreliable, sometimes packets are lost and here the problem starts. The packet is only sent if something changes, like animation; but animation is important, they must arrive to the clients.

So the question is, should I change reliability to reliable? Or just split packet into two? Or simply resend packet?

sentences:
Easy method of obtaining texture coordinates for sprite sheet In my (OpenGL ES 2.0 Android) game, I use 2 types of Sprite Sheets.  In one type all sprites/frames are of equal size and in the other they are all different shapes and sizes.

It is the latter one to which this question pertains.  Basically, I've created a sprite sheet and I currently use Paint.net to find the coordinates a particular frame sits at.  I then have to work out the texture coordinates by dividing the pixel by the width (for X) or height (for Y) so, if my image is 2048 x 2048 and a particular frame is at 300, 500, I work it out like so:

300/2048 = 0.146484375
500/2048 = 0.244140625

So, my X (or S) is 0.146484375 and my Y (or T) is 0.244140625.

I use the same method to work out the width and height.

I then code this using a method like so:

setTexCoords(0.146484375f, 0.244140625f, 0.048828125f, 0.048828125f);  //X, Y, Width, Height

When working with lots of sprites, this is a very tedious process.

The main problem however, is if I, at a later date, want to add sprites to the sheet and make it bigger to accommodate the extra sprites, I have to revisit every sprite and work out it's new texture coords based on the new bitmap size.

Is there any method I can use to make this process easier?

Even if it's just a program where I can hover the mouse over a bitmap and it tells me the texture coordinate (between 0-1).  Even that would take a little of the work out of it.

Any suggestions welcomed.

I have read a similar question on here however, none of the answers really helped

sentences:
how to put elements around circle with equal distance? I know circle formula and know how to draw it. but I want put 4 points on it with equal distance from each other. how can I do that?

I work with unity.

sentences:
Cocos2d rotating sprite while moving with CCBezierBy I've done my moving actions which consists of sequences of CCBezierBy. However I would like the sprite to rotate by following the direction of the movement (like an airplane). How sould I do this with cocos2d?

I've done the following to test this out.

    CCSprite *green = [CCSprite spriteWithFile:@"enemy_green.png"];
    [green setPosition:ccp(50, 160)];
    [self addChild:green];

    ccBezierConfig bezier;
    bezier.controlPoint_1 = ccp(100, 200);
    bezier.controlPoint_2 = ccp(400, 200);
    bezier.endPosition = ccp(300,160);

    [green runAction:[CCAutoBezier actionWithDuration:4.0 bezier:bezier]];

In my subclass:

@interface CCAutoBezier : CCBezierBy

@end

@implementation CCAutoBezier

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}

-(void) update:(ccTime) t
{
    CGPoint oldpos=[self.target position];
    [super update:t];
    CGPoint newpos=[self.target position];

    float angle = atan2(newpos.y - oldpos.y, newpos.x - oldpos.x);
    [self.target setRotation: angle];
}

@end

However it rotating, but not following the path...

sentences:
List cells in a 2D grid that belong in a sector / portion of a circle Are there any algorithms to find out which cells in a 2D grid lie inside/is part of a slice of a circle - a pie slice shaped region?

Essentially, as per image below, I need to list out all the green cell coordinates.

At the moment, I am ray casting (using DDA based line interpolation) from the starting red cell, and sweeping across the area in with (arbitrarily chosen) small fixed angle increments, casting multiple rays; but this does not guarantee all cells will be covered.

Are there any approaches to this problem?

sentences:
Shooting Bullets Around a Sphere I currently have a ship that can orbit around a sphere freely controlled by a joystick. There is a separate joystick that controls the gun and starts shooting when it is touched.

Right now the bullets start shooting and then orbit the sphere until their lifetime has elapsed. Instead of having them orbit the sphere I want them to orbit for maybe the first half of their life and then shoot off into space. Does that make sense?

It would give the effect of a kind of glancing off the atmosphere, instead of staying in orbit for the whole time.

I am working in Unity3D and using the RotateAround() method to get the bullets to orbit. I'm thinking I need to take a snapshot of there position at half life, and then figure out the vector that would shoot them off into space. If someone could help me get going in the right direction with that, that would be great!

sentences:
What do I need to Mod a Unreal Engine 3 game? what I am looking for is some advise making a mod for a certain game and how I would go about making it. The game I am talking about is Blacklight: Retribution and what I wan't to know is;
Is it possible? And if so, what programs will I need?
It is an online only game so I was unsure how plausible a mod would be for it. Plus I have never made a video game before, but I do like the game and I wanted to do some things with it. Additionally, this will be my first time making anything video game related so I would appreciate any advise.

To expand a bit, I plan to add something simple at first. A mod that would let you spectate another player in the first person. Then I plan do something a bit more complex where I want to make so the game optionally always records you playing (in short intervals most likely or you would run quickly out of memory).
After all that is done I would add items, armor, weapons, and maybe make a map or not I am not sure but this in a shell what I hope to do. I don't know much about these things but I am reading anything I can get my hands on. So if this is overly ambitious or just plain out not a possibility any advise on what I should look to instead will be welcomed warmly. Thank you.

sentences:
Where can I find examples of demoscene-like pixel art effects? I will keep this simple. The question pretty much sums up what I am looking for. Where are some locations for 2D effects. Specifically ones like those used in old Amiga demos. They do not need to have source code. I am just looking for inspiration to code and replicate some of the effects.

It would be nice to have a list of links to images and examples as opposed to downloading old demos and running them through an emulator.

sentences:
What kind of data structure to use for planetary populations? I am in the process of building out the prototype for my space strategy game, which is focused on empire building type gameplay.

One of the most important elements of the game are the various planets and the population groups on them. I have looked at Unity and Amazon Lumberyard before settling on Unreal Engine 4 to build the prototype on, but I am not sure what the best way to store information about the populations and planets are.

For now, planets are a class of object and store their characteristics as variables (no issue there). The problem arises with the populations, as each distinct group of population will have unique characteristics (i.e. species traits, faction alignment, education level) and game objects that they have possession of (weapons, armor, industrial machinery, trade goods).

What would be the most efficient way to tie the objects owned by the population to them, and to tie the population group to their planet of residence, such that I could compute things like:

For Faction X, on Planet Y, what is the product of their population's (Education x Industrial Machinery x Planet Mineral Rating)?

I considered implementing Population as a struct stored inside the Planet class, but that seemed problematic if I needed to move the population to a transport ship and then to a different planet, or add new groups of population during runtime.

sentences:
Libgdx box2d - what is the best approach to spawn an actor on a stage dynamically? I'm currently building a 2d sprite infinite runner game, but everytime I spawn new enemy(actor) and platform, I noticed that there's a delay on it. Any idea of what would cause this behavior? I'm using textureAtlas to animate each enemy, and I used the same approach of Drops game in LibGdx.

Here's my code on the stage class

private void update(Body body) {
  if(TimeUtils.millis() - lastSpawnTime > 3000){
    float y = (float) (Math.random() * ( 5  - 1 ));
    setUpGroundInfinite(50 , y );
    createEnemy(51, y +  3);
  }
}

private void createEnemy(float positionX, float positionY) {
  Enemy enemy = new Enemy(WorldUtils.createEnemy(world,  positionX,  positionY));
  enemies.add(enemy);
  addActor(enemy);
  lastSpawnTime = TimeUtils.millis();
}

If you see any other way to optimize my game, I'd like to know them!

sentences:
What would be the best approach to creating a pressure plate in a 2D game? I've just really gotten started in Unity and while documentation has been helpful I haven't figure out how to detect collisions with 2 or more objects. I was able to get a script working that plays a sound when I touch the pressure plate with the player but I don't know how I would do something when 2 objects are within the collider but undo it when one of them leaves the area.

void OnTriggerEnter2D(Collider2D other)
{
    if(other.tag == "Player")
    {

        AudioSource.PlayClipAtPoint(Sound, transform.position);
    }

}
}

Am I going about this the wrong way by using OnTriggerEnter2D? I see that there is a mass component on Rigidbodies but I don't know if I should be using it because I am still a novice in Unity. I'm also aware of OnCollisionExit but I don't think that works in this case because I'm currently only detecting 1 object but I need to detect 2. I was able to find videos that somewhat helped but all of them only worked with one object and were in a 3D space rather than a 2d one.

sentences:
Hex axial coordinates to table coordinates conversion I am developing a browser game based on a hex map. I am storing my data based on axial coordinates system.

I developed a function which shows me axial coordinates of hexes within $distance from a given hex. Now I want to show those hexes in a form in a HTML table.

The data that I have is only axial coordinates of center hex as well a list of axial coordinates of hexes within distance (not sorted in any way)

As shown in the transition scheme below, hexes may always be shown in form of a simple HTML table:

But I am struggling at how to get each of the map hexes shown in a correct table field (row/column) of the table, assuming that table numbering looks like this:

To solve this out it seems to me that in first instance I need to determine the size of the HTML table that I need. If I will be able to determine what is table coordinate of center of the HTML table then I would be able to find out localisation of each hex in reference to the center hex.

In case of $distance = 1 I need 3 columns and 3 rows:

In case of $distance = 2 I need 5 columns and 5 rows:

This leads me to the conclusion that my required HTLM table size is:

$distance *2 + 1

The center hex lies in the middle of the table, so its coordinates are:

($distance *2 + 2) /2

But what is next, how to convert axial coordinates to table coordinates?

sentences: Game search engine in a p2p format I am currently using Java to develop a multiplayer game engine. However, I am stuck on one thing. Many games (Overwatch, DotA) have automatic game search engines - you click a button and the computer automatically finds you a game. My first thought to replicate this was to have a server that every computer running the game would connect to, then would find groups of, say, in a 3v3 team game, 6, start a new room with those 6, and run the game. However, there is one major problem here: I am only 14 and am nowhere NEAR being able to afford a server farm that would be necessary. Since I cannot afford this, a single server running the game would be out of the question, so I've been looking into the p2p (peer-to-peer) format. The problem is, I cannot think of a way to have an automatic game search engine in a p2p format without a host server. Is there any way that I can replicate this with a p2p format?

sentences:
Connecting smoothly N textures on terrain I started to create my own terrain in a quite common way, just like this:  http://www.rastertek.com/tertut18.html . It is infinite and automatically generated (by using coherent noise). The areas are determined by using Voronoi noise (http://www.ctvisualeffects.com/renderman/maya_pattern_animation/cellnoise.jpg .

I am using triangle list with shared vertices. I'd like to create areas textured differently that are connected smoothly with each other. I came up with something like giving every vertex the texture id, e.g.:

0 - grass
1 - snow
2 - sand

I was thinking about sending the texture ids (the 0, 1, 2) to the shader in the TEXCOORD semantic (the z value), however I have no further idea on how to use them there to actually blend the textures smoothly.

Could you give me any hints, please? I'd be really grateful.

// EDIT

I ended up giving each vertex weights of each texture. But this is completely not generic solution and quite heavy as I have to change vertex structure when adding another area which has another texture.

sentences:
Connecting two arbitrary points with 2 lines DEFINITIONS:

Any "Point (x, y)" mentioned below is really the bottom left coordinates of a 1 unit by 1 unit rectangle. A "Line" is a defined as a rectangle that is either 1 unit tall and 1 unit or greater wide, or 1 unit wide and 1 unit or greater tall. These rectangles are constructed given a Rectangle(bottomLeftX, bottomLeftY, width, height). The height and/or width can be negative. If either are it will shift the start x or y accordingly as so:

public Rectangle(int x1, int y1, int width, int height) {
  _left = x1;
  _right = x1;
  if(width < 0)
    _left += width;
  else
    _right += width;

  _bottom = y1;
  _top = y1;
  if(height < 0)
    _bottom += height;
  else
    _top += height;
}

THE GOAL:

Given two arbitrary points, define two lines (as rectangles) connecting the two points. The two lines need to randomly 'bend' at one of the two possible connections (see below). The two points aren't in any specific order. Point A's X and/or Y can be above, below or even the same as Point B's X and/or Y.

THE PROBLEM:

I have made a solution that only partially works. There is a bug in my method below where sometimes the two lines do not connect at the bend/junction. It seems to only be when the bend/junction is in the bottom right of the points' bounds.

WHAT I HAVE NOW:

A little background: I'm working on a random dungeon generator. I create rooms randomly, and then I am going to connect them using the described point and line system above. Here's what I have now. "graph" is a Map>, technically it's directional, but the reason was so that I wouldn't draw the same lines twice.

int x, y, dx, dy;
Rectangle a, b;
// loop through each edge of the graph
for(Rectangle outer:graph.keySet()) {
  for(Rectangle inner:graph.get(outer)) {
    // randomly set a and b
    if(random.nextBoolean()) {
      a = outer;
      b = inner;
    } else {
      a = inner;
      b = outer;
    }

    // generate the origin points based on a
    x = (int) a.getCenterX();
    y = (int) a.getCenterY();
    // and the delta of b to a
    dx = (int) b.getCenterX()-x;
    dy = (int) b.getCenterY()-y;

    // create line starting at a, then
    // create line starting at end of above line
    lines.add(new Rectangle(x, y, dx, 1));
    lines.add(new Rectangle(x+dx, y+dy, 1, -dy));
  }
}

Here's what it produces. Most of the time it works, however there are cases where the corners do not line up. I'm not sure how to fix this.

Any input is much appreciated.

sentences: RTS Pathfinding without collision between units Options Ever since I made my units move to a certain location a problem has popped up that of course if I try to make two or more units go to the same place they fight for the same spot. Am I just being stupid and unity already has a way around this or do I need to do something specific? I have looked into flow field path finding but no way on how to implement it. I dont want to have to use a ready made script but some pointers and other options are more than welcome.

sentences:
Arrow key control on winforms RichTextBox I am making a faux console using winforms for the game I am working on. Right now I am moving a '0' across the screen using the arrow keys.

In order to provide fine grain formatting on the text, I am using a richTextBox for the console display. The background for this box is black.

Problem: If the richTextBox is set to Enabled = false I can use the arrow keys without a problem but the box background color is grey and will not change. If I set it to read-only, when using the arrow keys it will just move the cursor and my arrow key events will not fire.

I am fine with setting the text to read-only and getting my black control color. So my question would be, is there a way to set the control to read-only and still allow for my arrow key events (and not move the cursor)?

sentences: Change back to initial value of rotation? I have a sprite that I can rotate and I wonder if there is a way to change the rotation back to the initial value?

sentences:
Calculating price increases in a virtual economy I'm trying to design a method to have price increase depending on the number of items bought from shops in my game.

I'm fairly new to coding and I am struggling to figure out how to program the increase in price when buying multiple items.

Currently the price increase is a percentage increase based on the quantity of items in store, however if I buy 5 items, all 5 items will be charged the same. How can I get it so each item is charged at a different price?

I also need a reasonable inflation system, right now my code just determines a price increase based on the percentage of items remaining, but it's very simple and easy to exploit.
It looks like this:

30 - 2 = 28

1 - (28 / 30) = 0.07  0.93

1 + 0.07 = 1.07

10 * 1.07 = 10.7

Rounded up

Price = 11

I'd like to make this more complex also.

sentences:
Bug with OnColliderEnter/Exit when colliding with multiple objects at almost the same time Unity Version: 2017.4.1f1

I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump.

This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air.

Note: I don't think this is an error with the velocity of the player, at no point do you go through a collider.

So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below.

private bool canJump;
private Rigidbody rb;
public float jumpStrength;

private void OnCollisionEnter(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = true;
    }
}
private void OnCollisionExit(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = false;
    }
}
private void Update()
{
    if (canJump && Input.GetKey(Keyode.W))
    {
        rb.velocity += new Vector3(0, jumpStrength, 0);
        canJump = false; // Safety measure to ensure consistent jump height
    }
}

Thanks

sentences: Is there a way to make a game using lwjgl work on android? I'm working on a platformer and I'd like to make an android version. Do I need to rewrite everything for android, or can I use something to make the lwjgl code work with android?

sentences:
Variables in static library are never initialized. Why? I have a bunch of variables that should be initialized then my game launches, but must of them are never initialized.

Here is an example of the code:

MyClass.h

class MyClass : public BaseObject {
    DECLARE_CLASS_RTTI(MyClass, BaseObject);
    ...
};

MyClass.cpp

REGISTER_CLASS(MyClass)

Where REGISTER_CLASS is a macro defined as follow

#define REGISTER_CLASS(className)\
class __registryItem##className : public __registryItemBase {\
    virtual className* Alloc(){ return NEW className(); }\
    virtual BaseObject::RTTI& GetRTTI(){ return className::RTTI; }\
}\
\
const __registryItem##className __registeredItem##className(#className);

and __registryItemBase looks like this:

class __registryItemBase {
    __registryItemBase(const _string name):mName(name){ ClassRegistry::Register(this); }
    const _string mName;
    virtual BaseObject* Alloc() = 0;
    virtual BaseObject::RTTI& GetRTTI() = 0;
}

Now the code is similar to what I currently have and what I have works flawlessly, all the registered classes are registered to a ClassManager before main(...) is called. I'm able to instantiate and configure components from scripts and auto-register them to the right system etc...

The problem arrises when I create a static library (currently for the iPhone, but I fear it will happen with android as well). In that case the code in the .cpp files is never registered.

Why is the resulting code not executed when it is in the library while the same code in the program's binary is always executed?

Bonus questions:

For this to work in the static library, what should I do?

Is there something I am missing?
Do I need to pass a flag when building the lib?
Should I create another structure and init all the __registeredItem##className using that structure?

sentences:
Maya 3d Model. 2+ Materials on a face? Snooker Table felt with lines overlay I've made a snooker table in Maya for use in a game in Unity.
The felt texture on the table is a tiled texture, I used Blinn, and 'place2dTexture' node to do the tiling.
It all looked great. Except I had hoped to 'overlay' another texture on top of the felt which is the straight line and semi-circle drawn across the table.
I couldn't use the same texture with UV mapping because the felt texture is tiled, and of course the lines texture is not (ie. It is intended to fill the whole plane on 1 to 1).
Is there a solution to this? Basically I need to know a way to overlay a non-tiled, partly transparent texture, on top of a tiled one.
Thanks for any help.

sentences:
Restrict render in Blender is not working I click "Restrict renderability", so that everything except the item I want to export is grayed out. However, it still exports lights and everything when I import it into Unity.

How can I fix this?

sentences:
How are 3D game levels built? I am wondering what is the best / most common practice in 3D games (mostly shooters) like Quake or Doom. How are the levels built?

With larger, open spaces the answer is probably some kind of terrain editor, that is what I understand. But what about things like houses or closed areas?

I see two main solutions. One is to make a whole house, factory, dungeon (or generally a level) in other tool, like Blender, and then put it in the game. Other is to make the most simple elements like walls, floor, doorways and make the level from them (like Lego blocks).

Is one of the ways more common? More "industry standard"? Are there some obvious advantages or disadvantages?

sentences:
Xcode Build Errors Unity 4.7.2 These two errors are doing my head in. New to Xcode. So please advise thank you.
FYI
I did not touch or modify anything of the Xcode that was generated by Unity. Upon opening there is a warning that says to set to recommended settings. Other than that just set the provisional file. Set the simulator device then pressed play but these two errors keep showing!
include "Unity/GlesHelper.h" file not found
include "UI/Keyboard.h" file not found

sentences: First Mobile Indie Game - Monetization Model. Ad based or in app purchases? We are a team of 3 (1 graphics designer, 2 developers). We're almost done with our first Android based indie game. Which monetization model will be suitable for us? We don't want to disturb users with a lot of ads (at this point we're thinking to put only banner ads) also, if we go with in app purchases, can we also keep ads as well? or is it a better practice to follow one model at a time? How much will it affect the user experience?

sentences:
The script in the event trigger disappears when the player dies I am making an 2D platformer for mobile in unity with c#. Right now it is setup in a way that I have one joystick that controls the players shooting, arm rotation and movement. But on that joystick there is an event trigger which is what I use to make the player shoot the gun when the joystick is pressed. The problem I am having is when the player dies the script in the event trigger disappears and I am no longer able to shoot. I am calling Destory() when the player dies and he does have lives. the location of that script is on the player I am not sure if that has anything to do with it but of anybody has any suggestions that would be great.

Here is the code for when the player dies and respawns

public static void KillPlayer (Player player)
{
    Destroy (player.gameObject);
    _remaningLives -= 1;
    if (_remaningLives <= 0)
    {

        gm.EndGame();

    }else
    {
        gm.StartCoroutine(gm._RespawnPlayer());
    }
}

sentences:
detecting the coordinates where a bullet hits a mesh I have a lot of complex objects in a scene and I'm looking for an efficient way to find which object a fired bullet hits, and to find the hit coordinates.

It would be best if there was a lightweight library to do this.

It seems that PhysX can do this, but I didn't find a way except to give every face in every mesh a PhysX system, and that seems to become a bottleneck.

sentences:
2D Grid based game - how should I draw grid lines? I'm playing around with a 2D grid based game idea, and I am using sprites for the grid cells. Let's say there is a 10 x 10 grid and each cell is 48x48, which will have sprites drawn there. That is fine.

But in design mode, I'd like to have a grid overlay the screen. I can do this either with sprites (2x600 pixel image etc) or with primitives, but which is best? Should I really be switching between sprites and 3d/2d rendering?

Like so:

Thanks!

sentences:
Unity: material has shiny white outline I have two different projects open in Unity. But my grass material appears different in each project, despite all the parameters being the same.

See this image:

On the left is the desired appearance. But on the right my material has a strange white-ish outline. How do I get rid of it?

I have tried copying the material between the projects, and the problem seems to be independent of the available lighting

sentences:
Real-time fluid simulation? I'd like to create a system in Unreal Engine 4 with glob-like fluids which interact with the environment, like the gel in Portal 2. Here's a GIF of the gel from that:

(search that I used to bring up similar images)
I was wondering how it might be possible to do something like this? An in-depth guide would be nice as I have a mostly basic understanding of blueprints in UE4, although I know it's a lot to ask for. If you know how I can achieve this, please let me know. Thank you! :)
P.S: The "fluid" stains don't need to give effects such as speed like you saw in the GIF, but I would still like the liquids to stain wherever they hit. :)

sentences:
Sounds for Car racing game Possible Duplicate:
  Car engine sound simulation

M working on 3d car racing game . Being assigned the task of creating sound effects for the car. I have all the sounds with me like idle engine sound , onLow sound, onMid sound and onHigh sound ......now the issue is i dont know how actually the other games use these sounds to create awesome sound effects ..
 Does anyone have any idea how to implement my sounds for car when it runs and changes gear all that ?

EDIT:-

When the car is at start line there would be idle engine sound.
on 1st gear the sound of accelerating car till 2nd gear.
before second gear the car sound drops (actual rpm of car drops) then gear shift and again boost in the sound and so on..

I need to simulate these events in the game. I am given with three sounds :-

sound for low speed
sound for mid speed
sound for high speed

these are steady sounds of engines at a particular rpm levels of a engine...
Hope now things are clear

Thanks

sentences:
LibGDX: open android camera I need help, I can't find a solution to open camera device in my libgdx app. I'm developing it only in Android for now but I have this issue.
I need only to open the preview view, no snap picture o make video... I followed this example but I found this unhelpful.

https://github.com/libgdx/libgdx/wiki/Integrating-libgdx-and-the-device-camera

Have you other resource to do that?

Thanks

sentences:
Java - Finding distance between player and tile in array What is the best way performance wise to do this? When I click a tile I want it to get the distance and if I am close enough I can interact with the tile. One way would be to find the tile by doing mouse / tile width when I click correct? But then how would I get that tiles position? I know how to find the distance I just don't know how to get a certain tiles position from the array when I click it

public void checkDistance(GameContainer gc) {
    Input input = gc.getInput();

    float mouseX = input.getMouseX();
    float mouseY = input.getMouseY();

    double mousetileX = Math.floor(mouseX/tiles.tileWidth);
    double mousetileY = Math.floor(mouseY/tiles.tileHeight);

    //Distance code
    double lengthX = Math.abs(playerX - mousetileX);
    double lengthY = Math.abs(playerY - mousetileY);
    double distance = Math.sqrt((lengthX*lengthX)+(lengthY+lengthY));

    System.out.println(distance);
}

sentences:
How to implement camera pan like in Maya? I am trying to implement camera pan like the one in Maya. I've got it almost working.

The problem is that the mouse cursor is moving faster than the 3d mesh (in fact I am moving the camera but I said mesh, because it is more intuitive), while in Maya the distance between the mouse position and the mesh stays always the same.

This is what my code looks like :

glm::vec3 dist = cameraPos-modelPos;
float len=glm::length(dist);

float clipX = startX*2.0 / width - 1.0;
float clipY = 1.0 - startY*2.0 / height;

float clipEndX = lastX*2.0 / width - 1.0;
float clipEndY = 1.0 - lastY*2.0 / height;

// convert begin and end mouse positions into world space
glm::mat4 inverseMVP = glm::inverse(projection*view*modelMatrix);
glm::vec4 outVector = inverseMVP*glm::vec4(clipX, clipY, 0.0, 1.0);
glm::vec3 worldPos(outVector.x/outVector.w, outVector.y/outVector.w, outVector.z/outVector.w);

glm::vec4 outEndVec = inverseMVP*glm::vec4(clipEndX, clipEndY, 0.0, 1.0);
glm::vec3 worldPos2(outEndVec.x/outEndVec.w, outEndVec.y/outEndVec.w, outEndVec.z/outEndVec.w);

glm::vec3 dir = worldPos2 - worldPos;

glm::vec3 offset=glm::length(dir)*glm::normalize(dir)*angleFovRatio*len/2.f;
cameraPos-=offset;
cameraTarget-=offset;

Where angleFovRatio = std::tan(cameraFov*0.5f)
I am using glm::lookAt(cameraPos, cameraTarget, cameraUp); for my view matrix

I will add picture of what my problem is:

As you can see, when I drag to the right, the red dots are my begin and end mouse positions. But the teapot is on the blue dot, which is not what I want.
It must be centered on the second red dot (mouse end position, just like in maya).

sentences:
How do I zoom in and out in a fully tiled based game I am currently developing a tile based game in Java and trying to add the option of zooming. I do the zoom by reducing and enlarging the tiles, but the problem is that it creates spaces between the tiles.
The default form, in which I created all of these tiles from the beginning:

When zooming out - width -= 2 and height -= 2:

Bigger zooming out:

My question is very simple, how do I zoom in and out on a tile based world?

sentences:
Native crashes on UE4 android game only in distribution build As I build my game for development mode and install it directly from apk file to my device, it runs without errors and doesn't crash, there are in-game ads and it is able to get variables from game-saves.

But once I build with Shipping and Distribution tags and upload it to Google Play I get errors on all devices that it is tested. (Installing directly through apk also crashes it.)

Here are backtraces-

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'motorola/harpia/harpia:6.0.1/MPI24.241-2.35-1/1:user/release-keys'
Revision: 'p1b0'
ABI: 'arm'
pid: 14791, tid: 14855, name: Thread-932  >>> com.MadElectron.FarmPlanet <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    r0 00000000  r1 00000000  r2 00000001  r3 00000000
    r4 000084fa  r5 95bd3280  r6 00000000  r7 00002888
    r8 9dbb5fd4  r9 980edb20  sl 96d7f100  fp 9dbb5f88
    ip a274d504  sp 9dbb5f60  lr 9fd0eed4  pc a162ad24  cpsr 20070010
backtrace:
    #00 pc 0344dd24  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN22FSessionServicesModule13StartupModuleEv+72)
    #01 pc 01b32058  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN14FModuleManager27LoadModuleWithFailureReasonE5FNameR17EModuleLoadResultb+432)
    #02 pc 01b31e98  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN14FModuleManager10LoadModuleE5FNameb+76)
    #03 pc 0196bee8  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN11FEngineLoop4InitEv+1752)
    #04 pc 0196aa10  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_Z11AndroidMainP11android_app+2568)
    #05 pc 0196e618  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (android_main+108)
    #06 pc 01981bc8  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so
    #07 pc 00041acb  /system/lib/libc.so (_ZL15__pthread_startPv+30)
    #08 pc 00019355  /system/lib/libc.so (__start_thread+6)

sentences:
What can I do with an old XNA game? I have this little amusing game that I made in my second year of high school, and I'm rather impressed with it. It isn't anything that I could present in any style of major game conference or anything, it is simply a castle-defense I enjoyed creating greatly that got me through my programming course with highest grades. It is simply too small to do anything big with, I made the majority of it in a single week Easter holiday, but I still want to share it. It was made in C#, Visual Studio 2008, XNA 3.1. It can be played by either Xbox controller connected to the computer, or by keyboard. It relies heavily on XNA codes, I only thought of making things work so I saw it and not for everyone else. Now, my question.

If I want to share it, is this possible, where do I do it, and what should I expect for incidents? I am entirely new to the concept of sharing my game online, so I don't even know where to start. Is the game simply too old? Is there someplace similar to, like, Newgrounds except for XNA games? What could I possibly release the game for?

This kind of question must arise all the time, so I don't mind if I'm linked to some other question I've been unable to locate. All questions I've been able to find are asked before the people have even started the project, which is possibly smart. Me, I'm already done with this game and I'm wondering what I can do with it.

Anyone who can sate my curiosity?

sentences:
How to implement a slight skid in a car game I have a top down car game, where I'm trying to allow a slight skid; I've tried the following code to calculate the X and Y, but there is no skid whatsoever:

radians = rotation * Math.PI / 180;

aX = (momentum * Math.cos(radians));
aY = (momentum * Math.sin(radians));

newX = playerX + aX,
newY = playerY + aY

I can get skid by introducing a velocity variable; for example:

radians = rotation * Math.PI / 180;

aX = (momentum * Math.cos(radians));
aY = (momentum * Math.sin(radians));

velocityX = velocityX + aX;
velocityY = velocityY + aY;

newX = playerX + velocityX;
newY = playerY + velocityY;

This introduces far too much skid, like the car is on ice.  I've tried reducing the amount I increase the velocity by:

velocityX = velocityX + (aX / 3);

Which sort of works initially, but still ends up ice skating and uncontrollable after playing around for a few minutes.

Are there any techniques for introducing a slight skid without this extreme side effect?

sentences:
How should I structure my turn based engine to allow flexibility for players/AI and observation? I've just started making a Turn Based Strategy engine in GameMaker's GML language... And I was cruising along nicely until it came time to handle the turn cycle, and determining who is controlling what player, and also how to handle the camera and what is displayed on screen.

Here's an outline of the main switch happening in my main game loop at the moment:

switch (GameState)
{
case BEGIN_TURN:
    // Start of turn operations/routines
break;
case MID_TURN:
    switch (PControlledBy[Turn])
    {
    case HUMAN:
        switch (MidTurnState)
        {
        case MT_SELECT:
            // No units selected, 'idle' UI state
        break;
        case MT_MOVE:
            // Unit selected and attempting to move
        break;
        case MT_ATTACK:
        break;
        }
    break;
    case COMPUTER:
        // AI ROUTINES GO HERE
    break;
    case OBSERVER:
        // OBSERVER ROUTINES GO HERE
    break;
    }
break;

case END_TURN:
    // End of turn routines/operations, and move Turn to next player
break;
}

Now, I can see a couple of problems with this set-up already... But I don't have any idea how to go about making it 'right'. Turn is a global variable that stores which player's turn it is, and the BEGIN_TURN and END_TURN states make perfect sense to me... But the MID_TURN state is baffling me because of the things I want to happen here:

If there are players controlled by humans, I want the AI to do it's thing on its turn here, but I want to be able to have the camera follow the AI as it makes moves in the human player's vision.
If there are no human controlled player's, I'd like to be able to watch two or more AI's battle it out on the map with god-like 'observer' vision.

So basically I'm wondering if there are any resources for how to structure a Turn Based Strategy engine? I've found lots of writing about pathfinding and AI, and those are all great... But when it comes to handling the turn structure and the game states I am having trouble finding any resources at all. How should the states be divided to allow flexibility between the players and the controllers (HUMAN, COMPUTER, OBSERVER)?

Also, maybe if I'm on the right track I just need some reassurance before I lay down another few hundred lines of code...

sentences:
draw fog of war using shaders I am making a RTS game, and I'd like some advice on how to best render fog of wars, given what I'm already doing.

You can imagine this game as being a classic RTS like Age of Empires 2, where the fog of war will basically be handled by a 2D array telling if a given "tile" is explored or not.
The specific things to consider here are :

1) I'm only doing a few draw calls to draw the whole screen, using shaders, and I'm not drawing "tile by tile" in a 2D loop

2) The whole map is much bigger than the screen, and the screen can move every frame or so

In that case, how could I draw the fog of war ? I have no issue maintaining on the CPU-side a 2D array giving the fog of war for each tile, but what would be the best way to actually display it dynamically ?
thanks!

sentences:
How to make TMXTiledMap responsive? I've been struggling with Cocos2d-x (C++) and finally I got to the point I feel more or less comfortable with that.

My game is a 2D car-based one, with a straight infinite map where I've finally been able to add some random obstacles. There are only 3 positions the car can be at, and everything is working fine.

The point is that I've recently noticed that it is not responsive, and tried to make it responsive by adding a line like these one to the AppDelegate.cpp:

glview->setDesignResolutionSize(1024.0, 600.0, kResolutionFixedWidth);

I've tried to use kResolutionFixedWidth, kResolutionFixedHeight and all others 5 variables you can put there, but I only got black lines along the screen and every single screen breakdown you can imagine -.-'

I can figure out I need to resize my TMXTiledMap manually because of the nature of tiles (I did it with Tiled), but I don't know how to face this problem.

Note that I'm currently developing for a 1024x600 Android device but I would want to support at least the most common resolutions for both tablets and smartphones.

Thanks in advance to anyone who can help me in some way.

sentences:
Why am I getting these errors when including stb_image.h? I'm trying to put an include guard around including stb_image.h (from the well-known public domain image library).

I have noticed that, unusually, the include guard works inside the .cpp file but not inside the header file.

Let me explain:
Inside texture.h:

//This is something that stb image defines in its own include guard, so I should be able to test for it
#ifndef STBI_INCLUDE_STB_IMAGE_H
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif

This gives me errors (multiple definitions of everything inside stb_image.h), but the same code in Texture.cpp does not give me an error.

Also, I'd like to note that this does not work either:

#ifndef WHOMST
#define WHOMST
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif

sentences:
Smooth behaviours at high Time.timeScale When I set the Time.timeScale in unity very high, many scripts seem to do werid things (because of the high deltaTime they use for their logic).

Is there an option to let unity split up one update - call with a high deltaTime to multiple calls per frame, each with a lower deltaTime?

sentences:
How to implement a mechanic of entering a town I am planning a game played on a 2-D map, where some spots are "towns". When the player walks into a town, he enters a high-resolution map of this town; when he exits the town, he returns to the low-resolution map of the world (as in e.g. Ultima 4). My question is how to implement this enter/exit mechanism in Unity? I thought of two approaches:

The world map and each of the town maps is a different scene. Entering/exiting a town is implemented by loading the appropriate scene using the scene manager.
There is a single scene, but the maps are geographically separted. For example, the world map is in coordinates 1...256, town A map is in coordinates 301...364, town B map is in 401...464, etc. Entering/exiting a town is implemented by moving the player and the camera to the appropriate map.

Is there a better approach? What approach is commonly used to implement this mechanism?

sentences:
Who should handle animations when game logic is separated from rendering? Suppose I have a tile-based game and I want the step to be 1 tile but also want the movement to be smooth while the player is getting there. If I understand correctly, the only way to achieve this would be making a series of small movements where the increment is a percentage of a tile.

My question is: should the game logic thread send the animations to the rendering thread? What is the best way to go about it?

sentences:
delaying enemy attacks I have an enemy attack script that when a raycast hits the player it deals damage to the player, however the enemy attacks at multiple times per second and I wish for the enemy to have to wait 1 second after it attacks the player before it can attack again. The script is here, the main focal point is the void update(). Any help is appreciated, let me know if I've missed out any needed details. :)
public class DamagePlayer : MonoBehaviour
{
    int attackDamage = 10;

    [SerializeField]
    float agroRange;

    [SerializeField]
    Transform castPoint;

    Rigidbody2D rb2d;

    bool isFacingLeft;

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();

    }

    bool CanSeePlayer(float distance)
    {
        bool val = false;
        float castDist = distance;

        if (isFacingLeft == true)
        {
            castDist = -distance;
        }

        Vector2 endPos = castPoint.position + Vector3.right * castDist;
        RaycastHit2D hit = Physics2D.Linecast(castPoint.position, endPos, 1 << LayerMask.NameToLayer("Action"));

        if (hit.collider != null)
        {
            if (hit.collider.gameObject.CompareTag("Player"))
            {
                val = true;

            }
            else
            {
                val = false;
            }

            Debug.DrawLine(castPoint.position, endPos, Color.red);
        }
        else
        {
            Debug.DrawLine(castPoint.position, endPos, Color.green);
        }

        return val;
    }

    // Update is called once per frame
    void Update()
    {
        if (CanSeePlayer(agroRange))
        {
            PlayerHealth.currentHealth -= attackDamage;
            //Debug.Log("can see player");
        }
        else
        {

        }
    }
}

sentences:
is there any method to simply ignore some files in unity build? as im trying to build my new app on unity android specially when i want to use gradle, there is always some conflict with manifest or libraries and .....

for debug and problem exploration i need to ignore some folders to check for those bugs instead of need to move them somewhere else.

i just thought about git branching but it can cause lots of branches and maybe not efficient

sentences:
Is it better to have object components in a variable than using GetComponent everytime? (Unity c#) Is this:

Rigidbody2D rb = GetComponent<Rigidbody2D>();

void Update()
{
    rb.AddForce(transform.up * 20 * Time.deltaTime);
}

Better than this?:

void Update()
{
    GetComponent<Rigidbody2D>().AddForce(transform.up * 20 * Time.deltaTime);
}

And can you please tell me why?

sentences:
Questions about Jrpg NPC events (Unity C#) So, I'm trying to wrap my head around something. I've got my basic quest system up and running for my rpg style game.

Right now I'm taking a look at NPC events and triggers that as I see it have two distinct styles

The classic floor panel trigger that rpg maker uses or
have a listener class for quest active / event active

My questions are thusly what's the best way to go about activating the event and what's a good way to define the event? Like set movement patterns etc would it be feasible in json? Or should I use scriptable objects?

sentences:
openGL - Updating instanced model transform in vbo every frame I am using OpenGL to render a large number of models by instanced rendering (using LWJGL wrapper).
As far as I can tell I have implemented the instancing correctly, although, after profiling, I've come upon an issue.
The program is able to render a million cubes at 60fps when their model (world) transformations are not changing. Once I make them all spin though, the performance drops significantly. I deduced from the profiler that this is due to the way I write the matrix data to the VBO.
My current approach is to give each unique mesh a new VAO (so all instances of cubes come under 1 VAO), have 1 VBO for vertex positions, textures, and normals and 1 instance array (VBO) for storing instance model matrices. All VBOs are interwoven.
In order to make the cubes spin, I need to update the instance VBO every frame. I do that by iterating through every instance and copying the matrix values into the VBO.
The code is something like this:
float[] matrices = new float[models_by_mesh.get(mesh).size() * 16];

for (int i = 0; i < models.size(); i++){
    Model cube = models.get(i);
    float[] matrix = new float[16];
    cube.getModelMatrix(matrix);    //store model matrix into array
    System.arraycopy(matrix, 0, matrices, i * 16, 16);
}

glBindBuffer(GL_ARRAY_BUFFER, instance_buffers_by_mesh.get(mesh);
glBufferData(GL_ARRAY_BUFFER, matrices, GL_STATIC_DRAW);

//render

I realise that I create new buffer storage and float array every frame by calling glBufferData instead of glBufferSubData but when I write:
//outside loop soon after VBO creation
glBufferData(GL_ARRAY_BUFFER, null, GL_DYNAMIC_DRAW); //or stream

//when updating models
glBufferSubData(GL_ARRAY_BUFFER, 0, matrices)

nothing is displaying; I'm not sure why, perhaps I'm misusing subData but that's another issue.
I have been looking at examples of particle simulators (in OpenGL) and most of them update the instance VBO the same way as me.
I'm not sure what the problem could be and I can't think of a more efficient way of updating the VBO. I'm asking for suggestions / potential improvements with my code.

sentences:
Non-perfect maze generation algorithm I want to generate a maze with the following properties:

The maze is non-perfect. Means it has loops and multiple ways to reach the exit.
The maze should be random. The algorithm should output different mazes for different input parameters
The maze doesn't have to be braided. Means dead-ends are allowed and appreciated.

I just can't find the right resources on google. The closest i found was this description of the different types of algorithms: http://www.astrolog.org/labyrnth/algrithm.htm. All other algorithms were for perfect mazes.

Can anyone give me a website where i can look this up or maybe an algorithm directly?

sentences:
Is this converting from or to premultiplied alpha? I found this code buried under some rocks:

var divAlpha = 0xff00/color.A;
var r = (byte) (color.R*divAlpha >> 8);
var g = (byte) (color.G*divAlpha >> 8);
var b = (byte) (color.B*divAlpha >> 8);

The fields on color are bytes, of course. My guess would be it's avoiding using floating point operations to handle premultiplied alpha, but is it converting from or to? How does this work out?

Example output:

0x44112233 -> a: 0x44, r: 0x3f, g: 0x7f, b: 0xbf

sentences: Collision detection using distance field for a dynamic object I am using a signed distance field for collision detection. The object I calculated the distance field for rotates between 0 and -30 degrees. The other object I want to check collision against is in a bounding volume hierarchy (BVH) of axis aligned boxes. The problem is that as the first object is rotating, I cannot use the initial calculated distance field for collision detection. One solution that I thought of is that I can rotate the Bounding volumes by an angle opposite to what the original object rotates and then check the collision but this can be computationally extensive. Is there any other better solution that I can use to check the collision with the rotating object?

sentences:
sf::mouse::getPosition method help I am trying to write sf::mouse::getPosition(const Window &Relative To) in a function but I can't write the correct argument in it. Why is that?

Here is my Game.cpp File:
EDIT: I pasted the current code:

#include "Game.h"

Game::Game() : m_window("Multiplayer Space Shooter Game", sf::Vector2u(800, 600)) {
    // Setting up class members.
    m_shipText.loadFromFile("C:\\Users\\AliTeo\\Desktop\\Piksel çalışmaları\\ship_pixel2.png");
    m_ship.setTexture(m_shipText);
    m_ship.setOrigin(m_shipText.getSize().x / 2, m_shipText.getSize().y / 2);
    m_ship.setPosition(320, 240);
}
Game::~Game() {}
void Game::Update() {
    m_window.Update(); // Update window events.
    m_ship.move(m_speedX, m_speedY);
    m_ship.setRotation(90 + m_angle);
    HandleInput();
}
void Game::HandleInput() {
    sf::Mouse m_mouse;
    m_angle = atan2(m_mouse.getPosition(&m_window).y - m_ship.getPosition().y, m_mouse.getPosition(&m_window).x - m_ship.getPosition().x);
    m_angle *= 180 / m_PI;

    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right) && m_speedX <= m_speedLimit) {
        m_speedX += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && m_speedX >= -1 * m_speedLimit) {
        m_speedX -= m_acceleration;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && m_speedY <= m_speedLimit) {
        m_speedY += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && abs(m_speedY) >= -1 * m_speedLimit) {
        m_speedY -= m_acceleration;
    }
}
void Game::Render() {
    m_window.BeginDraw(); // Clear.
    m_window.Draw(m_ship);
    m_window.EndDraw(); // Display.
}
Window* Game::GetWindow() { return &m_window; }

m_window is a member of Game.h

no instance of overloaded function "sf::Mouse::getPosition" matches the argument list

#include "Window.h"
class Game {
public:
    Game();
    ~Game();
    void HandleInput();
    void Update();
    void Render();
    Window* GetWindow();
private:
    sf::Sprite m_ship;
    sf::Texture m_shipText;
    //sf::Vector2i mousePos = sf::Mouse::getPosition();
    Window m_window;
    const float m_PI = 3.1415f;
    float m_speedX = 0;
    float m_speedY = 0;
    float m_acceleration = 0.001f;
    //float m_friction = 0.001f;
    float m_speedLimit = 0.5f;
    float m_angle;
};

sentences:
Texture visualization problem on camera movement (xna) I'm trying to move a camera over a model that is used as the floor of the game. When I move the camera, the texture of the model is not showing correctly (video of the problem: http://www.youtube.com/watch?v=bpycA7epMns&feature=youtu.be). I know that the model is fine because i use xnamodelviewer (http://modelviewer.codeplex.com/) to preview all the models, and  i can see it all right, even if i move the camera. So, the problem is in my model class maybe? what is wrong with this? any help is appreciated.

this is the model class im using:

public class CModel
{
    public Vector3 Position { get; set; }
    public Vector3 Rotation { get; set; }
    public Vector3 Scale { get; set; }

    public Model Model { get; private set; }

    private Matrix[] modelTransforms;
    private GraphicsDevice graphicsDevice;
    private BoundingSphere boundingSphere;

    public BoundingSphere BoundingSphere
    {
        get
        {
            // No need for rotation, as this is a sphere
            Matrix worldTransform = Matrix.CreateScale(Scale)
                * Matrix.CreateTranslation(Position);

            BoundingSphere transformed = boundingSphere;
            transformed = transformed.Transform(worldTransform);

            return transformed;
        }
    }

    public CModel(Model Model, Vector3 Position, Vector3 Rotation,
        Vector3 Scale, GraphicsDevice graphicsDevice)
    {
        this.Model = Model;

        modelTransforms = new Matrix[Model.Bones.Count];
        Model.CopyAbsoluteBoneTransformsTo(modelTransforms);

        buildBoundingSphere();

        this.Position = Position;
        this.Rotation = Rotation;
        this.Scale = Scale;

        this.graphicsDevice = graphicsDevice;
    }

    private void buildBoundingSphere()
    {
        BoundingSphere sphere = new BoundingSphere(Vector3.Zero, 0);

        // Merge all the model's built in bounding spheres
        foreach (ModelMesh mesh in Model.Meshes)
        {
            BoundingSphere transformed = mesh.BoundingSphere.Transform(
                modelTransforms[mesh.ParentBone.Index]);

            sphere = BoundingSphere.CreateMerged(sphere, transformed);
        }

        this.boundingSphere = sphere;
    }

    public virtual void Draw(Matrix View, Matrix Projection,bool luces)
    {
        // Calculate the base transformation by combining
        // translation, rotation, and scaling
        Matrix baseWorld = Matrix.CreateScale(Scale) * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) * Matrix.CreateTranslation(Position);

        foreach (ModelMesh mesh in Model.Meshes)
        {
            Matrix localWorld = modelTransforms[mesh.ParentBone.Index]
                * baseWorld;

            foreach (ModelMeshPart meshPart in mesh.MeshParts)
            {
                BasicEffect effect = (BasicEffect)meshPart.Effect;

                effect.World = localWorld;
                effect.View = View;
                effect.Projection = Projection;
                if (luces == true)
                {
                    effect.LightingEnabled = true;
                }
                else
                {
                    effect.EnableDefaultLighting();
                }
            }
            graphicsDevice.DepthStencilState = DepthStencilState.Default;
            mesh.Draw();
        }
    }
}

If I disable the line:
    graphicsDevice.DepthStencilState = DepthStencilState.Default;
The problem with the texture is solved, but i now have problems with the model showing things that must be hidden behind others, like in this picture:

sentences:
How to handle a Block World like Minecraft I want to write a simple game with a block world like in Minecraft. My theoretical question is what is the best way to handle this block informations during playing. My first Idea was a huge array but this will cause running out of memory I think. Maybe I have to only load the blocks near the player.

How can I handle the loading of needed block informations from a file and the holding only of needed ones in memory?

sentences:
How can I use an HLSL pixel shader to peek at other pixels? I think this is like a pixilation shader but I had a hard time trying to find one online, and one that I could manipulate specifically.

I want to create a pixel shader for my monogame project that splits the texture up into blocks. The width and height of the block may or may not match. Then on each block, I want to average out the color of all pixels in the block, and fill it in.

I'm not sure how I would do this in a pixel shader. I can do something like this in code pretty easily but that is because the code scans the entire image at once. A pixel shader though seems to run on each pixel, so I'm not sure how to do that.

I currently have a simple pixel shader where I can plug in code to test. It doesn't do anything right now but return the same color.

#if OPENGL
    #define SV_POSITION POSITION
    #define VS_SHADERMODEL vs_3_0
    #define PS_SHADERMODEL ps_3_0
#else
    #define VS_SHADERMODEL vs_4_0_level_9_1
    #define PS_SHADERMODEL ps_4_0_level_9_1
#endif

// Our texture sampler
texture Texture;
sampler TextureSampler = sampler_state
{
    Texture = <Texture>;
};

// This data comes from the SpriteBatch Vertex Shader
struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
    float2 TextureCordinate : TEXCOORD0;
};

// Our Pixel Shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 color = tex2D(TextureSampler, input.TextureCordinate);
    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile PS_SHADERMODEL PixelShaderFunction();
    }
}

sentences:
Unity higher Z position tiles rendered underneath When placing tiles in an isometric tile-map in Unity, I try to place blocks on top using the "Z Position Value" However it looks like higher Z position values get rendered underneath.

In this picture, the green cubes have a z position of 0 whereas the yellow cubes have a z position of 1. I want the yellow cubes to render on top, but they are underneath. I'm using an Isometric Z as Y tile-map and have the Transparency Sort Axis set to (x=0,y=1,z=-0.26).

sentences:
Is there a common way to execute a task at a certain pace, without relying on the task priority feature of the OS? There is no cross platform way to set process priorities, and I don't want to use threads since there are no standard method of setting priority to certain threads, apart from the fact that threads are hard to use.

Let's say I have a task that takes a certain amount of computing time, which on my computer takes 10 seconds. This task usually takes a long time, like for example, loading geometry chunk dynamically, or opening a new audio ambience file. I don't need this task to be finished instantly because it's a big task so I can't afford to wait for a frame to finish, so I need to execute it over several frames, rather a certain amount of time.

Since I don't want to freeze the game, I can cut this loop into several batches and execute one batch per frame. If my game runs at 50 fps, a 10 second task can be divided in 500 batches. If my program loops over N*500 iterations, each batch loops over N iterations. If I don't want it impact others parts of my game, I can execute N/2 or even N/5 iterations per batch.

I'm not sure if I'm reinventing the wheel though, isn't there some C++ standard thing or programming pattern that allows me to do that already ? I'm not sure if it's optimal to cut a loop, and I'm not planning to use multithreading.

sentences:
OpenGL ES 2.0: Converting GL_TRIANGLES into GL_TRIANGLE_STRIP I export my 3D geometry from a 3D authoring application. It is possible to export the vertex coordinates as full triangle arrays.

On ther other hand, triangle strips are more efficient for the OpengGL to render. This is especially true for OpenGL ES, which is very sensitive for performance.

Is it therefore possible to convert GL_TRIANGLES arrays into GL_TRIANGLE_STRIP, please?

Could anybody provide me with working algorithm? Thank you.

sentences: Algorithms for Physically based shading models For real time interactive graphics, it seems to be practical now to use physically based shading models. I want to write some shaders to incorporate into an openGL based game engine that I'm writing and I wasn't sure of what algorithms to read up on. What algorithms and models seems to be practical and useful for real time graphics as of 2014?

sentences:
Can i tell if a Vertex Tree is a solid shape? if a Vertex looks like this:

struct vertex {
    vec3 point;
    vertex [] connected;
};

Can I tell if this makes a solid shape with no holes? (e.g a sphere or a cube, NOT a sphere with a side missing for example)

(if i can see the back of a face from outside of the shape then it is not solid)

sentences:
GUI.DrawTexture problem in Unity I'm having a problem with GUI.DrawTexture() and I'm looking an alternative function to draw 2D Texture Images. The problem I have is that my textures draw above all other objects and when my camera moves, the images move with the camera, keeping their relative position inline with the cameras position.

using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using UnityEngine;

public class AnimatedGifDrawer : MonoBehaviour
{
public string loadingGifPath;
public float speed = 1;
public Vector2 drawPosition;

List<Texture2D> gifFrames = new List<Texture2D>();
void Awake()
{
    var gifImage = Image.FromFile(loadingGifPath);
    var dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
    int frameCount = gifImage.GetFrameCount(dimension);
    for (int i = 0; i < frameCount; i++)
    {
        gifImage.SelectActiveFrame(dimension, i);
        var frame = new Bitmap(gifImage.Width, gifImage.Height);
        System.Drawing.Graphics.FromImage(frame).DrawImage(gifImage, Point.Empty);
        var frameTexture = new Texture2D(frame.Width, frame.Height);
        for (int x = 0; x < frame.Width; x++)
            for (int y = 0; y < frame.Height; y++)
        {
            System.Drawing.Color sourceColor = frame.GetPixel(x, y);
            frameTexture.SetPixel(frame.Width - 1 - x, y, new Color32(sourceColor.R, sourceColor.G, sourceColor.B, sourceColor.A)); // for some reason, x is flipped
        }
        frameTexture.Apply();
        //frameTexture.LoadImage.
        gifFrames.Add(frameTexture);
    }
}

void OnGUI()
{
    GUI.DrawTexture(new Rect(drawPosition.x, drawPosition.y, gifFrames[0].width, -gifFrames[0].height), gifFrames[(int)(Time.frameCount * speed) % gifFrames.Count]);
}

}

The code above is designed to draw animated GIFs using System.Drawing.dll in Unity

sentences: Why would you want multiple render targets? In d3d11, you can bind multiple render targets ID3D11DeviceContext::OMSetRenderTargets.  But why would you want to do this?

sentences:
Right way to get reference from across scene object in unity I need a reference for the game-object from another scene but the problem is that the scene object by default is off. So I thought that
I should place its reference in another script and get a reference from it. But it will introduce me to a new script (third script) which means a new dependency. Now here is the triangle to solve the issue (which i don't like and posting here)

First scritp where the refrence is require

The actual refrence (Script/game-object) reside in a separate scene.

The reference holder

My consideration is that this is not the right way to do this job as its required dependency. How can i efficient and more professionally deal with it?

sentences:
How do I set an object's speed to arrive in X seconds? I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds.

I have tried many equations and formulas to no success.

Speed = Distance/Time

This one doesn't seem to give me the right result. Thing is the game is updated 60 times a second and the movement is affected by delta time.

I'm pretty sure I am not taking the framerate in consideration.

What am I doing wrong?

Edit:

This is how I calculate the speed:

int dst = 500;
int time = 2; // in seconds
float speed = dst / time;

Doing it this way is making the movement instant and the game object is not traveling the distance in 2 seconds.

Every frame each game objects gets updated this way:

p.x += dir.x * speed * deltaTime;
p.y += dir.y * speed * deltaTime;

The dir vector holds the direction of movement which is calculated on mouse click:

Vector2 dir = new Vector2(mouseX, mouseY).subtract(objectX, objectY).normalize();

Delta time calculation:

long time = System.nanoTime();
float deltaTime = (time - lastTime) / 1000000000.0f;
lastTime = time;

Please note: The game object stops upon arrival.

sentences:
How to make illusion of round world? I want to make a flat world, but i want to split it into pieces which will load in segments (for better optimization), and when you are at the end of map it will start loading segments from the beginning again. And I want to make an illusion of roundness (only optical effect if possible). For example, when you watch ships on the horizon, you see their masts first.

I'm asking only for theoretical ideas, so you don't need to send any scripts.

sentences: Radiosity lightmap generation Is there any working C++ source code for a lightmap generation algorithm using Radiosity or any other GI system? I've found technical papers only, but I can't really find any implementation.

sentences:
Problem with C# script in 2D game I'm busy following this YouTube tutorial for a 2D game in Unity by inScope: https://www.youtube.com/watch?v=-gC1u7qHMY4&list=PLX-uZVK_0K_6VXcSajfFbXDXndb6AdBLO&index=6

I decided to not finish the attacking episode and skipped to the next episode.
But things were not working out so I deleted all my new work so everything will be back to how it was before.

But low-and-behold my attack stopped working. What should happen is whenever I press Left Shift my character should play his attack animation.

I've rechecked the videos again and again but I can't find whats wrong with my script! The script is in C#, and there are no errors in the script. I don't know whats wrong PLEASE HELP!

public class Player : MonoBehaviour
{
  private Rigidbody2D myRigidbody;

  private Animator myAnimator;

  [SerializeField]
  private float movementSpeed;

  private bool attack;

  private bool facingRight;

  // Use this for initialization
  void Start ()
  {
    facingRight = true;
    myRigidbody = GetComponent<Rigidbody2D> ();
    myAnimator = GetComponent<Animator> ();
  }

  void Update()
  {
    HandleInput ();
  }

  // Update is called once per frame
  void FixedUpdate ()
  {
    float horizontal = Input.GetAxis ("Horizontal");

    HandleMovement (horizontal);

    Flip (horizontal);

    HandleAttack ();

    ResetValues ();
  }

  private void HandleMovement(float horizontal)
  {
    myRigidbody.velocity = new Vector2 (horizontal * movementSpeed, myRigidbody.velocity.y);  // vector2 = x-axis - 1, y-axis = 0
    myAnimator.SetFloat ("speed", Mathf.Abs (horizontal));
  }

  private void HandleAttack()
  {
    if (attack)
    {
      myAnimator.SetTrigger ("Attack");
    }
  }

  private void HandleInput()
  {
    if (Input.GetKeyDown (KeyCode.LeftShift))
    {
      attack = true;
    }
  }

  private void Flip(float horizontal)
  {
    if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight)
    {
      facingRight = !facingRight;

      Vector3 theScale = transform.localScale;

      theScale.x *= -1;

      transform.localScale = theScale;
    }
  }

  private void ResetValues()
  {
    attack = false;
  }
}

sentences:
Visual Basic PictureBox A description of my game:

When you start the game, you have a few seconds to memorize the arrangement of the grids. By the arrangement, I mean each grid is one of two colors. After the time is up, all the grids are set to the 'off' color. The player must click on the grids to toggle them and put them in their correct color assignments as they were seen before.

Okay so this is part of a game I am developing.Instead of using solid colors, I want use background images but I don't know how to edit the code to do so.
Any help would be welcome.

Dim GridOn As Color = Color.LightBlue
Dim GridOff As Color = Color.DarkBlue
Dim MaxTime As Integer = 40

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    For Each pic As Control In Me.Controls 'For every picture in form1's controls...
        If TypeOf pic Is PictureBox Then   'Then, only picks the pictureboxes, not the buttons, labels, etc.
            AddHandler pic.Click, AddressOf PictureBoxClick 'For each picturebox (grid), add an event handler (PictureBoxClick) to avoid
        End If                                              'typing 16 of them ourselves
    Next
End Sub

    Private Sub PictureBoxClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
    If AllowEdit = True Then
        Dim ctrl As PictureBox = DirectCast(sender, Control)
        If ctrl.BackColor = GridOn Then
            ctrl.BackColor = GridOff 'Set the backcolor to either GridOn or GridOff
        Else : ctrl.BackColor = GridOn
        End If
    Else
        'Do not allow the user to change the colors
    End If
  End Sub

sentences:
How can I make user-friendly polar coordinate movement around a circle? I am working on a 2D game where you land on planets with a ship and can exit the ship and walk around.

These planets are very small (think ~350 pixel radius sometimes), and are seen from the side. So you can easily see the whole planet on the screen generally.

This may be sort of confusing so here's a picture:

I am using the A and D keys to move counter-clockwise and clockwise, respectively. The problem is that if you are on the "top" of the planet (upper half), this makes sense: A moves to the left, D moves to the right. However, if you are on the "bottom" of the planet (bottom half), A moves to the right, and D moves to the left.

Any ideas on how can I make this more user-friendly?

sentences:
algorithm for combining smaller tiles to balance the bigger ones I have a field of tiles - basically each tile is a country that has some kind of sovereign. The tiles - countries - have different weight. For now I use some numerical value but in the future the weight will depend on tile size, produced resources and so on.

So I want for those countries to make alliances if their sole weight is much lower - or at least lower than a certain threshold - than the weight of the neighborhood tile (each sovereign is basically a primitive AI at that stage that is able to make decision to create the alliance). Here is couple of scenarios

Here are the examples for bigger maps with possible alliances

So my question is - is there some kind of algorithm that allows to achieve that or I have to create it myself or use training sets for AI to gain the ability to form alliances?

sentences:
Unity IUnityLifecycleManager already exists I followed this tutorial https://www.youtube.com/watch?v=OElh7wda4Qc in Unity version 2019.3.1f.1 Personal Edition, but I got 6 errors like this in the console, also I updated to version 3.4.4 via the package manager, because it said that the asset store version was not compatible anymore.

  Library\PackageCache\com.unity.ads@3.4.4\Runtime\Monetization\AndroidPlacementContentOperations.cs(55,40): error CS0433: The type 'IUnityLifecycleManager' exists in both 'UnityEngine.Advertisements.Editor, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null'

This is the code I am using, its the same as the code in the official website, but personalized to my project.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class adsController : MonoBehaviour, IUnityAdsListener
{
    public bool testMode = true;
    public Button rewardedAd;

    private string storeID = "3509232";

    private string rewardedVideo = "rewardedVideo";

    private void Start()
    {
        rewardedAd.interactable = Advertisement.IsReady(rewardedVideo);
        rewardedAd.onClick.AddListener(ShowRewardedVideo);

        Advertisement.Initialize(storeID, testMode);
    }

    private void Update()
    {

    }

    private void ShowRewardedVideo()
    {
        Advertisement.Show(rewardedVideo);
    }

    // Implement IUnityAdsListener interface methods:
    public void OnUnityAdsReady(string placementId)
    {
        // If the ready Placement is rewarded, activate the button:
        if (placementId == rewardedVideo)
        {
            rewardedAd.interactable = true;
        }
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            // Reward the user for watching the ad to completion.
            Debug.Log("Reward");
        }
        else if (showResult == ShowResult.Skipped)
        {
            // Do not reward the user for skipping the ad.
            Debug.Log("Not Reward");
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }

    public void OnUnityAdsDidError(string message)
    {
        // Log the error.
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Optional actions to take when the end-users triggers an ad.
    }
}

EDIT:
Looks like I forgot a line in the code and reinstalling the unity ads package now it runs but still gives this warning.

  Please consider upgrading to the Packman Distribution of the Unity Ads SDK.  The Asset Store distribution will not longer be supported after Unity 2018.3

sentences: What advantages does DirectX 11 have over DirectX 10? What advantages does DirectX 11 have over DirectX 10?  Most of the new features seemed to be for directcompute from what I can tell, and how much more are you limiting your market by if you use DX11 compared to DX10 (assuming you don't add DX10 support).

sentences:
How do you get textures out of a png file I have 1 png of many different textures. I want to use these textures in my iphone game using cocos2d. I found the program "Zwoptex" where you can combine many textures to one png and create a plist file that you can use in your program.

But if you have already a png file how do you get all these textures out of this file automatically OR how do I create a plist file from this png file?

sentences: How to test an android game made in Unreal Engine 4 I have made a android game in unreal engine 4 version 4.12.4 and I want to test it on a real android device and i do have an android tablet but i don't know how to get the exported project onto the tablet for testing so can someone tell me please?

sentences:
How to calculate the price for acquisition of a mobile game I searched long and hard thru the Game Dev community here and I didn't manage to find a good enough answer for a situation that I need help with.

Here is the deal - I've spent about a year to single-handedly develop a mobile game which is a mix between MMORPG and idle battle games. Wouldn't like to go into too much depth as to which game we are talking about and who is trying to buy it but, a company I have worked for before reached out to me with a proposal to buy the game from me so they can reap the profit from it and develop it further since they are a professional game dev company while I am a single person and I can't really reach the game's full potential as far as growth and player base goes. Now the game is pretty beneficial for me since I live in a region with a very low-income standard so the money I get from the game might not be much for many other people but for me, they are equal to about 1.5 ~ 2 monthly salaries (we are talking average salary for this country). That is about 600 Euros of pure profit after I pay for all the expenses. Of course, this number fluctuates depending on different events and sales I release and general user activity. It is a free-to-play-game so the income is mostly from microtransactions for in-game rare currency and special event item packs purchases.

Now the issue I have is that I am not sure how to set a price for the acquisition. What feels right for me would be to calculate the potential average income from the game in the next 12 months and add to this the average salary per month for a game dev of my qualifications multiplied by the number of months it took me to develop it to its released state. That would round up to about 15k euros.

When I think about it 15k euro isn't a small price to pay, but the game will pay that off in the next 1-2 years, and it might even grow much faster after they make investments for advertising and release new features and so on and so on. This means that after the second year they should be on a clean juicy profit from that deal, and that sounds good to me as well since 15k euros for me is a decent sum of money considering that the game has been running for about 14 months. And lets not forget that it has been beneficial for me for the last few months so it hasn't been always uphill.

What I need really is an advice as to is this price of around 15k Euro justified and is it a good deal for both sides, since I don't want to shoot way high and blow the acquisition, but I don't want to give the game away for a low price since it really holds a lot of potential, and it is my first fully released game.

sentences:
Unity assembly files missing from "Temp/bin/Debug" I'm trying to use VS Code on a Mac with Unity and C#. When I try to open a Unity project in VS Code, it can't load Assembly.dll* files from few locations which are defined by default in .csproj files; "Temp\bin\Debug\".

When I check the *Temp\bin\Debug* paths, while Unity is running, they are empty; they doe not contain the assembly files, where I assume they should. The files are in "Library/ScriptAssemblies". Moving them is not an option, because I would have to do that manually every time I change sth. in any script file. Changing the path in the .csproj files is also not a good idea, because those files get rewritten every time you open a project in Unity.

This issue causes lot of problems in the editor:

  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
  [INFORMATION:OmniSharp#MSBuild] Update project: Assembly-CSharp-Editor-firstpass
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
  [INFORMATION:OmniSharp#MSBuild] Update project: Assembly-CSharp-Editor
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-Editor-firstpass.dll'
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'

All type references coming from my custom scripts and the UnityEngine namespace are missing, and highlighted as errors:

However, intellisense seems to be working fine for UnityEngine types:

I tried to reinstall MonoDevelop it a few times, including a brew and downloadable package. MonoDevelop seems to be installed properly:

  $ mono --version
   Mono JIT compiler version 4.6.2 (mono-4.6.0-branch/ac9e222 Wed Dec 14 17:02:09 EST 2016)
   Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug
    LLVM:          yes(3.6.0svn-mono-master/8b1520c)
    GC:            sgen

.NET works as well:

  $ dotnet --version
  1.0.0-preview2-1-003177

How do I fix this?

sentences:
Is it possible to use the Unreal Engine as a big C++ library, without using the editor? I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike its visual editor: I find it heavy, slow and unintuitive. Finally, it forces me to use Visual Studio instead of my favourite C++ IDE.

Is there a way to use the Unreal Engine as a big library that I could simply include in my C++ project, or am I forced to used the Unreal Editor?

Related question for Unity: How can I build a game in Unity with minimum/no use of the visual editor?

sentences: how to breakdown my game project? I am a newbie so when ever i start over i get stuck how to organize things (code) or what should be the order of my work. Can you share your experience of project granularity so i can make my mind what should be done first and so on.

sentences:
Speech synthesis book? When I was a kid, everything had a speech synthesizer in it, more or less. A couple years back I started to wonder where the technology is going after all these years, and after some research found that it's going nowhere. Storage has increased, making concatenative synthesis more life-like, but little else has improved.

Text to speech seems to be the primary research field. Most books I've found of the subject of speech synthesis skim on the actual voice generation and then spend hundreds of pages on text to speech.

I'm not interested in text to speech as such, but more on the voice generation. Yet, I haven't found a single book with good, practical explanation of this. Concatenative synthesis is simple to grasp, but formant is the one I'd like more information about. (The third method, physical modelling, would be a plus, but not all that interesting).

What makes this game specific is that I'd love to make a tool that lets low budget/downloadable games have speech, without having to go out to get actual voice actors and having to store hundreds of megs of oggs with the game. Since the author is in complete control of the voice editing before release, text to speech is less important; what's more important is the voice synthesis.

So, anyone know any good books about this?

sentences: How to force Landscape Mode Unity3D Android Game? I am developing a small side project on Unity that will ultimately be for Android but I cannot figure out how to force landscape on the device and when I have tried it out the game just goes all over the place! I am using Unity Canvas and have spent a long time with binding position points etc. but I cannot work it out! Could someone please tell me how to force the phone into landscape mode?

sentences:
Is it acceptable to say "Inspired from ... game" For a game I'm developing, I would like to use "inspired from ... game" to acknowledge and praise that game. But I'm not sure if this is a good idea from a legal point of view. They might think my game is a ripoff, and base the claim on my word.

Any ideas?

sentences:
Changing color for each element in linerenderer not working I want to change color for each line (element) just like in color switch. But my code is not working. What I wanted is that the right line should turn blue then the down line should turn color red. What is wrong with my code?

void Start()
{
    lineGeneratorPrefab = new GameObject();
    DrawLine();
}

private void DrawLine()
{
    GameObject myLine = new GameObject();
    myLine.transform.position = start;
    myLine.AddComponent<LineRenderer>();
    LineRenderer lr = myLine.GetComponent<LineRenderer>();

    lr.positionCount = 4;

    lr.SetPosition(0, new Vector3(-2, 0, 0));
    lr.SetPosition(1, new Vector3(2, 0, 0));
    lr.SetPosition(2, new Vector3(2, -2, 0));
    lr.SetPosition(3, new Vector3(-2, -2, 0));
    lr.materials[2].color = Color.blue;
    lr.materials[3].color = Color.red;
}

sentences:
JME3 Transparent Image Shows Geometries Behind I'm using jME3 (JMonkeyEngine). I’m setting a geometry (a box with a bullet hole material/texture) to show transparency using

material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
geometry.setQueueBucket(Bucket.Transparent);
geometry.setMaterial(material);

I guess it works, but this happens:

Basically, instead of the transparent part of the image (bullet hole) showing iron man’s (first model) red armor, it shows the ninja’s green clothing, which is in the same position but behind the iron man model. This happens even when the geometry is in front (between the camera and the both models) of the models, so idk what’s happening. Any help is appreciated!

sentences:
Networking in a strategy, city management game I'm developing a city management mobile game with its' share of multiplayer elements (leaderboards, achievements, social interactions). It's built using Unity and GameSparks as a backend. I'm a little bit confused on how I should be implementing the networking.

At the end of every in-game month, the game should go through every business building, calculate the revenue (each building generates different amounts of money depending on the number of workers), then add this value to the player's funds. These funds can then be used to continue building more businesses and houses, which increase the population.

I have to save the states for the city (buildings, population, etc) and player (funds, premium currency, etc) in the cloud.

I'm afraid people will exploit the game (due to the leaderboards) if I entrust data with the client, and I feel it would be best to keep the system deterministic, but I'm not completely sure I'm doing the right thing. How would you solve the problem?

sentences:
Unity Input System: Rebinding composite parts I have controls for movement defined as composite Binding through Vector 2D.

I have shown in settings any single binding which is not composite. I understood that I must get a composite index for binding, which is correct, I got the right binding like up, down, ...
But whenever I click on button for change something on Move, whole game freezes. And I can't do anything... Is there something I'm missing, when rebending part of composite?
Here is my code and screen, how the control settings looks.
public void Start()
{
    Button.onClick.AddListener(() =>
    {
        Key.Text = "Listening";

        _operation = Action.PerformInteractiveRebinding()
            .WithTargetBinding(BindingIndex)
            .Start();

        _operation.OnApplyBinding((op, path) =>
        {
            Action.ApplyBindingOverride(BindingIndex, path);
            Key.Text = Action.bindings[BindingIndex].ToDisplayString();
            _operation.Dispose();
        });
    });
}

sentences:
Which is the best method implementing a background scrolling for game in libgdx? My question is very simple I am new to libgdx development, which is the best approach implementing a background that is to make the background move in y direction

1)My First approach is drawing the background image 10 times towards positive y direction using camera.translate(x,y) function to move camera from bottom to top
2)second approach is to make the camera still while making the background scroll ie drawing the background frame by frame updating the position each time

Can you please suggest which is the best approach?

sentences:
Depth is disabled - How to turn on? In XNA 3.1 is there any other way to disable depth in 3D Worlds using DirectX models other than

GraphicsDevice.RenderState.DepthBufferEnable = false;

?

The reason for my question is I have quite a huge program which offers a 3D World with a couple of 3D DirectX models inside. Depth was never an issue since it ever worked fine but since a few days after doing some modifications my models are all depth-translucent i.e. depth-buffering and/or culling seems to be disabled.

But in my whole source code I never touch any of the options related to Depth or Culling which means I never turn these settings on explicitly nor turn it off somewhere.

So I am searching for some other statement maybe related to the GraphicsDevice that implicitly turns depth off - but I can't find it.

(Sorry that I don't post any source code but I have too much source code and I simply don't know where to search)

UPDATE:

These are a couple of simple objects seen with correct depth.

These are the same objects in their current state.

sentences:
How to process multiple shadow maps in deferred shading I'm attempting to implement shadow mapping in an OpenGL deferred shading system.

I know how to handle a single shadow map in the lighting stage, but I want my rendering system to be able to support multiple shadow maps.

At present, My lighting shader is capable of supporting up to 128 point and spotlights in a single pass.

I'd like to know how to modify the shader to handle an indeterminate number of shadow maps of each type (ortho for directional, cube for pointlights, projection for spotlights).

Normally, when I define a sampler in GLSL, i simply use :

uniform sampler2D shadowMap;

But I think it would be cumbersome to define up to 256 individual sampler uniforms, if it were even possible (which I am far from convinced about).

Is there a way to define an array of samplers which I can iterate through on a 1:1 ratio for each light, and if so, how would I do this?

For instance, I know that I can use UBO's to send the data for many lights to the shader, so can I do the same to populate an array of samplers, like so:

shadowMaps[MAX_SHADOWMAPS];

Or:

uniform sampler2D
{
    shadowMaps[MAX_SHADOWMAPS];
};

sentences:
How can I launch the Unity Editor and open a specific project from C# code? I created a very simple console application:

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // The project I want to open
            var arg = @"""-projectPath C:\Users\Administrator\Downloads\New Unity Project""";

            // Start Unity and open the project
            Process.Start(@"C:\Program Files\Unity\Editor\Unity.exe", arg);
        }
    }
}

But only the Unity Editor is launched; the specified project is not opened.

What do I need to modify to launch the project?

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

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

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

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

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

thanks

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

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

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

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

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

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

         float4x4 unity_Projector;
         float4x4 unity_ProjectorClip;

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

         sampler2D _ShadowTex;
         fixed4 _Color;
         float _Attenuation;

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

sentences:
Present fails randomly on mixed C++ Direct3D9 app I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class which extends System.WIndows.Forns.UserControl.

Everything has been working fine for years now, but I recently put another instance of this Direct3D9 control inside a new Windows Form. That is, I have two concurrent instances of the control. I had done that before and it worked, but now I have issues. Perhaps the problem was always there, but because it's related to a race condition, it started happening now...

Ok, the details: When I try to render an image over a texture on the new instance of the control, sometimes it works, sometimes it doesn't. And when it doesn't, nothing is rendered, and from that point onwards, all Present calls fail (I log those failures). If I close the form and open it again, it might work or not. Nasty.

If I use DXGetErrorString and DXGetErrorDescription, all I get is something like:

  EFAILED Undetermined error

Not really helpful... To make matters worse, I can't reproduce the issue in my development environment; I only see it in a production box.

As far as I know, the main reason Present fails like this is a Lost Device. But I implemented the usual scheme to handle that (I can post the code if necessary), and it seems like the device is not being lost... What else can I try?

sentences: Rotation based on movement How can i calculate angle based on movement in C# XNA when i'm moving object with accelerometer? If object is moving up, sprite would rotate in corresponding direction. Should i use two vector coordinates(old, new) to calculate angle using Atan2?

sentences: Unlock cursor through script I am using unity's default FPS controller script. My game switches scenes, and when it does I can't move the mouse. I know that this is because of unity's m_mouselook's lock cursor is on. What I don't know how to do is turn that boolean to false through a different script.

sentences:
Canvas - darken sprites rendered by drawImage I am implementing lighting in a tile engine, and I need a way to darken tiles, based on their light level.

For the ground tiles, I can clear the context to black, then set the globalAlpha and use drawImage normally. But what about foreground tiles, such as trees? I don't want them to be translucent, just darker. Is there any way to filter the output of drawImage?

sentences:
Tools for generating texture atlases/sprites from source images? Is there an industry standard file format for texture atlases?

What are the apps that take a directory of images and turns it into a texture atlas png and a text file describing what's on it?

This is primarily for use in OpenGL iPhone/Objective-C, but it seems like there ought to be a standard across many platforms.  I can create these by hand or by writing a script to simply tile them, but it seems like there would be some tools already made for this.

sentences:
Calculate Relative Mouse Movements Regardless of position Context

I'm working on making a variant of the atari game Breakaway IV and I'm trying to improve my mouse input handling.

I use the input of a mouse's motion left and right to move the bumper.

public void mouseLocationChanged(Point mouseLocation) {
    if (lastMouseLocation == null) {
        lastMouseLocation = mouseLocation;
        return;
    }
    bumperStep = (int) ((mouseLocation.x - lastMouseLocation.x) * SENSITIVITY_MULTIPLIER);
    lastMouseLocation = mouseLocation;
}

Then in the update method of my game I check if there is a bumper movement queued up.

 public void update() {
    if (inputHandler.isBumperMove()) {
        submitBumperMove(inputHandler.getBumperMove());
    }
    ...
}

If there is, I move the bumper with the below code.

public void submitBumperMove(int move) {
    if (move < -1 * BUMPER_SPEED_LIMIT) {
        move = -1 * BUMPER_SPEED_LIMIT;
    } else if (move > BUMPER_SPEED_LIMIT) {
        move = BUMPER_SPEED_LIMIT;
    }

    testPoint.x = bumper.x + move;
    testPoint.y = bumper.y;

    while (testPoint.x != bumper.x) {
        if (!willCollideWithWall(bumper, testPoint)) {
            bumper.x = bumper.x + move;
            if (bumper.hasBall){
                ball.x = ball.x + move;
            }
        } else {
            move = shrinkStep(move);
            testPoint.x = bumper.x + move;
        }
    }
}

Observed bugs

I don't reset bumperStep with the call to getBumperMove() so the cursor drifts if there isn't a different input to set bumperStep to 0. This mainly happens when the mouse exits the window.
When resetting bumperStep to 0 with getBumperMove() (making it consumeBumperMove()) the mouse can run out of the window before the bumper reaches the edge of the game and the bumper can't be moved to the edge.

Proposed Solution

I was considering resetting the mouse cursor in the center of my window (with the cursor invisible) while the game is in "play" mode with each game update. This would prevent the problem of the mouse leaving the screen and not working while still allowing me to consume the movements which will stop the drifting bumper I'm observing.

Questions(finally ;-) )

Is there a better approach to getting mouse left and right movements from any position in java, or should I stick with just keeping the cursor where I want it?
If locking the cursor is the way to go, how can I pragmatically set the mouse position in Java? I've heard about a Robot class that is supposed to help, but it looked like an application needs special signing/permission to use that.

sentences:
Occlusion culling of BV tree nodes behind terrain So I have a bounding volume tree, almost an octree but not quite.

Anyway I'm trying to optimize my drawing, right now I have a few different culling frustums that I use to cull different ranges of the BV tree, its very fast, I can pull all my world data in less than 1ms but when it comes to culling the grass and the other mesh data I'm thinking that because I have lots of mountains and hill that I'm rendering stuff that is inside the frustum but occluded but hills and mountains.

What would be the right way to cull this? Should I do a ray cast against my terrain from each corner of the bounding boxes to the player and cull anything that gets a hit? or should I find some fancy way to do it on the GPU?.

I only have to test maybe 1k boxes x 8 corners, so the ray casting shouldn't take to long.

sentences:
Animation import: What am i doing wrong? I need some help with an Animation that i want to import with Humanoid type (made in Blender).
Essentially i made an animation in blender with IK/FK (Rigify, with a bone for the sword, and IK to the hand). This is the preview in blender: https://i.gyazo.com/4f197c5e0ff1b291b45399fb4325ffc9.mp4
And this is when i import and set the animation with humanoid (activated the mask on the sword bone, parented with the root bone): https://i.gyazo.com/b042c29895be8e3db93edaa22e2a3665.mp4
In Blender i keyed IK and FK swith with the slider of Rigify, so i can move the hand without sliding. What i'm doing wrong? This is the Blender Rig (Rigify) with the sword bone https://i.gyazo.com/00a1f9f523e67c0371b7f00e48c58ae9.mp4

sentences:
Invulnerability timer while standing on spikes I want to decrement the player's health every .7 seconds while the warrior is standing on a spike tile. Every frame, the game calculates what kind of tile the player is walking into. I've tried calling a function that uses setTimeout from the spike tile code in the walkingIntoTileType switch statement and I've tried using setInterval directly in the switch statement. My current implementation has this declaration at the top of the warrior class:

this.interval = setInterval(function() {
            //blank
        }, 1000);
clearInterval(this.interval);

I then have this in the warrior movement code, which gets run every frame:

switch( walkIntoTileType ) {
  case TILE_GROUND:
    this.x = nextX;
    this.y = nextY;
    this.onSpikes = false;
    break;
  //other tile type code...
  case TILE_SPIKES:
    this.x = nextX;
    this.y = nextY;
    this.onSpikes = true;
  default:
    // any other tile type number was found... do nothing, for now
    break;
}
if(this.onSpikes){
    if(!this.running){
        this.running = true;
        this.interval = setInterval(function() {
            this.playerHealth--;
        }, 700);
    }
}
else{
    this.running = false;
    clearInterval(this.interval);
}

Despite this, the player's health never gets decremented when on the spikes, and the console returns no errors. I would think the interval is not falling victim to garbage collection since its variable is declared at the top of the class, but obviously I could be wrong.

sentences:
3D vector graphics - maintaining correct Z 'length' So I'm trying to build myself a 3D display 'engine', or whatever it ought to be called. I've been experimenting with PyGame, as it's familiar to me.

In a way this has almost been more an excuse to learn the math than to actually build a 'game engine' or anything like that, though ultimately that's why we're all programmers right? To code the next Super Mario Brothers. :) Anyway, this isn't that, it's a learning project, but unfortunately I seem to have hit a wall and I'm not entirely sure how to proceed or what to look for.

I'm unsure of how to move items smoothly on the Z-axis. 0 is the 'closest' a point gets to the screen, whereas N is the 'furthest' it could go. In the interest of (hopefully) keeping my math similar across calculations, I've set HEIGHT, WIDTH, and DEPTH all to an arbitrary value of 600.

It would appear that moving objects along the Z-axis is not quite the same as moving them along X and Y. Whereas X and Y are just addition and subtraction, Z is apparently only really effective as a percentage. Unfortunately I can't seem to find a method of incrementing Z in any way that doesn't stretch the shapes as if they're going into Warp when I move them closer to the horizon point. Likewise they squash nearly flat as they move closer to the screen.

I believe that the two most likely code candidates for weirdness are the following two snippets; one is the model's "move all the points" method, the other is a view method. Hopefully the code I'm not sharing is self-evident; Zpt is a class that contains x, y, z coordinates, and so on.

def move_pts_to_pt(self, newX=None, newY=None, newZ=None):
##This is how the model moves its points
    oldCtr = self.center
    if newX is not None:
        deltaX = newX - oldCtr.x
    else: deltaX = 0
    if newY is not None:
        deltaY = newY - oldCtr.y
    else: deltaY = 0
    if newZ is not None:
        deltaZ = newZ
    else: deltaZ = 1
    for zpt in self.zpts + [self.center]:
        zpt.x += deltaX
        zpt.y += deltaY
        zpt.z *= deltaZ

def zshape_draw(shapelist, objcolor=(255, 0, 0), objwidth=2):
##This is the view's drawing method for points with a z coordinate
    for shape in shapelist:
        drawnpoints = []
        for zpt in shape:
            z = zpt.z
            horzoff = z / DEPTH
            invhorz = 1.0 - horzoff

            newX = (zpt.x * invhorz) + (WIDTH * HOR_X * horzoff)
            newY = (zpt.y * invhorz) + (HEIGHT * HOR_Y * horzoff)
            drawnpoints.append((newX, newY))

        pygame.draw.polygon(SCREEN, objcolor, drawnpoints, objwidth)

I apologize if I've left any code out; I'm happy to re-edit my post. In any event, I cannot suss out what it is I need to do to prevent the z-values that are closest to the 'back' of the screen from increasing much faster than those closer to the screen, while still maintaining their intended 'shape' -- that is, generally looking like they aren't changing in depth as they move from z=0 to z=600 (or, whatever ends up being 100% 'away' from the screen).

sentences:
Entity Component System: Retrieving components quickly Possible Duplicate:
  Retrieving components from game objects (entities)

I'm working on an entity-component-system game at the moment. I've looked in particular at the Artemis framework and a c# port of it but I am writing my own implementation of the pattern.
http://gamadu.com/artemis/manual.html

I'm puzzled as to how components are retrieved from the EntityManager.
As far as I can tell I have two options:

Assign each type of component a static ID, that is used as the index of the component (my entities are held as EntityComponent[entityID][componentIndex]) but I'm concerned that in a situation where an entity has a component of ID 9, that I will then have size the array to 10 and have 9 empty elements preceding the sole component, consuming memory unnecessarily.
Alternatively I could write a generic method e.g EntityManager.GetComponent(int entityID)
but this would require a look up or OfType<> call against the entities components.

Surely there is a more efficient way. What am I missing?
Artemis includes a ComponentMapper class but I struggle to understand what it does.
I want to ensure the basics of the system work as efficiently as possible.
Many thanks in advance for any feedback.

sentences:
How to convert .max files to .egg on linux I am very new to 3d graphics and game engines and panda3d and python. I followed few panda3d tutorials and now I want to test them with few new models. High majority of 3d models in the internet are in .max format.

Is there a way to convert these models to a format that can be used with panda3d. (.egg or .bam, I think). I am using linux. Thank you

sentences:
Is there a way to procedurally generate the history of a world? I am somewhat intrigued by the diagram found here representing 1800 years of cultural history in an imaginary world some guy created.

This sort of thing would seem to have strong applications for game development, insofar as world design.

It looks like he did this diagram by hand. What I'm interested in is seeing if there is a way to create this sort of diagram programatically.

If you were tasked with generating diagrams in the style of the above from random values, how would you go about it? Are there any particular data structures or algorithms that you would consider?

sentences:
How to Render to Texture using DirectXTex I can display a textured quad by using D3D11 & DirectXTex's ScratchImage and CreateShaderResourceView. How would I be able to render this texture to another one similarly created? I know that I need to create a RenderTargetView and use Map somehow but I don't know how it all fits together I'm quite mixed up. I have studied Braynzarsoft's Tutorial 34 How to Render to Texture but I couldn't congeal the information into a logical form of understanding. Plus the registration doesn't work and can't download the source code. Finally should I actually just use DirectXTeX::CopyRectangle or is it too slow? In good faith here is how I create the texture:

m_spTexture.reset(new ScratchImage);

WCHAR wcExt[_MAX_EXT];
_wsplitpath_s(wsFilename.c_str(), nullptr, 0, nullptr, 0, nullptr, 0, wcExt, _MAX_EXT);

HRESULT hr;
if ( _wcsicmp(wcExt, L".dds") == 0)
{
    hr = LoadFromDDSFile(wsFilename.c_str(), DDS_FLAGS_NONE, &m_stInfo, *m_spTexture);
}
else if (_wcsicmp(wcExt, L".tga") == 0)
{
    hr = LoadFromTGAFile(wsFilename.c_str(), &m_stInfo, *m_spTexture);
}
else
{
    hr = LoadFromWICFile(wsFilename.c_str(), WIC_FLAGS_NONE, &m_stInfo, *m_spTexture);
}

if (SUCCEEDED(hr))
{
    hr = CreateShaderResourceView(g_pEngine->GetD3DObj()->m_spD3DDevice.Get(),
                                  m_spTexture->GetImages(),
                                  m_spTexture->GetImageCount(),
                                  m_stInfo,
                                  m_spSRV.GetAddressOf() );
    if (FAILED(hr))
        return hr;
}

return hr;

I look forward to and appreciate your thoughts.

sentences:
Detect obstacles in path on a tile-based map I'm creating a 2d game with a tile-based map, but smooth movement. I currently use A* in combination with some other tricks for pathfinding, and one issue what I've been dealing with is getting the units to move smoothly despite tile-based pathfinding.

My solution at the moment is the use raycasting to determine if there is an obstacle between a unit and its target. If there is, it uses A*. Otherwise, it just sets its next move directly as the coordinates of its target. In the case that it uses A*, I also use raycasting to determine which point in the path the unit should move to next, by finding the nearest point in the path that is not obstructed from the units current location, and setting that as the next move. This is necessary so the unit doesn't have to move in a jerky fashion based on the tile-based path that the A* found.

Raycasting is faster than A* every time, but it still has some overhead with a large number of units since it checks every point on the line in small increments. (More so since I'm doing double raycasting each time to account for the size bounds of the unit)

My question is: Is there a better algorithm than raycasting to determine if there is an obstacle between two points (independent of the tiles structure) on a tile-based map? My thought is that there is some way to take advantage of the tiled nature of the map.

sentences:
unity: input event consumed by image raycast target that is "under" a sprite with a 2D collider I am having a hard time getting my UI to work.

Basically I have a canvas with a UI image A that is the size of the screen. This image has raycast enabled and if effectively receiving inputs.

Not in the canvas I have a sprite B that have a 2D collider attached to it. No matter what I try, the UI image is always consuming the input event when I click on the sprite.

When I disable the image A , the sprite B gets the events, so the setup looks right (camera with Physic2D raycaster for the sprite B, layerMask set to the layer of the sprite B, canvas with Graphic raycaster for the image A, no blocking object, no mask).

What do I need to do so that the sprite B gets the input event BEFORE the image A and consume it?

EDIT:
Those two elements are part of the UI and must be interactable at all time. I use a sprite for the second element as it is dragged from the UI inside the game and I don't want to make it an image.

The image A is a big cancel button with opacity 0 on the whole screen that must be active at all time.

I just want to know if the Collider of sprite B can intercept the input before the image A. If it isn't possible, I'll create an Image B instead of the sprite B and destroy it to create a Sprite with the same texture when the  is interacted with.

sentences:
Tic Tac Toe, Reinforced Learning and Hash Tables - Don't understand how to create a game For my data structures course, we were asked to create Tic Tac Toe(3x3)that:

1) Has two player - dumb and smart(computer plays both sides)
2) Dumb player - "X" , always makes first move, and all of his moves are random.
3) Smart player - "O" relies on reinforced learning. Basically, he looks through the hash table(transposition table) created from the different game states learned from prev games and finds good move. Project specifications page has no information on the implementation of the "intelligence"

I don't understand how to handle 3). At what stage of the game, board's hash needs to be inserted into table ? How Smart player decides on his next move ?

Thanks !

sentences: Best Practices for Texturing Large Objects Kind of a 3D graphics newbie here.  This is the biggest prop I've ever tried to texture, and I'm kind of stumped.  How do you get a decent resolution on large meshes like this without exporting enormous maps?  Texture atlases?  Tiling textures?  And what's the best way to set up the UVs, if so?

sentences:
Proper way to handle Movement/Animation/AI functions of an AI character in Unity3D My team is currently building a 2D game in Unity and we've run into some workflow/script organization blockades for many of our game's characters.

For example, we're not sure what the standard method of encapsulating/organizing a character's movement, animation, and more complex AI code is so that things don't become a behemoth mess.

Originally, we had all a character's code in one file -- movement, animation, and AI decision-making code. Needless to say, this became messy really quickly and horrendous to debug.

Then, we redesigned it so that there were three scripts on the character: a movementHandler, animationHandler, and AIHandler. These scripts would communicate to each other, but encapsulate their own functions. This worked better than before, but also grew to a point where it was a bit messy organizationally and debugging is becoming a nightmare again.

We're interested in knowing how people typically organize their scripts. Is there a way people know to organize these code sections so that they're more scalable and don't become headaches to manage once the project grows and grows?

sentences:
Unity multiple servers for rooms I have an FPS game that I'd like to make multiplayer. It would need to support multiple matches at once with about 10 players in each. However I want physics to be server-authoritative so that means running a Unity instance.

How do I have multiple Unity processes running on a server, creating/destroy them as needed, having players connect to the instance they need, and so on? How does this vary between uNet/Sockets/LLAPI/Photon/Bolt/etc?

There just seems to be an atrocious lack of information on Unity networking and when people ask online there's almost never any answer, or it's too vague to be useful.

sentences:
How to create 2D game terrain? Last month, I experimented a lot in game development using cocos2d for the iPhone, especially on moving and modifying sprites. However, vertices and polygons are still new stuff for me.

I developed an algorithm that creates a set of points. I now want to use them to create my 2D terrain. Here is how it looks like when I connect the points in java, so that you can get the idea

The points are connected with lines. However a real game terrain is a shape that is colored or has a texture overlayed, right? For example:

How could I use my points to create such a terrain?

What I tried so far is I created an array and filled it with my points. I pass this array to this method

void ccDrawPoly ( const CGPoint *  vertices,
    NSUInteger  numOfVertices,
    BOOL  closePolygon
)

  draws a poligon given a pointer to
  CGPoint coordiantes and the number of
  vertices measured in points. The
  polygon can be closed or open

This actually draws a plain shape. But from the blue picture it looks like there is not one shape but many.

Please share you knowledge on how to create 2d game terrain.

Update 03.06.2011

Based on the two good answer I have following result

sentences:
What causes this z position change? This is a follow-up on the following thread.

I'm applying a code that will move an object just outside the camera's frustum.
I have used the same code in other projects, and it worked fine.

However, I'm using it with URP now, and I'm experiencing a z-position change while I expected only a x position change.

And I just don't see why it does that.

I have recorded a video here.

If I press the button, the cube should be moved to the left only. But it also moves to the back (z position).

And this is the script that I have applied to the cube in the video:

using System;
using UnityEngine;

public class PlaceOutsideCamera : MonoBehaviour
{
     public void PlaceOutsideFrustum(Transform uTransform, bool uLeft)
    {
        uTransform.position = pPlaceOutsideFrustum(uTransform, uLeft);
    }
    public static Vector3 pPlaceOutsideFrustum(Transform uTransform, bool uLeft)
    {
        var frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main);
        Ray ray;
        Plane plane;

        if (uLeft)
        {
            // 1.
            ray = Camera.main.ScreenPointToRay(new Vector3(0, Camera.main.pixelHeight / 2f, 0));
            plane = frustumPlanes[0];
        }
        else
        {
            ray = Camera.main.ScreenPointToRay(new Vector3(Camera.main.pixelWidth - 1, Camera.main.pixelHeight / 2f, 0));
            plane = frustumPlanes[1];
        }

        float fDistance = Mathf.Abs(Camera.main.transform.position.z - uTransform.position.z);

        // 2.
        var borderPoint = ray.GetPoint(fDistance);

        // 3.
        var frustumOutside = -plane.normal;

        Bounds b = BoundsFromTransform(uTransform);
        // 4.
        var halfDiameter = b.size.magnitude / 2f;

        return borderPoint + frustumOutside * halfDiameter;
    }
    public static Bounds BoundsFromTransform(Transform uTransform)
    {
        try
        {
            Bounds bounds = new Bounds(uTransform.position, Vector3.zero);//wir hätten auch einfach new Bounds() nehmen können, meint Manfredas

            foreach (Renderer renderer in uTransform.GetComponentsInChildren<Renderer>())
            {
                bounds.Encapsulate(renderer.bounds);
            }

            Vector3 nOff = bounds.center - uTransform.position;

            return new Bounds(nOff, bounds.size);
        }
        catch (Exception ex)
        {
            UnityEngine.Debug.Break();
            return new Bounds();
        }
    }
    public void OnGUI()
    {
        if (GUI.Button(new Rect(0, 350, 100, 50), "DoThis!"))
        {
            pDoThis();
        }
    }
    private void pDoThis()
    {
        this.PlaceOutsideFrustum(this.transform, true);
    }

}

Can anybody tell me why my code does this? I just don't see it.
Thank you very much for the help!

Edit: Here is another video that shows the camera position in the Inspector.

sentences:
Using an FBO texture and write to it I wanted to know if it's possible to use a texture of an FBO for post-processing and using that texture again for writing or do I need at least two textures?

I hope you understand what I mean.

sentences: Unity what are the rules for determining sizes of gameobjects I am making a game for windows phone. I am a newbie so currently I am unable to understand if I have to make a simple menu for a game targeting portrait mode always, what should I give the background size ,camera size ,button size , position? For example I have to set a background on renderer  full screen size in portrait mode and fis a gui test between it.. I am using 2d orthographic camera

sentences:
Can I slightly rotate a 2D vector (UV Edge) to more closely reflect the corresponding 3d vector? I'm trying to get the difference between the 3D angle of two connected edges and their corresponding angle in 2D (mesh to UV space).  I would like to slightly rotate the angle in 2D to closer match the angle in 3D.  How do I rotate the 2D vectors to reflect this change?

Here's my current approach to get the angles:
3D angles:

dot3D = vectorA.dot(vectorB);  //normalized vectors
angle3D = acos(dot3D);

2D angles:

dot2D = vectorA.dot(vectorB);  //normalized
angle2D = acos(dot2D);

Angle difference:

angleDiff = angle3D - angle2D;

Rotation:

vectorC = vectorA - vectorB;
float deltaX = vectorC.x * cos(angleDiff) - vectorC.y * sin(angleDiff);
float deltaY = vectorC.x * sin(angleDiff) + vectorC.y * cose(angleDiff);
vectorA.x += deltaX;
vectorA.y += deltaY;

sentences: MonoGame audio format MP4 AAC is a well supported playback format according to the docs, but the MonoGame content project only seems to compile MP3/WAV/WMA formats. I tried to put raw aac files in my android game but the content manager wouldnt load them, only raw wav files work, but they are large in size. I would like to know how to load aac or ogg audio files.

sentences:
Development platform for 2D web and mobile games Is there a game development platform -- similar to Torque, or Unity -- which can be used to deploy 2D games on the following platforms:

Web
iOs
Android
Xbox Live Arcade (Preferred but not required)

And which has an integrated or mature physics engine? Perhaps, even a built in editor?

I've looked at the following possibilities but I've found something missing in each one. Of course in each case I may be guilty of misconception.

Corona SDK (No web deployment, no windows support)
Torque 2D (No web deployment)
Flash + Flash Punk or Flixel (No native android deployment, and I'm not sure if it is stable on mobile platforms)
Unity + SpriteManager2 (Not really optimised for 2D games, and I haven't seen enough advanced 2D examples -- like say platformers -- to really have any confidence in using it for something like this)

Has anyone had any luck with this?

sentences:
Set Parent to Instantiated Objects in Unity i am having problem in attaching parent to the instantiated objects. I have attached the code below. please tell me where i am doing wrong. Thank you.

public GameObject brick;
public Transform BrickHolder;
//public GameObject Bricks;

void Start(){
    for (float y = 2.16f; y < 4.88f; y += 0.34f){
        for (float x = -2.125f; x <= 2.125f; x += 0.85f){

            GameObject Bricks = Instantiate(brick, new Vector3(x, y, 0), Quaternion.identity) as GameObject;

            if (Bricks != null) {
                Debug.Log("Hello");
                Bricks.transform.SetParent(BrickHolder);
            }

        }
    }
}

sentences:
Can Flash games packed for iOS and other mobile devices achieve reasonable performance? I was thinking of developing a game in Flash, as a hobby/educational project.

However, I was hoping I could make it run on a smartphone, but a friend who develops in Flash says that in their experience things will move really slow on the likes of an iPad when the Flash packager is used. So slowly that you can't use it commercially for fast-moving games.

Has anyone else experienced this slowness? Is there a way around it or is the technology just not there yet?

sentences:
velocity question from book iPhone I am reading an iphone game dev book and I have a question about velocity.

mainly it is this line

playerVelocity = ccp(playerVelocity.x * dec + acceleration.x * sens, 0);

Why do you mutiple the playerVelocity.x by the deceleration. the book says it works by reducing the current velocity so it is easier to change direction and then add the ( acceleration.x * sens. )

this piece of code is using the accelerometer.

float dec = 0.4f; //lower = quicker to change direction;
float sens = 6.0f; //higher more sensitive;
float maxVel = 100;

playerVelocity = ccp(playerVelocity.x * dec + acceleration.x * sens, 0);
NSLog(@"%@", NSStringFromCGPoint(playerVelocity));

if(playerVelocity.x > maxVel)
{
    playerVelocity.x = maxVel;
}
else if(playerVelocity.x < - maxVel)
{
    playerVelocity.x = - maxVel;
}

sentences: How to convert Blender models for XNA I am creating my first game, I'm using Blender to create character models, is there any tutorial or guide to tell me what steps to convert a model into something animated and usable in XNA?

sentences:
TypeLoadException when running a Monogame Windows Phone 8 game Using Monogame, I'm trying to port a game to Windows Phone 8, but I'm having issues getting a basic example to run.

When I create a basic Mono project and run it on my phone (to check everything's OK), it compiles the game, and deploys it to my phone, but when the app starts running, the debugger throws this error:

I tried adding a reference of that .dll, but that doesn't solve it. This is the first time that I use Monogame, so please bear with me.

sentences:
Monogame - Not enough storage is available to complete this operation, on backgrounds I am making a level selector, which works like a web slider. I am showing 12 levels per page, and I have a total number of 60, which means 5 pages of 12 levels.

Each level has his on background image, and I tried to load all the backgrounds into an Texture2D array. Since now I loaded only 12 backgrounds, because I had only them, everything worked perfectly. Now, I have more, about 40, and when I try to load them into the array I receive this error:

Additional information: HRESULT: [0x8007000E], Module: [General], ApiCode: [E_OUTOFMEMORY/Out of memory], Message: Not enough storage is available to complete this operation.

Code line:

for (int i = 1; i <= 36; i++)
                LevelBackgroundTextures[i] = Resource.ContentManager.Load<Texture2D>("Levels/Backgrounds/bg_" + i);

If I understood correctly I receive this error because I do not have enough space (RAM) to load all the content once and I need to use multiple content processors, and here is the problem.

I do not know how can I use them to be effective, when to load/unload the content, etc. Or is there another way that I can fix this error?

Thanks.

sentences:
Child transform's position not updated as parent moves I have a parent game object Object1. It has a child, which is simply an empty game object called ReferencePoint. ReferencePoint can be any arbitrary point on Object1 itself.

I have another game object Object2. It has a public field called RotationReference, of type Transform. In the inspector, the ReferencePoint on Object1 is assigned to the RotationReference field on  Object2.

As Object1 moves, I expect ReferencePoint to change its position as well. Object2 is supposed to change its rotation to face its RotationReference -- in this case, the ReferencePoint on Object1:

public override void Rotate()
{
    Vector3 relativeRotationReferencePosition =
        this.RotationReference.position - this.transform.position;

    this.transform.rotation = Quaternion.LookRotation(relativeRotationReferencePosition);
}

However, I noticed that Object2 is not rotating at all, even when Object1 is moving. When I step through the call stack multiple times, I discover that this.RotationReference.position always has the same value, even though Object1 is moving.

What am I missing here?

sentences:
How to handle collision detection So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that will be the unit's destination.

This is the process input method:

    public void ProcessInput(Vector2 mouseLoc)
    {
        // SO, I have to take this mouse location, which is the location on the screen
        // And convert it to a "world" coordinate

        Vector2 distance = new Vector2(mouseLoc.X - position.X, mouseLoc.Y - position.Y);

        if (distance.Length() < speed)
        {
            position = mouseLoc;
            isMoving = false;
        }
        else
        {
            distance.Normalize();
            Vector2 toMove = new Vector2((int)(distance.X * speed), (int)(distance.Y * speed));
            position += toMove;
            bounds = new BoundingSphere(new Vector3(position, 0), radius);
        }
    }

I have a basic Wall class that is essentially just another rectangle object but with different properties like textures and what not.

This is my check collision method with the wall:

    public Boolean checkCollision(Wall wall)
    {
        if (wall.Bounds.Intersects(this.bounds))
        {
            Vector2 direction = new Vector2((position.X - destination.X) * -1,
            (position.Y - destination.Y) * -1);
            direction.Normalize();
            position += direction * 5;
            destination = position;
            return true;
        }
        return false;
    }

The problem is that the unit just kinda gets stuck in the wall when it hits it. I'm wondering what is the best way to fix this problem. I know that I have to move the unit out of that spot, but I'm not sure how to.

Any thoughts on how to handle this are appreciated.

sentences:
Why would you use a negative value for Bounding Box? I have the following code I'm working with in XNA from the book Professional XNA Programming.

It's just pong on a 2d screen plane.  We use bounding boxes for collision detection.  I'm just having trouble understanding why we would use a negative paddle size for the RedPaddleBox.  I read bounding boxes define the minimum and maximum corners of the box, but I'm not sure what that means--minimum in terms of coordinate values?  If so, why use a negative value when the paddle isn't partly off screen?

This is the code line that gave me trouble:

            new Vector3(-paddleSize.X/2,

in context of:

        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));

in the following code:

        // Check for collisions with the paddles.
        // Construct bounding boxes to use the intersection helper method.
        Vector2 ballSize = new Vector2(
            GameBallRect.Width / 1024.0f, GameBallRect.Height / 768.0f);
        BoundingBox ballBox = new BoundingBox(
            new Vector3(ballPosition.X - ballSize.X / 2,
                ballPosition.Y - ballSize.Y / 2, 0),
            new Vector3(ballPosition.X + ballSize.X / 2,
                ballPosition.Y + ballSize.Y / 2, 0));
        Vector2 paddleSize = new Vector2(
            GameRedPaddleRect.Width / 1024.0f,
            GameRedPaddleRect.Height / 768.0f);
        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));
        BoundingBox rightPaddleBox = new BoundingBox(
            new Vector3(1-paddleSize.X/2,
                rightPaddlePosition+paddleSize.Y/2, 0),
            new Vector3(1+paddleSize.X/2,
                rightPaddlePosition+ paddleSize.Y/2,0));

sentences: How to integrate admob ads in Unity 5.6.2f1 I made the game space shooter. But i don't know how to integrate admob ads in Unity. I downloaded Google Admob ads Plugin for unity. But where i write the code don't know and how to implement it!!

sentences:
Why isn't OnCollisionEnter2D working? I've made a hole. I have animals tagged as animals. When an animal walks into the hole, they disappear. I tried OnTriggerEnter2D() as well, and set the collider to isTrigger, but it still didn't work. I can get it to work without the tag part, but anything that bumps into each other sets each other to inactive.

public class BlackHole : MonoBehaviour
{
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "animal")
        {
            other.gameObject.SetActive(false);
        }
    }
}

sentences:
How many resources are too many? I don't know if this question is too broad but I am finally working on a game I want to release and I find that questions like: "can I really add another 10 frames?", "Do I really need that animation?", "Can I add more background effects?" etc. are always on my mind and limit my creativity.

I am trying to find an answer online without success, and as a hobby developer with no real training it is hard to know what is considered "too many" resources.

I suppose it differs depending on what you plan to release it for etc, but is there a general rule of thumb? I want to release for Android and ios.

For example I have a main character, and right now he has these animations:

 atlas = Assets.manager.get(Assets.runner, TextureAtlas.class);
        tallAnim = new Animation(1/10f, atlas.findRegion("runner1"), atlas.findRegion("runner2"), atlas.findRegion("runner3"), atlas.findRegion("runner4"));
        shortAnim = new Animation(1/10f, atlas.findRegion("short_runner1"), atlas.findRegion("short_runner2"), atlas.findRegion("short_runner3"), atlas.findRegion("short_runner4"));
        hitAnim = new Animation(1/10f, atlas.findRegion("runner_hit1"), atlas.findRegion("runner_hit2"));
        flyAnim = new Animation(1/10f, atlas.findRegion("runner_fly1"), atlas.findRegion("runner_fly2"));
        animation = tallAnim;

I want to add more but I am stopping my self because I don't know if this is too much. Right now he has 12 frames, and I am rendering a scrolling background and 2 different enemies (each with 3 frames) and a few other objects. Do I need to start limiting my game or is it hard to reach a point of "too much"?

sentences:
Collision resolution - Character walking on ascendent ground I don't know if the solution to this problem is quite straight-foward but I really don't know how to handle collision resolution on a game where the player walks on an ascendent floor which is not flat. How can the player position itself on the y axis depend on the ground x and z (opengl coords)? What if the floor's slope is too much and the player can't go up, how do you handle that?

I don't need any code, just a simple explanation would be great.

sentences:
How to rotate to a target position over time I know how to do rotations to vectors, but how do I rotate over time?

For instance say I made a function

RotateTo(vec2 iPosition, float iTime);

so it rotates to iPosition over iTime - how would this look? Does anyone know simple algorithm?

sentences:
fbx file asks for fbm file in xna? I downloaded a bat model from the internet and I went to Blender, used texture and shading as I want, then I exported it as a fbx file. Next I placed it into my content pipeline and ran it but it is asking me for the path of a .fbm file. It says Error Missing asset

  C: ...._Game\obj\x86\Debug\FBX\387D35A3\bat.fbm\wpn_fps_mel_barbedwire_df.dds

What does this mean. How can I place these images in that file like that?

sentences:
Can I change the order of these OpenGL / Win32 calls? I've been adapting the NeHe OpenGL/Win32 code to be more object-oriented and I don't like the way some of the calls are structured.
The example has the following pseudo-structure:

Register window class
Change display settings with a DEVMODE
Adjust window rect
Create window
Get DC
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Show the window
Set it to foreground
Set it to having focus
Resize the GL scene
Init GL

The points in bold are what I want to move into a rendering class (the rest are what I see being pure Win32 calls) but I'm not sure if I can call them after the Win32 calls.
Essentially what I'm aiming for is to encapsulate the Win32 calls into a Platform::Initiate() type method and the rest into a sort of Renderer::Initiate() method.
So my question essentially boils down to: "Would OpenGL allow these methods to be called in this order?"

Register window class
Adjust window rect
Create window
Get DC
Show the window
Set it to foreground
Set it to having focus
Change display settings with a DEVMODE
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Resize the GL scene
Init GL

(obviously passing through the appropriate window handles and device contexts)
Thanks in advance.

sentences:
Why do I get an access violation while reading the pixels of an SDL_Surface as follows? I'm trying to write a software rasterizer and I'm in the step to texture a triangle. I'm trying to get a pixel from an SDL_Surface which is an image, 100x60 at 24 bits of color depth.

I got a read access violation exception. For instance I try to say

Uint32 * pixels = (Uint32 *)texture->pixels;

then

int pixel = pixels[5900];

It gives an access violation. However the calculated pixels count is correct

int pixel_count  = (texture->pitch / texture->format->BytesPerPixel) * texture->h;

Is this wrong? How can I access the pixels of this surface?

sentences:
How to render decoded video that is on GPU memory without copying to CPU I'm reading this example of ffmpeg hardware decoding: https://github.com/FFmpeg/FFmpeg/blob/release/4.2/doc/examples/hw_decode.c

At line 109 it does this:

/* retrieve data from GPU to CPU */
            if ((ret = av_hwframe_transfer_data(sw_frame, frame, 0)) < 0) {

which means that decoded video is in GPU. Since I want to render this video using Open GL, I guess it's much more efficient to not get this back to CPU but to actually render directly from GPU memory.

Is it possible to render directly from GPU memory?

What I know is that, in order to render from CPU memory, we usually send data from CPU using gltextImage2D function and the shaders will render it. If I want to pass data that is already on GPU, how do I do?

sentences:
Figure out why vertices are clipped I am trying to figure out why, at sharp cutoffs in geometry, some vertices seems to be culled for some reason.

I have a heightmap for demonstrating it like this

And this is the result I get

See the red rectangles where the geometry is just cut and the skybox is shown behind.

I am not quite sure where to start looking where the problem might be.
I know for a fact it's not colliding with the z-near value.
Any non-steep geometry is fine. Any pointers?

EDIT: at certain angles, re-orienting the camera ever so slightly changes things, like this

sentences:
GameMaker: how to let the game run as fast as it is able to? I am making a game/simulator where I want the game to, upon command, run as fast as the computer can handle, that is to say, if the game can run at 60 fps, don't run at 30 fps.

What should I do to make the game do that and would this even make sense?

(Note: when I looked at the built-in variable fps, I often see the value to be higher than the room speed I set, so I thought that maybe I can allow the game to run faster than the room speed initially set.)

sentences:
Physic engine for snooker/billard game Possible Duplicate:
  Is there an algorithm for a pool game?

I think most billard/snooker games have a lot of problems with their physic engines. They are far away from realistic and you can't really enjoy the game (especially when snooker is your hobby :) )

So I want to try to make an own physic engine (and own snooker game). I think the physic engine is the most important part of such a game. So my question is:

Do anybody know an open physic enginge I can start with? Is there any literature about such physic problems?

sentences:
Where to save enemy positions in C++? I'm wondering how and where to save the positions my enemies should spawn.

My idea was to use a struct such as:

struct enemy{
    int x,y,type;
}

And save an array of it in a .dat with fwrite() but I'm not sure if it's a good idea.

I want to know how it's commonly done. Also I recently asked a question about events and was answered something about scripting languages like Lua, is this related to the enemy positions too? Could I create a file in a scripting language with them?

sentences:
Java BufferStrategy Flickering I was watching a tutorial on using a BufferStrategy in Java and I wanted to test a very simple example. The issue is that it flickers intensely and it seems as if a piece of the starting oval stays on the screen. I know that the loop is a very bad practice but I just wanted to very simply test the BufferStrategy.

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferStrategy;

public class Game extends JFrame {
    private Canvas canvas = new Canvas();

    public Game() {
        setBounds(0, 0, 1280, 720);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        add(canvas);

        setVisible(true);

        canvas.createBufferStrategy(3);
        BufferStrategy bufferStrategy = canvas.getBufferStrategy();

        int x = 0;
        int i = 0;

        while(true) {
            i++;

            if(i == 10) {
                i = 0;
                x++;
            }

            bufferStrategy = canvas.getBufferStrategy();
            Graphics g = bufferStrategy.getDrawGraphics();
            super.paint(g);
            g.setColor(Color.RED);
            g.fillOval(x, 200, 50, 100);
            g.dispose();
            bufferStrategy.show();
        }
    }

    public static void main(String[] args) {
        new Game();
    }

}

sentences:
Libgdx - GLSL shader which uses mod doesn't seem to work properly on android Through trial and error I've managed to come up with a scanline-ish shader I'm satisfied with. On my desktop testbed it looks like this:

Basically, every 2nd(vertical) pixel is darkened.

However, when I add the same shader to my android sprite batch the darkened lines no longer show up. I've assumed it's due to use of mod and float comparison since GLES is lower precision than desktop GL and it probably never evaluates yPos == 0.5 to true. So to combat that I've created an EPSILON value to give a bit of leeway for float comparison but that didn't help either. However I'm certain that I've set up the shader program correctly since simple color manipulation shaders seem to work properly, only when mod gotten introduced into the mix things turned sour.

Here's the shader code:

scanline.vert

attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;

varying vec4 vColor;
varying vec2 vTexCoord;

void main() {
    vColor = a_color;
    vTexCoord = a_texCoord0;
    gl_Position = u_projTrans * a_position;
}

scanline.frag

#ifdef GL_ES
    precision mediump float;
#endif

varying vec4 vColor;
varying vec2 vTexCoord;

uniform sampler2D u_texture;
uniform mat4 u_projTrans;

const float SCANLINE_INTENSITY = 0.7; // lower is stronger, probably should call this softness
const float SCANLINE_DENSITY = 2.0; // every 2nd pixel

const float EPSILON = 0.01;

void main() {

    vec4 texColor = texture2D(u_texture, vTexCoord);

    float yPos = mod(gl_FragCoord.y, SCANLINE_DENSITY);

    vec4 retColor = vColor;

    //if(yPos == 0.5) {
    if(abs(yPos - 0.5) < EPSILON) {
        retColor *= vec4(vec3(SCANLINE_INTENSITY), vColor.a);
    }

    gl_FragColor = texColor * retColor;
}

What am I doing wrong?

sentences:
Unity3d: "random" transform position values on editor Run into some strange behavior on editor position values.

https://youtu.be/DUBpbOUkbfo

As you can see we have two cube object with colliders on both and rigidbody on parent.
After start play mode parent object editor values sets to some random numbers while transform.localPosition and transform.position is still (0,0,0).

This somehow related to parent-child physics hierarchy but can't understand how.

sentences: How can I play a video in a Godot game? I'd like to know if and how it is possible for me to play a video in my Godot game. Specifically I'd like to know what video file format I need to use and what code I have to write to play that video back fullscreen.

sentences:
What problems could occur if you make use of both the MonoGame API and the underlying graphics API? What kinds of problems could one run into if they were making a game with MonoGame and started making calls to the underlying graphics API as well?

For example, if I wanted to do something in a MonoGame project that MonoGame didn't necessarily support, or I just couldn't find the proper documentation / example for but I could find an example of how to do it in OpenTK, am I setting myself up for trouble if I implement it using OpenTK directly while using the MonoGame API everywhere else? Specifically I'm looking to find out if there are any big issues that are known that might result of this and not something obscure that will happen in very rare cases.

I tried doing a little research via Google and the GD.SE site itself and I couldn't find much. Maybe MonoGame has really covered most of its bases, but what if I manually wanted to work around one of it's outstanding issues or a feature that is not yet implemented?

If so what sort of problems might arise and are there any ways to help mitigate these issues?

sentences:
Why are my sprite sheet's frames not visible in Cocos Builder? I have created a sprite sheet with zwoptex. Then I just dragged the .plist and .png files to my Cocos Builder project. After this I wanted to take a sprite frame and set it to a sprite:

But the sprite image is empty! At first I thought it was just empty in Cocos Builder, and that it must have been working correctly when imported to a project. But if I try to run that scene with CCBReader I still see an empty sprite. Why?

sentences: Making a zoom out/in space map in Unity I'm new to unity, I was wondering how would one go into implementing a dynamic 2d space map. Let me give you an example what i mean. You see our solar system on the map, if you zoom out at a treshold value this solar system would just be represented by a name and our sun and around it you see adjacent solar systems. How would I do this in unity?

sentences:
Bullet is not instantiating properly in Unity So I'm trying to make a simple weapon where I just instantiate a bullet at the Shoot Point's gameobject position. For some reason when I press down on my mouse the bullet just flies up. Any ideas on why this could happen?

Vector3 velocity = bullet.transform.forward * 1000 GameObject bulletGameObject = Instantiate(bullet, shootPoint.transform.position, Quaternion.identity);
Rigidbody bulletBody = bullet.GetComponent<Rigidbody>();
bulletBody.velocity = velocity;
Destroy(bulletGameObject, 4f);

sentences:
how to start the game without entering into menu screen i am trying to play the game without entering to menu screen. i have placed only one scene. my ui and game both is placed within the same scene. in my game over screen i have two buttons. for home button i give

Application.LoadLevel (Application.loadedLevel);

by this code is loading the scene from the begning and its working perfectly. in my another button i want to play the game direcly without showing the main menu. so i tried

Application.LoadLevel (Application.loadedLevel);
launchGame();

but after loading the level my second line launchGame() is not working. how can i solve this problem? please help

sentences:
How to calculate move while avoiding deep copy Suppose in a turn-based game, I have an object holding the current status of the game (like players, board information, positions of pawns, things like that). Now I want my AI to calculate the best move (or at least a good move).

My first try was to determine all allowed actions and generate a new game object for each action the player or computer could do. Then I would repeat the process for all resulting game objects. This would yield a form of tree with all the future possibilities, from which the AI simply could select the optimum.

But it turns out that this approach is cruelly slow, mostly to me deep copying the game object thousands of times and holding thousands of copies of the game object in the memory.

I am now searching for a better approach to calculate a good move. Are there technics for this type of problem. I am aware that this probably depends on the kind of choices the player or AI has to make in the game. But I am more interested in general technics used to tackle this kind of problem.

Any help is appreciated. If this question is more appropriate for somewhere else (for example StackOverflow), please move it there. Thanks!

sentences:
Scale a game object to Bounds I'm trying to scale a lot of dynamically created game objects in Unity3D to the bounds of a sphere collider, based on the size of their current mesh. Each object has a different scale and mesh size. Some are bigger than the AABB of the collider, and some are smaller. Here's the script I've written so far:

private void ScaleToCollider(GameObject objectToScale, SphereCollider sphere) {
    var currentScale = objectToScale.transform.localScale;
    var currentSize = objectToScale.GetMeshHierarchyBounds().size;

    var targetSize = (sphere.radius * 2);

    var newScale = new Vector3 {
        x = targetSize * currentScale.x / currentSize.x,
        y = targetSize * currentScale.y / currentSize.y,
        z = targetSize * currentScale.z / currentSize.z
    };

    Debug.Log("{0} Current scale: {1}, targetSize: {2}, currentSize: {3}, newScale: {4}, currentScale.x: {5}, currentSize.x: {6}",
        objectToScale.name, currentScale, targetSize, currentSize, newScale, currentScale.x, currentSize.x);

    //DoorDevice_meshBase                   Current scale: (0.1, 4.0, 3.0), targetSize: 5, currentSize: (2.9, 4.0, 1.1), newScale: (0.2, 5.0, 13.4), currentScale.x: 0.125, currentSize.x: 2.869114
    //RedControlPanelForAirlock_meshBase    Current scale: (1.0, 1.0, 1.0), targetSize: 5, currentSize: (0.0, 0.3, 0.2), newScale: (147.1, 16.7, 25.0), currentScale.x: 1, currentSize.x: 0.03400017

    objectToScale.transform.localScale = newScale;
}

And the supporting extension method:

public static Bounds GetMeshHierarchyBounds(this GameObject go) {
    var bounds = new Bounds(); // Not used, but a struct needs to be instantiated

    if (go.renderer != null) {
        bounds = go.renderer.bounds;
        // Make sure the parent is included
        Debug.Log("Found parent bounds: " + bounds);
        //bounds.Encapsulate(go.renderer.bounds);
    }
    foreach (var c in go.GetComponentsInChildren<MeshRenderer>()) {
        Debug.Log("Found {0} bounds are {1}", c.name, c.bounds);
        if (bounds.size == Vector3.zero) {
            bounds = c.bounds;
        } else {
            bounds.Encapsulate(c.bounds);
        }
    }
    return bounds;
}

After the re-scale, there doesn't seem to be any consistency to the results - some objects with completely uniform scales (x,y,z) seem to resize correctly, but others don't :|

Its one of those things I've been trying to fix for so long I've lost all grasp on any of the logic :| Any help would be appreciated!

sentences:
Custom effects on Model in XNA If I have a Model that is drawn with a different effect occasionally, what is the typical approach to this?

Models have effects stored in each of their meshes, and you seem to be forced to use those.

Typically this is done:

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (Effect effect in mesh.Effects)
    {
        effect.Parameters["World"].SetValue(world);
        // Other stuff related to this specific effect is done here.
    }
    mesh.Draw();
}

I want to be able to do this:

foreach (ModelMesh mesh in model.Meshes)
{
    myEffect.CurrentTechnique.Passes[0].Apply();
    mesh.Draw(); // Mesh will be drawn with "myEffect".
}

What are our options?

sentences:
What would be theoretical the perfect texture size? I am more a newbie considering game development but I am dealing very often with optimization of games for work and because I am interested in it.

So as far as I know higher texture size need less draw calls if you make serveral objects share the same texture but it takes up more VRAM.
Also you have to consider how acuit you want to have your textures.

But the more I thought about the topic I thought there would be a theoretical perfect texture size, correct me if I am wrong.

Thought experimet:
Considering you always want the same acuity of your game and you have 4 objects that take the exact same amount of UV space but have different textures.

Then there would be a perfect spot between texture size and number of objects that share the same texture considering your goal is best performance.
In this case there would be 4 possibilities:

1 texture where all objects share the same one
2 texture for two of the objects
3 texures where it would be a mix of those above
or 4 textures where every object have their own

If performance is your main goal then there would be only one variable to change depending on how acuit you want your game, the acuity, wouldnt it?

Hope you understood my thoughts^^

sentences: Stop map from scrolling but let player still move? I have a basic method of scrolling around on a map (moving the map instead of the player), but at when the player gets to a certain proximity to the edge, how do you stop the map from scrolling, but still allow the player to move around until it is away from that proximity? I'm not looking for any code. Just a suggestion so that I can implement it myself. I can see it visually (creating 4 boxed intersecting boundaries for the player to enter), but not sure how to come about stopping and resuming the scrolling of the map.

sentences:
Extrapolating performance on cheaper devices I am in the final stages of developing a game with XNA and MonoGame and am planning to release it on Windows Phone and Android. I personally have a Blu Win HD LTE and my father and sister have a Nexus 5 and Moto e, respectively.

I am testing on all of these devices. What I am unsure of is how to extrapolate what the performance will be on cheaper devices, like a Lumia 630. I already can use profiling on my phone to make sure I'm under the 185MB memory limit, but I'm not sure what the framerate/performance will be.

I am looking for a way to roughly estimate how much slower the performance will be based on some variable (processor speed, GPU model, number of cores, etc.), such that I can tune performance on my current device and be assured of performance on cheaper devices. Has anyone tried this?

sentences: lwjgl request display close when undecorated I want to create a custom titlebar/border for my display/window so I set the corresponding system property to "true" but how do I send a close request to the window manually to react to the Display.isCloseRequested()?

sentences:
Mouse click movement I need to make realistic human movement (3D) using mouse click.

Get mouse click point using Raycast.
Smoothly Slerp to LookRotation.
Move transform.forward.

Everything works fine, except I have problem with circular movement (close radius).

Example If dont move transform.forward while Slerp to LookRotation or MoveTowards instead of transform.forward it will be spinning like whirligig on circular movement.
Example If do move transform.forward while while Slerp to LookRotation it will distort trajectory of straight direct movement.

Is there any solution to move circular realistic (not spin like whirligig) and move straight direct when needed (not distort trajectory)?

I need straight movement from first example and circular movement from second.

        if (Input.GetMouseButtonDown(1))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit[] hits = Physics.RaycastAll(ray);

            foreach (RaycastHit hit in hits)
            {
                if (hit.transform.tag == "Ground")
                {
                    DestinationPosition = new Vector3(hit.point.x, transform.position.y, hit.point.z);

                    DestinationRotation = Quaternion.LookRotation(DestinationPosition - transform.position);

                    break;
                }
            }
        }

        if (Vector3.Distance(transform.position, DestinationPosition) > 1)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, DestinationRotation, RotationSpeed * Time.deltaTime);

            transform.position += transform.forward * MovementSpeed * Time.deltaTime;

            //transform.position = Vector3.MoveTowards(transform.position, DestinationPosition, MovementSpeed * Time.deltaTime);

            animation.CrossFade("run");
        }
        else
        {
            animation.CrossFade("idle");
        }

sentences:
What do I risk if I name my game the same as another company? I came up with the best title for my game - a title that is catchy and also indicative of the gameplay, plus there isn't any other game on the market with a similar name. But after a Google search, I found a company in another country using the same name.
To put my situation better in context, imagine a game like Minecraft being in development, only to find out that there's another company called something like Minecraft Studios in a far-off country dealing with digital graphics and art for media (including games).
Aside from the legal aspect of it (lawsuits, cease-and-desists, etc.), what disadvantages would there be to have my game named the same as a company dealing in a similar field?

sentences:
In Unity's Shader Graph how do you access parameters from code? I recently rewrote a shared I was using into Shader Graph. As an example I carried out the color as an external parameter.

In my traditional shader to set the color I would call something like

MyMaterial.SetColor("_NewColor", color)

In the new code, I could not figure out the name of the parameter until I looked at the generated code. Turns out my Color parameter was actually named "Color_D027E98" So now my code is

MyMaterial.SetColor("Color_D027E98", color);

Not very pretty and I don't know how constant D027E98 is. Is this the correct way of changing a shader's parameter? Should I be doing something different using Shader Graph - Is this number going to change on me as if I update my shader?

sentences:
Improving performance of a particle system (OpenGL ES) I'm in the process of implementing a simple particle system for a 2D mobile game (using OpenGL ES 2.0).  It's working, but it's pretty slow.  I start getting frame rate battering after about 400 particles, which I think is pretty low.

Here's a summary of my approach:

I start with point sprites (GL_POINTS) rendered in a batch just using a native float buffer (I'm in Java-land on Android, so that translates as a java.nio.FloatBuffer).

On GL context init, the following are set:

GLES20.glViewport(0, 0, width, height);
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);

Each draw frame sets the following:

GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

And I bind a single texture:

GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle);
GLES20.glUniform1i(mUniformTextureHandle, 0);

Which is just a simple circle with some blur (and hence some transparency)

http://cl.ly/image/0K2V2p2L1H2x

Then there are a bunch of glVertexAttribPointer calls:

mBuffer.position(position);
mGlEs20.glVertexAttribPointer(mAttributeRGBHandle, valsPerRGB, GLES20.GL_FLOAT, false, stride, mBuffer);

...4 more of these

Then I'm drawing:

GLES20.glUniformMatrix4fv(mUniformProjectionMatrixHandle, 1, false, Camera.mProjectionMatrix, 0);
GLES20.glDrawArrays(GLES20.GL_POINTS, 0, drawCalls);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

My vertex shader does have some computation in it, but given that they're point sprites (with only 2 coordinate values) I'm not sure this is the problem:

#ifdef GL_ES
// Set the default precision to low.
    precision lowp float;
#endif

uniform mat4 u_ProjectionMatrix;

attribute vec4 a_Position;
attribute float a_PointSize;
attribute vec3 a_RGB;
attribute float a_Alpha;
attribute float a_Burn;

varying vec4 v_Color;

void main()
{
vec3 v_FGC = a_RGB * a_Alpha;
v_Color = vec4(v_FGC.x, v_FGC.y, v_FGC.z, a_Alpha * (1.0 - a_Burn));
    gl_PointSize = a_PointSize;
    gl_Position = u_ProjectionMatrix * a_Position;
}

My fragment shader couldn't really be simpler:

#ifdef GL_ES
    // Set the default precision to low.
    precision lowp float;
#endif

uniform sampler2D u_Texture;
varying vec4 v_Color;

void main() {
    gl_FragColor = texture2D(u_Texture, gl_PointCoord) * v_Color;
}

That's about it.  I had read that transparent pixels in point sprites can cause issues, but surely not at only 400 points?

I'm running on a fairly new device (12 month old Galaxy Nexus).

My question is less about my approach (although I'm open to suggestion) but more about whether there are any specific OpenGL "no no's" that have leaked into my code.

I'm sure there's GL master out there facepalming right now... I'd love to hear any critique.

sentences:
Performance issues with visibility detection and object transparency I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks behind them. By itself this is not a huge issue, but I'm having trouble determining which walls should be transparent exactly.

I can't use a circle or square mask. There are a lot of cases where the wall piece at the same (relative) position has different visibility depending on the surrounding area.

With the help of a friend I came up with this algorithm:

Create a grid around the player that contains a lot of "visibility points" (my game is semi tile-based so I create one point for every tile on the grid) - the size of the square's side is close to the radius where I make objects transparent. I found 6x6 to be a good value, so that's 36 visibility points total.
For every visibility point on the grid, check if that point is in the player's line of sight.
For every visibility point that is in the LOS, cast a ray from the camera to that point and mark all objects the ray hits as transparent.

This algorithm works - not perfectly, but only requires some tuning - however this is very slow. As you can see, it requries 36 ray casts minimum, but most of the time 60-70 depending on the position. That's simply too much for the CPU.

Is there a better way to do this?

I'm using Unity 3D but I'm not looking for an engine-specific solution.

sentences:
Unity 3D - Why does my button need to be clicked twice to work? My goal is to go back and forth between a series of animations by clicking left and right arrow UI buttons. I wrote this C# script and the "next" button (which executes AddInt() on click) works as intended, however the "previous" button (which calls ReduceInt() on click), needs to be clicked twice to work. Is this a glitch or is something wrong with my code?
public class update_animator_parameter_int : MonoBehaviour
{
    Animator gameobject_animator;
    public string int_parameter;
    public int max_int;
    public int current_int=0;

    void Start(){
        gameobject_animator = GetComponent<Animator>();}

    public void AddInt(){
          current_int++;
          if (current_int > max_int){current_int = 0;}
          gameobject_animator.SetInteger(int_parameter, current_int);}

    public void ReduceInt(){
          current_int--;
          if (current_int < 0){current_int = max_int;}
          gameobject_animator.SetInteger(int_parameter, current_int);}
}

sentences:
Expiring timed actions a good idea? We have an online game where players sometimes have to wait a while (say 30 minutes) before a process they intiated completes. This encourages them to come back later. An example of this is growing crops in Farmville or basically any action in the Sims Play4Free.

Now, however, there is the idea to let these processes expire, so if the player doesn't 'reap' them in time (e.g. within 4 hours) they are aborted. I'm a bit sceptical about this. How will this make players come back more often? Is not the reward of reaping the process enough for that? Can we expect players to fit their daily schedule around our game, maybe even set the alarm clock at night? Won't this just cause players to give up on starting these processes in the first place?

I realise this may be too subjective for this site, so I'll end with a concrete question: Do (m)any other online free-to-play games employ this technique?

sentences:
How do I implement object picking, using OBB in OpenGL? I am trying to make 3D drawing software. I wanted to have the drag feature so I am using object picking using the OBB algorithm. I am facing problems in understanding the algorithm, and my implementation thus is having bugs.

How do I implement object picking, using OBB in OpenGL? As I am new to OpenGL (free-glut library), a step by step explanation would be helpful.

sentences:
Why does collision only work when keys are being pressed? My player object containing a rigidbody that is controlled using Input, is not colliding with an enemy unless keys are pressed. When no keys are pressed, the enemy simply goes through the player without collision. I'm using Unity 5.6.1f1.

I figured the problem is in the Patrol class because when I don't attach the script to the enemy object the collision appears to take place fine.
But I don't know what I'm doing wrong in this script because I seems to do it's task well. I wrote this script to make the enemy object move between points in patrolPoints which are just some empty's in the game world.

So, I would like to know if I'm doing it right or is there another way to do it.

Patrol.cs

public class Patrol : MonoBehaviour {
    public Transform[] patrolPoints;
    public float speed;
    private int currentPoint;
    private bool forward;

    // Use this for initialization
    void Start () {
        transform.position = patrolPoints [0].position;
        currentPoint = 0;
        forward = true;
    }

    // Update is called once per frame
    void Update () {
        if (transform.position == patrolPoints [currentPoint].position) {
            if (currentPoint < patrolPoints.Length - 1 && forward) {
                currentPoint++;
            } else {
                currentPoint--;
                forward = false;
            }

            if (currentPoint == 0)
                forward = true;
        }

        transform.position = Vector3.MoveTowards (transform.position,
            patrolPoints [currentPoint].position, speed * Time.deltaTime);
    }
}

sentences:
Client/Server best way of telling client which player it is I'm making a client/server, everything works grand its very simple, a simple login system, ID, empty variable and the X and Y positions of the player.

Should my server tell my client who it is? and if so what kind of relationship would a client/server usually have?

My server currently stores each connection so I can communicate with one, or all clients - is this the right type of architecture?

sentences:
Is a mesh OK to use for grass if there will be 1000's of them across the terrain? Am creating a low poly game in Unity 3D for PC.  The terrain is made in Blender, so it's a fixed size, but quite large for the player to explore.  I want to add things such as grass and flowers, but am not sure the best practices are for creating those types of assets.

Is using a mesh for small clumps of grass the wrong way to do this if there will be 1000's of them?

I will likely be using the occlusion culling system Unity provides, but I'm not sure if I still need to look at doing things such as grass in a different way for performance sake.

sentences:
Different Sprite sizes for animation I have a character which has a size of 32x64 when walking or standing. Using the libgdx animation class I can easily animate him with a texture atlas.
When I want to make him attack however, the Sprite appears squished because the frames for the attack animation are 64x64 to accommodate the sword.
My question is as the artist and programmer, would it make more sense to have each Sprite frame for every animation be 64x64? Or in code, resize the Sprite origin and bounds before the attack animation and set them back to 32x64 when the attack is done?

sentences:
Fixing the frame rate for SDL2 2D game Working on a 2D game with SDL2, for now on Window, but I'd like to dream and imagine that if I finish it, I could run it on other platforms that SDL2 games can target. A core part of which is GGPO based lockstep netplay. So, I want to fix my framerate (to 60fps).
On Windows, should I use VSync, but then somehow override/ignore it if the refresh rate of the monitor is not 60Hz? Or not use Vsync at all, and handle the fixed frame rate manually in all cases?
It seems in this case, various platform specific hoops need to be jumped through, as SDL_Delay (= Windows Sleep()) is nowhere near accurate enough. Seems I would need to dive out of platform independnce a bit to handle this?

sentences:
How to properly handle top down 2D collision? I can never seem to get this right, well polished at least. I'm creating a top down game in XNA, and collision has always been an issue for me to do properly. Detecting collision is fine, but resolving it is where I get messed up.

My approach so far:

Loop through rectangles polled by a quad tree
check if these rectangles intersect with the player
if yes then undo the velocity that we just applied to the player
if no then do nothing

This approach is less than ideal but it's close, I'm trying to allow players to move along the wall even if they're applying the force on the wall.

For example: if the player collides against a vertical wall, they should be able to move up and down even if they are still trying to move left/right.

I can't seem to find a good way to do this. Maybe I'm overthinking, but I tried doing vector subtraction on the centre's of the player and tile and seeing where the vector pointed. But that didn't give me much helpful information. I tried seeing if it was the x-axis or y-axis that was colliding but that didn't work as the player is bigger than the tiles.

Is there a way to find which axis is colliding so I can undo velocity on that specific axis?

sentences:
Proper way to maintain Vertex Buffer Objects I've started learning WebGL, currently I'm building a 2D lighting system, but there is some confusion going on inside my head.

How the lighting works is based on this tutorial http://archive.gamedev.net/archive/reference/programming/features/2dsoftshadow/default.html (probably the most linked article of the genre).

My question is about the proper way to store/create/update the Vertex Buffer Objects of the polygons.

Currently I have something like:

//-- during initialization of each polygon
//build vertices from the provided points
//[...]
//create the VBO
this._VBO = gl.createBuffer();
gl.bindBuffer( gl.ARRAY_BUFFER, this._VBO );
gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.DYNAMIC_DRAW );

//-- during rendering of each polygon
gl.bindBuffer( gl.ARRAY_BUFFER, this._VBO );
gl.enableVertexAttribArray( program.aVertexPosLoc );
gl.vertexAttribPointer( program.aVertexPosLoc, 3, gl.FLOAT, false, 0, 0 );

The vertices array is created only one time at the top of the file, and reused for each new polygon, the motive to do that is to avoid the creation of various Float32Arrays per object.

//top of file
var vertices = new Float32Array( 20 * 3 ); //maximum of 20 points

It's okay to have one VBO for each object? I was thinking about the possibility of a single VBO, but I don't understand how I can make it work with only one.
The number of vertices can vary between one polygon and another, so how I'm going to store that?

Currently I'm not taking into consideration textures, however, answers that already take they into account are welcome.

sentences:
Interactions between game objects I'm programming a basic Pacman clone to teach myself game programming. However, I'm struggling with the best way to have the game objects communicate/interact without my code becoming a huge mess.

Right now, I have a stack (implemented as a list) of objects in my base Game class. These objects include components such as Graphics, Input, etc. as well as "actual objects" such as Map, Pacman, etc. While running the game, the Game class loops through all of the objects and updates the ones which want to be updated and draws the ones which want to be drawn.

However, these objects must obviously interact. I implemented a Link function on the objects which allows one object to be "linked" to another; i.e. it gives one class a pointer to the other class so interaction can take place. For example, the Pacman class may use Link to be given a pointer to the Map class so Pacman can determine whether or not it can move in a certain direction.

With a game as simple as Pacman, this structure probably won't be too challenging to maintain, but were a game to have many interacting objects, I suspect the code would get out of hand. Is the method I am using right now alright, or should I look at another implementation of object communication? If so, what would you recommend?

I've looked at Communication between objects in games?, but whenever I try to implement the mediator pattern, I end up with a giant mediator class which is a challenge to maintain. Is the mediator pattern what I should be using?

sentences:
3D Planetary gravity so i am making a thing in javascript and i want to have planetary gravity in my "universe".

But when i use an equation to calculate the acceleration by gravity i get one number. That is how fast the object accelerates in the direction of the other object, but how do i convert a speed in one direction to a speed in the X, Y and Z axis?

sentences:
try to create CCSpriteFrame but get nil values I'm trying to animate a CCSprite in cocos2d v3 following this question, but I'm getting the following error message in Log:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM
 insertObject:atIndex:]: object cannot be nil'

This is my code:

NSMutableArray *animationFrames = [NSMutableArray array];
    int frameCount = 0;
    for(int i = 1; i <= 9; ++i)
    {
        CCSpriteFrame *spriteFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"hero-%d.png", i]];

            [animationFrames addObject:spriteFrame]; //ERROR OCCUR THIS LINE

        frameCount++;
        if (frameCount == 8) break;
    }

The problem is that all spriteFrames are nil, but I don't why. I already tested the i values with NSLog, and also tried to add hero-1.png to a CCSprite object and works fine. I also tried to add all fixed hero-1.png in all frames to verify if the problem was with i variable. But didn't work also.

sentences:
Should recoil be an animation or script? Should recoil for a rapid fire gun be be done through an animation or a script? I want the recoil to increase as I continuously fire, like a lot of FPS games do.
I was initially considering achieving this through a script in unity that rotates the gun slightly each time I fire, but I realized that since I plan to have most rapid fire guns be 2 handed weapons, at some point, the left hand won't be on the weapon.
However, since I also want the recoil to increase as I fire, I'm not sure how I can achieve this in an animation.
How is recoil typically done? Input on this would be very much appreciated.

sentences:
How to avoid hard coding in game engines My question isn't a coding question; it applies to all of game engine design in general.

How do you avoid hard coding?

This question is a lot deeper than it seems. Say, if you want to run a game that loads the files necessary for operation, how do you avoid saying something like load specificfile.wad in the engine's code? Also, when the file is loaded, how do you avoid saying load aspecificmap in specificfile.wad?

This question applies to pretty much all of engine design, and as little as possible of the engine should be hard coded. What is the best way to achieve that?

sentences:
How can I render 3d pictures synched frame by frame to a keyed video? I'm developing a software that aims to combine a keyed video with a 3D rendered one, synchronously frame by frame.

Each frame of video should be combined with a timely corresponding frame of 3D picture using a matching camera position parameter.

How can I perform this rendering and ensure it stays in synch?

sentences:
ECS: Movement system I'm a game developer enthusiast. I've decided to implement a game, however I'm pretty confused about all the movement mechanics (kinematics). Here goes a couple questions:
Velocity x acceleration x speed:

How do you apply acceleration/deceleration to your movement?
When moving (player input), do we either increase the velocity vector or the acceleration/speed value, or actually both? How does it really work?
How do you apply object weight to the movement?
How do you apply friction & gravity to the movement (should be applied to both axis, as this is going to be a 2D top-down view)?

Questions might be quite simple and/or stupid, but I'm just beginning (and also re-studying physics).

sentences:
Ground texture comes up blurry using the UV Rect Tool Im trying to recreate the ground as this sample sprite sheet: https://opengameart.org/content/post-apocalyptic-expansion

I downloaded the sprite sheet and extracted the top left block and saved it separately and added it as a default object not Sprite/UI. I then added a UI > Raw Image to my scene, added the imported texture. But as I expand it, it becomes blurry, even the UV rect does not seem to help. I though the UV rect was supposed to repeat the texture.

Am I doing this wrong?

sentences: Making filled circles in cocos2d How can you make filled-in circles in cocos2d? I understand you have to create a new method, but I don't really understand how it works/how to do it. Could someone please provide maybe an example or tell me how to go about achieving this? Also, I need to create about 24 filled-in circles, would this cause lags of some sort? Thanks!

sentences:
Interactive map designer I've made a simple game in pygame/pymunk. Currently my maps consists of lists with functions, e.g

ground_segments = [ground(position, size, shape...), ...]

I have equally built up lists for planks, stones, trees etc. And althoug it works, it is a bit tideous to work with.

I tried first tried making a tile-based map editor and .txt files to read/write to, but having a grid of letter felt limiting to wha I could add. Since I had a working concept of importing lists with the information I tried to build on that, but stopped once I realised I couldn't edit the contents of map.py fromlevel_editor.py. Is there a workaround for that or do I need anothter concept? If so, any suggestions?

sentences:
Game Development at iOS, Android and PC with OpenGL ES I'm beginning iOS apps development, and my aim is to make games to launch on App Store.
But I want to know if it's possible to program a game on Xcode with OpenGL ES (C++ game logic), integrate it on iOS with ObjC, and with that same game code (OpenGL ES + C++), implement it for Android with Java and to PC.

I have great interest to publish the same game on App Store, Google Play and specially Steam, and intent to build my personal 2D engine/API when I have more experience on graphic programming.

Do you know where can I find material to learn this?

sentences:
Good Book or Resource for 2D Game Art I have a very clear idea for my first Game . I have immense Experience in Coding Games in LibGDX but i am very poor at game art . So far I've been hating all the characters I've drawn . Are there any good books or other resource for learning 2D Character and Game elements Art .

Thank You

sentences:
Gdx.input.setInputProcessor(stage) doesn't work I have an image and I want to make clickable this image. I have already done this a lot of times, but this time doesn't work. Probably because the image is from a class which extends Image:

public class BitmapFontGenerale extends Image
{

BitmapFont bitmapFont;
String scritta;
private float x;
private float y;

public BitmapFontGenerale(BitmapFont bitmapFont1, String string, float scale)
{
    bitmapFont = bitmapFont1;
    bitmapFont.setColor(Color.BLACK);
    bitmapFont.getData().setScale(scale);
    scritta = string;
}

@Override
public void draw(Batch batch, float parentAlpha)
{
    bitmapFont.draw(batch,scritta,x,y);
}

public void setX(float x)
{
    this.x = x;
}

public void setY(float y)
{
    this.y = y;
}

public float getX()
{
    return x;
}

public float getY()
{
    return y;
}

}

This is the code which I used to set the input:

image.addListener(new ClickListener()
{
    @Override
    public void clicked (InputEvent event, float x, float y)
    {
       Gdx.app.log("CLICKED ", "CLICKED");
    }
});
stage.add(image);
Gdx.input.setInputProcessor(stage);

This code works if image is from Image class and not if it's from a class which extends Image. Note: I need to extend Image class. What's the problem?

sentences: Way to Get Collision Box Width Gamemaker I was coding the wall collision system for my game, and I wanted to do it using intersect boundaries instead of checking every step if they are off the screen. When the player crosses the boundary they get moved back to half of the sprite, but because the intersect boundary uses the collision box, it appears to jitter when you walk into the wall. Is there a way to get the width and height of the collision box so I can move them half of that away from the wall?

sentences:
What is the clearest way to present several numbers in a very limited space? I'm building a mobile incremental game and as, is typical for the genre, I've got a ton of changing values to show to the user. They serve both as a way to show them their progress, but also to help them make better decisions as the game goes on.

I have five values I want to show, the amount of "Harvesters" and "Salesmen" the user has, and then how many resources they're adding or removing from the resource pool, along with the net result. Say if you're harvesting 10 resources a second, and you're selling 2, you're netting +8/s.

In the following images, blurred to focus on the area in question, you can see the different styles I've tried out. This is the first style, where everything is shown to the player, but is exceptionally busy:

The second style is just the net change, but is missing the quantities of the two types of workers (ie 10 harvesters and 5 salesmen)

Finally the third style is a mix of verbosity and information, but does not show the net difference (ie +123/s).

I'm a fan of the first style because it shows the player everything, and as the programmer I'm happy to look at piles of numbers that represent the fruits of my labour, but the player might not want to see all of that. I've considered adding a toggle setting that goes between the styles if you press it, but I'm hoping there's some sort of happy medium here.

The highlighted parts of the image is all the space I have, but I can incorporate icons if it would help.

My question is between the three of these (or some totally different style), how can I convey the same amount of information clearly and cleanly?

sentences:
Random generation of a board So I have four "boards" made of 16 sprites (4x4). Each board is parented to an empty GameObject. I would like to randomly generate their positions but I am not sure how. However, they should still be generated at the middle of the screen not like anywhere off. So basically each board can be placed at any position but must touch at least one of the boards. The sprite of one board should line up with the sprite of the other board. For example:

So yeah any help is appreciated!

sentences:
Object goes straight through game object without colliding The "shot" is supposed to collide with the left bumper and then be destroyed, but the shot goes right through it. Both objects have a box collider.

The following is the code I am using:

#pragma strict
var speed : int = 2;
var collided_with : GameObject;

function Update () {
    transform.Translate(Vector3(-1 * speed * Time.deltaTime, 0, 0));
}

function OnCollisionEnter (col : Collision) {
    if (collided_with.tag == "Left") {
        Destroy(gameObject);
    }
}

I have made sure that all the tags are assigned correctly and that there are no spelling errors. The variable collided_with is also assigned to the left bumper. What am I doing wrong?

sentences:
Support of multiple 3d formats in engine What is the best practice to add support of loading models from multiple file formats (.obj, .3ds ...)?
What class hierarchy should I use (now I have Mesh class( containing vertex, data ) and MeshLoader class ( doing nothing right now ))?
I do not want to write loaders by myself, so than I have to copy loaded data into my structure.
Possibly you can show some articles explaining it especially Mesh class organization. Thanks in advance.

sentences:
Spherical fractal noise generator in shader I have a growing sphere in space, and I thought of having a procedural generated texture over it. Since it is growing, I thought a fractal would be a great choice, because more details would be visible the larger the sphere get (and I could mess with some parameter over time to have it animated).

A quick Mandelbrot implementation in GLSL showed it would be too expensive to have it in the devices I am targeting; also, I don't know how to map a cool looking fractal over complex plane onto a sphere without distortions (I expect the players to fly around this sphere in every direction, so there should be no "glued" edges or collapsed points), neither I have the background to devise/project a fractal over the spherical surface myself (probably was done before, but I could not find).

So weighting the requisites of the procedural texture:

Fast to run, for low-end/mobile GPU;
Over a spherical surface domain;
Growing in details with growing in size;
Possible to animate (BONUS);
Cool looking (of course);

then I thought it might be impossible within the constraints. But since I am no expert in this fractal thing, I thought I could ask it here first before scraping out the idea.

Maybe it is really not a fractal I need, and there is some other kind of noise with growing details I could use. Do you know of such noise generation procedure?

Do you know of any noise generator with uniform distribution over spherical sufaces, or any fractals whose domain is a sphere?

Can you suggest any alternatives for my situation?

sentences:
Why is my velocity decaying? Programming in Java.  Tinkering around with physics.  My entities all have position and velocity.  In the main loop, all I'm doing is applying gravity and bouncing off the edges, like so:

    //  add gravity vector
    o.velocity.add(GRAVITY.cpy().mul(dt));

    //  bounce off walls
    if ((o.position.x<0 && o.velocity.x<0) || (o.position.x>WORLD_SIZE_X && o.velocity.x>0))
        o.velocity.x*=-1;

    //  bounce off of ground
    if (o.position.y<=0.0f) {
        o.position.y=0.0f;
        if (o.velocity.y<0)
            o.velocity.y *= -1;
    }

The x and y values of my vectors are just floats.

For the first second it looks like it's working fine, but the vertical velocities slowly decay.  Any idea why?

sentences:
Inflating a balloon while the user touches & holds the screen I'm trying to create a simple balloon which will enlarge as the user touches and holds the screen.

So I wrote something like this:

while ( Input.GetMouseButtonDown(0) ) {
        transform.localScale += new Vector3(1, 1, 1);
        yield return new WaitForSeconds(1);
}

It causes a compiler an error:

  The body of 'enlargeBalloon.Update()' cannot be an iterator block because 'void' is not an iterator interface type

How can I fix this?

sentences:
Why do game developers develop games for exclusive contracts? There are several companies that develop their games for one console only (Playstation or XBox). Why and how are they doing this? Shouldn't there be more sales when they publish it for PC/PS/Xbox?

Why are they signing such contracts? What are the benefits?

Note: As long as these games are full funded by the console company I totally understand this exclusivity - but are there cases where these companies do not fund a game and it is still exclusive?

sentences:
A good way to build a game loop in OpenGL I'm currently beginning to learn OpenGL at school, and I've started making a simple game the other day (on my own, not for school). I'm using freeglut, and am building it in C, so for my game loop I had really just been using a function I made passed to glutIdleFunc to update all the drawing and physics in one pass. This was fine for simple animations that I didn't care too much about the frame rate, but since the game is mostly physics based, I really want to (need to) tie down how fast it's updating.

So my first attempt was to have my function I pass to glutIdleFunc (myIdle()) to keep track of how much time has passed since the previous call to it, and update the physics (and currently graphics) every so many milliseconds. I used timeGetTime() to do this (by using <windows.h>). And this got me to thinking, is using the idle function really a good way of going about the game loop?

My question is, what is a better way to implement the game loop in OpenGL? Should I avoid using the idle function?

sentences:
How to generate Bayer matrix of arbitrary size? In ordered dithering Bayer matrix is used.

How is that matrix generated? What algorithm can be used to generate matrix of arbitrary size?

sentences:
How to move 3D Object With Touch Dragging Finger By the screen In android Unity Game My Code is As Followed:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sphere : MonoBehaviour

{
    [SerializeField]
    private Touch touch;
    private float speedModifier;
    // Start is called before the first frame update
    void Start()
    {
        speedModifier = 0.01f;
    }

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

    {
        if (Input.touchCount > 0)
        {
            touch = Input.GetTouch(0);

            if (touch.phase == TouchPhase.Moved)
            {
                transform.position = new Vector3(
                    transform.position.x + touch.deltaPosition.x * speedModifier,
                    transform.position.y,
                    transform.position.z + touch.deltaPosition.y * speedModifier);
            }
        }

    }
}

I tried with this code but object is not even responding

sentences:
Sony PSM SDK's 2D game engine I have started with the Sony PSM SDK this week, I'm interested in creating a little 2D game and have been reading through the web about a so called "2D game engine" integrated into the SDK.

Some information I read suggested that it was added on January 2012, but I have been going through the documentation and haven't been able to find any reference to it.

Does anybody know if they finally introduced the 2D game engine for the PSM SDK?

sentences:
How to draw a trapezoid in OpenGL? The question seems easy, but you simply change vertex positions to match the corners of a trapezoid but it simply fails. I've tried scaling top and bottom edges like this :

but when I apply my texture it doesn't behave as I expected rendering this texture

into this image

Edit:

so far I've managed to produce a good looking image by changing w component of vertex coordinates instead of the x component, but I'm wondering if there is any better way to solve it?

Edit2:

here are my vertex and texture coordinates when I initialize the class.

float w = mTexture->getPixelsWide();
float h = mTexture->getPixelsHigh();
mVertices[ 0+0] =-w; mVertices[ 0+1] = 0; mVertices[ 0+2] = 0; mVertices[ 0+3] = 1;
mVertices[ 4+0] = w; mVertices[ 4+1] = 0; mVertices[ 4+2] = 0; mVertices[ 4+3] = 1;
mVertices[ 8+0] =-w; mVertices[ 8+1] = h; mVertices[ 8+2] = 0; mVertices[ 8+3] = 1;
mVertices[12+0] = w; mVertices[12+1] = h; mVertices[12+2] = 0; mVertices[12+3] = 1;
mCoordinates[0] = 0; mCoordinates[1] = 0;
mCoordinates[2] = 1; mCoordinates[3] = 0;
mCoordinates[4] = 0; mCoordinates[5] = 1;
mCoordinates[6] = 1; mCoordinates[7] = 1;

and later to scale it I'm currently using:

float ts = (mSpreadTime - mDropTime) / ((mSpreadTime - mTime) + mTopSpreadRatio * (mTime - mDropTime));
float bs = (mSpreadTime - mDropTime) / ((mSpreadTime - mTime) + mBottomSpreadRatio * (mTime - mDropTime));
mVertices[3] = ts;
mVertices[7] = ts;
mVertices[11] = bs;
mVertices[15] = bs;
mVertices[1] = 0 * ts;
mVertices[5] = 0 * ts;
mVertices[9] = h * bs;
mVertices[13] = h * bs;

note: that method above solved my issue, I'm looking for a way to fix it without messing with w component.

sentences:
How do I model diffusion and heat? So I'm trying to solve a heat/diffusion equation for a continuous space, but I'm not opposed to a grid solution. I'm a little short on the maths needed but have made it work so far.

If I model sources and sinks on a grid, I just need to center a gaussian potential on that coordinate with the appropriate sign. A source is like a positive metaball and a sink is like a negative one. Similarily, I can just do a gaussian blur of the entire image if it has no walls. The sources and sinks will smear together and give the actual solution.

However, if I have walls I can't do that, because there are boundary conditions to the problem all of a sudden. I could incrementally blur by a small amount, then add the walls back in, but I'm looking for a solution that I can lookup any t (time) for directly.

I could also expand the heat map out from sources and sinks by flood filling from those points, but I need the heat value to be implicitly there. I'll be pulling single values of perlin noise out of the air for obstacles and don't want to evaluate the entire field only to pull a single heat value.

So, is there any way I can define the boundary conditions as part of the convolution (gaussian blur) using math or some technique?

I looked at potential fields but I don't think that solves the diffusion exactly. To restate, how do I add boundaries to a diffusion problem and solve for a specific coordinate (x,y,t)? It should be possible since the boundary/obstacle is a single function f(x,y,t).

sentences:
I'm making a board game: who should manage the player move if the board has specific locations for the players? I know this is very specific question but imagine I have a board with spaces (like Monopoly) and a player that must go from one space to another after the dice are thrown.

So my workflow:

Player roll dice
After the player rolled dice

(from player class) space = board.getNextSpaceFromPlayer(player)
Move the player each step until it reach the destination

board.movePlayerToNextSpace(player);
OR
player.moveToSpace(space);

But how exactly do I move the player?

The board must move the player or the player move itself?

I'm trying hard to reflect how the things are in the real world but I find very hard to do so in this context.

Thanks for your help.

sentences:
Unity movie texture behaviour when hidden I have a UI with a button and a panel. Clicking the button toggles the panel on and off :

GameObject.SetActive();

Now the panel element has a child which is a plane. This plane has the following components :

mesh renderer
videoPlay, a script I've written
an audio source

The videoPlay script basically applies the MovieTexture to the plane's material, sets the plane's audioSource to the movie's audio clip, and starts audio and video.

public MovieTexture movie;

void Start() {
    GetComponent<Renderer>().material.mainTexture = movie as MovieTexture;
    GetComponent<AudioSource>().clip = movie.audioClip;
    movie.Play();
    GetComponent<AudioSource>().Play();
}

Now when at runtime I click the button (which hides the panel which is the plane's parent element), the audio and video stop as the plane disappears - which is expected behaviour.

When I reopen the panel though, the sound restarts right away but as if it were catching up for the time it was hidden (so it starts really fast and then comes back to regular speed) ; and the video is just frozen for - empirically and approximately - the same time the panel was hidden.

I've tried in the script - in Update() - messing with

if (!transform.parent.gameObject.activeSelf && movie.isPlaying)
    {
        movie.Pause();
        GetComponent<AudioSource>().Pause();
    }

for example, (and the same with Play() when it shows back up) but it doesn't seem to change anything.

sentences:
How can I provide an instance of a certain script to all scripts that need it? Problem
Whenever a player is added to the game (in the form of the server instantiating a player Game Object with a Player component), I want to provide it to every script that needs a reference; in other words, dependency injection.
Potential Solutions
I thought I'd create an IPlayerRequester interface and have the Player script look up all implementing scripts on the client when it's created, but Unity has no interface-searching equivalent of FindObjectsOfType<>().
More Info
The game is multiplayer, where 1 player is the host — a client and the server — that is joined by other clients.
I'm using Mirror.
When a new client is added, the Player script's (that was just spawned) callback OnStartLocalPlayer() is invoked, and so far, that's the only way I've found to access the local environment.
But because this is the same Player that I'm trying to inject into requesting scripts, I can't just raise an event in that method, so that's out.

What would be a good solution here?

sentences:
Unity splash is starting in progress after white screen When I export my Unity project (on Windows), there is a brief white screen before the Unity splash screen renders, already in progress. Discretely cutting to the already in progress splash screen looks pretty bad, so I'd like to fix this.
Here is a video showing what I mean.
After some googling, I did find other reports of a white screen, but only on Android. My project is very simple and I am not loading anything intensive on boot, so I'm not sure what is causing this white screen.
Does anyone know what might be causing this issue or have ideas to troubleshoot it?

sentences:
Tiles in the Tilemap dont overlap properly This is my first try making a "proper" game in Unity. I'm using the latest version (2019.2.2 at the time of writing) and I'm writing with C#. This is a project I'm doing for my studies, together with another person (he makes tiles, sound, music and I'm at charge of the programming).

We are making a 2D Roguelike RPG using the Unity tilemap feature.

My algorithm to generate dungeons works really well, but only used one ground tile and one wall tile. We found that to be very boring and changed it.

Now comes the problem. If I let the algorithm pick between fewer than 3 tiles, everything works fine.

If I let the algorithm pick from more than 2 tiles, something strange happens and the some tiles don't overlap properly.

I hope somebody can help me understand why this happens.

Here the important settings of camera and tilemap:

Camera
Grid
GroundLayer
WallLayer

One weird think I have been able to find out: The tiles that don't overlap will change if I change the position of the camera.

As a gif:

sentences:
The ship "shudders" in scrolling Asteroids In my Asteroids game the user can scroll through space. When scrolling, the ship is drawn in the centre of the window. I use interpolation. I scroll the window uing glOrtho, centering it around the centre of the ship. On my first machine (7 years old, Windows XP, NVIDIA), I am doing 50 updates and 76 frames per second. This is smooth. My other machine an old compaq laptop (Pentium III) with Linux and Radeon OpenGL driver delivers 50 updates and 30 frames per second. The ship regularly seems to "shudder" back and forth when at maximum thrust. When you position the mouse cursor beside the ship it is obvious that its relative position in the window changes. Also, the stars seem blurred into short "lines".

Playing the game in non-scrolling mode, the ship moves within the window, glOrtho is therefore not called repeatedly and there is no problem.

I suspect a bug in my positioning of the ship and the window but I have dumped out these values and they seem to only go forward, not forward-back-forward. The driver does support double buffering. I guess if it is my bug I need to slow the frame-rate down to debug properly. My question: is this an obvious driver bug or is the slower machine uncovering a bug in my stuff and if so, some debugging tips would be appreciated. I am drawing in world co-ordinates and letting OpenGL do the scaling and translation so if I had a quick way of verifying what pixel co-ordinates OpenGL produces for the ship centre, that would help clarify this.

sentences:
How big a transition from programmer to modeler/level designer/creator So I think I may take a break from the programming side, I have put in 6 hard months learning C++ and graphics theory, I have learned a huge amount but over the last few days have been studying level design and modeling and think that is maybe more suitable to me.

So how would programming compare in a learning curve sense, C++ takes a while to grasp the core language never mind writing 100,000s lines of game engine code which you would eventually have to do.

Without being arrogant the modeling/level creation side seems a much faster progression, is that a fair thing to say?

sentences:
How can I get animated bone's transformation in LibGDX? I am trying to get transformation from a bone, but i can't, I exported just a animated armature with just a bone from blender, then I converted to .g3dj, so I just need the bone transformations so that I can get it value for some effects like moving sprites and other things.

any ways to read just transformation in "render()" method, seems bones animation does not effect on bone's value!
I want to use just openGL ES 1.x.

sentences:
How to remove an object from a std::vector So I have a vector of bullets that show up on the screen and I do not want these bullets to live forever. I want them to "die as soon as they go off screen or collide with an enemy. How can I make sure they are removed from the array and no longer take up memory.

code:

std::vector<Bullet> bulletArray;

for(int i=0; i<bulletArray.size(); i++)
{
    bulletArray[i].MoveBullet();
    bulletArray[i].Draw();
    if(bulletArray[i].PosY<0)
    {
        //Delete object forever
    }
}

sentences:
Gradually reduce speed Basically I am working on following application of android version
Party Games: Drinking Wheel

For this I want to rotate wheel and want to stop wheel at specific point. But I want this with gradually decreasing speed. For example at start I have speed of 10 then at stop time it at 0. So wheel stop smoothly.

At presently I have working code but it stop suddenly.

registerEntityModifier(new RotationModifier(desireTime, 359f,
            desireRotation, new IEntityModifierListener() {

                @Override
                public void onModifierStarted(IModifier<IEntity> pModifier,
                        IEntity pItem) {
                }

                @Override
                public void onModifierFinished(
                        IModifier<IEntity> pModifier, IEntity pItem) {

                    mPointer.stopRotation();
                    showWindowAfterSomeTime(randomSegment);
                }
            }, EaseLinear.getInstance()));

I want some help in this. Thanks for your time.

sentences:
Convert game replay into video format My game outputs a replay file for each individual game and allows the player to watch past games.

Just a quick example of what our replay files look like:

m 6 2098.25 917.125 -1 0 224 56ööööö843949615
m 2 1715.25 1835.25 1 0 224 44ööööö843949621
m 11 1661.125 1890.875 1 0 224 56ööööö843949627
m 5 1818.125 929.0 0 1 224 56ööööö843949633
death 9 3 4 5ööööö843949663
hit 9 3 4 48 26 2114 1987 2.8266926 1865 1891ööööö843949663

Some info on the identifiers:

Movement: // m (player id) (x coord) (y coord) (x-movement) (y-movement) (remaining health) (shot energy remaining) (timestamp)

Death: // death (dead player id) (killer player id)

Hit: // hit (hit player id) (hitter player id) (weapon (1-4)) (damage dealt) (life remaining ) (x coord) (y coord) (angle of hit) (total damage dealt) (total damage taken)

There are a lot more than what I listed, but you get the idea.

What's in the replay files are essentially the same as what is sent to the server during a live game.

Right now, if we want to take a video of the game, we just go into our replay system and record it with Fraps, but I'd like to convert our replays into some kind of video format.

I know this may be a bit far-fetched, but I thought I'd give it a shot here.

The game is written in Java and is sprite based.

sentences:
Does cube map texturing works only for objects which vertices are is in [-1,1] range? Im attempting to texture an .obj file that is not a skybox. So the question is, every tutorial about cubemap creates their hardcoded cubes with vertices ranging from [-1, 1]. Probably not, but is it necessary to scale my .obj model to be in that range?

Also, to map my fragments with the right texel - I saw people online telling that I should take a point p then subtract it with the model center c in the shader. Some said that I should normalize them? normalize(p - c)  I hope you can help me deliver a brief explanation.

sentences:
Is it worth to implement game mechanics/rules separately from the main code? Not sure whether it fits the scope of this community, or should go to Stackoverflow instead.

Let's suppose that I want my game be easily extendable in its core, i.e. I want that a lot of people, even without decent programming knowledge, would be able to not only tweak existing rules, but even add totally new game mechanics into it. I'm not good programmer myself, but I'm ready to learn, I'm just need some directions and assurance it can be done.

What I've thought about is whether it's possible/feasible to somehow implement game mechanics separately from the main utility code? I mean, for tabletop games we have those rulebooks which don't contain actual algorithms of all actions, but rather describe some protocols and limits, referencing context of each such item heavily. Is it possible to do something similar for PC game, like, describe all the rules in some very high-level, easily readable (and changeable) by a human programming language, which is then "consumed" and parsed by the utility code into a working instance of game mechanics?

That really seems like I need to write my own language and a compiler for it )) Which I won't be able to do, of course. But may be there is an easier approach to the problem?

FYI: my language of choice for the utility code will be Python 3.x

sentences:
Binary Space Partitioning of 3d Triangle Mesh (for finding nearest points) I'm writing a Binary Space Partitioning (BSP) tree for the purpose of optimizing finding the nearest point on the surface of a 3d triangle mesh with respect to another point. I'm currently following a method similar to the one described here to build the tree and then using Barycentric coordinates to locate the nearest points on the surface of the triangles.

I'm having an issue on how to resolve when a triangle is split by the splitting plane (i.e. all three points in the triangle are not on the same side of the splitting plane). One solution presented in the previous link would be to attach these conflicting triangles to the root node, but I'm not sure how this would impact tree traversal. When traversing through the tree and eventually getting to a leaf node containing a set of triangles that are nearest to your query point, which you would have to check each to see which is nearest, would you be also required to check against all triangles in parent nodes?

A different method I thought of would be to just include the conflicting triangles in both the positive and negative children of a node that is split (positive children being above the plane, negative below). This way, they could still be excluded in further iterations of the splitting plane, but it seems a bit redundant.

A final alternative is to instead use vertices to build my tree and once having found the nearest vertex to the query point reference nearby triangles. This would make building the tree much simpler, but because the nearest point is not necessarily a part of the nearest triangle, you are required to retrieve multiple nearest points and query against multiple nearest triangles to ensure you have the correct nearest one.

Each of these methods seems a bit inelegant so I'm hoping there's a simpler solution out there.

sentences:
Upon import, isosphere is missing To build my tank for a Unity game, I am using Blender. Currently, I am making a turret consisting of an isosphere with half of the faces removed (I needed the bottom to be "flat") with some minor visual edits, two cylinders (one is the hatch, the other the antenna), and a cube to act as a hinge:

The inside is hollow. When I imported it to Unity (drag and drop from File Explorer straight to Unity Assets folder), the entire isosphere was missing as you can see from the preview:

I have tried to correct the normals with CTRL-N as mentioned in other Blender forum pages but it still doesn't work. How exactly do I make my isosphere appear in Unity?

NOTE: This works if imported as a .fbx file but I would much prefer the file to be a .blend file instead (which is default).

sentences:
What Java library provides a high-level communication interface suitable for use in an action-game server? I need to write a server for an action game, which needs fast communication with the client. There will only be one server, and I'll split the world in zones. The client will be written in Java using jMonkeyEngine and in my opinion I should write the server in Java as well. I don't want to implement any low-level features such as communication, reliable udp, etc.

Is Java the most appropriate language to write an action game server which will run on Linux? Is there a Java library which provides a high-level interface for network communication?

sentences:
Render cylinder tube along 3D Path I'm working on a roller coaster game, and I have computed a function that represents the path of the track in the 3D space. Since the track will be tubular and will be dynamically generated(as opposed to a very large obj file), I was wondering if there was any elegant way to render something like this.

Something like this is what I'm aiming for

PS: I'm currently working in SceneKit on iOS/OSX

sentences:
Character rotation according to camera causes rapid flipping when game starts When I load my scene, my character rotates +90 and -90 on the X axis very fast about 4 or 5 times, and then he stops at -90 on X axis (lays back down).

When I move the character, the rotations are just the way I want them, but I need to fix that weird bug at the beginning of the game.

Here's my character's movement logic. It's based on the rotation of the camera, which is a child of my character object.

void Update() {
    Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    transform.position += (camF * vec.y + camR * vec.x) * Time.deltaTime * MoveSpeed;

    Vector3 deltaPosition = transform.position - prevPosition;

    if (deltaPosition != Vector3.zero)
    {
        transform.forward = deltaPosition;
    }

    prevPosition = transform.position;
}

sentences:
How do you ensure consistent experience across multiple graphics cards (or even driver versions)? So I was writing a simple 2D game with OpenGL and SDL and had this problem when there was awful tearing when running in windowed mode (even though I explicitly asked SDL_SetVideoMode to use double buffering). Didn't worry about it all too much because most of the time the game grabs the entire screen, windowed mode is just for debugging.

Anyway, yesterday I updated my nVidia drivers and tearing disappeared, the game runs smooth and looks nice in windowed mode too. I can see how the problem may be in the graphics driver, but this leads to a question.

Obviously, professional game developers have to deal with a lot of different hardware/software configurations. What are the techniques they use to make sure the game looks the roughly the same on different graphics cards or even the same model of graphics card, but with different driver versions?

sentences:
How can I get old Minecraft style terrain biome selection? I'm using this post as a reference for what I'm doing.

The real thing of interest is this:

As you can see, this is a Whittaker diagram, with temperature and rain considerations.

So would this be the algorithm he uses?

def rain(x,z):
    return some_fbm_perlin_noise(x,z)
def temp(x,z):
    return some_fbm_perlin_noise(x,z)
def biome_at_point(x,z):
    return diagram_at_point(rain(x,z),temp(x,z))

The issue with this is that if I assume the fbm perlin noise to be in the range [0,1] for both of them, then this algorithm only covers the bottom left half of the diagram. What is the top right half?

And also, perlin noise tends to make "short forays" into extreme ([0.9,1.0]) values, so the smaller, rarer biomes would have little tiny dots scattered around the map. An example would be the tundra: the tundra is very rare, and when it happens it probably only happens for a small area.  But what actually happens in Minecraft is that the smaller, rarer biomes are very rarely come across, but they still have a normal size.

I've tried something like this:

def rain(x,z):
    return hash(nearest_voronoi_point(x,z))
def temp(x,z):
    return hash(nearest_voronoi_point(x,z))

But this runs into the triangle problem, and a new one: the hash function, by definition, is incoherent, which means that it could put a desert next to a snowy mountain, because there are no constraints.

How does can I fill in the final triangle and not half tiny biomes everywhere, while maintaining biome coherency?

sentences:
Direct3D11 and SharpDX - How to pass a model instance's world matrix as an input to a vertex shader Using Direct3D11, I'm trying to pass a matrix into my vertex shader from the instance buffer that is associated with a given model's vertices and I can't seem to construct my InputLayout without throwing an exception.

The shader looks like this:

cbuffer ConstantBuffer : register(b0)
{
    matrix World;
    matrix View;
    matrix Projection;
}

struct VIn
{
    float4 position: POSITION;
    matrix instance: INSTANCE;
    float4 color: COLOR;
};

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

The input layout looks like this:

var elements = new[]
{
    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
    new InputElement("INSTANCE", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1),
    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0)
};
InputLayout = new InputLayout(device, signature, elements);

The buffer initialization looks like this:

public ModelDeviceData(Model model, Device device)
{
    Model = model;
    var vertices = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, model.Vertices);
    var instances = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, Model.Instances.Select(m => m.WorldMatrix).ToArray());
    VerticesBufferBinding = new VertexBufferBinding(vertices, Utilities.SizeOf<ColoredVertex>(), 0);
    InstancesBufferBinding = new VertexBufferBinding(instances, Utilities.SizeOf<Matrix>(), 0);
    IndicesBuffer = Helpers.CreateBuffer(device, BindFlags.IndexBuffer, model.Triangles);
}

The buffer creation helper method looks like this:

public static Buffer CreateBuffer<T>(Device device, BindFlags bindFlags, params T[] items)
    where T : struct
{
    var len = Utilities.SizeOf(items);
    var stream = new DataStream(len, true, true);
    foreach (var item in items)
        stream.Write(item);
    stream.Position = 0;
    var buffer = new Buffer(device, stream, len, ResourceUsage.Default,
        bindFlags, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
    return buffer;
}

The line that instantiates the InputLayout object throws this exception:

*HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.*

Note that the data for each model instance is simply an instance of SharpDX.Matrix.

EDIT

Based on Tordin's answer, it sems like I have to modify my code like so:

var elements = new[]
{
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0),
new InputElement("INSTANCE0", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE1", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE2", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE3", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1),
};

and in the shader:

struct VIn
{
    float3 position: POSITION;
    float4 color: COLOR;
    matrix instance: INSTANCE;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

However I still get an exception.

sentences:
How to store 3D entity position, offset, and transformation data for parent and children? I am looking for a cleaner pattern to storing character position data, offsets, and transformations. I currently have a character with a vec3 for position.

Entity{
 position: vec3
 rotation: vec4Quaternion
 velocity: vec3
}

I use this position vector as the world coordinate. So that when Y=0 I imagine the characters feet are on the ground. This makes it easier to think about where the entity is in world space.

The problem I am having is that mesh entities like colliders or the skin mesh will assume a position vector at the center of the mesh.  This is causing me to have to do a bunch of transformation juggling. I can't 1-to-1 map these meshes to the entities world position.

I will update my characters 'ground position' when they move. then have to calculate the new 'center position' which is calculated like

centerPosition = [
groundPosition.x
groundPosition.y + entityHeight/2,
groundPosition.z
]

I"m wondering if there is a better pattern for this. Maybe I assume the entities position vector is a 'center position' as well? but not clear to me how to handle the ground offset in that case.

sentences:
Resize the Texture Region (parallax background) to fit my screen size in libgdx I am using libgdx to make a running game. I am using vertical parallax background. I have successfully implemented parallax background many times. But for this game, I want my Texture region to fit my screen size. I tried several things but the texture region is streched badly.Here is a screenshot.

I used this code:

texture_bg  = loadTexture("data/road1.png");
bg  = new TextureRegion(texture_bg, 0,0, 600, 600);

that is obvious. Now ..what should I do... so that while making it as a parallax background... it would fit my screen... I am worried only about the width.... as if the width will fit the screen width... it will look like a running road... no matter how long the height is.

I found some solution here
https://stackoverflow.com/questions/7551669/libgdx-spritebatch-render-to-texture

but not able to understand.. it seems somewhat complex.
Please make it clear if it is the solution or suggest on other possibilties.

sentences:
Where to put input detector? So below is the usual XNA Game Component override method. If I want to add a touch input detector (lets say, I want to draw a rectangle under touched screen area), where do I put it and how? Googled it, but I found no satisfying solutions.

public override void Initialize()
{
    base.Initialize();
}

protected override void LoadContent()
{
    _spriteBatch = new SpriteBatch(GraphicsDevice);
    base.LoadContent();
}

protected override void UnloadContent()
{
    base.UnloadContent();
}

public override void Update(GameTime gameTime)
{
    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    base.Draw(gameTime);
}

Thanks

sentences:
How to position a sprite in a 2D animation skeleton? Given two joints that define a bone, I would like to know how to decide where, between those two joints, I should draw the sprite. This should be a fairly simple thing to solve, but there is one thing that I am not sure about.

After I've determined the rotation of the sprite (which is the absolute angle the joints form with the x-axis), I also need to determine the origin point from where I need to start drawing the transformed image.

So how should I position the sprite between the two joints? Should I make the center of the image be the midpoint between the two joints, or should I make one the of the joints be the origin? Do these things matter that much (could the wrong positioning make the sprite move oddly during the animation)?

sentences:
How to make a point light cast shadows in realtime? I have a solar system...

The central star has a point light attached to it.

However, objects don't cast shadows on each other...

Planets are < 20 units from the star, so it's not a light falloff issue.
The point light is the only light source in the scene.
There are occasions when it works - moon 3 of planet 5 correctly casts a shadow on its parent and siblings, whereas none of the others do.
Here's a video showing the issue more clearly: https://youtu.be/rmlWlXjygk0
Note that there are issues both casting and receiving shadows for all but the outermost moon.

Everything is set to both cast and receive shadows, objects are in the correct layers and not marked static...

I've tried changing from forward to deferred but that only prevented me seeing any shadows at all.
What am I missing? How can I get Unity to cast shadows correctly?

sentences:
Wheel rotation, to change velocity of vehicle I update the velocity of my vehicle like so:

[v setVelocity:  ((2 * 3.14 * 100 * (wheel.getRotationValue / 360) / 30)) * gameSpeed]; // update on 60 fps this gets velocity on all frames divide by 60 for 1 frame.

This is done in my update method in my world class.

Now wheel.getRotationValue returns the rotation value which is worked out like this:

- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:[touch view]];
    location = [[CCDirector sharedDirector] convertToGL:location];

    if (CGRectContainsPoint(wheel.boundingBox, location))
    {
        CGPoint firstLocation = [touch previousLocationInView:[touch view]];
        CGPoint location = [touch locationInView:[touch view]];

        CGPoint touchingPoint = [[CCDirector sharedDirector] convertToGL:location];
        CGPoint firstTouchingPoint = [[CCDirector sharedDirector] convertToGL:firstLocation];

        CGPoint firstVector = ccpSub(firstTouchingPoint, wheel.position);
        CGFloat firstRotateAngle = -ccpToAngle(firstVector);
        CGFloat previousTouch = CC_RADIANS_TO_DEGREES(firstRotateAngle);

        CGPoint vector = ccpSub(touchingPoint, wheel.position);
        CGFloat rotateAngle = -ccpToAngle(vector);
        CGFloat currentTouch = CC_RADIANS_TO_DEGREES(rotateAngle);

        float limit = 0.5;
        rotationValue += (currentTouch - previousTouch) * limit;
    }

    touching = YES;
}

Say I steer the vehicle to the far right of the screen, and want to move it to the far left, It wont start moving to the left of the screen until the rotationValue is past 0 degrees again (the wheel is in its center posistion) and is dragged past this value.

Is there anyway to change the code I have above, so that movement on the wheel is recognised instantly and updates the velocity of v instantly too?

sentences:
Optimum Screen Resolutions Most PC games nowadays obviously come with the standard option to change the game's resolution from between 640x480 to 1920x1080 on average, depending on your monitor and whether or not you are playing in windowed mode. However, when developing a retro pixel art game, allowing the resolution change to be between 640x480 and 1920x1080 is rather absurd.

So in a pixel art game where, at default resolution, one frame of the main character's sprite is 16x32 pixels, what would you like to see the game's default resolution to be, and by how much would it scale with each resolution option? Would a square screen be better than a widescreen? How many map tiles (at 32x32) would be best to display across and down?

So, in general, what would be the optimum game screen size and at what resolution for a pixel art game now? Your opinions are appreciated.

sentences:
Moving a camera without rolling (tumble not arcball rotation) I'm trying to move my camera around using mouse+keyboard. I'm looking for specific camera behaviour however, and I cant figure out how to get it right. What I've found, is that to get a maya/tumble style camera, I need to multiply my xrotation in world space then my yrotation. Reversing the order it looks like this:

view = cam_move * //wasd in cam_space, this works correctly
       yrot * //before = world to camera space
       view*
       xrot; //after = model to world space

This means my xrot(world) doesn't interfere with my yrot(eye), which avoids unwanted roll induced by regular cam-space x-rotation.

My problem however, is that I want the xrotation to happen around a point (as if done in eye space) but without creating unwanted roll. I do not know how to get that result.

According to my sources It should be as easy as translating inversely before xrotating, then translating back after, but its just not working. Perhaps someone knows how I can get my cam to spin (yaw) around a point, without causing the unwanted roll?

SOLUTION:

Keeping track of pitch/yaw (mouse_move.xy) seperately, as well as the camera location, and making sure to multiply the yaw before the pitch. Pitching will create unwanted roll, but yawing wont create unwanted pitch, so its a matter of which you do first here.

To move the camera in eye space, I do this:

//make a mat3 rotation matrix and multiply it with current movement
if (keys['A'] - keys['D'] || keys['W'] - keys['S']){
    camlocation += //rotated then moved
        (glm::normalize(vec3(keys['A'] - keys['D'], 0, keys['W'] - keys['S']))*move_speed)*
        mat3(glm::rotate(mat4(1.0f), pitch, vec3(1, 0, 0)))*
        mat3(glm::rotate(mat4(1.0f), yaw, vec3(0, 1, 0)));
} //which will be a value to add in world space

Then under camera update, or where I build the view matrix, I do this:

view =
    glm::rotate(mat4(1.0f), pitch, vec3(1, 0, 0))* //pitch radian float
    glm::rotate(mat4(1.0f), yaw, vec3(0, 1, 0))* //yaw also in radian
    glm::translate(mat4(1.0f), camlocation);

Just remember that in OpenGL/GLM the matrix transformations are reverse order, due to how OpenGL does column/row matrix computations. (Compared to directx it saves a transpose operation in the shader (apparently))

Making sure to yaw before pitching, and both after translating (reversed on paper) avoids the unwanted roll, wich yields the desired tumble/maya effect!

sentences:
Use both AddForceAtPoint and change velocity property? I'm using Rigidbody2D for some game objects. It seems that when I AddForce() or AddForceAtPoint(), the game objects are mostly affected on the Y axis and hardly at all on the x axis. I don't understand why. To really get any effect on the x axis, I need to have a very strong force like *10 000. But the effect on the y axis is then extremely strong and shoots the object out of screen, yet only nudges the game object on the x scale.

I believe that the problem with the y axis is because I use .velocity to move the character. But I don't know how to change the velocity directly without doing that.  What should I do to use both forces and set velocity on the same object?

sentences:
UV interpolation is wrong with a wide FOV How should I take FOV into account when interpolating UV coordinates? This picture shows the result today. Everything works fine with a narrow fov, but when I make it really wide, things deviate. The black line is expected to be straight.
I'm writing a software renderer myself, so I can't just invoke some OpenGL function. Any advice is appreciated.

https://bitbucket.org/jevring/threedee

sentences: Create a normal map using a script? Unity I don't have a software that can create normal maps from an image so I usually make a grayscale image and then let unity make the normal map from that image. But I can't save the image to use for later, Instead I have to convert it to a normal map every time I use it. So how would I make a normal map from a greyscale using a script? i prefer c# but js works fine.

sentences:
In HLSL pixel shader , why is SV_POSITION different to other semantics? In my HLSL pixel shader, SV_POSITION seems to have different values to any other semantic I use. I don't understand why this is. Can you please explain it?

For example, I am using a triangle with the following coordinates:

(0.0f, 0.5f)
(0.5f, -0.5f)
(-0.5f, -0.5f)

The w and z values are 0 and 1, respectively.

This is the pixel shader.

struct VS_IN
{
    float4 pos : POSITION;
};

struct PS_IN
{
    float4 pos : SV_POSITION;
    float4 k : LOLIMASEMANTIC;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = (PS_IN)0;
    output.pos = input.pos;
    output.k = input.pos;
    return output;
}

float4 PS( PS_IN input ) : SV_Target
{
    // screenshot 1
    return input.pos;

    // screenshot 2
    return input.k;
}

technique10 Render
{
    pass P0
    {
        SetGeometryShader( 0 );
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}

When I use the first statement (result is first screenshot), the one that uses the SV_POSITION semantic, the result is completely unexpected and is yellow, whereas using any other semantic will produce the expected result. Why is this?

sentences:
Object Transparency Dithering (as shown in Super Mario Odyssey) A couple games I've been playing recently all have a similar goal of dithering objects when they approach the near clip plane.  Super Mario Odyssey applies this dithering-near-clip-plane effect, but along with object intersection dithering for objects like Mario.  I have an example of this dithering in Super Mario Odyssey later in this post.

How would one go about creating this effect in their graphics solution of choice?

The gifs might take a little while to get started.  I couldn't get them to each be under 30 mb :(

Example in Super Mario Odyssey

The balloon of the Odyssey doesn't "exit dithering" until the camera is a good distance away from it.  This could mean dithering is calculated based on object distance from camera, instead surface distance.

Flag starts out with a small dither density, and Mario has no dithering applied to him.  Once the flag is fully opaque, Mario becomes dithered, but only in the portions that is covered.  Also note Mario's coat tail has the "transparency dithering" applied to it.  How are the object's shaders structured to allow this compound effect?

Below is a blown up image of Mario being dithered.  Notice how dithering exists in intersection regions, and when behind objects!

sentences: Is there an MMO-related research body? I'm trying to find a research resource for MMOs -- preferrably where people send papers to be published, have conferences, etc. If nothing else, just a repository of articles would be nice. Is there a site like that? I'm assuming it would be a subconference of a bigger group.

sentences:
How can I architecture the cards and boards of this board game? I want to create a board game (at least it's structure and engine, not the graphics), and since It's the first time I do this I don't know where to start.

It's a turn based strategy card game where cards that act differently, some are placed and moved on the board, some are placed but don't move, and some are played from the hand but not placed on the board.

Well, I don't know how to translate this to code. I thought that I should have a interface for the Cards, but since there are various types of cards that act very differently it doesn't make sense . Then I thought that there should be a class for each Player which stores which of his cards are played, which are left etc.. Something like this:

public Class Player
{
 private List<Card> PlayableCards;
 private List<Card> OutOfGameCards;
}

But there's a fixed amount of cards of each type, so its useless to have a List<T> (besides as I said I don't think I'll have a Card class).
Then How should I approach this? Having the cards as individual variables? It doesn't sound right.

The next thing is the Board, it's formed by 8x8 squares where the cards are placed. How do I identify each placed card with a card in the code?

Maybe something like this:

public Class GameBoard
{
 private Square[][] SquareGrid;
}

If I do it this way its easy to separate each square and access it by it's position (SquareGrid[3][4]=3x4). But do I store which card is in each Square? Or do I store in which square is each card? After that there's a "special zone" outside this board and everything gets more messy.

sentences:
Animation imported from Blender into Unity via FBX doesn't play? I started building this model in Blender and gave it a simple animation that rotates the board about the axel.

...I exported it as FBX and imported it into Unity. I can see the animation is stored in the file when I import, but I can't find an animation file after I drop it in the scene, and there is no controller for the Animator controller it generated, either. I can watch the animation play in the FBX preview thumbnail but nowhere else.

How can I get my animation working?

sentences:
SlimDX Direct3D10 Sprite stretches with window size I'd like to draw a sprite bitmap with SlimDX Direct3D10, but I'm stuck at this  problem, where I can see my image on screen, but it gets stretched depending on the window size.

The issue looks like this:

I got the same general idea of drawing sprites in Direct3D9 and Direct2D working fine, because there I simply resize the RenderTarget or reinitialize the Device with a new BackBuffer.

How do I fix this, so that the sprite remains the same dimensions independent from window size?

I'm seeing two potential issues:

I don't know if and how I need to set the different Transforms to adjust for window size (I'd rather resize the backbuffer, and only transform sprites for positioning and scaling)
I suppose I need to update the backbuffer or do something in the form's resize event.

Here is my rendering code:

using DiscSim;
using SlimDX;
using SlimDX.Direct3D10;
using SlimDX.DXGI;
using System.Windows.Forms;
using System.Drawing;
using Device = SlimDX.Direct3D10.Device;
using Vector2 = SlimDX.Vector2;
using Resource = SlimDX.Direct3D10.Resource;

namespace DiscSimSlimDX
{
    class Camera_DX10 : Camera
    {
        private RenderTargetView renderTarget;
        private Device device;
        private SwapChain swapChain;
        private Sprite sprite;
        private SpriteInstance[] spriteInstances;

        public Camera_DX10(ISimulation simulation, Form form, string spritePath)
            : base(simulation, form, spritePath)
        {
            var swapChainDescription = new SwapChainDescription()
            {
                BufferCount = 1,
                ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
                IsWindowed = true,
                OutputHandle = form.Handle,
                SampleDescription = new SampleDescription(1, 0),
                Flags = SwapChainFlags.AllowModeSwitch,
                SwapEffect = SwapEffect.Discard,
                Usage = Usage.RenderTargetOutput
            };

            Device.CreateWithSwapChain(null,
                DriverType.Hardware,
                DeviceCreationFlags.Debug,
                swapChainDescription,
                out device,
                out swapChain);

            using (var backBuffer = Resource.FromSwapChain<Texture2D>(swapChain, 0))
            {
                renderTarget = new RenderTargetView(device, backBuffer);
                RenderTargetViewDescription r = renderTarget.Description;
            }

            device.OutputMerger.SetTargets(renderTarget);
            device.Rasterizer.SetViewports(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0, 1));

            device.OutputMerger.BlendState = BlendState.FromDescription(device,
                new BlendStateDescription()
                {
                    IsAlphaToCoverageEnabled = true,
                });

            sprite = new Sprite(device, 512 * 512); // How big should the buffer size be?
            sprite.ProjectionTransform = Matrix.Identity; // ?
            sprite.ViewTransform = Matrix.Identity; // ?

            ShaderResourceView texView = ShaderResourceView.FromFile(device, "Resources/World.png");
            var spriteInstance = new SpriteInstance(texView, Vector2.Zero, new Vector2(1, 1));
            spriteInstance.Transform = Matrix.Identity; // ?

            spriteInstances = new SpriteInstance[1] { spriteInstance };

            form.ResizeEnd += (s, e) =>
            {
                // How do I resize the backbuffer or what do I need to do
                // to adjust for the new window size?

            };
        }

        public override void Draw()
        {
            device.ClearRenderTargetView(renderTarget, Color.Black);
            sprite.Begin(SpriteFlags.None);
            sprite.DrawBuffered(spriteInstances);
            sprite.End();
            swapChain.Present(0, PresentFlags.None);
        }
    }
}

sentences: Visual Studio not updating files made in Unity In the past Visual Studio simply updated solution based on files added in Unity but now all of them have to be added manually and they are as miscellaneous when they are added. How can I fix it?

sentences:
ARBShaderObjects.glDeleteObjectARB vs GL20.glDeleteShader to remove shader? I've created a shader object using ARBShaderObjects.glCreateShaderObjectARBand I'm wondering exactly how I'm suppose to remove said shader.

It seems both ARBShaderObjects.glDeleteObjectARB and GL20.glDeleteShader can do this.

I'm leaning towards ARBShaderObjects.glDeleteObjectARB since I created the shader using the ARBShaderObjects set of classes.

Do both of these work?

In this case is one prefered or different from the other?

Sorry for general LWJGL / OpenGL noobiness.

sentences:
Can i make a Game for play store on my own I am not sure what i am asking for. Sorry if this question look stupid.

I love to play games on android and pc . Some times very cool  ideas strike me , but i don't know what to do with them. and they vanish over time.

I got no computer science background , since i am a math student . Although i learned C++ for a week for a exam. In short I know C++ but just the alphabets.

Is it possible that i can learn to make games. What should i have to learn.
Is it possible to learn from youtube. Since it's like side hobby i can give it few hours a day ( not money ).

sentences:
Unity3d select empty gameobjects in scene I have a pathing system that I am creating in Unity. When you add nodes to denote the path, I create a empty GameObject and render it in OnGUI as a square. The problem that I have is clicking on the object in the scene view. I am trying to figure out what would be the best way to click the Node, so that I can move and rotate the Node.

I had some ideas, like:

Creating a Cube or some other GameObject with a mesh, and change the layer to Node. Then make the camera cull out the Node layer.
Only in editor mode, create a temp asset and delete it before runtime.
Do a raycast and see what objects are near the click, then pick the closest one.

I have a feeling that I am putting to much thought into it, and suggestions would be greatly appreciated!!

sentences:
Make the player run onto stairs smoothly I have a 2D Platform game, where the player Always runs to the right, but the terrain isn't Always horizontal. Example:

I implemented a bounding-box collision system that just checks for intersections with player box and the other blocks, to stop player from running if you encounter a big block, so that you have to jump, but when I put stairs, I want him to run smoothly just like he is on the horizontal ground. With the collision system you have to jump the stairs in order to pass them!

I thought about generating a line between the edges of the stairs, and imposing the player movement on that line... What do you think? Is there something more clever to do?

sentences:
How do I create a server for an existing game I don't have the source for? I was wondering if it is possible to create a dedicated game server for a game that already exists and you don't have access to. For example, a game on Steam that only allows multiplayer through hosting a game with your running client. A client can host a server but only while the hoster is also playing the game.

The question being, is it possible to write a server from scratch that can replace the game client host with a dedicated server that does not require a player hosting it? If so, how?

sentences:
How can I change Box2D bodyDef type of an object after adding it to the world in Libgdx? I have a basic 2d square class that has it's body type set to a Static Body. After the player presses a button on the UI I want to change the body type to a Dynamic Body.

When I change the object to a Dynamic Body within the render method nothing happens.

How can I change the Body Type so that it updates on the screen?

public void show() {
    ...
    s0 = new Square(-10, -20, 5, 5, 3);
    ground = world.createBody(s0.bodyDef);
    ground.createFixture(s0.fixtureDef);
    ground.setUserData(s0.sprite);
    s0.shape.dispose();
    ...
}

public void render(float delta) {
    ...
    if (ready) {
        s0.bodyDef.type = BodyType.DynamicBody;
    }
    ...
}

sentences:
SDL2 dragging a sprite with mouse I am trying to figure out how to drag a sprite. I know when the mouse is being hovered, pressed, or released over a sprite. I don't know how to tell if the mouse is being pressed and moved at the same time. Every time I try to use event.type, I only get one mouse event back (SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP, or SDL_MOUSEBUTTONDOWN). I tried doing something like (pseudo-code):

if(event.type == SDL_MOUSEMOTION && event.type == SDL_MOUSEBUTTONDOWN && mouse_in_sprite && left_button_pressed) {
    /* Never goes in here */
}

However, it never goes inside that if statement because the event.type is never more than one of the above mentioned every frame (unless I'm doing it wrong).

In the picture below, I am trying to make it so the scrollbar on the right moves up and down like a normal scrollbar would when pressing the left mouse button on the sprite and moving the mouse up or down.

Unfortunately, I don't know how to proceed further than getting the mouse position when the mouse is pressed on the sprite (pseudo-code):

if (mousePressed(SDL_BUTTON_LEFT)) {
   currentMousePosition = getMousePosition();

   /* Do something with currentMousePosition.x, currentMousePosition.y */
}

Any help would be appreciated! Thank you!

sentences:
How can I implement fixed joints in a 2D physics system? I'm developing a simple, 2D physics system to complement an entity/component game object framework. So far, I have implemented some basic, tutorial-level physics. An entity that is affected by physics must have two components:

Transform (translation, rotation, scale; may have parent transform)
Rigidbody (mass, list of forces)

The physics engine currently uses Verlet integration to move entities - that is, velocity is derived from the current and previous positions of an entity, and is not explicitly stated anywhere.

I would now like to start implementing some joints, starting with the basics and perhaps expanding as I grow more familiar with the concepts.

The first joint I attempted to implement was extremely simple - the fixed joint, whereby two entities are 'fixed' together and their transforms may not change relative to each other. My approach was to make one entity an immovable child of the other - that is, to set the transform of A as a local transform relative to B and disable movement of A by passing all accumulated forces of the rigidbody of A to the parent, B. Already this seems hackish and inflexible and has issues with gravity (B ends up with two gravity forces acting on it) - I'm clearly heading in the wrong direction.

I have searched for some literature on the subject but have only found either very basic tutorials that only cover what I've already done, or articles with advanced mathematical formulae that are difficult to follow or relate to simulation in any meaningful way.

This leads to two questions:

How are fixed joints normally implemented?
Are there any good 2D physics simulation tutorials aimed at those without a degree in physics or mathematics?

sentences:
How can I instantiate enemies in a 2D game at a set Viewport Position before my camera enters the room? (Or alternative solution!) I'm currently working on a 2D game where I'm trying to pre-populate my level with encounters, I want the enemies already in the room when the player enters. Right now the encounter is triggered upon entering the room when the camera bumps into the collider and the enemies are instantiated at the Viewport position, however because it does it while the camera is moving into the room the position is incorrect. Using hard values isn't an option because the maps could of course change and also I may want them randomly generated at some point. So I guess ultimately the problem is the camera not being in the right position when they instantiate and not wanting enemies to "pop" in once it is.
Is there a way I can I instantiate an enemy at the same point on the screen regardless of resolution in each specific room at the start of the level?
Encounters will have up to 3 enemies and they will always hold the same formation (with spots randomized to add diversity)
Here is my instantiating code:
[SerializeField] public List<GameObject> levelEnemies = new List<GameObject>();
GameObject levelEnemy;
Vector3 enemyPosition;
Vector3 viewportPosition = new Vector3(0.8f, 0.5f, 10f); // Place on the screen I decided I want single enemies to appear
Camera cam;

void Start()
{

    Debug.Log("Enemy Triggered");
    cam = Camera.main;
    enemyPosition = cam.ViewportToWorldPoint(viewportPosition);
    levelEnemy = Instantiate(levelEnemies[0], enemyPosition, Quaternion.identity); //instantiate test enemy at the converted position

    //navigation.DisableNavigation();
}

Here is what my camera collider looks like (Room 1) and my enemy encounter collider looks like (Room 3)

Here's what should be happening when the enemy is instantiated (triggered manually through the editor once camera has been moved fully)

Here is what happens when the camera collider bumps into the encounter collider

Any help in the right direction would be much appreciated or a workaround!
Here is what my camera collider looks like (Room 1) and my enemy encounter collider looks like (Room 3)

sentences:
How to display the counter in pygame.time.set_timer? in pygame, we use pygame.time.set_timer() to repeatedly create an event. This function takes 2 arguments : the event type and the delay time after which the event occurs in milliseconds.
For my case, that delay time is the reload time. So, i'm looking for a way to display that reload time on the screen. This is what i tried :
...
pygame.time.set_timer(pygame.USEREVENT+1, time)
...
reload_time = myfont.render(time, True, 'black')
myscreen.blit(reload_time, (670, 650))
...
pygame.display.flip()

This resulted in displaying the time delay value forever (it's not decreasing or resetting)
So what should i do?

sentences: The best algorithm enhancing alpha-beta? I'm studying AI. My teacher gave us source code of a chess-like game and asked us to enhance it. My exercise is to improve the alpha/beta algorithm implementing in that game. The programmer already uses transposition tables, MTD(f) with alpha/beta+memory (MTD(f) is the best algorithm I know by far). So is there any better algorithm to enhance alpha-beta search or a good way to implement MTD(f) in coding a game?

sentences:
How can I disable an NGUI button when I pause my game? There is an NGUI button in my game, which when pressed increases the player's power.

When I press the escape key, my game pauses completely. But the button still functions normally. Here's how I check for pausing:

void Update ()
{
    if(Input.GetKeyDown("escape"))
    {
        if(isPaused && Time.timeScale == 1.0f){
            Time.timeScale = 0.0f;
            AudioListener.volume = 1;
        }
        else
        {
            Time.timeScale = 1.0f;
            AudioListener.volume = 0;
        }
    }
}

I'd like the button to be deactivated when the game is paused. It should be visible, but not be clickable or anything. How can I achieve that?

sentences:
Physics: calculating angular acceleration in world vs local space I have a pretty simple rigid body simulation written in Python. In my code I calculate the angular acceleration using formula:

angAcc = torque * inertiaTensor^-1  (note row-major matrix order)

Now, the torque is in world-space so my inertiaTensor should also be in world-space. My Python code that does the angular acceleration computation looks like this:

oriMat = quaternion.ToMatrix(self.ori)
inertia_world = self.inertia_local * oriMat
matrix.Invert(inertia_world)
angAcc = vector.Transform(self.totalTorque, inertia_world)

oriMat is effectively local-to-world transform. self.totalTorque is torque in world space. So this code transforms local inertia to world inertia and uses its inverse along with world torque to compute world angular acceleration. This code works completely fine.

I thought to check out if I could conduct the angular acceleration compuation in local space and eventually convert local angAcc to world angAcc. Here's the code:

oriMat = quaternion.ToMatrix(self.ori)
self.totalTorque = vector.Transform(self.totalTorque, matrix.Inverted(oriMat))
angAcc = vector.Transform(self.totalTorque, matrix.Inverted(self.inertia_local))
angAcc = vector.Transform(angAcc, oriMat)

Here I wanted to do the torque-inertia transform in local space. To do so, I transform self.totalTorque to rigid body's local space using inverse of oriMat. Then I mul that by inverted local inertia to get angular acceleration in local space. Finally, I transform angular acceleration to world space by transforming it with oriMat.

For some reason this code doesn't yield correct behaviour of my rigid body and I really can't tell why. Anyone got an idea?

sentences:
Any good pathfinding algorithm for lots of different speed zones? NavMesh seems not work I have a terrain map with lots of different areas: roads, grass, swamp, forest, mountains. Each has different speed for the player. The map is continuous 3D map, not grids.
Given a start & end point, I want to find the shortest time path instead of shortest distance path.
I tried NavMesh with area cost as the standard solution. But it could not solve system with different speed zones correctly.
For example, given a simple NavMesh graph, each square is a nav mesh (you can think of two triangles if you like), gray is road, which has fastest speed; green is swamp, which has slowest speed. Given the start point s1 to end point e1. The NavMesh algorithm will give the direct path p1 since it's translating within one mesh, no matter what the area cost is. But the actually shortest time path would be p2: get out of swamp, then travel along the road, finally get into the swamp again.

Another example is s2 -> e2. The actually shortest time is the direct path, but the NavMesh would give the red path since each mesh only count once, without considering the path length.
So for my use case, what would be a good path finding algorithm?

sentences:
How to convert mouse coordinates to isometric indexes? I draw isometric map with tile 64x32:

const Offset = 160;
int X, Y;

for (int a=0; a < 6; a++)
  for (int b=0; b < 6; b++) {
    X = a * 32 - b * 32 + Offset;
    Y = a * 16 + b * 16;
    DrawTile(X, Y, tile);
  }

Image, illustrating this code:

Dear professionals, please, help with a formula of transformation of mouse coordinates in isometric indexes of a cell. Example: (105; 100) -> [1; 4].

sentences:
why specular light is not running? this is my method for lighting:

private void lights(GL gl) {
    float[] LightPos = {0.0f, 0.0f, -1.0f, 1.0f};
    float[] LightAmb = {0.2f, 0.2f, 0.2f, 1.0f};
    float[] LightDif = {0.6f, 0.6f, 0.6f, 1.0f};
    float[] LightSpc = {0.9f, 0.9f, 0.9f, 1.0f};

    gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, LightPos, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, LightAmb, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, LightDif, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, LightSpc, 0);

    gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, LightSpc, 0);

    gl.glEnable(GL.GL_LIGHT0);
    gl.glEnable(GL.GL_LIGHT1);
    gl.glShadeModel(GL.GL_SMOOTH);
    gl.glEnable(GL.GL_LIGHTING);
}

and i see my objects flat, no specular light.. any ideas?

ps. to render my objects:

gl.glColor3f(1f,0f,0f);
gl.glBegin(GL.GL_TRIANGLES);
for(Triangle t : tubeModel.getTriangles()) {
    gl.glVertex3f(t.v1.x, t.v1.y, t.v1.z);
    gl.glVertex3f(t.v2.x, t.v2.y, t.v2.z);
    gl.glVertex3f(t.v3.x, t.v3.y, t.v3.z);
}
gl.glEnd();

this is what i'm looking for:

this is what i get:

well it's not all black but if i rotate it becomes grey-white

sentences:
Can I remove the systems from a component entity system? After reading a lot about entity-component based engines, I feel like there is no real definition for this kind of engine. Reading this question, and the linked articles, made me think a lot. I do not feel that comfortable using the system concept, so I'll write something else that is inspired by this pattern. I'd like to know if it is a good way to organize game code, and what improvements can be made.

Regarding a more strict implementation of the entity-component based engine, is my solution viable? Do I risk getting stuck, at any point, due to the lack of flexibility of this implementation, or anything else?

My engine, as for entity-component patterns, has entities and components, but no systems, since the game logic is handled by components. I also think the main difference is the fact that my engine will use inheritance and object-orientated programming concepts, in general. I don't try to minimize them.

Entity: an entity is an abstract class. It holds a position, width, height, scale and a list of linked components. Every frame, the entity will be updated (i.e. all the components linked to this entity will be updated), and rendered, if a render component is specified.
Component: like for entity, a component is an abstract class that must be extended to create new components. The behavior of an entity is created through the components collection. Components are updated when the owning entity is updated, or for only one specific component (render component), rendered.

sentences:
BoxCollider2D fails verification, where CircleCollider2D does not I have a 2D game object with no parent and a 2D box collider set with trigger enables. The dimensions are quite large.

When I place the game object in the scene, manually, it works just fine. However, when I instantiate the prefab, it doesn't work; in the inspector view, under the collider component a notification appears:

  The collider did not create any collision shapes as they all failed verification. This could be because they were deemed too small or the vertices were too close. Vertices can also become close under rotations or very small scaling.

When I switch to scene view, while the game is in play mode, I can not see the collider boundaries. Surprisingly, everything works fine, if I use the circle collider.  Does anyone know what the problem could be?

sentences:
OpenGL Regarding Frame/Buffer Caching I have been trying to get myself refreshed on OpenGL ES. Whilst doing so, I had the following question in mind:

Does OpenGL have any "caching" mechanism?

For example:

Let's say we draw a stationary triangle with only 3 vertices on the screen; if there will be no transformation applied to the primitive, will OpenGL ES still go through the vertex and fragment shader, drawing the primitive anew every single frame?

Or, does it have any "caching" mechanism, which is smart enough to know that since there is no transformation, a "caching" buffer will display the primitive on the screen bypassing calculations within vertex and fragment shaders so that unnecessary calculations could be reduced/avoided in hopes to enhance frame rate and performance?

Thank you.

sentences:
Dynamic chunk loading with high FPS. But still chops I am creating a voxel world, (like any other person), but I currently have a small performance hit when loading/unloading chunks.

Right now I can load and unload chunks dynamically with "infinite" type world. I am using VBO's to store chunk data with float buffers. Also, (my big point), I am using Greedy meshing to only render the edges I need. My only thought of why it's not loading well is that I am using SSAO shading, which should have a hit on my FPS, but my FPS stays in the high 200's. Also, I am using frustum culling and normal culling. What I want is the player to have a really large render distance without actually rendering the chunks until the player is close. Almost like fog but instead of covering up unloading, it's actually reducing the detail as you move away.

Also, when a player creates a voxel or destroys a voxel (basically any change in the chunk) it saves the chunk to a file in the corresponding world folder.

Any ideas?

Here is a video of the game in its' current stage.

Here's a screenshot with a far render distance. Anything with a render distance that is far, hits the performance BAD

sentences:
Up / down powerbar computation at server side I aplolgize if my question  is unclear, because I don't know how to formulate the problem.

I have a player that can do damage with a weapon. The weapon has a min and max damage. Holding the space bar makes a power bar grow and degrow on time, and the hit is fired when the space bar is released. This kind of mechanics is quite everywhere.

I manage to do that in Unity with a scrollbar, using delta time to add or substract some damage on time. However, my game is networked, and I don't want the user to send to the server the damage done, just that the strike is performed and make the server compute the damage done.

Here is a graph to better explain my requirement :

I don't want to do it with add and substract at every delta time at server side because of potential compute costs at many parallel games, and the desync risk. I need a formula or a simple algorithm to get the damage at hit time based on time.

Thanks for any help.

sentences:
Screen Space Reflections: Artifacts problem I'm trying to implement a simple (so far) screen space reflections shader. Below is my code:

const int numBinarySearchSteps = 100;
const int maxSteps = 400;
const float rayStep = 0.01; // 25;
const float minRayStep = rayStep/2.5;

vec3 BinarySearch(vec3 dir, inout vec3 hitCoord, out float dDepth, out int hit)
{
    float depth;

    for(int i = 0; i < numBinarySearchSteps; i++)
    {
        vec4 projectedCoord = projectionMatrix * vec4(hitCoord, 1.0);
        projectedCoord.xyz /= projectedCoord.w;
        projectedCoord.xyz = projectedCoord.xyz * 0.5 + 0.5;

        depth = texture2D(depthMapTex, projectedCoord.xy).x;

        vec4 viewSpaceDepth = inverse(projectionMatrix) * vec4(projectedCoord.xy, depth * 2.0 - 1.0, 1.0);
        viewSpaceDepth.xyz /= viewSpaceDepth.w;

        dDepth = viewSpaceDepth.z - hitCoord.z;

        if(dDepth < 0.0)
            hitCoord += dir;

        dir *= 0.5;
        hitCoord -= dir;
    }

    vec4 projectedCoord = projectionMatrix * vec4(hitCoord, 1.0);
    projectedCoord.xyz /= projectedCoord.w;
    projectedCoord.xyz = projectedCoord.xyz * 0.5 + 0.5;

    hit = 1;

    return vec3(projectedCoord.xy, depth);
}

vec4 RayCast(vec3 dir, inout vec3 hitCoord, out float dDepth, out int hit)
{

    dir *= rayStep;

    float depth;

    /*vec4 projectedCoord = projectionMatrix * vec4(hitCoord, 1.0);
        projectedCoord.xyz /= projectedCoord.w;
        projectedCoord.xyz = projectedCoord.xyz * 0.5 + 0.5;

        depth = texture2D(depthMapTex, projectedCoord.xy).x;

    return vec4(vec3(depth),1.0);*/

    for(int i = 0; i < maxSteps; i++)
    {
        hitCoord += dir;

        vec4 projectedCoord = projectionMatrix * vec4(hitCoord, 1.0);
        projectedCoord.xyz /= projectedCoord.w;
        projectedCoord.xyz = projectedCoord.xyz * 0.5 + 0.5;

        depth = texture2D(depthMapTex, projectedCoord.xy).x;

        float zNear = 5.0;
        float zFar = 2000.0;
        float z_n = 2.0 * depth - 1.0;
        float z_e = 2.0 * zNear * zFar / (zFar + zNear - z_n * (zFar - zNear));

        /*vec4 viewSpaceDepth = inverse(projectionMatrix) * vec4(projectedCoord.xy, depth * 2.0 - 1.0, 1.0);
        viewSpaceDepth.xyz /= viewSpaceDepth.w;*/

        dDepth = -hitCoord.z - z_e;

        if(dDepth > 0.0){
            if (dDepth >= length(dir)) {
                // Inconclusive
                hit = 2;
                return vec4(0.0);
            }
            return vec4(BinarySearch(dir, hitCoord, dDepth, hit), 1.0);
        }
    }
    hit = 0;
    return vec4(0.0, 0.0, 0.0, 0.0);
}

vec3 ssr()
{
    // Reflection vector
    vec3 reflected = normalize(reflect(normalize(viewSpacePosition), normalize(viewSpaceNormal)));

    // Ray cast
    vec3 hitPos = viewSpacePosition;
    float dDepth;

    int hit;  /* 0 = no hit, 1 = good hit, 2 = nonsense hit */
    vec4 coords = RayCast(reflected /** max(minRayStep, -viewSpacePosition.z)*/, hitPos, dDepth, hit);

    vec3 color;
    if (hit == 1) {
        color = texture2D(colorMapTex, coords.xy).rgb;
    }
    else {
        color = vec3(0.0);
    }
    return color;
}

So far, all it does is just return the color of every pixels purely specular reflection, or black if there is no reflection on the screen or if the reflection ray passes behind an object.

My issue is that I get these bizarre artifacts where the pixel gets a color (dDepth >= length(dir)), even though dDepth is supposed to be way larger than length(dir). I've been stuck on debugging this for ages now and I'm wondering if anyone can see the mistake?

This is the scene using just a simple shader (to the right), and the scene running only the SSR-shader (on the left)

Extremely thankful for any help!!!
Simon

sentences: 1.5d Engine need pointers So I'm gonna start on a new project and were surfing around google images and found this image. Basically its almost pure 2D where there is no 3d object and everything is represented in 2d images as you see. Im wondering what this technique is called? Im guessing its some variant of parallax? I know this style has been called 2.5d back in the day. The project will be in MonoGame(c#) so i need headers of where to start developing an engine like this, what is the "2.5d" technique called?

sentences:
Beginner: How do I calculate a vector? I am trying to wrap my head around some concepts in a side project I'm working on. I'm struggling with how I can calculate a vector based on my character movement logic. Here are the relevant details of my character movement:

The character's hit box for collisions (and map position validity) is defined as a rectangle: x,y,w,h
A character can move in 8 directions, let's keep this simple to ignore strafing, call this direction:

Left(x-1), Right(x+1), Up(y-1), Down(y+1)
UpLeft(x-1,y-1), UpRight(x+1,y-1),DownLeft (x-1,y+1), DownRight(x+1,y+1)

The character can be in two moving states, again keeping numbers simple:

Walking 1 x offsets
Running 2 x offsets

When a character is moved the following logic happens:

Create their proposed new hit box by adding an offset to their x & y coordinates based on their direction, call this proposedHitBox
Check if the proposedHitBox is a valid position on the map, if so, then update the character's position to the location defined on the proposedHitBox
If the proposedHitBox is not a valid location on the map it should try to glance the character. This is where I'm having trouble.

Given all this, how do I essentially, calculate a vector of their proposed motion?

Example:

Character is at 10,10.
Character starts running.
Input is DownLeft.
Proposed location is 8,12 (x-(1x2),y+(1x2)).
Proposed location is valid.
Update character position to 8,12.
What calculation defines my vector? How does magnitude come from this? Is that generally stored as Z in a 2D game? So I'd use a Vector3 to store it? How does velocity come into this?

I'd assume my vector is a 45deg angle from current to proposed...?

Edit

Here is a picture of what the walls can look like in the game. The red box being the hit box as discussed above. The character is bound inside the blue polygon (which represents outer walls). Black being inner walls. The way I was doing glancing was overlaying 4x4 tiles across this entire map and then for each tile that the character should glance on I would choose an incoming direction (i.e. DownLeft) and then redirect them to a different direction (i.e. Down) which should make the proposed hit box in a valid position. This is however very tedious as I have to create glances for multiple directions for every tile. I'm looking for hopefully a better way.

I was reading that you could add vectors to each tile but I'm not sure how this works because on some tiles a incoming direction does not always have the same out direction.

sentences:
Unity3D: Making heavy calculation on separate thread So, I've created a program with Kinect as its input. As you know, Kinect will send the data 30 frame per second.

I have a model that will mimic Kinect's input motion, so on Update() I read the motion from Kinect.

The problem is, on Update(), I've done a heavy computational algorithm. It makes the system lag and freezing. I've tried to do the calculation every 60 frames instead of each frame, but the system still got lag.

void Update(){
        ...
        //GET DATA FROM KINECT
        frame = new SkeletonRecorded();
        frame.root.rotation = skeletons[kinect2SensorID, playerID].root.rotation;
            ...
        frame.rightShoulder.position = skeletons[kinect2SensorID, playerID].rightShoulder.position;
        frames.Add(frame);
        if (frames.Count >= 60) {
            //CALLING THE CALCULATION METHOD (Here is the heavy part begin)
            comparatorClass.GetSkeletonData(frames);
            frames.Clear();
        }

}

The above code is just small parts of the Update() method (I cut it short for convenience). So, how should I call the GetSkeletonData() method without making the interface lag?

sentences:
Unity C# - moving objects and Debug.Log; show multiple messages only once (easy but stuck) I have the following scenario:

a sphere is moving towards an object it can see (a cube). The cube is moving randomly through the landscape. The sphere will keep following it. I have a script that will check IF the cube is Within Sight. If it is, it will move towards it and it will keep following it.

What I want

I want a Debug.Log message to show when:

When the sphere is moving towards a (new) target. it must say: "Searching..."
When the sphere has found the cube, I want it to say: "Found the cube."
When the cube is found, I want it to continue searching for new cubes. So it must say once more: "Searching..."

Problem:

It keeps showing these messages nonstop. I found a solution with a false bool in an IF statement. But, I don't know how to combine 2 messages.

Code:

using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;

public class MoveTowards : Action {

public float speed = 0;
public SharedTransform target;
private bool pietje;

private bool jaap;

void PrintMessage (string message) {
    Debug.Log(message);
}

void Start() {
    pietje = false;
}

public override TaskStatus OnUpdate() {

    if (Vector3.SqrMagnitude (transform.position - target.Value.position) < 0.1f && !pietje) {
        PrintMessage ("Found the cube.");
        pietje = true;
        return TaskStatus.Success;
    }

        transform.position = Vector3.MoveTowards (transform.position, target.Value.position, speed * Time.deltaTime);
        transform.LookAt (target.Value.position);
        return TaskStatus.Running;

}

}

I just don't know how to fix the last part where it says: "Searching..." I don't know how to implement it with an IF statement (doesn't work somehow) or  how to create the IF statement (when I use this, it doesn't work:

if (TaskStatus.Running == 1 && !pietje)

Anyone that can help me? That would be awesome! Have been trying to fix this for some hours now....

sentences:
How do I clear up artifacts between aligned faces when using AA in XNA 4.0? I'm working on a graphics engine that lets you walk around a world that is made up of cubes (voxel engine) and I'm having some difficulties getting the results I want.

I'm not the best at 3D graphics, but I'm willing to learn. When I have anti-aliasing turned off, the textures line up properly together on the surfaces, but when I turn it on, I see a lot of lines between each square face. I've taken a picture:

I've tried changing the mip map mag filter options on the sampler, but cannot get it to look right. I've tried increasing the quality of the textures, but that doesn't help either. When I use Linear TextureFilter but that just makes everything super blurry, and the edges are even more obvious. In fact many edges get some blurry white and dark color to them. Anisotropic doesn't help.

Nothing I do seems to get rid of those lines in between faces when I have AA turned on. Anyone have any advice on where I would start looking? I'm assuming it's because all of the faces are individual, and not mixed together when they are next to each-other. Not just the edges are being anti-aliased. Not sure if I'm even on the right track with that thought.

I'm using XNA 4.0 to do this.

sentences:
How to convert a rotation around an axis into pitch and yaw rotation So i want to rotate particles towards a point and i've already figured out how to calculate the angle and the rotation axis.

Currently what i do is simply use a 3 dimensional matrix, apply the rotation and then extract the euleric angles from the matrix using joml.

Now using the result i have the problem that the particle is also using the z rotation, messing up the orientation of the particles texture. The easiest way to fix this would be to only use yaw and pitch, but how do i convert the roation to just a rotation around the x and y axis?

sentences:
2D Spatial partitioning alternatives to spatial hashes and quadtrees I've been trying to implement a spatial partitioning algorithm in my game, but both spatial hashes and quadtrees aren't what I'm looking for.

My level size is not supposed to have a limit (only Int32 limits). I need a spatial partitioning algorithm that doesn't need a "Level Width" and a "Level Height".

I have many moving physical objects. I need the algorithm to be fast enough to support 500+ objects.

Any alternative?

sentences:
How can I speed up the shapes drawing on high-density devices? I have a game that should draw many shapes on the canvas and in every frame these shapes position will change, the game is running smooth but after adding more shapes some jerk arise and it drops some of frames. And this is just happening in high-density devices (more than 320 dpi).

public void run() {
    while (mRunning) {
        if (mSurfaceHolder.getSurface().isValid()) {

            synchronized (mSurfaceHolder){
                canvas = mSurfaceHolder.lockCanvas();

                canvas.drawColor(Color.BLACK);
                drawOnCanvas(canvas);

                mSurfaceHolder.unlockCanvasAndPost(canvas);
            }
        }
    }
}

draw function

public void drawOnCanvas(Canvas canvas) {
    new Thread(changeGamePosRunnable).start();

    for (int i = 0; i < obstacles.size(); i++) {
        Obstacle obstacle = obstacles.get(i);
        x= obstacle.getX();
        y=obstacle.getY();

        canvas.drawLine(0, 0, x, y, linePaint);
        canvas.drawBitmap(bitmap,x,y,null);
    }
}

I have created bitmaps in the constructor, initializing all variables out of the game loop, using SurfaceView and implements Runnable, added Thread.sleep(5); to while loop, tried to decrease bitmap size to about 240 bytes, tried to draw circle instead of bitmap again no change.

It's so strange that the drawing function is so slow in high-density devices, I tried to use some bitmaps as buffer and use them in 3 threads but the game sometimes draw on the wrong location. also I think drawing on another bitmap is not a right solution.

How can I speed things up? The quality does not matter, I just need some more speed.

sentences:
Problem with Blender model imported to Unity (Lighting problems) I made a simple box in blender and imported it to unity. Now I'm facing with this weird lighting problem:

I've been messing around with normals, duplicated vertex, lots of things, even lightning properties but still I'm not getting any results at all. Why does this happen and how can I solve it?

Source blend file: https://drive.google.com/open?id=1Ze1JBRFBvhnnY-w36U2KDe7Q2zcfXsmf

sentences:
DirectX 11, using Tessellation & Geometry shader in a single pass Before all, sorry for my poor english !

With DirectX 11, i'm trying to create a random map full with GPU.

Using Hull shader stage, I'm managing LOD with tessellation.

Using Domain shader stage, I'm generating the map (based on perlin noise).

Now my goal, is to compute normals in the geometry shader (normal on vertex).
For that, I must use vertex adjency, like geometry is capable of.

But here is the problem... For tessellation, my primitives must be
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST.

But for geometry shader with 6 vertex (triangle primitive and adjency), I must use :
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ.

Think I'm missing something... It must be possible to tessellate and use the results in the geometry shader...
However, it's working with 3 points, but I cannot use the 3 others (they are 0.0, 0.0, 0.0)....

Thank you in advance for any help ;)

sentences:
Imposters in Unity - How to set which color is used as 'transparent' in the RenderTexture? I'm still working at making imposters for my Unity scenes. Here I am attempting to make a large block of stadium seating, using the one seat mesh as shown.
I'll try to explain in full what Ive done so far:

Imported 3d mesh of seat
Created RenderTexture 'seat' (default format R8G8B8A8_UNORM)
Added new Orthographic camera in front of seat. (settings: Clear Flags=Solid Color; TargetTexture='seat'
Created some quads and aligned them so I can see the textured side.
Gave the quads a new material 'seat'.

I've gone through many of the settings in the Material and other places changed many things here and there such as 'transparent' or 'cutout' and lots of the other settings but cannot get rid of the magenta color in the seating textures I created.
Also tried making that color alpha 0 but it had no effect. And tried various colors as transparent (magenta, white, black).
Am I doing this completely wrong? Hopefully I am just missing some small setting. Ideally somewhere I can just set the magenta color to mean transparent pixels.
Really do need help here honestly have been trying very hard to achieve this alone but not getting anywhere fast.

sentences:
How to implement zombie AI? We need to make a zombie videogame for a semester project and I was wondering about what are considered nice algorithms/techniques for implementing zombie AI that don't take too long to implement.

The project is a videogame product, involving other stuff as physics and multiplayer, so we have limited time, so what I'm specifically looking for is:

A quick & dirty way to implement zombie AI (I'm thinking on neural networks or perhaps even fuzzy logic)
Common ways of implementing and optimizing zombie AI
The ideal way of implementing zombie AI (I imagine it would involve pathfinding, or even swarm intelligence?)
General advice on zombie AI

Considering that the quick & dirty implementation would perhaps be a place-holder for another and better algorithm/technique.

Thanks in advance.

sentences:
Avatar creation / dressing feature What is the effort required to use a game engine such as Unreal or Unity, etc. and create an avatar customization features...complete with clothes.

The user should be able to customize the body features and the clothes need to then fit onto the customized body.

What is needed?
Can you create one set of 3D models for clothes and somehow programatically have the clothes adapt to the body shape?  I.e. The same shirt model will be able to fit on a skinny person vs. someone with a big beer belly.

How difficult is this? What are the steps needed to implement this avatar creation/dressing feature.

I'm basically talking about something like in Rockband 3.

sentences:
How to put labels at a specific point on any resolution I am working on a project in Unity 4.6.1 and I put the label at the top:

But when I put the Scene in full view this happened:

I made a Development Build and when I select my resolution (1366x768) the label goes behind the buttons. Is there any way to put the label at a specific point no matter what resolution?

sentences:
Calculating the angular direction from velocity I'm trying to calculate the angular direction of a projectile, knowing it's X and Y velocity I can find the magnitude of its movement, but I'm having a hard time wrapping my mind around getting the angular direction (in radians) that it is moving...

I assume there is a tan or a sin involved, but I'm a bit clueless otherwise...

sentences:
Getting Center and Radius of Irregural Object I have drawn an asteroid object manually , and would like to get its center/radius by a specific equation. I think I can get them by calculated and hard-coded values.

The code to draw the asteroid:

float ratio = (float)app::getWindowWidth()/app::getWindowHeight();
gl::pushMatrices();

gl::translate(m_Pos*ratio);

gl::scale(m_size*ratio,m_size*ratio);
gl::color(ci::Color(1,1,1));

    gl::drawLine(Vec2f(20,0),Vec2f(80,0));
    gl::drawLine(Vec2f(80,0),Vec2f(100,20));
    gl::drawLine(Vec2f(100,20),Vec2f(100,50));
    gl::drawLine(Vec2f(100,50),Vec2f(60,100));
    gl::drawLine(Vec2f(60,100),Vec2f(40,100));
    gl::drawLine(Vec2f(40,100),Vec2f(50,70));
    gl::drawLine(Vec2f(50,70),Vec2f(25,90));
    gl::drawLine(Vec2f(25,90),Vec2f(0,70));
    gl::drawLine(Vec2f(0,70),Vec2f(20,40));
    gl::drawLine(Vec2f(20,40),Vec2f(0,20));
    gl::drawLine(Vec2f(0,20),Vec2f(20,0));

gl::popMatrices();

gl::pushMatrices();

float radius = getRadius();

Vec2f center = Vec2f(m_Pos.x+50, m_Pos.y+50);

gl::drawStrokedCircle(center*ratio, 10);
gl::popMatrices();

}

According to the answer I have written that code to calculate the radius, is it correct or not ?

cinder::Vec2f Asteroid::getCenter()
{
    return ci::Vec2f(m_Pos.x, m_Pos.y);
}

double Asteroid::getRadius()
{
    ci::Vec2f  _vec = (getCenter()- Vec2f(15,5));
    return _vec.length()*0.3f;
}

sentences:
Creating a set of islands by subtracting gradient values from a Perlin noise The answers to this question explains fairly well how to create a big island in the center of the screen by setting up a gradient and then subtracting its value from a Perlin Noise.

Anyway they explain how to create only
one gradient at the center of the screen to create a big, sort of circular island.

But what if I want to create an island which has more than one gradient to create a less regular shape, or if I want to create multiple separated islands by setting multiple gradients in different positions? What value should I subtract from the Perlin Noise function for each point? The sum of the distance from each gradient to that point? The average?

Edit: Jon's method of multiplying and normalizing worked, got this result with 4 gradient points:

sentences:
How to open box item animation? I want make 2d open box animation. Like cs-go open keys or other random box.
I need the basics of implementation it and i want get more information about it. Thanks.

Upd:
Steps.
I have array of elements.

I press to button and shuffle array.

I get random element from array by weight.

All elements in array have images.

So , after i press button all images start move with some accelerate to left or right. 6 images move to left. And what is next ? I need get random items images while acceleration is not end ? Or what ? I need logic example.

My example realization(I don't know working it or not): I need add to array new items while acceleration is enable or what ?
Or after i get random item by weight, i need sort array and past it item to last position and add other random items to this array. And after all i need loop to this array to last item. And when loop in last position i show it item in screen ?

I really don't understand how it working.. D:

sentences:
Texture coordinates from world position Im making an editor in which I want to build a terrain map. I want to use my mouse to increase/decrease terrain altitude to create mountains and lakes essentially.

Technically I have a heightmap I want to modify at a certain texcoord that I pick out with my mouse. To do this I first go from screen coordinates to world position - I have done that. The next step going from world position to picking the right texture coordinate puzzles me though. How do I do that?

sentences:
Platform for DS/Gameboy Dev - Managed Memory, Tools, and Unit Testing I'm interested in dabbling in Nintendo DS, 3DS, or GBA development. I would like to know what my (legal) options for development tools and IDEs are.

In particular, I would not consider moving in this direction unless I can find:

A programming language that has managed memory (garbage collection)
A unit testing tool akin to JUnit, NUnit, etc. for unit tests

I would also prefer if other tools exist, like code-coverage, etc. for that platform. But the main thing is managed memory and unit testing.

What options are out there?

sentences:
What's the difference between Canvas and WebGL? I'm thinking about using CAAT as a part of a HTML5 game engine. One of it's features is the ability to render to Canvas and WebGL without changing anything in the client code. That is a good thing, but I haven't found precisely: what are the differences between those two technologies?

I would specially like to know the differences of Canvas and WebGL in the following regards:

Framerate
Desktop browser support
Mobile browser support
Futureproofability (TM)

sentences:
How should I implement hit detection netcode for AI enemies in a co-op first-person-shooter? I'm working on a FPS/sandbox game that has multiplayer but no PvP. Since the game has no PvP, I'm trying to make the networking code favor the player as much as possible.

For example, I allow the game-clients to decide whether a shot hit/missed an enemy, rather than having the game-server verify. I also allow the game-clients to decide where they are on the map -- with no verification from the server.

This opens the doors for cheaters, but in a PvE game I don't care so much.

However, I don't know how to design the enemy AI. If a player is lagging, the server doesn't know that player's real location, so how could I ensure that the player actually saw himself get attacked by an enemy (for example, a Zombie) before the server registered a hit on the player?

sentences:
How to check if a line casted from one point to another point passes through a mesh? Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know from the documentation that both the Ray and Raycaster classes accept origin and direction vectors but I specifically need two points.
Thanks in advance.

sentences:
Thread runs faster on a faster processor... how to control Thread speed I have a thread that uses TimeUnit.MILLISECONDS.sleep(5);

Problem is when I load my app on a faster phone say with a snapdragon, it runs at lightning speed.

Is there a way to control this speed so processor speed is not an attributing factor?

Thanks!

sentences:
How to do multi-agent 2d pathfinding when agents can block each other? I recently restarted on my long time game development project and had a few questions about how to improve my games AI.

I am a little stuck on the best way to implement my Enemy path finding when there are multiple enemies that can collide with each other.  Here is an example of the way my AI works at the moment.

The melee enemy has the following states:

Aggressive Attacking - Is in range of attacking player

Aggressive Stuck - Is trying to reach the player but blocked by a collision object

Aggressive Clear - Is trying to reach the player but is not blocked by a collision object

Passive - not currently looking for the player but if it moves in it's line of sight it will move to the aggressive state

Currently I am using a uniform tile system.  Here is the basics on how the pathing works.

FIND PATH FROM ENEMY TO PLAYER

    IF [BLOCKED BY A COLLISION TILE]

             CALL A STAR ALGORITHM

    ELSE IF [NO COLLISION ON PATH]

            MOVE TO PLAYER

I do this every frame.  This seems to work ok, but things have got more complicated when I bring in multiple enemies.  What would be the best way to achieve the following.

Find a path for the enemy to the player when there are multiple enemies that can all collide with each other?  If I just call A STAR it won't work correctly as the other enemies who are collision objects are also moving.

Sorry I hope this made sense, any help would be great.

sentences:
What is the meaning of this "MuxOMX ctor" log in LibGDX? I'm developing a game in Java for Android using LibGDX with Android Studio. I'm using the AssetsManager class and I've noticed weird log when finishLoading() is finished:

10-17 22:15:17.108 31943-32282/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.146 31943-32285/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.182 31943-32291/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.231 31943-32296/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.284 31943-32299/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.330 31943-32302/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.385 31943-32309/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.425 31943-32312/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.462 31943-32315/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.499 31943-32318/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.546 31943-32321/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.607 31943-32324/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
10-17 22:15:17.654 31943-32327/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.698 31943-32330/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.740 31943-32334/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.782 31943-32339/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.822 31943-32343/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.864 31943-32346/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.911 31943-32353/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.953 31943-32356/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:17.997 31943-32359/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:18.043 31943-32362/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:18.087 31943-32365/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
    10-17 22:15:18.139 31943-32368/com.gadarts.parashoot.android I/OMXClient: MuxOMX ctor
...

Does anybody have any idea what it means? I've searched everywhere and couldn't find anything relevant.
It doesn't make any problem, it just blows my Android Monitor with these logs.

Thanks in advance!

sentences:
Calculate Discrete Fourier Transform by using c# There is a definition of Discrete Fourier Transform:

I want to calculate amplitude and phase of a transformed sequence.

I tried :

 public ArrayList phase = new ArrayList();
 public ArrayList amp = new ArrayList();
 public float phi = 0;

 void Start ()
 {
      DFT();
      foreach (var ampList in amp)
      {
        Debug.Log(ampList);
      }
 }

 void DFT()
 {
  //Given sequence of Numbers

  float[]  X = {1,2,3};
  float[]  Y = {2,3,5};
  float  N = X.Length;
  float re = 0;
  float im = 0;

  for (int k = 0; k < N; k++)
  {
      //The discrete Fourier transform, lists of Re & Im instead of a+ib
      for (int n = 0; n < N; n++)
       {
           float phi =  (Mathf.PI * k *n)/N;
           re += X[n] * Mathf.Cos(phi) - Y[n] * Mathf.Sin(phi);
           im -= Y[n] * Mathf.Cos(phi) - X[n] * Mathf.Sin(phi);
       }

      re = re/N;
      im = im/N;
      var  ampp = Mathf.Sqrt(re*re + im*im);
      var  phasse  = Mathf.Atan2(re,im);

      phase.Add(phasse);
      amp.Add(ampp);
  }
}

but answer is Not correct, I use Wolfram Mathematica to check the answer :

sentences:
How can I rotate a cylinder so the top points at specific transform? I have a GameObject (goA) with a LineRenderer that has a single line drawn, on which I'd like to place cylinders so the top of the cylinder points to each end of the straight line that the cylinder sits on, (similar to a cylindrical bead on a straight piece of string, or a Candlestick chart).

The cylinder GameObject (goB) is a child of the goA which the LineRenderer is sat on (goB.transform.parent == goA.transform).

goA is not rotated itself, and the Line drawn could be any angle relative to the GameObject, and it would be a bit of a hassle to refactor so that the Line is always vertical and instead rotate goA, and it seems this should be an easily solvable problem!

I'm attempting to use either LookRotation or LookAt on the cylinder but for whatever reason all permutations I can think of simply are not working.

Thanks for any advice!

sentences:
Bodies going through the walls of a box I have a game where the user controls a box to collect falling balls. However, very often the balls will just fall through the walls of the box and be flung away. What could be causing the balls to do that?

Here is a video of the issue.

Here's how I'm creating the box and the balls:

//BOX CODE

private Body pbox() {

    pbdef = new BodyDef();
    PolygonShape shape=new PolygonShape();
    pbdef.type=BodyType.StaticBody;
    pbdef.position.set(Gdx.graphics.getWidth()/2,100);
    Body body1=world.createBody(pbdef);
    FixtureDef fdef = new FixtureDef();
    shape.setAsBox(30, 5);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    //
    shape.setAsBox(5, 20,new Vector2(-25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    fdef = new FixtureDef();
    //
    shape.setAsBox(5, 20,new Vector2(25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    body1.setGravityScale(-3);
    body1.setBullet(true);
    return body1;

}
//BALLS CODE

private void spawner() {

    bbdef= new BodyDef();
    FixtureDef fdef = new FixtureDef();
    CircleShape circle = new CircleShape();
    bbdef.type=BodyType.DynamicBody;
    bbdef.position.set(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight());
    bbody = world.createBody(bbdef);
    circle.setRadius(5);
    fdef.shape=circle;
    fdef.density=0;
    fdef.friction=0;
    bbody.createFixture(fdef).setUserData("ball");
    bbody.setBullet(true);

}

sentences:
Stencyl or flash limitation? I have found that Stencyl doesn't seem to be very good at handling very many actors in a game. I had been trying to implement some basic AI at the moment all the behaviours were: wander (pick a random point and move directly to it) and wrap around screen (if it goes off the top of the screen it appears at the bottom). Even with these simple behaviours and calculations the frame rate dropped dramatically when there were more then 50 actors on screen:

10 actors: 60fps

50 actors: 30-50fps

75 actors: ~30fps

100 actors: 15-20fps

200 actors: 8-10fps

I had planned on having a maximum of around 200 actors but I see that's no longer an option and implementing a more complicated AI system with flocking behaviour, looking at creating a game in a similar vein to flOw.

I understand that a game is perfectly playable at 30fps but this is a super simple test with ultra simple graphics, no animations and no sounds is child's play in terms of calculations to be made.

Is this a limitation with Stencyl or is it flash?
Should I simply scale the scope of the game down or is there a better game engine that exports to .swf that I should look into?

sentences: Can I remove the "powered by COCOS creator" message from my game? Is it legal to remove powered by COCOS creator in the page where the html is exported and also in the splash screen?

sentences:
How to implement dynamic background music? Assumption 1: As a game's story progresses, dynamic background music is often used to enhance the player's immersion.

Assumption 2: Background music is probably always streamed due to memory limitation and performance.

What do I need to consider when I'm checking the feasibility of having dynamic(ally changing, adapting) background music? For example when a boss enemy appears the game should not just replace the "wandering music" to "boss combat", it should rather somehow cross-fade the two music scores as it starts playing the new music.

Is it usually possible to stream multiple sounds in parallel? I'm using LibGDX, where -- as far as I'm aware -- only a single streaming music instance can be played at a time, so how can I have such music with this framework?

Do I suspect correctly if I also need to separate a dynamic music into parts like "intro", "loopable part", "loopable part near the climax", "outro", etc., and when a part ends have a music manager code decide which part should be (re)started?

I'm more interested in understanding the theory instead of the actual implementation of the code.

sentences:
Which purpose do armor points serve? I have seen a mechanic which I call "armor points" in many games: Quake, Counter Strike, etc. Generally, while the player has these armor points, he takes less damage.

However, they act in a similar fashion that health points do: you lose them by taking said damage.

Why would you design such a feature? Is this just health 2.0, or am I missing something?

To me, armor only makes sense in, for example, RPG games, where it is a constant that determines your resistance. But I don't see why would it need to be reduceable during combat.

sentences:
Directory.EnumerateFiles hangs with disk pegged to 100% I am having an issue that occurs seemingly at random with the following block of code.

    public static IEnumerable<string> GetSavedGameFileList()
    {
        foreach (string fullFilePath in Directory.EnumerateFiles(Application.persistentDataPath, "*.save"))
        {
            Debug.Log("Located save game: " + fullFilePath);
            yield return Path.GetFileNameWithoutExtension(fullFilePath);
        }
    }

Unity will freeze and force me to close it. There is no error message, in the Windows Task Manager, I noticed that the disk utilization gets pegged at or near 100%:

Nothing is logged to the console when this happens. The folder it's scanning only contains 3-5 files during my testing. I am running Unity 2017.2.0f3 with the .NET 4.6 backend.

Here is what I have tried without success:

Use Directory.GetFiles instead of Directory.EnumerateFiles.
Storing my results in intermediate arrays instead of returning an IEnumerable.
Restarting the Unity editor.

Any ideas? Thanks!

sentences:
running GL ES 2.0 code under Linux ( no Android no iOS ) I need to code OpenGL ES 2.0 bits and i would like to do this and run the programs on my desktop for practical reasons.

Now, i already have tried the official GLES SDK from ATI for my videocard but it not even runs the examples that comes with the SDK itself, i'm not looking for performance here, even a software based rendering pipeline could be enough, i just need full support for GLES 2.0 and GLSL to code and run GL stuff.

There is a reliable solution for this under Ubuntu Linux ?

sentences: What is the difference between body transform and root transform I am learning about Root animation and here come two terms, one is root transform and Body transform. As name suggests that body transform is the character body but what is root transform? and what is the Root transform rotation based upon body orientation, Feet, center of mass or original.

sentences:
Player field of view, Physics.overlap, onTrigger performance I would like to ask you what is the best way to accomplish my problem.
I have a player who can detect ennemy with raycast in a zone, or in a certain angle, like in this picture:

As you see I want to get only green one.

I'm in topDown view. I was thinking about using Physics.OverlapSphere first, and then try Angle between player and target. But: In the picture I don't want to get the Purple one.

Also: what is the best way to do that with the best performance ?

sentences:
How to manually kick players in new Unity Input System Using the new Unity PlayerInputManager, I'm trying to create a page in the pause menu of the game where players can remove other players from the game.  It's a split-screen game, and it seems to handle kicking the last player (i.e. if there were three players, kicking the third) just fine.
However, if we have three players and we destroy the gameobject for player two, it seems like the player index and the screen index of player three do not automatically adjust, and the screen remains split three ways.  Here's some of the code I've tried:
public void KickPlayer(int i)
    {

      PlayerInput.Destroy(players[i]);
      players[i] = null;
      for (int j = i; j < 4; j++)
      {
          if (j+1 == 4 || players[j+1] == null)
          {
              players[j] = null;
          } else
          {
              players[j] = players[j + 1];
              players[j + 1] = null;
              PlayerInput pi = players[j].GetComponent<PlayerInput>();
              PlayerInput.Instantiate(players[j], j, pi.currentControlScheme, pi.splitScreenIndex-1, pi.devices.ToArray());
              PlayerInput.Destroy(players[j + 1]);
          }
      }
}

Although this code looks like it should rearrange and re-assign the split-screen, what I end up with when I spawn in three players and try to kick player two is player 0 with split-screen index 0, then there suddenly are three other players, player 1, 2, and a second copy of player 2 all sharing split-screen index 2.
What would be the best way to go about this?  Is there a way to reassign player index and split-screen index?

sentences:
How can I bundle assets into an executable from my Game Maker-like editor? I am attempting to implement a simple "game-maker" solution. I'm working with Visual Studio, in C#, using MonoGame. I'd like the games my editor creates to be stand-alone executables, with their art resources bundled within them so that they are not loose in a "data" folder next to the application.

I'm not sure how to implement that, though. If I create a game from my editor, how can the resulting game data be made distributable within the executable?

I'd like it so that the end result allows you to first open the editor and create and save a game, then go to that directory and run that game with its own executable.

sentences:
Things that make a game more interesting for kids What makes a game more interesting or fun to play for children ages 8 to 14+?

Does the age of the consumer play an important role in his/her interest in the game?

What can I put in a game to make it more fun, educational, and interesting to play?

sentences:
How does time-dependent camera rotation with a mouse work? The commonly used equation for camera rotation with a mouse does not involve time. This make sense since higher frame rates have smaller changes in mouse position and vise-versa so it all evens out. If time slows down or speeds up, however, camera rotation from the mouse does not adjust accordingly. Just as you move slower when time is slowed, logically I also want rotating to be slower.
One option is to multiply the change-in-position of the mouse with the same multiplier I'm using on time, but shouldn't it be possible to have change-in-rotation and change-in-time in the same equation, independent from framerate?

sentences:
XNA 4.0 HLSL - strange depth map I want to draw my pre-rendered depth map to the scene.

I get my depth value in the following way:

basically (Pixel Shader)

// Depth is stored as distance from camera / far plane distance, 1-d for more precision
output.Depth = float4(1-(input.Depth.x / input.Depth.y),0,0,1);

where (Vertex Shader)

output.Position = mul(input.Position, worldViewProjection);
output.Depth.xy = output.Position.zw;

(input = output of Vertex Shader)

and store it in a RenderTarget2D

depthTarg = new RenderTarget2D(GraphicsDevice, viewWidth,
                viewHeight, false, SurfaceFormat.Single, DepthFormat.Depth24, samples, RenderTargetUsage.DiscardContents);

But somehow, when I draw that (Single), I get this result:
(displaying rgb)

channel r:

(all black)

channel g:

channel b:

channel a:

Why is there data in every color channel althrough i only defined a value on the red parameter (and 1 on a, but you can somehow see the outlines of the model, so it cant be all 1)

And surprisingly, the b channel looks almost like what I am looking for, but has strange lines in it which stay at the same distance to the camera if I move it.

sentences:
Organizing Setup(), Update() and Draw() function in a game engine I'm creating my first game engine and I want help with organizing the Setup(), Update() and Draw() functions in the correct way.

Here is how my main() function looks like

/* BEGIN main() Function */
int main(int argc, char *argv[])
{
    prepareSetting(&settings);

    initEngine();

    setup();

    // Main loop

    while (!done)
    {
        update();
        draw();
    }

    SDL_Quit();
    return 0;
} /* END main()*/

The above approach requires me to declare the shared variables as global, which I think is not a good thing to do.

I was thinking about creating a ENGINE class which contains the setup(), update() and draw() functions and inheriting it. libcinder use this kind of approach.
So should I use classes or leave them as it is. What is the best way to organize those functions?

What approach is used by professionals in the industry?

sentences:
How to return the scene view camera to the default view By the "scene view camera" I don't mean a GameObject with a Camera component, I mean the camera used to draw the Scene window in the Unity editor, controlled by this "Scene Gizmo" widget:

The default view shows an almost isometric perspective, where all three X Y Z axes are visible.
But when I clicked the green Y cone, my view changed to look straight down the Y axis, and I can't seem to return to the 3-axis view.
Clicking the other cones on this widget just switchest to look along the X or Z axis instead, and clicking the cube in the middle or the "Top" label just toggles between orthographic and perspective projection.
How can I get back to the default 3-axis view?

sentences:
Rotating an object smoothly I'm trying to rotate a ship in an asteroid game. What I'm doing is creating a float angle variable and at each time I press left or right buttons, I increase and decrease it, and in the drawing function, I rotate the ship by that amount.

The behaviour that I get is not really correct, because what I want is at each press, the ship should move smoothly and not by small increments.
This is what I'm doing:

 static float ang = 20.0f;

 if(event.getCode() == KeyEvent::KEY_RIGHT)
 {
      ship.m_Angle+=ang*getElapsedSeconds();
 }
 else if(event.getCode() == KeyEvent::KEY_LEFT)
 {
      ship.m_Angle-=ang*getElapsedSeconds();
 }

 gl::pushMatrices();
 gl::translate(Vec2f(m_Pos.x,m_Pos.y));

 gl::rotate(Vec3f(0,0,m_Angle));
 gl::scale(0.3,0.3,0.3);
 gl::color(ci::Color(1,1,1));

 gl::drawLine(Vec2f(-52,-23),Vec2f(69,0));
 gl::drawLine(Vec2f(-43,-20),Vec2f(-43,20));
 gl::drawLine(Vec2f(69,0),Vec2f(-52,23));
 gl::popMatrices();

EDIT: I would also like to limit the angle, it goes forever and the variable will overflow.

sentences:
How accurate is Gdx.input.justTouch()? We're developing a game, we want to perform actions the moment the user touches the screen, delays make the game impossible to play.

We're testing on samsung S3 mini and samsung a5, we know they are low end devices and lags are to be expected.  But How accurate is Gdx.input.justTouch()? Is it so accurate on high end phones?

If not then how to improve the accuracy?
Is the same problem expected from keyboard or mouse input if we publish a webapp version?

sentences:
First frame has a much longer delta time than other frames I had a problem where my AI moved extreme at the first frame and then normal after that. I then figured out it was my delta. It's about 0.016 seconds (60 fps), but the first frame was about 19000 seconds, which is obviously impossible. Does anybody know what might be happening? Also the delta later on likes to oscillate from 0.01 to 0.03.

    long time = Sys.getTime() * 1000 / Sys.getTimerResolution();
    float delta = (time - lastFrame) / 1000f;
    lastFrame = time;
    return delta;

That's the delta code.

EDIT: Wow, you guys really like to take the fun out of composing a question with all your editing.

sentences:
Is there a way to increase the collision check efficiency of a system of n objects? I'm making a game that consists of many onscreen objects, one of which is the player. I need to know which objects are colliding every iteration.

I made something like this:

for (o in objects)
{
   o.stuff();
   for (other in objects)
      if (collision(o, other))
          doStuff();

   bla.draw();
}

This has O(n^2), which I'm told is bad. How do I do this more efficiently, is it even possible? I'm doing this in Javascript, and n will usually be lower than 30, will it be a problem if this stays the same?

sentences:
Designing interface for interacting with game objects I'm making a roguelike (-like) game, somewhat like Project Zomboid or Don't Starve. In my game, there are many different object in the world that the player can interact with; there are also many items, some of which may be required for a particular interaction.

Physically, all I have to trigger the interaction is the mouse click: when player clicks on an object, something happens (adding right-click is an option too, but staying with just one button is preferable).

There are several problems here:

For a given object, there might be several interactions possible. I might want do drive the car, or access its truk, or refuel it etc.
Some interactions may require an item: I need an axe to chop down trees or a fuel source to refuel a car.
Some interactions may be non-obvious, so I need to have some sort of discovery mechanism. Some way to say to the player: "You could chop down this tree if you had an axe".
Some interactions should be very quick. Whacking an enemy with a bat should NOT require clicking and then choosing an action from menu; just clicking should work.
Added The list of objects, items and interactions is pretty open-ended. I'm still developing the game, and in the future players might make mods. This means that the interface must be generic enough to adapt to new interactions automatically.

Given these constraints, I'm really struggling to devise a good interface for interactions. I can't show a menu of all possible actions on click, because that would break (4). I can't just leave one single on-click action, because that would break (3) and probably (1).

How can I present all options to the player in a usable and preferably obvious way?

sentences:
Translating conditions ("If A has B, then true") into objects that satisfy them ("A has B") I have a system where I'm sifting through a large number and variety of objects in my game, looking for objects that match an arbitrary search criteria that can be simple or complex.
For example, suppose a Foo has three integer properties, A, B, and C. I might search the list of Foo objects three times. First, I want to find a Foo where A>5. Second, I might want to find a Foo where A<B or B=8. Third, I might want to find a Foo where A=2, B=6, C>A, and C<B. The point is that I could arbitrarily pass any of a very wide set of conditions into the search.
Now here's my problem. In all cases, if I can't find an item that matches these criteria, I want to create a new Foo that does match, and add it to the list of Foo objects.
The thing I'm wrestling with is figuring out an underlying system of representing conditions that allows me to then create an item that directly matches those conditions. So far I've got two ideas, neither of which I'm a fan of:

Repeatedly generate random Foo objects across the span of possible properties, until applying the criteria to one of them results in true. Given the possible permutations involved, this feels like an absolute performance nightmare, and would probably require a ton of caching logic to track what possibility spaces have already been tried.
Establish a list of individual conditions with isolated variables (such as a GreaterThan condition with the referenced property that indicates whether the property is A, B, or C; and the target value) and create a corresponding declaration (Make [property] a random value between [targetValue] and [propertyMax]). Not only is this incredibly tedious, but I'm also not really confident I understand how it would work, particularly in C# but more generally also. This feels like self-reading code and that's something I have no experience with.

My question is, basically, what designs and techniques can I use to address this sort of issue - the need to create objects that match criteria, when those criteria could be arbitrary? Surely this has come up in other projects. What kinds of constraints or frameworks are applied to make this doable?

sentences:
How to get position of CCSprite added to CCParallaxNode? I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this:

_backgroundNode = CCParallaxNodeExtras::node();
this->addChild(_backgroundNode,-2);

    float acum = 0.0;
    back1 = CCSprite::create();
    for(int i = 0; i < num_repeats; ++i) {
        CCSprite *back = CCSprite::createWithSpriteFrameName("rock.png");
        back->setPosition(ccp(acum, 0));
        back1->addChild(back);
        acum+= back->getContentSize().width+150.0;
    }

    _backgroundNode->addChild(back1,  1 , ccp(0.1,0.1), ccp(0, winSize.height * 0.64));

now in my update I have this:

CCPoint backgroundScrollVert = ccp(-1024, 0);
_backgroundNode->setPosition(ccpAdd(_backgroundNode->getPosition(), ccpMult(backgroundScrollVert, dt)));

perfect, the background moves and disappears (that is what I want for now) but I need to get the collision between the sprites on that background and a fixed sprite as a child of the main node.

The problem is that whenever I try to get the collision by the simple way (intersecting the bounding boxes) it doesn't work, so I tried to just get the position of the sprites and all I get is the position fixed in the CCSprite (back1) composed by the sprites (back).

Now, is there a possible way to get the position of any individual sprite located in that parallax node? If i try something like:

CCSprite *tempsprite = (CCSprite*)_backgroundNode->getChildren()->objectAtIndex(0);
printf("%f\n", tempsprite->getChildren()->objectAtIndex(0)->getPositionX());

it prints always the same value, it is like the position is not being affected by the transformation of the parent in the background node... so, how do I get it correctly? how do I get the position relative to screen and not to the parent?

sentences:
Replace glTranslatef and glRotatef with matrixes I'm not an opengl expert, and, as a novice, I prefer to practice a little bit with the old opengl just to be sure to understand correctly the basic concept of computer graphics before deal with shaders and modern opengl (3.x). I don't want to start a flame with this so I'll go through my question. I just know that what I'm using is deprecated.

What I wanto to render is this:

and I'm drawing it using this piece of code:

// draw grid
drawGrid(10, 1);

// draw a teapot
glPushMatrix();
glTranslatef(modelPosition[0], modelPosition[1], modelPosition[2]);
glRotatef(modelAngle[0], 1, 0, 0);
glRotatef(modelAngle[1], 0, 1, 0);
glRotatef(modelAngle[2], 0, 0, 1);
drawAxis(4);
drawTeapot();
glPopMatrix();

Now, I'd like to replace the last glTranslatef and glRotatef with matrixes, and I'm doing in this way:

Matrix4 _matrixModel;
_matrixModel.identity();
_matrixModel.translate(modelPosition[0], modelPosition[1], modelPosition[2]);
_matrixModel.rotateX(modelAngle[0]);
_matrixModel.rotateY(modelAngle[1]);
_matrixModel.rotateZ(modelAngle[2]);

glLoadMatrixf(_matrixModel.getTranspose());

And I don't see anymore the teapot. So I thought that this _matrixModel is not complete because it is only the model matrix and I need a modelview so I have to multiply it with the projection matrix but.. this is what I get:

where am I wrong?

sentences:
How can I send commands to only certain clients? I am building a multiplayer game server with Unity. In the game there are players moving around the map. Now, because this map is quite large compared to the number of players, I was thinking to have the server send each clients' position only when they are nearby, and then slow the rate down when they are far away.

At first I was using the convenient SyncVar to do sync everyone's position, until I discovered its shortcomings, that is there is no conditional way to either sync or not a certain value.

I came out with this player synchronization class so far (I removed all optimizations for simplicity):

public class PlayerSyncPositionConditional : NetworkBehaviour {

    Vector3 lastPos;

    void FixedUpdate () {
        TransmitPosition();
    }

    [ClientCallback]
    void TransmitPosition () {
        CmdProvidePositionToServer(transform.position);
    }

    [Command]
    void CmdProvidePositionToServer (Vector3 pos){
        transform.position = pos;
    }

}

Now, what this code does is nothing more than sending its position to the server: when I am looking at the dedicated server instance, each players' position is correct. Also, as expected, each client will not receive any updates.

From my research, I found that instead of SyncVar, I can use Server and ClientRpc to dispatch commands from the server to all clients, so this

 [Server]
 public void MoveTo() {
     RpcMoveTo(transform.position);
 }

 [ClientRPC]
 void RpcMoveTo(Vector3 newPosition) {
     transform.position = newPosition; //this will run in all clients
 }

would move all clients to the transform current position whenever needed.

Now, the problem is that those commands, apparently affect every client, while I only want to affect ones that are near each other.

I know how to have the server issue the MoveTo at any rate I want, setup more than one interval, etc. but I don't know how to have it send only to certain clients at a single time.

I am not asking for the code itself, but I am getting really confused with all these client/server architecture concepts, which class does what, etc. so any heads-up will be greatly appreciated.

sentences:
Is there such thing as a design pattern for game character attributes? I'm toying with the idea of a character based game. The characters, robots, monsters, heroes (and weapons I suppose) will all have various attributes as per a D&D game for example.

They player should be able to configure those attributes to personalize their character, so maybe they'll be given 100 points at the start to allocate how they see fit to things like strength, speed, etc...

Also, I'd like the player to be able to add additional options, like maybe shields or individual spells, things like that.

Is there a standard design pattern for things like that?

I'm hacking my way through a prototype right now, and I've been considering an Options  object that accepts an Option in the constructor, with methods addOption() and getOption.

For my implementation of Option I did the following:

class Option{

  final String optionKey;
  String optionString;
  int optionInt;
  long optionLong;
  float optionFloat;
  char optionType;

  public Option(String optionKey, Object option){

    this.optionKey = optionKey;

    if(option instanceOf String){

      optionString = (String) option;
      optionType = 's';
  }else if(option instanceOf int){

    optionInt = (int) option;
    optionType = 'i';
    }else if(option instanceOf long){

    optionLong = (long) option;
    optionType = 'l';
    }else if(option instanceOf float){

    optionFloat = (float) option;
    optionType = 'f';
    }

  }

public String getOptionKey(){
  return optionKey;
}

public String getOptionValue(){
  return optionValue;
}

public void setOptionValue(String optionValue){
  this.optionValue = optionValue;
}

public void getOptionType(){
  return optionType;
}

}

But now I'm thinking this is a bit much, and perhaps I should be using an options class that encapsulates a Hashmap instead. So maybe something like this:

class Options{

HashMap<String, Object> options;

public Options(String key, Object value){
    options = new HashMap<String, Object>();
    options.put(key, value);
}

public void putOption(String key, Object value){

    options.put(key, value);
}

public void getStringOption(String key){

    return (String) options.get(key);
}

public void getFloatOption(String key){

    return (float) options.get(key);
}

//....... and so on...

}

I'm thinking the version directly above is better, is there a standard for this type of thing?

sentences:
Rotating with a preferred direction I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags.

I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the image flag 1 points to left of the screen and flag 5 to the right. I understand why, but do not know how to rotate it.
I saw LookRotation (Unity) has an override that takes a forward direction too. I thought it would work with say Vector3.Forward, but if a flag is placed on a wall it points into the wall.
The direction or angle they face can be set by the player.
I have a hard time understanding quaternions, every time I think I do, I get stuck.
Any tips ?

sentences:
Workflow for creating spherical heightmaps I'm wondering how I can create a spherical heightmap.

In my ideal workflow, you'd see a 3D sphere that you can edit using procedural terrain techniques (like World Creator) and that spherical terrain can be exported into six seamless images based on what layout you want your images to fold up into a cube in-game to create your planet.

Another option would be if you can at least tell the program you want specific images to tile with other images, such as the designated 'front, right, back, left' images tile with each other and the 'up, down' images seamlessly.

Specifically, I'm making planets for a game that wraps six images into a cube and 'inflates' them into a planetary terrain.

I've made a few basic heightmap sets in a program called Scape, and flipped them so at least four of the images mirror each other, then I edited the interior of those maps to all be different so the landscape isn't repetitive. However, manually editing the top and bottom maps is very daunting to get perfect, and I'm creating a dozen or more planets.

I'd like to know how to make 'front, right, back, left' images tile with 'up and down' images and I can edit the interiors of the images in a 3D program of choice. I've been directed to this site from search queries many times, but I'm a newbie to all things code so I have no clue how to use things such as the Diamond-Square method or any algorithms to achieve seamless textures (what program do you actually use, literally a python script you write in Notepad++ or something?).

sentences: Is Update called based on screens refresh rate? MonoGame My game is running 60fps (Because I'm using a 60hz monitor) but if I would use a 85hz monitor it would be running 85fps. My question is if update is called based on the screens refresh rate or if its limited to 60 calls per second

sentences:
Merging custom c++ engine with Unreal Engine I have my own custom C++ game engine with networking, game logic (most important) suitable for type of games I am working with etc.

I find it harder and harder to keep up with other engines in case of graphical part.

I wonder if it's possible to merge my C++ engine with Unreal Engine? And if so, what would be the best practice for it?

What I mean is to keep my already established game logic and data modules and use UE to render meshes ordered by game logic (I can easily detach the rendering part of my engine, because it's closed into few abstract interfaces that I can implement again with calls to another API or custom code), as well as do some simple physics (the type of games I do do not require too much of physics simulations). That way I could benefit from both UE rendering superior and my engine's tailored game logic module.

I know it's possible to extend UE with custom plug-ins, but I'm not sure it would be the best approach for me.

sentences:
Function to draw an image inside a rectangle How can I draw an image inside a rectangle?

I am introducing myself in the manipulation of images for games, I have a window and inside there is a rectangle that deforms. I would like to fill the rectangle with an image, but I have no idea how to translate the coordinates of the image to the rectangle.
I don't want a library function, I want to implement it myself.

the idea would be to have a function:

void fill_image_rectangle (img, b1, b2, b3, b4) {

// *
}

I use Java on Windows 7 CPU

sentences:
Does Big O really matter? In academia worst case Big O is taught over everything else.  Compared to space complexity, normal case analysis, simplicity over complexity, etc.

In particular to game programming and industry, what really matters most and why?

References would be very helpful.

sentences:
Missing features from WebGL and OpenGL ES I've started using WebGL and am pleased with how easy it is to leverage my OpenGL (and by extension OpenGL ES) experience. However, my understanding is as follows:

OpenGL ES is a subset of OpenGL
WebGL is a subset of OpenGL ES

Is this correct for both cases? If so, are there resources for detailing which features are missing?

For example, one notable missing feature is glPushMatrix and glPopMatrix. I don't see those in WebGL, but in my searches I cannot find them referenced in OpenGL ES material either.

sentences:
How can I manage large numbers of objects in a physics engine? MY friend and I are programming a game and I decided to give the physics engine a try. I was able to get a class working where it would calculate out the total force on a model and apply the correct acceleration, velocity, and position during each time step.

My question is how do I implement this over many objects when the game starts to get big. Is there just one class managing all the physics calculations for each object or do you attach the physics engine class to each object in the game so that they update and manage their own physics?

I've looked through some code and I usually see people putting the velocity, acceleration, and position calculations right on the object itself. But somehow I think I'm getting the wrong interpretation of this and I think on a large scale, this would be very inefficient.

We don't want to use a pre-built physics engine because we want to learn about how this all works.

sentences:
Running Slick2d outside of the IDE I am looking for advice how to solve an exception I am getting,

I've looked around and seen people get the same error but most people whom had it seems to run on old graphics drivers and once they fixed that it seemed to work for most people.

I doubt that's the reason causing it for me since I have the latest nVidia drivers and the game runs well from the IDE. I also did create a jar of the game before I implemented Slick2d and that ran without exceptions.

I used to get another exception, that it couldn't find the right natives for lwjgl so I removed the natives from the build and made a fat jar with jarsplice and added them during that process and that's when I ended up at this point.

I've tried and tried for days and it's probably something really stupid and easy to fix but I havn't built a lot of project to be ran from outside Eclipse so any help would be greatly appreciated.

Some basic info on my rig:

OS: Windows 7: Enterprise

CPU: Intel Core i7-2600K

GPU: nVidia GTX 980

RAM: 8192MB (forgot the brand and make, it's old lol)

sentences:
NegaScout with Zobrist Transposition Tables in Chess I'm trying to put Transposition tables into my alpha beta scout. I do see an incremental speed boost I think toward mid or late game, however, even with a table size of 1-2GB, its may or may not be slower than just not reading from the Transpose table at all. I'm also noticing some less than efficient moves if I were to play the exact same game without the tables.

I tested my Zobrist key hashing, and they come out properly even after making and undoing moves. I don't believe they are the issue. I tried to follow the advice of these articles in designing the alpha/beta pruning.
http://web.archive.org/web/20070809015843/http://www.seanet.com/~brucemo/topics/hashing.htm
http://mediocrechess.blogspot.com/2007/01/guide-transposition-tables.html

Can anyone help me identify a mistake? Perhaps I'm not understanding the evaluation of checking alpha vs beta from the hash. Or is 1-2GB too small to make a difference? I can post more of the Transposition table code if need be.

 public int alphaBetaScout(Board board, int depth, int alpha, int beta, bool color, bool
quiscence)
{
    // !!!! With or without this specific section, and any other Transpose.Insert, doesn't make the game play or evaluate any faster.
    HashType type = HashType.AlphaPrune;
    HashEntry h = Transpose.GetInstance().Get(board.zobristKey);
    if (h != null)
    {
        if (h.depth >= depth)
        {
            if (h.flag == HashType.ExactPrune)
            {
                return h.scored;
            }
            if (h.flag == HashType.AlphaPrune)
            {
                if(h.scoredState > alpha)
                {
                    alpha = h.scored;
                }
            }
            if (h.flag == HashType.BetaPrune)
            {
                if(h.scoredState < beta)
                {
                    beta = h.scored;
                }
            }
            if (alpha >= beta)
            {
                return alpha;
            }
        }
    }

    if (board.terminal)
    {
        int scoredState = board.Evaluate(color);
        Table.GetInstance().Add(board.zobristKey, depth, Entry.EXACT, scoredState);
        return scoredState;
    }

    //May do Quescience search here if necessary && depth = 0

    Stack movesGenerated = GeneratePossibleMoves();
    while(!movesGenerated.isEmpty())
    {
        int scoredState = MAXNEGASCOUT;

        board.MakeMove(movesGenerated.pop());
        int newAlpha = -(alpha +1)
        scoredState = -alphaBetaScout(board, depth - 1, newAlpha, -alpha, !color, quiscence);

        if (scoredState < beta && alpha < scoredState)
        {
            scoredState = -alphaBetaScout(board, depth - 1, -beta, -scoredState, !color, quiscence);
        }

        board.UndoMove();

        if (scoredState >= beta)
        {
            Table.GetInstance().Add(key, depth, Entry.BETA, beta);
            return scoredState;
        }

        if (scoredState > alpha)
        {
            type = HashType.ExactPrune;
            alpha = scoredState;
        }
    }
    Table.GetInstance().Add(key, depth, type, alpha);
    return alpha;
}

sentences:
Workflow for authoring hitbox data for a 2D fighting/platformer game I understand that collisions in fighting games are detected using hitboxes and hurtboxes associated with specific frames of the animation

I am looking for techniques to author the data for these hitboxes to use in my Java platformer game (I'm not using a pre-existing engine)

I have a single hitbox for the character working, but as I add animations with sprites of variable sizes, I need to move from a single static hitbox to something that fits the animation frames.

So far I've considered:

Manually picking position & size numbers for each frame, and typing them out in a text file like a JSON data structure asset to load into my game.

This works for short animations, but seems like it wouldn't scale to larger animation sets of 30-100 frames each.
Automated image segmentation with rectangles. I wrote an algorithm which divides the image into n rectangles with their transparent parts trimmed.

However, it is far from optimized, and may produce inappropriate results. It cannot be relied to automate the task.

What method can I use to create suitable hitboxes for a large number of animation frames?

sentences:
How to get good movement synchronization in a networked game (action/shooter) I've spent the last two days trying to get good movement interpolation with Photon in Unity but I can't get anything that I'm happy with. I've tried several methods but none satisfied me. My understanding is that I better use some kind of interpolation (as opposed to extrapolation/dead reckoning) because in my game the players can change direction fast.
I've tried lerping between the current position and the last received authorized position, I've tried lerping between the old and the new authorized position, but nothing gives me the right amount of responsiveness + smoothness. What can I do?
Sample code:
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
    if (stream.IsWriting) //do we have authority over this object?
    {
        stream.SendNext(transform.position);
        stream.SendNext(transform.rotation);
    }
    else
    {
        newNetworkTime = Time.time;
        oldPosition = transform.position;
        oldNetworkPosition = networkPosition;

        networkPosition = (Vector3)stream.ReceiveNext();
        networkRotation = (Quaternion)stream.ReceiveNext();
    }
}

void RemoteMovement()
{
    float t = 1.0f - ((newNetworkTime + interpolationPeriod - Time.time) / interpolationPeriod);

    transform.position = Vector3.Lerp(oldPosition, networkPosition, t);
    transform.rotation = Quaternion.Lerp(transform.rotation, networkRotation, Time.deltaTime * movementSpeed);
}

sentences:
Sprite rotation: is it better to rotate with a quaternion or via sprite swap? Considering this question:
"In a generic game engine where you have an object sprite (e.g. Unity), is it better (in terms of performance) to implement a clockwise rotation calculating at each frame the incremented rotation (e.g. having a quaternion "q" representing a rotation of n degrees and at each frame computing newrotation = q * oldrotation) or having say 20 snapshot sprites of a complete rotation and changing the sprite at each frame (effectively a 2D animation)? "

Is there a non engine-specific answer to this question? If so, which one?

sentences:
Is it possible to design a multiplayer game which can be played from different devices? I want to design a online multiplayer game for all gaming devices e.g. Desktop PC, Internet browser, Android phones, Android tablets, iPhone, iPad, XBOX 360 etc. Now my main requirement is that, I want all devices can be used to play the game in multiplayer mode together i.e. One player can be connected using PC another using Android phone and other may be with iPhone or iPad.

My doubts are:

How to make all devices to connect to common game server?
What will be the logic for graphics and texture because all devices screen will be of different aspect ratio?

sentences:
Simulating a 2D rope from a top down perspective I was wondering if anyone could point me to any resources and/or explain how to properly simulate a 2D rope from a top down perspective?

I found a game that has the exact mechanic I'm looking for...

http://www.newgrounds.com/portal/view/300760

Play at least one level to get an idea of what I mean.

sentences:
Unity3D and Photon Networking RPG Good time of the day.
My question might sound stupid, due to the knowledge you might have, but here it is.

I've purchased Diablo 3 a long time ago and been enjoying it since then. Since many of my friend are playing other Blizzard titles, i tried to convince them to purchase Diablo and to play all together. However, they don't want to invest money in the game they don't understand (yet).

So i've decided to write a game, which will be similar to the Diablo in the way of interaction and gameplay, but will (obviously) have some unique points in it (since i'm not only doing this for them, but also to educate myself in the game development area). Other this is, i've decided to take Masters in the Game Development (later this march, just got my bachelors in computer security) and wanted to have some basic knowledge about game development.

I used to make "RPG" games before, tho only browser style ones using LAMP stack, and have some basic knowledge on storing/retrieving data to/from server.

In order to implement multiplayer part of the game, i've decided to use free package PUN (Photon Unity Networking). Had no problem with creating my first room and spawning a player prefab for every new connection (tho they all move no matter on which client action is performed).

Now to the question(s):

By using PUN, i'm able to create new room for players (limited to 5), is it possible to set room names BEFORE they are actually initialized by the player? (set of rooms might be stored on MySQL server and retrieved by the API call)
Is it possible to save progression of the player on the server, and later pass it back to the spawned player (by PUN). This is my main concern, since i've no actual access to the data processed by the server. (Solution is to create another connection to the "storage" server, and keep both of them "online"?)
Does PUN allows you to select which scene should be loaded upon first player entering the room, if so, a bit of pseudo code might be helpful.
What will happen to the player, if there is no spots left to join the server (this is just theoretical question, since i'm not going to publish this game, and amount of friends playing games is less than 20)
How would one deal with the item equipped, which is received during the gameplay? (This one links to the second question) What i'm talking about is, is it possible to restore player object with the set of data received form the server (if possible, ofcourse)

I know, the first suggestion will be to go and to read documentation (i'm in the process of reading it, don't worry). But i've decided to write here, since there are many skilled people out there in this area, who can give me basic understanding on how this whole PUN system works.

I would like to thank you for all of the responses, which you are about to post (or maybe not), and again, have a great day.

sentences:
Unity's CharacterController vs. Rigidbody with Collider With a few friends I started to make a 3D game in the style of the old platformers à la Super Mario 64 / Spyro / Banjo Kazooie.

So now we are thinking about the controls and how to do them.

There seem to be two mutually-exclusive options: Giving our character a rigidbody and however many colliders we want OR
using a character controller.

At the moment we have a rigidbody with a collider which technically works, but we have to make our own grounded check, and movement, while those two in particular are relatively easy to implement.
If we start to use a character controller OTOH, we won't have all the collisions anymore and programming logic needs to be applied in a different way.

Let's take a jumppad as example:

If we use a Rigidbody, the jumppad itself checks if someone is standing on it, and if so it increases the jumpstrength while that someone stands on it.
If we use a CharacterController, we'd have to check not only if we are standing on a jumppad, but also on which one, to determine the actual jumpstrength, as they might differ between pads.

So, is there a clear winner to use in a 3D platformer with fighting elements or do we have to work with limitations on either and just have to work around them?

sentences:
Combining several animations into a single FBX I'm trying to figure out a workflow for preparing character animations for Unity so that they are all combined in a single FBX file. The advantage as far as I see it is that it then uses only a single skeleton where multiple animation files would each have their own skeleton (which I think is unnecessary and would increase size considerably).

I've tried using Maya for this but haven't been successful so far. Then I tried Motionbuilder and I can get the animations (takes) together into a single file but many of the animations don't look right afterwards.

So I was wondering does anyone know of a solid workflow to achieve this? I'm having a hard time finding information about what I'm trying to achieve. This is probably a piece of cake for experienced animators but I'm just starting with animation now.

So how do you combine several animation FBX files into single one (whith either Maya, Motionbuilder, or 3DSMax) and make sure that the animations are all properly retained like they should? I'm sure there are some additional things to take care of but I don't know exactly what they are.

sentences:
How to access Collider in c# script with its tag name I want to access a Collider in c# script file with its tag name
I Tried this

if (Collider2D == Physics2D.OverlapPoint(touchPos))
{
    Some Code to be Performed
}

I want to access this Collider2D with its Tag Name like this

if (GameObject.FindGameObjectWithTag("tag name") == Physics2D.OverlapPoint(touchPos))
{
    Some Code to be Performed
}

But Its not working
Please Help...

public GameObject[] targets,targetss;

    void Start () {
        targets = GameObject.FindGameObjectsWithTag ("right screen");
        targetss = GameObject.FindGameObjectsWithTag ("left screen");
    }

    void Update () {
        if (Input.touches.Length <= 0) {

        } else {
            Vector3 wp = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
            Vector2 touchPos = new Vector2(wp.x, wp.y);

            foreach(GameObject target in targets)
            {
                if (target.collider2D == Physics2D.OverlapPoint(touchPos))
                {

                    GameObject.FindGameObjectWithTag("player2").transform.position =
                    new Vector2(GameObject.FindGameObjectWithTag("player2").transform.position.x, wp.y);

                }
            }

            foreach(GameObject target in targetss)
            {
                if (target.collider2D == Physics2D.OverlapPoint(touchPos))
                {

                    GameObject.FindGameObjectWithTag("player1").transform.position =
                    new Vector2(GameObject.FindGameObjectWithTag("player1").transform.position.x, wp.y);

                }
            }

        }
    }

sentences:
Opengl scrolling world guidance I'm looking for a tutorial about how to implement a horizontally scrolling background with various objects that auto-scrolls as your character/player moves just like various car/motorbikes games.

I'll have images for various obstacles, objects along the path. I'm concerned if I load everything on start of game. /i would want these to be loaded for visible area as the player moves (or appears to move).

Though I'm looking for a tutorial in android and I'm new to opengl, but I welcome any sort of help.

sentences:
How to stop switching between paths to a moving target? I've noticed after implementing A* pathfinding into my game, that there is exploitable/unrealistic behavior that goes on when the player moves between two nodes that alter the path of the AI trying to reach them. I have made a few images to demonstrate this problem.

This image above shows how the pathfinding in my game would behave if the player stood on the opposite side of a wall than my AI. If the player doesn't move it will take this single path to reach them. Assume that the red icon is the AI (enemy) and the blue icon is the target (player).

Now, if the player in this image above moves along the white arrows up and down, and the AI is constantly finding the optimal path to the player (ignore the performance costs of doing that), then the AI will also get stuck moving up and down because the optimal path will constantly shift between going above the wall and going under the wall. Is there a way to modify a standard A* implementation to remedy this? I will include my pathfinding code for clarity, but it's pretty much a standard top down implementation. The "Node" object is a node on my grid, and the grid is an object that holds a list of nodes, with a few functions to find a node from a world point.

public class Pathfinding : MonoBehaviour
{

public Transform seeker, target;
AstarGrid grid;

void Awake()
{
    grid = GetComponent<AstarGrid>();
}

public List<Node> FindPath(Vector3 startPos, Vector3 targetPos)
{
    Node startNode = grid.NodeFromWorldPoint(startPos);
    Node targetNode = grid.NodeFromWorldPoint(targetPos);

    List<Node> openSet = new List<Node>();
    HashSet<Node> closedSet = new HashSet<Node>();
    openSet.Add(startNode);

    while (openSet.Count > 0)
    {
        Node node = openSet[0];
        for (int i = 1; i < openSet.Count; i++)
        {
            if (openSet[i].fCost < node.fCost || openSet[i].fCost == node.fCost)
            {
                if (openSet[i].hCost < node.hCost)
                    node = openSet[i];
            }
        }

        openSet.Remove(node);
        closedSet.Add(node);

        if (node == targetNode)
        {

            return RetracePath(startNode, targetNode);
        }

        foreach (Node neighbour in grid.GetNeighbours(node))
        {
            if (!neighbour.walkable || closedSet.Contains(neighbour))
            {
                continue;
            }

            int newCostToNeighbour = node.gCost + GetDistance(node, neighbour);
            if (newCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
            {
                neighbour.gCost = newCostToNeighbour;
                neighbour.hCost = GetDistance(neighbour, targetNode);
                neighbour.parent = node;

                if (!openSet.Contains(neighbour))
                    openSet.Add(neighbour);
            }
        }
    }
    return null;
}

sentences:
How can I snap a game object's position to a grid? I'm making a game that involves "falling block" gameplay elements. The problem is, I'm not quite sure how to make it so that the blocks will snap to some kind of grid, in other words, I'm not sure how it will pick the closest cell to its position.

The blocks are not continuously snapping to a grid (i.e. they are subject to gravity). Any tips?

sentences:
Circle to Circle collision - bad accuracy Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls).

Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without intersecting, regardless of the collision point. As you can see on the image below, the blue circle bounces off properly only at the blue arrow spots, otherwise(red arrows), blue ball goes INSIDE the black circle, gets stuck in there for a second and then gets out.

I have no idea why this is happening. Please take a look at my code and help me out.
Thanks.

public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X); //velocity
                    circle.setLayoutY(circle.getLayoutY() + Y); //velocity

// Bounce off the walls (working perfectly)
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

//THE PROBLEM IS HERE

//Collision between circle1 and circle2 (stationary black circle.
                    double dx = circle.getLayoutX() - circle2.getLayoutX();
                    double dy = circle.getLayoutY() - circle2.getLayoutY();
                    double radii = circle.getRadius() + circle2.getRadius();

                    if ( (dx * dx) + (dy * dy) <= radii * radii) {
                        X = X * -1; //X gets inverted to change direction

                    }

 //The code below is working perfectly.
                    // If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                        //circle.setLayoutY(circle.getLayoutY() - 50); - Wasn't working. Had to create X and Y to fix the problem.

                    }
                    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }
                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

P.S. Apologies for the amazing paint skills :D

sentences:
BoundingFrustum Performance Issues I have noticed that BoundingFrustum.Intersects() is a rather slow check in XNA. I am doing only 256 checks per frame and it eats up arround 50-60% of availible time when running at 60fps. This is kind of crazy. I would like to know if anyone else has experienced these types of performance problems with the BoundingFrustum class in XNA? Does anyone suggest I make my own boundingfrustum class/struct?

(One pitfall, when using the BoundingFrustum class, is declaring a new instance of it every frame... for some reason it is a class and not a struct. I am not doing this.)

sentences:
Building a simple bomberman game with Node.js and Socket.io I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept.

To start with, I have a 2D grid system as the game map.

_________________________________________.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|.

Each position with values:

0: empty
1: wall - can not be destroyed by explosion
2: obstacles - can be destroyed by explosion
3: bomb
4-9: some powerups
10>=: the id of player

CLIENT-SIDE

I'm not planning to have any game logic happen on the client side, so the client simply send left, right, up, down and plant a bomb command to my server. There is however, some simple check that happen on the client side - 1. check that there's no wall at the direction the client is moving to; 2. the client didn't plant a bomb in the last 3 seconds.

The client also receives the state of the map as a 2d array and knows how to draw everything using that info.

SERVER-SIDE

Main game logic happen on the server side, which includes updating the position of player, calculating the damage of bomb explosion - destroy stuff in the range, except walls and space behind walls

Questions:

When the player is moving, he won't see himself moved until he gets the data back from server that updates his position. So I worry this delay may affect user experience, is it better that I move his position on his browser right away, and only update other players' position using info received from server, that means his own movement is rendered away, while his position info is sent to server.
When rendering everything, it's simple to implement that whenever anything on the map move or change, redraw everything with the new data. Is that a waste? Can I only update things that change, for example, a player move right 1 position, nothing else changed on the game map, do I still have to redraw everything? I think I'm going to use Canvas to render.
Please feel free to comment or answer if you think there are places I can improve or I simply thought wrong, thanks!

sentences:
How can I get my first-person character in Unity to move to a ledge with an animation? I'm trying to get this to happen:
The character walks up to a large crate, the player presses a button, and an animation starts playing where the character climbs up on to the crate. (all in first person view).

So far I tried this with normal "First Person Controller" Prefab in Unity.

My code so far:

function OnTriggerStay(other : Collider){
    if(other.tag == "GrabZone"){
        if(Input.GetKeyDown("e")){
            animation.Play("JumpToLedge");
        }
    }
}

However when i use this on The FPC it will always play from the position the animation is created on.

I also tried to create an empty game object, placing the FPC in there. Gives same effect.

I also tried just animating the graphics of the FPC alone. This seems to work but since the Character Controller itself is not animated that stays onthe ground. So the whole FPC wont work anymore.

Is there anyway i could let this animation play on the local position the player is on at that time?

Or can you think of any other logical solution for a grab and climb?

sentences:
In a simple raycasting engine, why is the distance between player and projection plane constant? According to this article about making a simple raycasting engine (like the one that was used in Wolfenstein3d), the distance between the player and the projection plane will be constant.

For example, suppose we are using a projection plane of dimension 320 X 200, and player's field of view (fov) is 60 degrees. Then the distance from the player to the projection plane is going to be

160 / tan(30 degrees) = 277 units

I can understand the trigonometry, but I can't understand why would the distance remain constant througout the game? Why wouldn't the distance change when the player moves closer or farther away from the projection plane?

sentences:
Something is preventing my NavMeshAgent from moving I apologize for the vague title. I really wish I could ask something more specific, but I can't. I had my click-to-move script working fine with the NavMesh. I showed it to my colleague earlier today, and must have accidenntally made a change and saved. Now the guy's not walking.

There are no errors and my debugging leads me to believe all code paths are working as expected. When I click on a location, it checks that it is valid on the NavMesh, then updates the NavMeshAgent's destination:

I am not going to post the code because I don't think the problem resides there, but rather it was something I did in the editor. The character also turns in the correct direction, and starts the walk animation correctly, but it looks like something is blocking its movement, and I can't figure out what that is.

The following screenshots will help clarify my situation. Note that the camera is shaking because its position is set to match the character's in Update. The character appears to be colliding with something, which makes it look like the camera is colliding too (note this is not a physics-based game in any way).

edit here's some more screenshots, showing the person slightly above the ground and their collider (it's the box near their feet). I disabled the collider on the floor so there are no colliders other than the player's.

sentences:
Whats the general method developers to implement FPS multiple weapon handling animations? I'm trying to create a first person shooter and I'm lost on what's a good, efficient methodology to implement the whole weapon handling animation system.

Now, I know that I could have a unique animation for every weapon, but this sounds very expensive. Do people use IK to modify hand positions so that they can reuse the same animations for similar weapons?

Also, How does recoil work? Is it baked into the animation? Or is it applied via script? In counterstrike it looks like it's baked into the animation (since they use hip firing), however, in COD it looks like

Id really appreciate any opinions because I am lost!

Thank you

sentences:
In Unity, does a reference delegate clear out when its parent GameObject is destroyed? If I have a GameObject with a component like some:

class SomeComponent : MonoBehaviour
{
    System.Action DoStuff;
}

class SomeOtherComponentInAnotherGameObject
{
    public GameObject ObjectWithThatComponent;
    void Start()
    {
        ObjectWithThatComponent.GetComponent<SomeComponent>().DoStuff += SomeFunc;

        Destroy(ObjectWithThatComponent);

        // is there still a reference to SomeComponent somewhere?
    }
}

I'm getting some odd behaviour/random crashing when deleting this stuff but I'm not sure if it's being caused by these delegates.

sentences:
Improving shading of procedurally generated pixel art sprites I've been working on a sprite generator and I'm having a hard time figuring out how to add shading automatically.

Here are some examples of the generated sprites

Currently what I'm doing is checking where a flat color meets a dark boundary, and then applying either a highlight or a shadow depending on the direction.

This is of course really boring. I've tried searching for other methods, but all I could find were AI examples. Does anyone know of any particularity simple yet clever ways of adding shading automatically?

I've thought of expanding the check up to 5 cells, and using a set of pre-determined patterns to generate the shading, but I'm just not too sure

sentences:
Algorithm for texture blending modification Im currently writing a terrain editor for my game (for the record: no commercial intentions) and after having implemented the terrain morphing to my liking im now working on the texturing of said terrain. One chunk of terrain can consist of up to 4 different layers of textures which are blended together using a 4-byte rgba texture with alpha values. The alpha values are 0-255 and together add up to 255, so the blending on the gpu happens like this:

float4 finalColor = color0 * alpha.r + color1 * alpha.g + color2 * alpha.b + color3 * alpha.a;

In a first approach ive been doing very simple modification of that blending (pseudocode):

selectedLayer.alpha += amount;
allOtherLayers.alpha -= (amount / numOtherLayers);

This doesnt work all too bad but it creates a lot of artifacts or sharp lines between chunks. Here is an example image:

Now im looking for different, better algorithms. The brush currently consists of an inner and an outer radius (as seen in the image). Inside the inner radius no interpolation depending on the distance to the center happens, between inner and outer radius linear interpolation between the pressure on the inside and 0 is created.

I hope my question is clear enough, please leave a comment if there has to be more information. Thank you in advance.

sentences: Updating code at runtime, without recompiling Hey guys i was wondering if anyone has come across a c++ ide that you can actively play test the updates without having to recompile all the code.

sentences:
Rotation of images in Slick2D I have have a rotation problem in the Slick2d library, the image is just not rotating (ie I set a rotation but no result is shown). Here is the rotation code:

if (input.IsKeyDown(Input.KEY_LEFT))  {
    velocity.x = -1;

    rotation = (float)Math.toRadians(180);
}

That is meant to set the rotation of image to 180 degress.

Then I render the image with an origin of the center of the image:

image.setCenterOfRotation(image.getWidth() * scale / 2, image.getHeight() * scale * / 2);
image.setRotation(rotation);

image.draw(position.x, position.y, scale);

Any ideas? Thanks.

sentences:
Flash  server, protocol protection I am making a flash game that will interact heavily with the server. For quite some time already I am using 'request hashing' technique to make sure that request data hasn't been tampered with. This works pretty well. However, in this game I'd like to go a little bit further and completely hide the protocol from the observer (right now it's plain JSON).

I imagine that I could zip and encrypt data (using one of symmetric algorithms). That would make it pretty unreadable by human, right (also smaller)? And SWF encryption/obfuscation should protect the encryption key (it is being done anyway).

As a side benefit that will also protect dynamically loaded resources from directly saving them to disk (or copying from the cache).

Questions:
* are there tools that allow you to simply dump the SWF with all its content, received and decrypted? If yes, this will render 'the side benefit' invalid.
* do you think it's worth it to burn all that CPU power?

To support my point, I will say that I like to inspect data being exchanged between client and server. And occasionally I find a bug or two which I can use to my benefit. But then there was a game that was sending and receiving some binary data. Being a lazy attacker, I decided not to analyze further. Otherwise, who knows what I could find :-)

Comments, ideas, criticism, suggestions? :-)

sentences:
Optimization of 2D terrain generation algorithm I am generating 2D terrain with 2D opensimplex noise, however I am having a problem with the FPS that is low when generating the terrains in TileMap. An example of how my game generates the terrain in javascript:

function generator(map_size=0, _posWorld=[0, 0], size=[1, 48], seed=0) {
    var simplex = new SimplexNoise(seed);

    var x = 0;
    var y = 0;
    var pos_modx = 0;
    var pos_mody = 0;
    while (x < size[0]) {
        pos_modx = utilsfunctions.mod(_posWorld[0] + x, map_size);
        y = 0
        while (y < size[1]){
            pos_mody = utilsfunctions.mod(_posWorld[1] + y, map_size);
            // GENERATION NOISE
            // TEMPERATURE
            var nx = parseFloat(pos_modx)/map_size - 0.5;
            var ny = parseFloat(pos_mody)/map_size - 0.5;
            var v1 = temperature * simplex.noise2D(1 * nx, 1 * ny);
            var v2 = 0.4 * simplex.noise2D(2 * nx, 2 * ny);
            var v3 = 0.23 * simplex.noise2D(4 * nx, 2 * ny);
            var v4 = 0.134 * simplex.noise2D(8 * nx, 8 * ny);
            var e = v1 + v2 + v3 + v4;

            // HUMIDITY
            var unx = parseFloat(pos_modx)/map_size - 0.4;
            var uny = parseFloat(pos_mody)/map_size - 0.5;
            var u1 = humidity * simplex.noise2D(1 * unx, 1 * uny);
            var u2 = 0.6 * simplex.noise2D(2 * unx, 2 * uny);
            var u3 = 0.7 * simplex.noise2D(4 * unx, 2 * uny);
            var u4 = 0.073 * simplex.noise2D(8 * unx, 8 * uny);
            var u5 = 0.09 * simplex.noise2D(16 * unx, 16 * uny);
            var u6 = 0.03 * simplex.noise2D(32 * unx, 32 * uny);
            var ue = u1 + u2 + u3 + u4 + u5 + u6;

            if (pos_modx >= 0 && pos_mody >= 0) && (pos_modx < map_size && pos_mody < map_size) {
                tile_map.set_cell(_posTileMap.x + x, _posTileMap.y + y, biomes.solos(e, ue));
            }
            y += 1;
        }
        x += 1;
    }

The problem is that I am generating several layers of tilemap, one for terrain, one for relief and one for trees. That is three scripts of these, of course for the relief and trees is much less complex, and alone for example, even the two together do not interfere almost anything in the FPS. However, only generating with the above-ground script is already a big problem, and I generate only one minimum possible bit at a time, which is (1, 48) for when moving up or down, and (48, 1) when moving to the right and left, it is clear that there is the case of the diagonal movement, having to generate 48 + 48, which is the worst case. However, even only the 48 are already leaving the FPS bad, nor do I need to move diagonally to feel the FPS suffer.

I would like tips to be able to optimize this generation, and if know any way to use only one algorithm to generate everything (terrain + relief + trees), or any help that can take me to a better way.

Understand why I am generating with 3 different scripts for terrain, relief and trees:

Terrains are large areas within large areas.

Reliefs are crooked lines on the map.

Trees are only points of a dirty noise on the map.

sentences:
Show the edges between the clipping plane and clipped objects I want to utilize shaders to not only discard fragments if they are on one side of a predefined plane but also render a contour along the intersection.

My fragment shader currently does something along the lines of:

float dot = dot(world_coordinate, normalize(clipping_normal.xyz)) - clipping_normal.w;
if (dot > 0.0f)
    discard;

this works but without the desired contour. I tried comparing the dot product against values close to 0.0 but this results in a contour with varying width depending on view etc...

This is what I am trying to achieve. Notice that the white contour/edge of where the plane intersects the sphere is of consistent width:

So below is what the result I currently see:

With the fragment shader:

in vec4 color;
in vec3 world_position;

out vec4 frag_color;

void main()
{
    float dist = (dot(clipping_plane.xyz, world_position) - clipping_plane.w) /
              dot(clipping_plane.xyz, clipping_plane.xyz);

    if(dist >= 0.0f && dist < 0.05f)
        frag_color = vec4(0.0f, 0.0f, 0.0f, 1.0f);
    else if(dist < 0.0f)
        discard;
    else
        frag_color = ComputePhong(color);
}

sentences:
How can I merge multiple sprite into one sprite or texture using Unity3d? I have an avatar generator where someone can create a custom avatar with layers superimposed.
And in order to reuse this image multiple times, i want to merge all layers in one image.
Is there any way on unity3D to create this image.

I've already coded that :

atlas = new Texture2D (width, height, TextureFormat.RGBA32, false);
foreach (Sprite s in allSprite) {
        atlas.SetPixels (0, 0, atlas.width, atlas.height, s.texture.GetPixels (0, 0, atlas.width, atlas.height));
        atlas.Apply ();
}

My problem is to keep the transparency and not erase old layers where pixels are transparent.
The setPixels method replace old pixels in atlas by new one.
I can't loop over pixels because of the size of the image (1024*1024) and more than 6 layers.

sentences:
Why does my machine render OpenGL using my onboard chipset instead of my graphics card? I'm following an OpenGL tutorial series at opengl-tutorial.org, but have run into a problem:

The following lines:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

cause my glfwCreateWindow() call to return null.

As I understand, this is caused by lack of support for OpenGL 3.3.

Why is my machine trying to render OpenGL 3.3 using my onboard graphics chipset (Intel HD Graphics 3000, which only supports OpenGL 3.1) instead of using my dedicated graphics card (GeForce 520M, which supports OpenGL 4.x)? I think this has something to do with power saving.

Note: I have newly updated nVidia drivers, installed as of yesterday. I know they are working because if I right-click my desktop I get a context menu for nVidia Control Panel.

Running OpenGL Extensions Viewer 4.x also displays that I'm using Intel HD Graphics 3000, supporting OpenGL <= 3.1, which is consistent with my theory regarding power saving.

Regards,

sentences:
What features does D3D have that OpenGL does not (and vice versa)? Are there any feature comparisons on Direct3D 11 and the newest OpenGL versions?

Well, simply put, Direct3D 11 introduced three main features (taken from Wikipedia):

Tessellation
Multithreaded rendering
Compute shaders
Increased texture cache

Now I'm wondering, how does the newest versions of OpenGL cope with these features? And since I have this feeling that there are features that Direct3D lacks from OpenGL's side, what are those?

sentences:
How Client send info to Host in Unity Multiplayer I want to send player name and other details from client to host device. I have setup game for maximum two players connection.

Here is the code that I have tried multiple times with different changes:

    void Start ()
{
    spriteRenderer = GetComponent<SpriteRenderer> ();
    circleCollder = GetComponent<CircleCollider2D> ();
    //      StartCoroutine (ColorSwitcher ());
    InitialTasks ();
}

private void InitialTasks ()
{
    isAlive = true;
    GameManager.Instance.IsPlayerWin = false;
    int selectedTheme = Random.Range (0, ballSprites.Length);
    spriteRenderer.sprite = ballSprites [selectedTheme];
    trailRenderer.material = trailMaterials [selectedTheme];
    destroyParticleObj.GetComponent<ParticleSystemRenderer> ().material = trailMaterials [selectedTheme];

    hidePlayerName += OnTouchHidePlayerName;

    if (!isLocalPlayer) {
        // remote player
        gameObject.tag = GameConstants.TAG_REMOTE_PLAYER;
    } else {
        // local player
        Debug.Log ("locally set player name: " + DataCollection.localPlayer.PlayerName);
        playerNameText.text = DataCollection.localPlayer.PlayerName;
//      StartCoroutine (SomeDelayForSendingPlayerDetails ());
    }

//  if (isServer)
//      RpcSetRemotePlayerName (DataCollection.localPlayer.PlayerName);
//  else
//      CmdSetRemotePlayerName (DataCollection.localPlayer.PlayerName);
}

public override void OnStartLocalPlayer ()
{
    base.OnStartLocalPlayer ();
    CmdSetRemotePlayerName (DataCollection.localPlayer.PlayerName);
}

[ClientRpc]
private void RpcSetRemotePlayerName (string remotePlayerName)
{
    playerNameText.text = remotePlayerName;
    Debug.Log ("rpc remote player name: " + remotePlayerName);
}

[Command]
private void CmdSetRemotePlayerName (string remotePlayerName)
{
    RpcSetRemotePlayerName (remotePlayerName);
    Debug.Log ("cmd remote player name: " + remotePlayerName);
}

Basically I want to interchange names of both players in 2 players multiplayer game. So please give me some advice into this.

sentences:
nodejs game server timer I'm new to game server develop.
I'm developing a card game server.
How could I make nodejs server wait for few seconds then push data to client after an event fired ?
Example : in poker game, one player have about 20 seconds to make a move, after 20 seconds server will auto fold and then push a message to another player. How could I make server wait for 20 seconds and then do next action ?

sentences:
Ideal draw order - sort primarily by distance or material? When it comes to pre-sorting the draw calls for a given frame, I am aware of two different methods for optimising.

The first is to batch draw calls by their material. This minimises shader changes and limits the number of times constant buffers, textures, and other data need to be switched or updated also. Furthermore, this approach leads to easy multithreaded commandlist generation (important in the coming era of DX12 and Vulkan!), each thread can build a list of draw calls for each material independently.

However, one major source of framerate slowdown is 'overdraw'- i.e. drawing partially or fully obscured geometry BEFORE drawing the geometry that obscures it. When drawing roughly front-to-back the fragment shader has to do far less work because obscured pixels can be depth culled.

However, in order to sort geometry front-to-back, it is not really possible or practical to also try and sort draw calls by material (or is it?). Therefore, I ask, which of the two approaches is the 'better' (in terms of performance or general adoption); or is there a third or hybrid approach I am unaware of?

sentences:
Unity Mesh collider not working with capsule collider I have in my Unity3d Project a capsule that represents a character and has a Rigidbody and capsule collider as components, and in my project I also have a mesh that is my terrain imported as fbx from blender.
I put a mesh collider to the terrain but the capsule goes trough the terrain as it had no colliders. Curiously, if I put a cube with a mesh or box collider, the cube does collide properly. Changing the Is Convex box in the mesh collider doesn't change anything
Any ideas?

EDIT
This is how the editor window for both, the capsule and terrain looks like:
Terrain

Capsule

sentences:
Speed seems random with constant impulse I'm shooting an object from the top vertex of a triangle using Box2dWeb. The issue I'm having is that the projectile speed seems to be fairly random, even with applyimpulse set to a constant. The gravity is set to zero.

I thought it could be the physics step, changing these settings hasn't made a difference. The projectile will shoot out at very very fast speeds, then it will shoot out at its defined speed.

bodyman[0].GetBody().ApplyForce(
    bodyman[0].GetBody().GetWorldVector(new b2Vec2(0,-50)),
    bodyman[0].GetBody().GetWorldCenter());

sentences:
How to create a trail like this in Unity? I want to create a trail like this game...

When the plane flies it creates this trail...

It's possible because the game itself was made in Unity...

But I can't find any options to do so...

Any help would be much appreciated...

sentences:
Sprites not being rendered on screen change - Android Libgdx In my game over screen for my Libgdx Android game I've the following code which starts a new game upon a screen touch.

       if(Gdx.input.isTouched()) {
        ScreenManager.setScreen(new GameScreen());
    }

A new game starts but none of the sprites are displayed on screen.

I've confirmed that a new game has started through logging and through use of the debugger. Also the game over screen eventually reappears after some time due to the player dying.

What's interesting is that if I hit the home button or bring up the running apps menu in Android and re-enter the app, the sprites display fine.

Both my GameOver screen and Game screen are classes which implement a Screen interface

Anyone have an idea of what could be causing the sprites not to display?

Here is my ScreenManager class which can either set or get the screen.

public class ScreenManager {

private static Screen currentScreen;

public static void setScreen(Screen screen) {
    if (currentScreen != null) {
        currentScreen.dispose();
    }
        currentScreen = screen;
        currentScreen.create();

}

public static Screen getCurrentScreen() {
    return currentScreen;
}

}

sentences:
Board-Game RPG Combat System I am currently working on creating a board-game together with some friends of mine. The game is focussed on gathering resources around the map and buying stronger items with the money you can get by selling said resources.

To make the game a bit more interesting for multiple players, so that they don't just play their own game by themselves, we want to implement a combat system that can help players to get resources from other players by fighting them. This fight should be able to have 3 possible outcomes:

The player that challenged the other player wins:
In this case the winning player is able to select one resource from the losing player.
The player that challenged the other player loses:
Same as above.
Draw, both players 'lose':
Nothing happens.

As you can see this is not too complicated so far, but we are stuck at finding a way to make this combat system more than just "I have the better weapon, I can win against all of you".

Every player has 2 combat item slots, for weapon and armor, each posessing an ATK and a DEF value, representing the items attack and defence.

The way we are currently determining which player wins is by following this procedure:

We compare the total ATK value of the attacking player with the total DEF value of the player being attacked. If it is higher, the attacking player wins.
If that is not the case, the total ATK value of the player that was attacked beforehand is compared to the total DEF value of the player that attacked before. If it is higher, the player that was challenged to the fight wins.
If none of the upper cases are met, the battle results in a draw.

Our problem is that when we tested the game with a few people, fights were almost not used, because the players were still primarily focusing on gathering their resources.

In a game of 30 turns and 4 players we had a total of 5 battles, 3 of them by the player that got a strong weapon at the start of the game by luck and won every fight easily.

After the game, we asked the players why they were not using the fighting mechanic, since it is supposed to put you ahead and the other players behind. They answered that they couldn't keep track of whether the player they would have challenged would be stronger than them or not, which was too great of a risk for them.

Is this combat system basically designed badly, or is there a way to improve it slightly to make it more appealing for the players?

sentences:
How does Unity's QualitySettings.masterTextureLimit work? I'm trying to get to the bottom of how masterTextureLimit works, but my results have been inconsistent so far.

I created a massive sprite (8192x8192), and I'd like to resize it at runtime to save performance. The idea is to start with large sprites and then resize based on the monitor's resolution. Here's what happens at different settings:

Texture import size 8192, masterTextureLimit 0, mipmaps off: ~2ms
Texture import size 8192, masterTextureLimit 0, mipmaps on: ~1.5ms
Texture import size 8192, masterTextureLimit 1, mipmaps on: ~1.5ms
Texture import size 4096, masterTextureLimit 0, mipmaps off: ~0.9ms
Texture import size 4096, masterTextureLimit 0, mipmaps on: ~0.9ms
Texture import size 4096, masterTextureLimit 1, mipmaps on: ~0.83ms

Looking at these results, I have a couple of questions:

If masterTextureLimit is supposed to halve the texture resolution, why did it not affect performance while setting texture size to 4096 did?
Why did turning mipmaps on improve performance at 8192 texture size but not at 4096? My camera is orthographic, and it's only 1 unit away from the sprite.

sentences:
Unity3d FullScreen Mode Vertical Aspect Ratio in WebGl My game has vertical aspect ratio and looks like this:

When I press full screen button

My game start to look like this:

I need to save aspect ratio of the game - how can I do that?

sentences:
How to use AttachComponentToComponent in C++? Anyone can explain why using the blueprint is more efficient in this case, I mean when I attach the hairs using blueprint, the hairs is welded with headsocket in editor and in play mode, but with C++ I don't know why only welded when playing the game... but in editor not welded. I can only think about the one thing that from where the BOOL condition comes in the AttachComponentToComponent node, I think this is responsible for this welding.
What I am trying to fix it: CODE:
//this must be in the constructor
     auto Material = ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("parrent material path"));

     void initSkeletalMesh()
     {

         if (Material.Object == nullptr) return;

         //create skin material
         SkinRef = GetMesh()->CreateDynamicMaterialInstance(0, Material.Object, NAME_None);

         GetMesh()->SetMaterialByName("Skin", SkinRef);

         //set master pose
         SKMShoes->SetMasterPoseComponent(GetMesh());

         //attach hair
         SKMHair->AttachTo(GetMesh(),TEXT("Head"), EAttachLocation::KeepWorldPosition, true);
     }

sentences:
What tools do professionals use to create pixel art with animations? I've been looking for the right tool for creating my own pixel art, but I've been having a few difficulties finding the right one.

What I've tried so far:

ProMotion NG - seems to have lots of features, but not sure how many of them are useful, or at least it's difficult for me to see how to use some of them (I only tried the Free version)
Aseprite - nice and simple, but doesn't do things like tile maps and more complicated brush modes
PyxelEdit - doesn't seem to do anything the other two wouldn't do as well, and lacks a shading tool

Then there's also Photoshop, but a lot of people seem to be using these editors made specifically for pixel art.

Is there some other program that I've missed? What do professionals at game studios use to create pixel art and its animations? When someone is creating an animation such as the one below, do they first draw the final version of the character? From what I've tried so far, changing the character after creating a bunch of frames is basically like starting over from scratch, and none of the tools seem to help with that.

sentences:
How to make a TCP Client Server in java over multiple Networks So I am trying to write server code for my game, and I am kinda running in a wall. I have seen oracles example for a server and client, but how do I allow it to connect to computers outside my network? Pretty much I'm trying to do the following

Client presses a key to move 1 unit to the left, the server receives the Client's input, checks if any modification is made, if there is send Client back to where they started.

The problem I have is how do I connect a Server and Client on separate internet connections?

sentences:
Is there any option other than Component Based for game architecture? Having read a lot recently on Component Based systems (for games), i find it hard to go back to my earlier state of mind.

If static object hierarchies fail to model "objects with a dynamic set of properties" then:

Why are they even used for in the first place? (in game dev and software engineering in general).
Is there any other option other than going Component Based to realize a more dynamic and flexible object model ?

sentences:
Can not access GUIText in instantiated prefab I have a prefab with the following component structure:

Block

Quad
RawImage
GUIText

When I instantiate it and try to access the GUIText, I get the output of 'null'.

Here is the code, I am using to access the GUIText:

public GameObject Block;

GameObject obj = Instantiate(Block, position, orientation) as GameObject;
GUIText myText = obj.GetComponent<GUIText>();
print(myText);

How do I fix this?

sentences:
Blending between many materials I am storing one material ID per vertex in my meshes. In the shader for the mesh, I have a texture array full of textures that the material ID can refer to. The fragment color is chosen using triplanar texturing. Unlike vertex colors, these material IDs cannot be blended.

For example, if a dirt texture had a material ID of 5, and a grass texture had a material ID of 1, fragments in between one vertex with material ID 5 and one with material ID 1 would potentially have a material ID between 2 and 4, which is not ideal. Another flaw with this method is the fact that there would be a hard transition in between materials, as the mix or lerp function in the shader is not used.

Is there a way to blend the textures of two neighboring vertices in the fragment shader? I can add additional per-vertex data if needed.

sentences:
Efficient parsing of text file to map I am creating a roguelike which will use an ASCII based tile set. There is a text file that represents the map (ie. walls, floor, items). I believe the next steps are to read this file in and use a 2D array to hold objects that represent each of the characters.

My question is, is there a more efficient way to parse through that file and create the object map without using one huge switch statement to create the proper object? If not, is there a better approach I can take overall?

sentences:
OpenGL ES 1.0 to OpenGL ES 2.0, I cant draw a square I am learning open GL ES 2.0 and I just made 1 easy game for 1.0

I am following tutorials but I cant understand this thing

In OpenGL ES 1.0 if I define a square that way:

private float[] vertices = { // Vertices for a face
0.0f, 0.0f, 0.2f, // 0. left-bottom-front
1.0f, 0.0f, 0.2f, // 1. right-bottom-front
0.0f, 1.0f, 0.2f, // 2. left-top-front
1.0f, 1.0f, 0.2f // 3. right-top-front
};

and draw it that way  it Works

public void draw(GL10 gl)
{

    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    gl.glBindTexture(GL10.GL_TEXTURE_2D,TextureLoader.TeclaBlancatextureIDs[0]);

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

but in OpenGL ES 2.0 if I do this that way( with the same vertex) it only write a triangle:

private void drawSuelo(Suelo suelo)
{
    // Pass in the position information
    suelo.mPositions.position(0);
    GLES20.glVertexAttribPointer(mPositionHandle, mPositionDataSize, GLES20.GL_FLOAT, false,
            0, suelo.mPositions);

    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // Pass in the color information
    suelo.mColors.position(0);
    GLES20.glVertexAttribPointer(mColorHandle, mColorDataSize, GLES20.GL_FLOAT, false,
            0, suelo.mColors);

    GLES20.glEnableVertexAttribArray(mColorHandle);

    // Pass in the normal information
    cubo.mCubeNormals.position(0);
    GLES20.glVertexAttribPointer(mNormalHandle, mNormalDataSize, GLES20.GL_FLOAT, false,
            0, cubo.mCubeNormals);

    GLES20.glEnableVertexAttribArray(mNormalHandle);

    // This multiplies the view matrix by the model matrix, and stores the result in the MVP matrix
    // (which currently contains model * view).
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);

    // Pass in the modelview matrix.
    GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVPMatrix, 0);

    // This multiplies the modelview matrix by the projection matrix, and stores the result in the MVP matrix
    // (which now contains model * view * projection).
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    // Pass in the combined matrix.
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    // Pass in the light position in eye space.
    GLES20.glUniform3f(mLightPosHandle, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]);

    // Draw the cube.
    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);
}

It seems to need all of this vertex in order to draw a square

final float[] PositionData = {

// Top face
-1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, -1.0f };

Why is happening this? Why I am missing? Is there any way in Open GL ES 2.0 to write a square with 4 vertex?

sentences: How to add rotation to two particle collisions? I'm trying to make a particle system where when particles collide, they merge together, to get the new velocity vector the smaller particle's force is added to the larger one. However, this isn't exactly how I want it to work because when a small particle hits the edge of a large particle it shouldn't simply move in the direction it was hit. It should impart a rotational force, and that should be resisted by inertia. The further away from the center the more it should rotate the particle as opposed to pushing it. What is the physically accurate way to approach this problem?

sentences: Game uses gamecenter in iphone - can I design a fallback for 3G and prior devices? If I develop a game using gamecenter, does itunes connect lock me in to only supporting 3GS and above with iOS 4.0 and above, or will it still allow sales of my game on older devices (as long as I build in fallback so it never calls gamecenter framework)?

sentences:
procedurally combine a main character with weapons during animations I need to find a way to programmatically place weapons for main character in right position of his body.

For example if I am using UMA to procedurally create humans and then use some pre-existing models of guns (10-20) of them. Now I need to find a way to place them correctly in the hand positions of the human model. I will use mixamo or IK to apply animations on the human character.

But is there any way to programmatically place the objects in the right positions? Probably by marking some joints?

I am looking at some efficient approach to begin with on this.

sentences:
How to make a character in a Box2D world jump faster? I have a question about using Box2D to simulate a physics-platformer.
I manage to make the character move to the right and left, and jumping as well. However, jumping seems extremely slow when compared to most tile-based platformers.

Is there a way to speed up the jumping  and falling of the player? I of course know from my basic physics lessons that 'heavier' objects don't fall faster in the real world, but is there a way to simulate this in Box2D?

sentences:
World space coords for 2d images How can I make an 2d image using World space coords with a shape? Like a circle instead of a quad.In 3d you can modify the vertices but if I want a smooth circle there will be too much vertices. What I want to achieve is something like a cirle mask that will be move over the global texture at runtime.
So has anyone done something similar?
I've tried combining some shaders with two uv's one for world space and one for alpha uv mesh but it gives some weird artifacts.

This is the how the shader looks on the right:

Shader "Unlit/WorldspaceTiling"
 {
     Properties
     {
         _MainTex ("Texture", 2D) = "white" {}

 }
 SubShader
 {
      Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
 LOD 100

 ZWrite Off
 Blend SrcAlpha OneMinusSrcAlpha
 Cull Off
     Lighting Off
     ZWrite Off
     Fog{ Mode Off }
     Pass
     {
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #include "UnityCG.cginc"

         struct appdata
         {
             float4 vertex : POSITION;
             float2 uv : TEXCOORD0;
         };

         struct v2f
         {
             float2 uv : TEXCOORD0;
             float4 vertex : SV_POSITION;
         };

         sampler2D _MainTex;
         float4 _MainTex_ST;

         v2f vert (appdata v)
         {
             v2f o;
             o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);

             // Gets the xy position of the vertex in worldspace.
             float2 worldXY = mul(_Object2World, v.vertex).xy;
             // Use the worldspace coords instead of the mesh's UVs.
             o.uv = TRANSFORM_TEX(worldXY, _MainTex);

             return o;
         }

         fixed4 frag (v2f i) : SV_Target
         {
             fixed4 col = tex2D(_MainTex, i.uv);
             return col;
         }
         ENDCG
     }
 }

}

sentences: Optimized rendering of a cube mesh world I want to render a cube-mesh (a.k.a. Minecraft-style) world. If I render each existing cube it will eat up FPS pretty quickly. How can I optimize it? I understand that the point is to not render invisible meshes (faces?) but my problem is to find out what is invisible and what isn't.

sentences:
Subdividing a polygon into boxes of varying size I would like to be pointed to information / resources for creating algorithms like the one illustrated on this blog, which is a subdivision of a polygon (in my case a voronoi cell) into several boxes of varying size:

http://procworld.blogspot.nl/2011/07/city-lots.html

In the comments a paper by among others the author of the blog can be found, however the only formula listed is about candidate location suitability:

http://www.groenewegen.de/delft/thesis-final/ProceduralCityLayoutGeneration-Preprint.pdf

Any language will do, but if examples can be given Javascript is preferred (as it is the language i am currently working with)

A similar question is this one: What is an efficient packing algorithm for packing rectangles into a polygon?

sentences:
OpenGL/SDL2 How to resize the render area with the window? After calling SDL_SetWindowSize, the area being rendered to doesn't change with the window, so if the window gets bigger, it leaves a black area on the top and right sides.  I am adjusting the OpenGL viewport to the new window dimentions.  Everything I'm drawing scales correctly but is cut off when the window is bigger.

I've been searching for the solution all day and all I've found is creating a new OpenGL context, but that causes crashes unless I reload all my graphics data which seems ridiculous just to resize the window.

Is it the default framebuffer that needs to be resized?  According to the OpenGL wiki,

  All default framebuffer images are automatically resized to the size of the output window, as it is resized.

So if the default framebuffer is being resized, why is it only rendering to the same small area?

I could initialize it to the largest possible resolution and then shrink it, but wouldn't that cause OpenGL to process a bunch of fragments outside the window?

sentences:
Imitate a textured sphere in 2D I'm writing planet generator, using pico8. I got surface generation done:

And the last thing to do is to map the texture onto a sphere.
Pico8 has no triangle function. So my question is, how do I make a sphere in my 2d space, and how do I apply a texture on it?

Looking for an effect like this (with no lighting, of course!):

I have really bad knowledge of 3d space manipulations.
The full list of available API functions can be found here.

Update 4:

Solved!

Try it live here.

sentences: How can I edit a float that is in another script? (In C#) So basically, I have one script for the UI, which holds the float, score. Then I also have another script on my coin that detects when the player collides with it. What I want it to do is change the value of score, but I don't know how to change it, as it is in the UI script. How can I do this?

sentences:
unity 5.x performance After I downloaded unity 5, it became very power consuming. For example, my pc becomes hotter and makes a lot of noise. Also building, compiling, baking of game takes a lot of time. I am making a multiplayer game and need to build the game almost on every change, but it takes hours or sometimes it doesn't even build the game. There are also bugs with directional light, it doesn't work. So yeah, any suggestions?

My internal PC specs: Intel core i3-3130M, 8gb of ram, video card: Intel R4000

I installed unity 5 after Windows 10 came out, maybe it's something with the OS? Also yesterday, I updated Unity but with the same problems.

Also here are some screens:

Directional light is turned off but everything except models is dark, i mean terrain is black.

Also this baking process is more than one hour and stays on 5/11 clustering | 41 jobs

sentences:
Java getResourceAsStream as local resource Before using LWJGL, I used the Graphic method, and there I displayed imageicons, and I had the picture file located in the resources.
I used:

ImageIcon tcard = new ImageIcon(this.getClass().getResource("RCA.png"));

to load the image.

Now when I load textures in LWJGL, I have to use absolute paths to locate the file:

tcard = TextureLoader.getTexture("PNG",  ResourceLoader.getResourceAsStream("C:/RCA.png"));

I tried Googling, but I didn't find anything helpful. How can I load the image from the local resources like in the first example?

sentences:
(C++, DirectX 11, UWP) - How do I update the ByteWidth of a VertexBuffer without recreating it? I want to have one buffer used for all dynamic properties but the amount of vertices in this could vary from just a few for an interface to the whole scene. As such if it's becomes initialized with only let's say the below.

offset = 120; //example situation.
bd.ByteWidth = sizeof(VertexPositionColorTexture) * offset;

The above is 120 vertices, but if let's say the next time when I go to update. I need 160 vertices the buffer will only have space for 120 and will do one of the following.

Crash with an access exception.
Draw but it'll be missing those 40 excess vertices.

I update the Vertex Buffer by doing the following:

D3D11_MAPPED_SUBRESOURCE resource;
ZeroMemory(&resource, sizeof(D3D11_MAPPED_SUBRESOURCE));

Engine::context->Map(dynamic_interfaces_buffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);

memcpy(resource.pData, &vertsToDraw, sizeof(VertexPositionColorTexture) * offset);

Engine::context->Unmap(dynamic_interfaces_buffer.Get(), 0);

The "offset" value changes with what ever data ends up being present. I update the existing "vertsToDraw" data as needed.

So if the title didn't make sense. I'm looking to edit the ByteWidth value that what stored in the ByteWidth of the description when the buffer was originally created. My only solution so far was to set the buffer to the maximum size I feel I would ever need then set the VertsToDraw array size to that same value. However then when I update I only update with the needed amount. I'm not sure if that causes a performance issue by having a buffer with a byteWidth of "32 Bytes" * "36,000 Vertices". When in many cases I might only use a few 1000 or less.

Another thought I had if the above is the only way was to create multiple buffer of various sizes and use which ever one fits the situation the best.

E.g. if it's 3828 vertices use a 4000 pre defined vertices buffer or if it's 18348 vertices use a 19000 pre defined buffer.

But i'm up for any solution if there's a better way to go about this i'm a bit new to DirectX.

sentences:
Where can I find a good tutorial to replicate Game Maker's surfaces and blend modes in XNA? I know Game Maker's surfaces exist in XNA (It's more the othe way around, XNA's surfaces exist in Game Maker), same thing for blend modes, since (I think) they both use DirectX.

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

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

Background

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

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

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

In the end, I chose to focus on XNA.

sentences:
How to create realism similar to scenes rendered in Vray? I am tasked to make a game which requires very realistic interior scenes. Unity's bedroom demo(http://blogs.unity3d.com/2015/11/10/bedroom-demo-archviz-with-ssrr/) really caught my eye. See I know how to code but I am not good at modelling in 3DS. I see some amazing images only generated in 3DS using vray. But those are static images and the moment the same models are imported into Unity, they end up looking unrealistic. But somehow in the demo, Unity managed to create a very realistic looking scene. So here are my questions :

How do I create realistic game scenes like the ones rendered by vray in 3DS Max? Is it possible to bake the image rendered by vray into a UV map? I couldnt find how to do this.
Also, pls refer to the image in this link, from evermotion http://www.evermotion.org/files/tutorials_content/uploads/nr_AI44_002_cam_001_pp_051.jpg and also this image : http://www.evermotion.org/files/tutorials_content/uploads/nr_ae44s02__0041_Layer_2_022.jpg. The second pic is very unrealistic but the first pic after vray rendering looks amazing. I am sure the bedroom demo assets looked the same and assuming the answer to my first question is it cannot be done, then how do I go about creating the same level of realism as in the first pic?

Guys this is a really long question and might not be clear. So sorry, tried to describe it the best I can. Appreciate any answer, tips or advice. Thanks guys

sentences:
Draw a texture2D at specific coordinates on another Texture2D I have a ShipTexture and a Sail Texture. I need to draw the sail texture at a specific location on the shipTexture (call it the sailMountPoint) regardless of the location vector associated with the ship. I.e. the sail should be mounted to the ship and move with it.

I have tried various methods calculating the offset from the vector2 location coordinates of the shipTexture, but am not really coming close. I have also put a color indicator (in the rgba data) in the texture where the sail mount is on the ship texture. During some pre-processing, I then calculated the offset from this position.

Something like the following:

    public class SailMountTextureCoordinates
{
    public static Dictionary<string, Dictionary<int, Tuple<int, int>>> SailMountCords = new Dictionary<string, Dictionary<int, Tuple<int, int>>>();
}

Preprocessing:

public Tuple<int, int> GetSailMountCords(Texture2D texture, int rows, int cols, string key)
        {
            Color[,] Colors = TextureUtility.TextureTo2DArray(texture);

            for (int r = 0; r < rows; r++)
            {
                for (int c = 0; c < cols; c++)
                {
                    // target frame on the texture
                    int width = texture.Width / cols;
                    int height = texture.Height / rows;
                    int X = width * c;
                    int Y = height * r;

                    for (int a = X; a < X + width; a++)
                    {
                        for (int b = Y; b < Y + height; b++)
                        {
                            //If we find a the red sail mount color
                                if (Colors[a, b].R == 255 && Colors[a, b].G == 45 && Colors[a, b].B == 0 && Colors[a, b].A == 255)
                            {
                                if (!SailMountTextureCoordinates.SailMountCords.ContainsKey(key))
                                    SailMountTextureCoordinates.SailMountCords.Add(key, new Dictionary<int, Tuple<int, int>>());
                                SailMountTextureCoordinates.SailMountCords[key][r] = new Tuple<int, int>(a-X, b-Y);
                            }
                        }
                    }
                }
            }
            return null;
        }

Mounting the sail:

        // set the sail location here (equal to ship location plus the offset on the texture to hit the mount)
        float offsetX = (0.5f * (float)(_texture.Width / nColumns));
        float offsetY = (0.5f * (float)(_texture.Height / nRows));
        shipSail.location.X = location.X - offsetX + SailMountTextureCoordinates.SailMountCords[bbKey][currRowFrame].Item1;
        shipSail.location.Y = location.Y - offsetY + SailMountTextureCoordinates.SailMountCords[bbKey][currRowFrame].Item2;

It is worth noting that I am using a large sprite sheet for both textures, then setting the source rectangle for the correct ship and sail frame.

Are there any easier ways to do this in monogame/XNA? So far I've had no luck with this route.

sentences:
Detect collision point I'm writing a 3D rigid body physics engine, I am using OpenGl for simulation.

Only convex objects are considered.

My question involves how to detect the point of collision, so that when I apply a response force, I can also calculate torque.

I have used SAT algorithm to detect collision according to this reference,

Everything seems to be work fine , But as i get SAT only gives for objects are they colliding? as well as by how much?, it does NOT give you a reference point at which to apply the response force (and thus calculate torque).

I have looked at

Resource 1

Resource 2

Resource 1

None of them seems to be an answer

sentences:
DirectX11 - AlphaBlending Rendering problem So.. I completed this tutorial on the following site rastertek.com/dx11tut12.html. The tutorial is all about rendering Text in an orthographic space. Basically just 2D rendering on DirectX 11.

Now that I finished i wanted to experiment with it. In the original tutorial he uses a Black background texture with the different letters in white, then he uses AlphaBlending to make the pipeline omit the background when drawing to the backbuffer saying that the alpha value for when the sample color is black is 0.

//Initializing the AlphaEnabledBlendingState
D3D11_BLEND_DESC blendStateDescription;
ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC));

blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f;
blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;

result = this->m_device->CreateBlendState(&blendStateDescription, &this->m_alphaEnableBlendingState);
if (FAILED(result))
{
    return false;
}

_

//Setting the AlphaEnabledBlendingState as the active AlphaBlendState
float blendFactor[4];

blendFactor[0] = 0.0f;
blendFactor[1] = 0.0f;
blendFactor[2] = 0.0f;
blendFactor[3] = 0.0f;

this->m_deviceContext->OMSetBlendState(this->m_alphaEnableBlendingState, blendFactor, 0xffffffff);

And the PixelShader I'm using to render the Text.

Texture2D shaderTexture;
SamplerState SampleType;

cbuffer PixelBuffer
{
    float4 pixelColor;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : TEXCOORD0;
};

float4 main(PixelInputType input) : SV_TARGET
{
    float4 color;

    color = shaderTexture.Sample(SampleType, input.tex);

    //If the color is black on the texture then treat this pixel as transparent
    if (color.r == 0.0f)
    {
        color.a = 0.0f;
    }
    //If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color
    else
    {
        color.a = 1.0f;
        color *= pixelColor;
    }

    return color;
}

This is the result

So i said, let's change the background of the texture to green, (0, 255, 0). So i did and changed the shader to look for a green color to set his alpha value to 0.

Looking for Green instead of black

//If the color is green on the texture then treat this pixel as transparent
if (color.r == 0.0f && color.g == 1.0f && color.b == 0.0f)
{
    color.a = 0.0f;
}

But the result is not what i expected. There's also the prove that the texture background is green.

This is the result

So, the question is... What am I doing wrong? what step am I skiping? I see that the color is totally transparent, as it should be.

Thank you for the time and help you can provide!

sentences:
Camera rotation (OpenGL) I am having trouble with a camera class I am trying to use in my program. When I change the camera_target of the gluLookAt call, my whole terrain is rotating instead of just the camera rotating like it should.

Here is some code from my render method:

camera->Place();

    ofSetColor(255, 255, 255, 255);

 //draw axis lines
 //x-axis
 glBegin(GL_LINES);
 glColor3f(1.0f,0.0f,0.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(100.0f, 0.0f,0.0f);
 glEnd();

 //y-axis
 glBegin(GL_LINES);
 glColor3f(0.0f,1.0f,0.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(0.0f, 100.0f,0.0f);
 glEnd();

 //z-axis
 glBegin(GL_LINES);
 glColor3f(0.0f,0.0f,1.0f);
 glVertex3f(0.0f,0.0f,0.0f);
 glVertex3f(0.0f, 0.0f,100.0f);
 glEnd();

 glColor3f(1,1,1);

 terrain->Draw();

And the rotate and place methods from my camera class:

void Camera::RotateCamera(float h, float v){
hRadians += h;
vRadians += v;

cam_target.y = cam_position.y+(float)(radius*sin(vRadians));
cam_target.x = cam_position.x+(float)(radius*cos(vRadians)*cos(hRadians));
cam_target.z = cam_position.z+(float)(radius*cos(vRadians)*sin(hRadians));

cam_up.x = cam_position.x-cam_target.x;
cam_up.y = ABS(cam_position.y+(float)(radius*sin(vRadians+PI/2))) ;
cam_up.z = cam_position.z-cam_target.z;
}

void Camera::Place() {
//position, camera target, up vector
gluLookAt(cam_position.x, cam_position.y, cam_position.z, cam_target.x, cam_target.y, cam_target.z, cam_up.x, cam_up.y, cam_up.z);
}

The problem is that the whole terrain is moving around the camera, whereas the camera should just be rotating.

Thanks for any help!

sentences:
anticheat architecture I have online game for which I wrote a simple external anticheat in c#, it checks my game's process modules and handles for suspicious activity. And so it works like this:

player starts launcher (anticheat) which then starts the game with
its pid as parameter
actual game (upon starting) reads that pid, locates anticheat
path using this pid and fetches md5 hash of my anticheat
If it doesn't match the game closes. Also if you close anticheat the
game closes too.

So theoretically there's no way user could exit anticheat without exiting the game except he could for instance suspend anticheat process and then its of no use. What simple thing I could do to prevent this from happening?
I was thinking - make a thread in the game that would check in a loop if anticheat process is suspended and exit if it is. Would that be a correct approach?

Is my architecture flawed or is it ok?

sentences:
How do i retrieve individual Tile Information from a tilebased procedural World fast? I am concerned about performance with my current setup; as I want to expand on it i need to figure out if I might need to change it.

Current Setup:
The Game/Prototype is similar to Dwarf Fortress or Rimworld. The world i have is tile based and procedural. It is made up of chunks(16x16). All chunks are connected not via coordinates but via pointers (chunk on the east, chunk in the north, chunk in the south and so on). Each chunk segment (or block/ tile) holds an entity(which can be the player, the human or a plant).
Lets say one Entity (for a example a human) walks towards the edge of the chunk and wants to know what is the tile next to him. Then i will have to look at min 8 tiles next to him. Due to the chunks only being accessible through neighbors, I have to always check wether the position relative to the entity is in a new chunk and how many chunks i have to iterate through to get to the position asked for. It is quiet the hassle and i can imagine it becomes a big performance problem once i want to do pathfinding.

Now some Questions:
How do games like Factorio handle this type of data gathering. In an Array i could easily figure out where to look. How do i retrieve individual Tile Information from a tilebased procedural World fast? Should i use coordinates or relative Positions(like i do now)?

sentences: How to save the 3D surface to bitmap in Flash 11 Stage3D I have been using Stage3D to create some 3D app in Flash. One of the items on my list is the ability to take a screen shot. Flash makes it easy to grab the stage content, but I can't find a way to grab the stage3D content. In DX I just used D3DXSaveSurfaceToFile. Anyone know of a way to do it in as3 and flash 11?

sentences:
Errors in Xcode using SDL I am using Lazy Foo's Production tutorials for making an SDL game in C in Xcode 6.1 - http://lazyfoo.net/tutorials/SDL/index.php#Hello%20SDL. I'm using Xcode 7 but I don't think they are very different.

In the second tutorial (http://lazyfoo.net/tutorials/SDL/02_getting_an_image_on_the_screen/index.php).
I cannot seem to compile properly without an error regarding one of the functions.

The function prototype:

//Frees media and shuts down SDL
void close();

Then the function declaration:

void close()
{
    //Deallocate surface
    SDL_FreeSurface( gHelloWorld );
    gHelloWorld = NULL;

    //Destroy window
    SDL_DestroyWindow( gWindow );
    gWindow = NULL;

    //Quit SDL subsystems
    SDL_Quit();
}

And then the function call at the end:

close();

I am getting these errors and am not quite sure how to fix them. Other solutions online are for problems that are not quite the same as mine.

SDL_Tutorial/SDL_Tutorial/using_image.c:28:6: Conflicting types for 'close'

SDL_Tutorial/SDL_Tutorial/using_image.c:28:6: Conflicting types for 'close'

SDL_Tutorial/SDL_Tutorial/using_image.c:127:5: Implicit declaration of function 'close' is invalid in C99

SDL_Tutorial/SDL_Tutorial/using_image.c:127:11: Too few arguments to function call, expected 1, have 0

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help would be much appreciated, as I am struggling to make progress with learning SDL game programming at the moment.

Thank you.

sentences:
In cocos2d's plist output, what are 'offset,' 'colorSourceRect,' and these other fields? <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>frames</key>
            <dict>
                <key>frame1.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{0,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>
                <key>frame2.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{96,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>

Above there is a part of a plist output in cocos2d format. each frame has own node, I do not know what is offset, sourceColorRect is. the first string node is the Rectangle of the current frame on sprite, but what are the "offset", "sourceColorRect" and "sourceSize"

sentences:
How do I force a game object to move along projectile trajectory, like in Angry Birds? I am a new Android game developer. I want to force my game object to move in a projectile trajectory, like in Angry Birds.Related example here
and my example You can see an example in the image.

I used jbox2d to write a little bit of code, but I don't know how to make it work. How do I force movement along a projectile trajectory?

My code is below:

    private static class ProjectileEquation {

        public float gravity;
        public Vector2 startVelocity = new Vector2();
        public Vector2 startPoint = new Vector2();

        public float yogx(float t) {
            return startPoint.x + t * startVelocity.x;
        }

        public float yogy(float t) {

            float u = (float) -4.97741939970554;
            float v = (float) 30.88079;
            float tt = 1/6f;
            float n = (u+v)/2*tt;

            return startPoint.y + n * t *startVelocity.y + 0.5f *(n*n+n)
                * t * t * gravity;
        }
    }

    private static class Controller {
        public float power = -66f;
        public float angle = 585f;
    }
}

 public float P2M(float xPixels) {
    return xPixels * metersPerPixel;
}

public float M2P(float xMetres) {
    return xMetres * pixelsPerMeter;
}

public float MaxHeight(){

     if (projectileEquation.startVelocity.y > 0){

            return projectileEquation.startPoint.y;
     }
        return projectileEquation.startPoint.y;
        }

public void Update() {
    projectileEquation.startVelocity.set(controller.power,controller.power);
    projectileEquation.startVelocity.rotate(controller.angle);
     //     bd = bodies;

}

    @Override
    protected void onDraw(Canvas c) {
        super.onDraw(c);

        MaxHeight();

        Update();

        float t = 0f;
        x = c.getWidth()/2;
        y = c.getHeight()-20;

        float timeSeparation = this.timeSeparation;

        for (int i = 0; i < trajectoryPointCount; i++) {

            float x = this.x +  projectileEquation.yogx(t);
            float y = this.y +  -projectileEquation.yogy(t);

            t += timeSeparation;

            if(A) {
                c.drawBitmap(bmp, x, y, null);
            }else if(B) {

                float bX = M2P(body.getPosition().x);
                float by = c.getHeight() - M2P(body.getPosition().y);
                body.setActive(true);

                c.drawCircle(bX, by, M2P(body.m_fixtureList.m_shape.m_radius), circlePaint);
            }
        }
    }

public class jbox2d {

    public float targetFps = 30.0f;
    public float timeStep = (1.0f / targetFps);
    private int interations = 2;
    public Body body;
    private World world;
    private BodyDef bodydef;

    public void Create(){

        Vec2 gravity = new Vec2(0,-10f);
        boolean doSleep = true;
        world = new World(gravity, doSleep);
    }

    public void addboll() {

        bodydef = new BodyDef();
        bodydef.type = BodyType.DYNAMIC;
        bodydef.allowSleep = true;

        bodydef.position.set(8.24f,10f);

        body = world.createBody(bodydef);
        body.setActive(false);
        float tt = 0f;

        Vec2 stx = new Vec2();
        Vec2 sty =new Vec2();

        for (int it = 0; it < 20; it++) {

            stx = M2P(projectileEquation.startVelocity.x);
            sty = M2P(projectileEquation.startVelocity.y);

            stx = M2P(projectileEquation.yogx(tt));
            sty = -M2P(projectileEquation.yogy(tt));

            body.setLinearVelocity(new Vec2(stx,sty));
            body.applyLinearImpulse(body.getLinearVelocity(), body.getWorldCenter());

            tt += timeSeparation;
        }

        CircleShape circle = new CircleShape();
        circle.m_radius = (float).42;

        FixtureDef fixturedef = new FixtureDef();
        fixturedef.density = 1.0f;
        fixturedef.restitution  = 0.9f;
        fixturedef.friction = 0.2f;
        fixturedef.shape = circle;
        body.createFixture(fixturedef);

    }

    public void update(){
        world.step(timeStep, interations, interations);
    }
}

sentences:
Texture-Mapping in Blender/XNA I have a simple Blender-Model (just a few faces). I want to add 2 Textures. (a special face should get Texture 1, the other faces Texture 2). This model I want to use in XNA.

The first Texture should be replaceable at Runtime by Code (the new image is generated based on user input).

So how do I best solve this: Using UV-Maps or Normal-based Maps in Blender? How can I access the Blender UV-Mapping in XNA? Or do I completely perform the Texturing in XNA (using Code or shaders)? And how (I´m new to this)?

sentences:
Hardcode per-instance properties into the shader in unity I am using one of the packages from the asset store and using its Polyline feature for wire rendering. There are thousands of wires and its taking much fps/Batch counts. The reason of the lack of support for static batching. Now there is a workaround suggested by the author of the package.

if you don't use polylines for anything other than that, and all your
shaders use the same properties, you could hardcode all per-instance
properties into the shader

Due to a lack of shader knowledge(I am developing the knowledge currently and it will take time) I am unable to hard code the above properties: I tried and here is the current scenario:
#define int _ScaleMode = 1
#define half4 _Color = (0,0,0,0)
#define float4 _PointStart = (0,0,0,0)
#define float4 _PointEnd = (0,0,0,0)
#define half _Thickness = 0.5
#define int _ThicknessSpace = 1
#define half _DashSize = 1
#define half _DashOffset =1
#define int _Alignment =1

HOw do i correctly hard code above values?

sentences: save player achievements in local device As  an indie developer with zero dollar budget for servers and backend i wonder if there are ways to store the player achievements on his mobile device ?

sentences:
Maintaining facing direction at the end of a movement I want to make my 2D top-down walking animation stop and revert to the idle animation while continuing to face in the same direction as the previous movement.
For example, when I go up then stop, my character should continue to look up. If I go down, it should continue to look down.
I use lastmoveX and lastmoveY floats for idle and for walking I use moveX and moveY floats. moveX and moveY change when I move with the joystick, but lastmoveX and lastmoveY do not change, and I don't know how to fix this.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D myRB;
    private Animator myAnim;
    public Joystick joystick;
    public MoveByTouch controller;

    [SerializeField]
    private float speed;

    // Use this for initialization
    void Start ()
    {
        myRB = GetComponent<Rigidbody2D>();
        myAnim = GetComponent<Animator>();

    }

    // Update is called once per frame
    void Update ()
    {
        myRB.velocity = new Vector2(joystick.Horizontal, joystick.Vertical) * speed * Time.deltaTime;

        myAnim.SetFloat("moveX", myRB.velocity.x);
        myAnim.SetFloat("moveY", myRB.velocity.y);

        if(joystick.Horizontal == 1 || joystick.Horizontal == -1 || joystick.Vertical == 1 || joystick.Vertical == -1)
        {
            myAnim.SetFloat("lastMoveX", joystick.Horizontal);
            myAnim.SetFloat("lastMoveY", joystick.Vertical);
        }

    }
}

sentences:
Lights shining through walls I'm currently having a problem with lights in Unity. They shine through walls for some reason.

Point, directional, etc. If a light is next to a wall on one side, you can see it on the floor on the other side. I believe this has something to do with culling masks or light culling.

I was wondering how I could go about culling the lights so they no longer shine through walls. Any help is greatly appreciated.

I'm on Unity 4.x Pro, so I have all the features for that.

Here's a picture of a light on one side of the wall:

And here's it shining through to the other side, which it's not supposed to do:

sentences:
Separating logic and data in browser game I've been thinking this over for days and I'm still not sure what to do. I'm trying to refactor a combat system in PHP (...sorry.) Here's what exists so far:

There are two (so far) types of entities that can participate in combat. Let's just call them players and NPCs. Their data is already written pretty well.
When involved in combat, these entities are wrapped with another object in the DB called a Combatant, which gives them information about the particular fight. They can be involved in multiple combats at once.
I'm trying to write the logic engine for combat by having combatants injected into it.
I want to be able to mock everything for testing.

In order to separate logic and data, I want to have two interfaces / base classes, one being ICombatantData and the other ICombatantLogic. The two implementers of data will be one for the real objects stored in the database, and the other for my mock objects.

I'm now running into uncertainties with designing the logic side of things. I can have one implementer for each of players and NPCs, but then I have an issue. A combatant needs to be able to return the entity that it wraps. Should this getter method be part of logic or data? I feel strongly that it should be in data, because the logic part is used for executing combat, and won't be available if someone is just looking up information about an upcoming fight. But the data classes only separate mock from DB, not player from NPC. If I try having two child classes of the DB data implementer, one for each entity type, then how do I architect that while keeping my mocks in the loop? Do I need some third interface like IEntityProvider that I inject into the data classes?

Also with some of the ideas I've been considering, I feel like I'll have to put checks in place to make sure you don't mismatch things, like making the logic for an NPC accidentally wrap the data for a player. Does that make any sense? Is that a situation that would even be possible if the architecture is correct, or would the right design prohibit that completely so I don't need to check for it?

If someone could help me just layout a class diagram or something for this it would help me a lot. Thanks.

edit

Also useful to note, the mock data class doesn't really need the Entity, since I'll just be specifying all the parameters like combat stats directly instead. So maybe that will affect the correct design.

sentences:
How to apply a script to multiple Objects in Unity? In Unity, I've almost 200 or more objects. I wish to apply single script to all those objects.

I'm a beginner & learning scripts in Unity.

Edit: At the time of editing the scene itself.

sentences: Rotate relative to set point in a specified direction in a 3D space I know there's a geometry formula to calculate the next point in rotation relative to another point in 2D but I'm working in 3D and I want to calculate the next position in specified direction as well. Think Spiderman or the Bloodstalkers from ARK. I'm working in a game engine that uses the basic {x = 1, y = 2, z = 1} for vectors. I'm pretty bad at math so I honestly can't figure this out myself.

sentences:
Rotation around arbitrary vector (using quaternions?) I currently have a camera which orbits a specific target object, always looking at it.
The user can drag the mouse to move the camera left/right/up/down and the camera will move over the surface of a sphere of fixed radius (note, I clamp the vertical angle to ± 89°).
Currently it looks something like this...
// Store position of camera for future reference
private Vector2 rotation = new Vector2(120, 25);

// Was intended to be the vector from planet to target. Only works with `up`
private rotationalPole = Vector3.up;

if (isDragging) {
    rotation += new Vector2(
        Input.GetAxis("Mouse X") * xSpeed * radius * 0.02f,
        -Input.GetAxis("Mouse Y") * ySpeed * 0.02f);

}

//target is the GameObject to center on...

var pos = target.transform.position;

camObj.transform.position = pos + (Vector3.back * actualRadius);
camObj.transform.LookAt(pos, rotationalPole);
camObj.transform.RotateAround(pos, Vector3.right, rotation.y);
camObj.transform.RotateAround(pos, rotationalPole, rotation.x);

This works fine when up is in the y direction.
Now, however, instead of an object on the ground, the target is something in orbit around a planet (currently on an equatorial orbit but hopefully on an arbitrary one in future).
I want the camera to behave the same as before, but with up being the vector from the center of the planet through the target. Nominally forward will be the direction of orbit (but since the user can spin through 360 "horizontally", that's less important).
Currently it looks like this...

Basically, I'd like to rotate the image above counter-clockwise by 90° (which I believe I can do by playing with the camera transform's up and right vectors) but also that my arbitrary rotation honors the new orientation.
Some research shows that I need to use quaternions but while my mental model for basic trig is fine, I can't picture how to use quaternions correctly in this situation.
Following on from @Jon's answer below...
I've now got the following.
var planetToTarget = (target.transform.position - planet.transform.position).normalized;
// "Reset" the camera before I do any transforms
this.transform.position = target.transform.position - tgtMovement * actualRadius;
this.transform.up = Vector3.up;
this.transform.LookAt(target.transform.position);

var camToTarget = (transform.position - target.transform.position).normalized;
Debug.Log(string.Format("targetMotion = {0}, planetToTarget: {1}, camToTarget: {2}", tgtMovement, planetToTarget, camToTarget));

// Line that's not working...
this.transform.Rotate(camToTarget, -90);

// To be added in when the above is working...
//this.transform.Rotate(Vector3.Cross(camToTarget, planetToTarget), rotation.y);
//this.transform.Rotate(planetToTarget, rotation.x);
//this.transform.up = planetToTarget;

The uncommented code (excluding the last line) keeps the camera behind the target, looking forward...
Initially, I get :

targetMotion = (0.0, 0.0, -1.0), planetToTarget: (-1.0, 0.0, 0.0), camToTarget: (0.0, 0.0, 1.0)

Which generates:

However, as the target moves around the planet, it changes to:

targetMotion = (0.4, 0.0, -0.9), planetToTarget: (-0.9, 0.0, -0.4), camToTarget: (-0.4, 0.0, 0.9)

By which point, the camera is slewing to the side...

So I'm clearly still missing something. I don't appear to be rotating around camToTarget correctly?

sentences:
Fill closed object with water - maintaining volume I'm showing the problem in 2D, but basically given a volume V (can be approximate), where should the center point of an upwards facing plane P be for any given rotation of the object? I'm not doing a strict fluid simulation, it doesn't need to pool in isolated areas or slop around, it's just (I think) a volume preservation exercise.

To reiterate, V is known, P is what i'm trying to solve.

Do I need to voxelize the object and essentially count boxes from the lowest bounds up?

Edit: Here's the code based on Bálint's response. Note that I haven't tested it yet (you'd call the top function and the second one is iterative).

https://pastebin.com/N4Mimnwg

sentences:
GuiSan | SDL2 - Setting colour key of render target results in having an black screen At the moment i am experimenting with guisan within my little project. Everything is done sofar with SDL_Texture except Guisan which utilize SDL_Surfaces instead SDL_Texture for rendering itself.

Per sé this is absolutly fine. When guisan has finished rendering stuff on its SDL_Surface target I simply convert this Surface into an SDL_Texture or to be more precise I Update an pre-existing SDL_Texture and then Render this specific SDL_Texture. This works perfectly.

Till here everything is fine. I can interact with my GUI and the rest of my application. Then i thought at some point why not use an colour key (0xff00ff) to make the target of guisan transparent except for the parts it is drawing his stuff.

So i started calling:

 SDL_FillRect(guisanTarget,NULL,*0xff00ff*);

To Fill my Target with the colour key i am about to hide away, with this call:

SDL_SetColorKey(guisanTarget,SDL_TRUE,SDL_MapRGB(guisanTarget->format,0xff,0x00,0xff));

And here is where my problem occurs... if i try to set my colour key the result will be a black screen. No visible GUI to interact with. If I DO NOT set the colour key via SDL_SetColorKey then i get my GUI with the background colour i filled my Target via SDL_FillRect.

I have no clue why... If anyone has an idea what the reason for this behaviour is please let me know i would appreciate it a lot. see my issue

sentences:
Should I care about CPU affinity of threads? I am currently developing a rendering engine, which I plan to use for creating games. The engine makes heavy use of multithreading; I have a thread for OpenGL rendering, a thread for updating, a thread for processing user input, a thread for audio, etc. I have heavily tested it, and the threads work like clockwork. The multithreading approach has shown to be faster, more robust and flexible on a multicore processor, which I verified by profiling.

However, something which I have not considered is CPU-core affinity for threads. Should I care about it? What benefits does pinning threads provide, and to which CPU core do I pin which thread?

sentences:
Disable depth testing for only some faces I have some meshes and I need to be able to draw some part of them without depth test. Is it possible to turn off depth testing from within shader, wo that some parts will be rendered no matter what depth is in z-buffer ?

Or transform Z, W somehow to fake this ?

sentences: Calculating contact points with SAT After detecting a collision between two convex shapes by using separating axis theorem and calculating MTV. How can I calculate the contact points?(for applying torque to the rigid body).

sentences:
How to make a beam follow a path in xna I'm making a 2D shmup with XNA 4.0 and one of the weapons in the game that I want is a laser beam that follows a path or a series of points and will smoothly beam along the path.

How would I go about achieving this?

sentences:
Novice Mobile Game Developers | Publishing on our own or Publisher? So we are almost done with our first indie game, developed on Android. We believe that the game has potential, our graphics guy is damn good so we have some good eye candy in our game.

Now we are thinking what should be our starting step? We can purchase the Google Play account and launch it on our own, but we aren't sure if we'd be able to advertise it well and get something big out of it.

Or we can contact a publisher, and talk about some deal.

Which one is better? What are the pros and cons of both, considering this is only our first game and we intend to make a lot more. Also considering that we're only students yet, currently in our senior year. We would love to generate some revenue out of it.

What are the best ways of contacting publishers? How do we approach them and deal with them?

Many thanks for your kind help!

sentences:
How to implement a simple chat option for server-client based game (blender/BGE) I want 2 players to be able to chat with eachother. I have a running server-client game, but I'm kind of stuck on this one.

Since there are only outdated videos this is an example I need:

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

It's just a very simple chat method, but I don't know how to integrate my Python code into Blender.

sentences:
How to rotate to look at target I have found other questions like this, but none seem to quite cover the situation I have.

I am using DirectX 11

I have an object that has:

Position (vector)
Rotation (quaternion)
View angle (pitch, roll, yaw)

The view angle needs to be added to the rotation in order to know the true view rotation. You can think of view a head, and rotation as body.

I want to be able to turn the head so that it looks at a given point in space (vector)

The head needs to move slowly so I need to workout what way to turn and then move the head in that direction in small amounts. (pitch, yaw, roll) units

I have attempted to get this working but I don't even seem to be able to get close to what I need.

Thanks in advance.

sentences: How to change a background from a list of images on button click? I'm trying to create a button within the settings menu that allows you to change the image of a GameObject per click. So, let's say there are only 2 different images available to choose from and it starts with Image1, if you press the button it changes to Image2 and if you press again it goes back to Image1, like a loop. My issue is on how to write the script for this.

sentences:
Why is the player not showing up on UI when connecting to server? I want to create a playerList, that whenever a player joins server, his/her name will show up on a list in UI. But currently the names are only showing up on the Client + host side. Below is my NewtworkManager code. lobbyPlayerList is just a UI element with VerticalLayoutGroup. lobbyCharacter is just UI textElement with a networkBehavior script that sets the text field value and also has newtworkIdentity and networkTransformation.
  public struct PlayerInfo: NetworkMessage
{
    public string name;
}

public class LobbyManager : NetworkManager
{
    public GameObject lobbyCharacter;
    public GameObject lobbyPlayerList;
    // Start is called before the first frame update

    public override void OnStartServer()
    {
        base.OnStartServer();

        NetworkServer.RegisterHandler<PlayerInfo>(CreateLobbyCharacter);
    }

    public override void OnClientConnect(NetworkConnection conn)
    {
       // base.OnClientConnect(conn);

        PlayerInfo info = new PlayerInfo
        {
            name = "Test"
        };

        conn.Send(info);
    }

    private void CreateLobbyCharacter(NetworkConnection conn, PlayerInfo info)
    {
        GameObject gameobject = Instantiate(lobbyCharacter, lobbyPlayerList.transform);

        gameobject.GetComponent<LobbyCharacter>().SetText(info.name);

        NetworkServer.AddPlayerForConnection(conn, gameobject);
    }
}

sentences:
Projecting grid textures to select parts of the terrain (Unity) So I'm trying to be smart and not use 500+ some tile prefabs to make a grid, and so far the back-end portion has gone swimmingly. I initially used a dedicated mesh to represent the grid, but as I'm now opting for 3D terrain (and not tilemapping), I figured that was a lot of unnecessary vertices - especially if I want to have the grid conform to the terrain.

My shader inexperience, on the other hand, is causing me to stop and overthink this.

Using FE as inspiration, I'm thinking about projecting the transparent grid texture onto a base terrain layer.

If I wanted parts of the terrain to not be covered by the grid (such as the water area in the picture), would I simply use the world coordinates to tell the shader don't do anything there?

The most confusing part for me, however, is how to go about highlighting tiles. I want movement and attack tiles to also be 'painted' onto the terrain in specific colors, but obviously they only affect an even smaller portion than the terrain than the grid.

Would I simply be using the same shader to grab world coordinates once again and more or less start/stop overlaying the movement/attack texture over the grid/terrain? And if I'm really being efficient, those textures belong to the same png and I just use UV's to switch between them like a sprite sheet?
Is this even a good practice for shaders in the first place? Redrawing and adding textures to only parts of a material? Should I be redrawing and updating the whole texture instead?

I guess I get thrown off because I'm only familiar with a 1:1 mesh to material design, so the so the thought of a single mesh but multiple textures on discrete parts that may or may not overlap makes somewhat sense on paper -- but implementation in Unity is just above me atm.

Thanks!

sentences:
I have a problem rotating a 2D game object after collision I'm developing a simple flip game where a cube flips and the bar a it collides with should start rotating after collision. Most snips involve destroying an object, but that's not my case.

Here is my code:

using UnityEngine;

public class CheckI : MonoBehaviour
{
    float x;
    public Rigidbody2D rb2d;

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "bar")
        {
            x += Time.deltaTime * -10;
            transform.rotation = Quaternion.Euler(0, 0, x);
        }
    }
}

How do I start rotation after collision?

sentences:
Andengine onAreaTouched TouchEvent not working - ACTION_OUTSIDE & ACTION_CANCEL I have a simple problem. I have a button on the screen. I want isActionDown to push the button down, and isActionUp to push the button back up again and make my character jump. But the problem is if I push the button down and drag away from it, the button stays pushed down. I would like the button to push back up again if the user drags away from it.

How can I create the desired affect? isActionCancel doesn't seem to do the trick.

    private void addButton(){
goB = new AnimatedSprite(240, 364, ResourceManager.getInstance().go_region, vbom){
    @Override
    public boolean onAreaTouched(final TouchEvent event, final float x, final float y){

        if (event.isActionDown()){
            goB.animate(new long[]{ 250 }, new int[] { 1 }, true);
            /*if(event.isActionCancel()){
                goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            }*/
        }
        if (event.isActionUp()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            fresh = true;
            playerBody.applyLinearImpulse(new Vector2(0, 45), playerBody.getPosition());
        }

        if (event.isActionCancel() || event.isActionOutside()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
        }
        return true;
    }
};
goB.setScale(3);

registerTouchArea(goB);
attachChild(goB);

goB.animate(250);
}

I'm having the hardest time with this, and I've tried all sorts of variations of the code above. Please let me know if you have the solution.

Thanks for your help!

sentences:
How can I calculate a vertex normal for a hard edge? Here is a picture of a lovely polygon:

Circled is a vertex, and numbered are its adjacent faces.  I have calculated the normals of those faces as such (not yet normalized, 0-indexed):

Vertex 1 normal 0:   0.000000   0.000000    -0.250000
Vertex 1 normal 1:   0.000000   0.000000    -0.250000
Vertex 1 normal 2:  -0.250000   0.000000     0.000000
Vertex 1 normal 3:  -0.250000   0.000000     0.000000
Vertex 1 normal 4:   0.250000   0.000000     0.000000

What I'm wondering is, how can I determine, taken as given that I want this vertex to represent a hard edge, whether its normal should be the normal of 1/2 or 3/4?  My plan after I glanced at the sketch I used to put this together was "Ha!  I'll just use whichever two faces have the same normal!" and now I see that there are two sets of two faces for which this is true.

Is there a rule I can apply based on the face winding, angle of the adjacent edges, moon phase, coin flip, to consistently choose a normal direction for this box?

For the record, all of the other polygons I plan to use will have their normals dictated in Maya, but after encountering this problem, it made me really curious.

sentences:
Post processing texture sizes I'm trying to write some code to do post processing in OpenGL ES2 on the iPhone. All is fine an dandy, except I am having trouble working out how to scale the texture rendered in the rendering step, such that it ends up pixel-aligned to the final image displayed on the screen.

I'm using a 512x512 texture, as provided by Apple's Texture2D class, to store my off screen rendering, and then mapping that onto a quad and rendering to cover the whole screen. The thing ends up taking up half of the screen vertically, more than the width of the screen, and is positioned about 2/3rds of the way down.
Here's my setup:

        // Create render to texture targets
        for (int i = 0; i < 2; i++)
        {
            textures[i] = [[Texture2D alloc] initWithData:0
                                     pixelFormat:kTexture2DPixelFormat_RGBA8888
                                     pixelsWide:512
                                     pixelsHigh:512
                                     contentSize:CGSizeMake(512, 512)];

            // create framebuffer
            glGenFramebuffers(1, &textureFrameBuffers[i]);
            glBindFramebuffer(GL_FRAMEBUFFER, textureFrameBuffers[i]);

            // attach renderbuffer
            glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textures[i].name, 0);

            // unbind frame buffer
            glBindFramebuffer(GL_FRAMEBUFFER, 0);
        }
        // Setup our render to texture quad
        // Screen bounds are usually -1 to 1 on both axis, but we
        // multiply 'y' coords by (2.0/3.0) in the vertex shader so that we
        // get to use a square coordinate system that matches the screen ratio.
        float xSize = 1.0f;
        float ySize = 1.5f;
        quadPoints[0] = -xSize;
        quadPoints[1] = -ySize;
        quadPoints[2] = -xSize;
        quadPoints[3] = ySize;
        quadPoints[4] = xSize;
        quadPoints[5] = -ySize;
        quadPoints[6] = xSize;
        quadPoints[7] = ySize;

I'm doing ping pong rendering, hence the 2 offscreen targets. I've tried fiddling with xSize and ySize to make the thing stretch out beyond the bounds of the screen, such that the texture aligns properly, but can't seem to get it right.

To render with a single post processing step, I do

// Bind to first offscreen framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, textureFrameBuffers[0]);
glViewport(0, 0, backingWidth, backingHeight);

// Render scene

// Bind to the screen framebuffer, and render the previously generated texture through our
// post processing shaders.
GLuint currentProgram = [[postProcessPrograms objectAtIndex:i] intValue];
glUseProgram(currentProgram);
GLuint sourceTexture = (i % 2 == 0)? textures[0].name : textures[1].name;
// Render the texture
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glEnableVertexAttribArray(ATTRIB_VERTEX);
glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_FLOAT, 0, 0, quadPoints);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

// Show our buffer
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER];

Any help would be great - I feel like i'm missing something obvious!

sentences:
How to generate objects at specific intervals and make them move with same speed? I'm creating an infinite runner where character has to jump on randomly generated pillars.
The pillars are positioned with a gap between each of them. The gaps are dmin and dmax.
In addition to this, i want the pillars to move to the left of screen with increasing velocity. But they all need to move with same velocity so that the gap in between them is maintained.
I have the script as follows:
pillar is a prefab.go is an empty gameobject which will later be used to Instantiate pillars.
first is the first pillar, manually positioned in the scene.

using UnityEngine;
    using System.Collections;

    public class GM : MonoBehaviour {
        float tempx,dmin=1.3f,dmax=3.5f;
        GameObject[] bins;
        Vector2 speed,pos,tempvel;
        public GameObject pillar,go;
        public Transform first;

        // Use this for initialization
        void Start () {
            speed = new Vector2 (-0.005f,0);
            tempx = first.transform.position.x;
            tempvel = new Vector2 (0, 0);
        }

        void Update () {
            if ((Vector3.Distance (go.transform.position,transform.position)<40f)) {

                tempx+=Random.Range(dmin,dmax);

                pos=new Vector2(tempx,-2.22f);

                go=Instantiate(pillar,pos,Quaternion.identity) as GameObject;
            }

            bins = GameObject.FindGameObjectsWithTag("trash");

            tempvel += new Vector2 (-0.0005f, 0);
            foreach (GameObject bin in bins) {

                //bin.GetComponent<Rigidbody2D>().velocity+=new Vector2(Random.Range(-0.005f,-0.05f),0);

                bin.GetComponent<Rigidbody2D>().velocity+=tempvel;
            }

        }
    }

Problem is, the speed of pillars increases way too fast. They move to the left at nearly invisible speeds. Also, after a certain speed, the gap between the pillars increases. They become so far apart, one is in camera view, another is somewhere far away.

Is there a way to accomplish this?

sentences:
Should a Game include Multi-Monitor Support? I'm coding a 2D platformer in SDL2 and c++ and was wondering if there's an expectation for videogame's to support Multi-Monitor setups and if so, if it applies to 2D platformers.

As a bonus question too: Does the expectation of being able to change a game's resolution apply to 2D platformers? Thanks.

sentences:
Internal Game Economy I need to set up a monetary system for my game however I am unsure how to craft an internal economy for that money. I want to make an rpg with a economy system that keeps the player for a time from just selling numerous of the same item to grind for money. So when the player sells to much of a certain item the buy price for that item will go down temporarily. Also, I would like to add a system where certain items go up in terms of what they can be sold for temporarily as well.

For example, in "Story of Seasons" I can sell items to vendors in order to get money, however if I sell to much of that type of item the price I get for it goes down. Also, there is a system where for a certain vendor or more the price I can get for the items actually increases.

sentences:
How does one specify raster operations in XNA? I'm looking for a way to add a sprite using a particular logic operation (like XOR). I can't find anything on Google and I'm not sure where to look in the documentation.

I've looked into SpriteBatch.Begin(...) and its Draw method and several options in the GraphicsDevice class, but I'm not recognizing anything capable of this. I'm still pretty new to XNA so I may just not have recognized the terminology to do this.

sentences:
setting a time delay between two frame when animation a sprite sheet this is my jsfiddle :http://jsfiddle.net/Z7a5h/

As you can see the animation of the sprite sheet when the player is not moving is too fast so i was trying to make it slow by declaring two variable lastRenderTime: 0,RenderRate: 50000

but my code is not working and it seem i have a misunderstanding of the algorithm i am using so can anyone lay me a hand to how can i fix it ?

 if (!this.IsWaiting) {
                    this.IsWaiting = true;
                    this.Pos = 1 + (this.Pos + 1) % 3;

                }
                else {
                    var now = Date.now();
                    if (now - this.lastRenderTime < this.RenderRate) this.IsWaiting = false;
                    this.lastRenderTime = now;

                }

sentences:
How do I determine if one value is within a certain range of another in Python I've been working on the attacking in my RPG.
The problem I have recently encountered is, I have to be in Exactly the same x coordinate as the Enemy. When I want to attack the enemy this is what happens:

 ...

    elif event.key == pygame.K_SPACE:
                    attack = True

if attack == True:
    if enx == x: #this is the line my qeustion is about
        endead = True

attack = False # I put this in so attack doesn't stay true forever

...

if endead == False:
            screen.blit(Enemy, [enx, eny])

How do I make it work if the enemy's position (enx) is equal to within a certain number of pixels to the player's position (x)?

So if I'm close but not Exactly the same place it works

(I know this only takes the x coords into account I'll add y later)

sentences:
Unity - Duck volume of audio source inside a boxed area I'm trying to lower the volume of an outside ambient wind sound while the player is inside a building or room. Is there any way in Unity to do this without scripting? Or would I have to script this to check whether the player is in a certain collider to duck (or lowpass filter) the sound?

The room is seamlessly in the scene's outside environment.

Any ideas on this?

sentences:
Is there a way to drain durability from an item instead of a sword, for instance? I am modding Minecraft 1.8 using Eclipse with Forge, and I just wondered, is there a way to drain durability from a battery, for instance, instead of a piece of armor when hit.
I have tried things like getting an item from the player's inventory and attempting to reduce its durability, so that would be a possibility, however, I was unable to find a way to do so?

sentences:
Load/generate new resources on start up in MonoGame I've a question about loading resources at the beginning of my game written in MonoGame. I've several spritesheets which I'm loading at the beginning of the game. This take about 5-10 seconds on my computer but I've got some reports it takes up to a minute on other computers...that´s way too long.
The reason is not loading the Texture2Ds but writing new RenderTargets on Startup. I've some colored spritesheets where I generate a black/white version of it on startup. That costs the time.

Now to my question: I've tried to do this operation later in the game so the game starts more quickly and I tried to start the color-> black/white operation when the player creates a new game - that would be a perfect situation to do it. But I always got two different kind of errors:

1. Operation not called on UI thread

or

2. Cannot call Present when a render target is active

As you may have guessed I do the load operation in a separate thread so the UI doesn't get frozen. But the actual problem seems to be, that I can not do RenderTarget operations when I'm already doing SpriteBatch operations (Begin and End).

How can I solve the problem?

Would be happy for any kind of suggestion.

Yheeky

sentences:
What is the rationale behind this method of computing the w-component from MD5 mesh files? In tutorials regarding the MD5Mesh format, like this one, we often see code like

float t = 1.0f - (q.x * q.x) - (q.y * q.y) - (q.z * q.z);

if (t < 0.0f) {
   q.w = 0.0f;
} else {
   q.w = -sqrt (t);
}

for computing the w-component of a unit quaternion given x, y, z.
Why do we obtain w in this manner?

sentences:
Building Irregular terrain in tile-based approach I'm starting to build a 2D game, metroidvania-like, tile-based and all. I've had some prior experience in it, and one of the major letdowns of those prior games was that worlds seemed too "blockish", kinda inorganic, when they shouldn't (underground caverns aren't squarish at all). So, for this time, I'm trying to come up with a way to build a world just like Cave Story's:

It has some nice angles and feels way better than a purely tiled world.

As far as I know, SP built this world using AS2 back in 2002, when computers hadn't all the processing power they have today, so I think he haven't used any kind of heavy mask to do it. Talking with one of my teachers, he suggested the guy used raycasts to search for non-transparent pixels in rectangular tiles. Dunno if it's true, but I decided to get further help through here. I'd like some suggestions for a nice and soft approach to this kind of work, if possible.

sentences:
What language or platform is used to develop apps for Google+? Does anyone know what language or platform is used to develop apps for Google+?

I'm hoping Python, but I know google has a lot of other mediums they could use for this. I'm fine with hearsay as I know the game portion of google+ is pretty new.

sentences:
How do I set the Jump distance and height of my sprite in C# I have been able to make my sprite jump for a platformer I am making in unity. I can't seem to be able to make him jump a certain height or distance though, every time he jumps it's like he's jumping on the moon, any suggestions? Here's my code:

using UnityEngine;
using System.Collections;

public class playerScript : MonoBehaviour {
    public bool grounded = true;
    public float jumpPower = 190;
    public float jumpSpeed = 100f;

private bool hasJumped = false;

// Use this for initialization
void Start () {
}

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

    if(!grounded && GetComponent<Rigidbody2D>().velocity.y == 0) {
        grounded = true;
    }
    if (Input.GetKey(KeyCode.Space) && grounded == true) {
        hasJumped = true;
    }   GetComponent<Rigidbody2D>().AddForce(Vector3.up * jumpSpeed);
}

void FixedUpdate (){
    if(hasJumped){
        GetComponent<Rigidbody2D>().AddForce(transform.up*jumpPower);
        grounded = false;
        hasJumped = false;
    }
}

Any help would be greatly appreciated :)

sentences:
How should I determine direction from a phone's orientation & accelerometer? I have an Android application which moves a ball based on the orientation of the phone. I've been using the following code to extract the data - but how do I use it to determine what direction the ball should actually travel in?

public void onSensorChanged(int sensor, float[] values) {
    // TODO Auto-generated method stub
   synchronized (this) {
        Log.d("HIIIII :- ", "onSensorChanged: " + sensor + ", x: " + values[0] + ", y: " + values[1] + ", z: " + values[2]);
        if (sensor == SensorManager.SENSOR_ORIENTATION) {
            System.out.println("Orientation X: " + values[0]);
            System.out.println("Orientation Y: " + values[1]);
            System.out.println("Orientation Z: " + values[2]);
        }
        if (sensor == SensorManager.SENSOR_ACCELEROMETER) {
            System.out.println("Accel X: " + values[0]);
            System.out.println("Accel Y: " + values[1]);
            System.out.println("Accel Z: " + values[2]);
        }
    }
}

sentences:
how to improve sprite animations to reduce FPS My game has different, and detailed animations throughout the game. For example, the main character has an idle stance, so its not just painted still, giving him some life. Death animation, hurt animation, etc... even the background scenario has animations(which I don't think I went with the best approach here, but, it's working for now, this will be in another thread if not answered here)
Anyways, the thing is, while the main character had these animations only that character was in the game at that time, so everything ran smoothly. After adding another character, the enemy, the burden of animations seems to overcharge the FPS and just slows the game down. The most obvious of this problems was that the spritesheet I was using was 1 per character, I figured how to use spritebatchnode efficiently and now 1 spritebatchnode covers the 2 characters animation set.
The FPS tried to get back to normal, but its still laggy at times. This worries me because my game design has more enemies to the game, meaning that it will have this issue in a bigger scale.
So I believe that its because of my animation approach, its poor, and inefficient making my game run slow.

I have been trying to find the answer online with no luck, and I don't my approach is the best. I tried working some solutions by my own, but they end up in the same thing. THE ONLY, the only way I find how to reduce this problem is to make my sprites smaller, its not a big deal, but I wouldn't like this solution.

sentences:
Unity3D : Pause Menu - Android I am making a 2D game for Android. Almost completed the game but now I need a pause game option. I added a pause icon on the top right side of the screen. The icon is a GUI texture.
What I did so far :

I made a script which will bring up some buttons (which is not working) and attached it to the GUITexture.This is the script :

#pragma strict

function OnMouseDown() {
   Debug.Log("*Pause Menu Opens*");
   Time.timeScale = 0;

   if (GUI.Button(Rect(10,10,100,50),"Restart"));
      Application.LoadLevel(Application.loadedLevel);

   if (GUI.Button(Rect(10,60,100,50),"MainMenu"));
      Application.LoadLevel("MainMenu");
}

Now the problem stands at the part where the buttons won't show up and the game freezes at the first frame. Please if you can help I would be really thankful.

Edit #1 : I just noticed that when I click "Pause" the game freezes and it takes me to the MainMenu. That's because I added the GUIButton which takes you to the main menu. I think the whole script structure is wrong. I also forgot to mention that I am new to scripting/unity.

Thank you.

sentences:
How do I load a texture in OpenGL where the origin of the texture(0, 0) isn't in the bottom left? When loading a texture in OpenGL, how do I specify the origin of the data I am loading?

For example, how would I load a Targa that has it's origin at the top left instead of the bottom left of the image?

sentences:
How can I store tile maps as PNG images? I want to let players of my top-down game save, load and share worlds as PNG images. How do I read the colors in a PNG file or change them?

I imagine something like this:

BufferedImage mapImg = ImageLoader.loadImage(path);

// (then, later)

for(x = 0; x < mapImg.width; x++) {
    for(y = 0; y < mapImg.height; y++) {
        // Look up the color at this position
    }
}

Here is my ImageLoader class:

public class ImageLoader {

    public static BufferedImage loadImage(String path) {
            try {
                return ImageIO.read(ImageLoader.class.getResource(path));
            } catch (IOException e) {
                e.printStackTrace();
                 System.exit(1);
            }
            return null;
    }
}

sentences:
How can I repeat / scroll a tile which is part of an texture atlas? I would like to scroll a tile which is part of a texture atlas like it can be done with a single quad and texture wrap mode set to repeat.

Can this be done? I hope it's clear what I would like to achieve.

Here is my shader code which I use to sample tiles from my texture atlas, but I can't figure out how to do the wrapping so that one tile repeats itself over time.

uniform float time
void main() {
  float texId = textureId/32.0;
  vec2 tileOffset = vec2(fract(texId)*32.0,floor(texId));
  vec2 offset = invTileCount * tileOffset;
  vec2 texCord = fract(vUv) * invAtlasSize + offset;
  vec4 texelColor = texture2D( uTex, texCord );
}

sentences:
Java 2D Game Development - Best Performance With Rendering I have seen two different rendering methods. One of them is rendering multiple bufferedImages like g.drawImage(image1 to imagexxx, x, y). Like in my game I have to render, on each tick, 880 buffered images. This is very bad. I have a good computer but my max fps is 140. There should be another way to get better performance.

The second way is drawing one single bufferedImage and setting its pixels to RGB from the other bufferedImages.

What is the best way? Is there another way to get better performance?

sentences: For a 2D XNA game, should I use the built in Vector2 or Vector3 or port my own class from ActionScript? I use a lot of 2D vectors in my Flash games - basically all velocities, positions etc I store in this way. My Vector2D class has lots of built in functions for rotation, dotproduct, projectOnto etc. The native Vector2 class doesn't seem to have half of this stuff, but it is used in a lot of places. The Vector3 has all this stuff, but has an extra dimension I don't need. So should I use either of the built in ones or port my AS3 class? Or should I try to extend Vector2 and add the extra functionality I need. Could that cause any problems?

sentences: How can I get Unity to do letterbox/pillarbox to maintain aspect ratio? I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ratio.

sentences:
Calculate 8 different directional input based on arrow keys combinations Considering I have four variables event binded to each arrow key, that can be 0 or 1

My current approach to this issue is simply 8 nested ifs checking each combination or keys

Is there a more math-y clever way to solve this issue?

sentences:
HAA* / HPA* C++ Algorithm / Help so I have been working on implementing a form of HPA* but i'm really struggling to decide what to do next.

https://webdocs.cs.ualberta.ca/~mmueller/ps/hpastar.pdf <- here is the article.

There is pseudo-code but the notation is very hard for me to understand, but I struggle to read due to learning difficulties (visual snow / ADD) and I find the paper very difficult to understand, so I appreciate anyone willing to explain/ break it down to me in simpler language.

I have implemented my grid and seperated it into squares.
Example diagram - here is my guess, I haven't implemented exits and entrances yet, green terrain is normal, white terrain are roads which travellers will travel across quicker, brown is mountains inpassable unless meets a special condition, and there are boats but they will use a different algorithm, since im only implementing HPA* for ground units in the game ,and JPS for sea units as the sea grid is uniform without costs.

Lets say for sake of argument each pixel on that image is its own individual grid space.

Question 1. Do I have to resize the squares if water/mountains is involved- lets assume the water/mountains is a wall for the sake of the argument. (If so whats a good method?)

Question 2. Is there a general algorithm that can be used, I know the A* algorithm, but how do entrances and exits link to eachother ? (thinking quad tree)

Question 3. How do I reconstruct the squares dynamically if the map could change or be dynamic.

Question 4. how does one traverse across the map from higher representation to lower representation.

Assumptions, I'm assuming first we path-find across the squares as a whole, then work out individually the route inside it from one end to another yes?

Also if you know the location of a good HPA* library that would be also be nice.

sentences:
Store and create game objects at positions along terrain I have a circular character that rolls down terrain like that shown in the picture below.

The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and one screen width behind. So as the character moves, edges are created infront and edges are removed behind.

My problem is, I want to create box2d bodies at certain locations along the path and need a way to store these creator methods or objects.

I need some way to store a position at which they are created and some pointer to a function to create them, once the character is in range. I guess this would be an array of some sort that is checked each time the ground is updated and then if in range, the function is executed and removed from the array. But I'm not sure if its even possible to store pointers to functions with parameters included... any help is much appreciated!

sentences:
How can I reset the mouse axes when respawning a player? I am making a simple parkour game in which the camera will follow the mouse based on the mouse input axis * the sensitivity. This works great, but when I want to reset my character to the start I cant figure out how to reset the mouse axis to zero, thus preventing me from resetting the camera rotation. I have tried Input.ResetInputAxes();, but that seems to only reset the buttons.
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{

    public CharacterController characterController;
    public Transform Player, camera;
    public Camera cam;
    public float XSensitivity, YSensitivity;
    public bool grounded, jumping;
    public float forwardSpeed, horizontalSpeed, jumpPower, gravity, sprintModifier;

    [HideInInspector] public float sideSpeed, lastPlayerPosX, lastPlayerPosZ, jumpSpeed, verticalRotation, horizontalRotation;

    private float isSprinting = 1;

    void Update()
    {
        //This is where I get the axes
        float mouseX = Input.GetAxis("Mouse X"), mouseY = Input.GetAxis("Mouse Y");

        //This is how I rotate the player and camera
        verticalRotation += -mouseY * YSensitivity;
        Player.transform.localRotation = Quaternion.Euler(0, horizontalRotation, 0);
        horizontalRotation += mouseX * XSensitivity;
        cam.transform.localRotation = Quaternion.Euler(verticalRotation, horizontalRotation, 0);

        if (Input.GetMouseButtonDown(0))
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        float horizontal = Input.GetAxis("Horizontal"), forward = Input.GetAxis("Vertical");

        grounded = characterController.isGrounded;

        if (grounded)
        {
            if (Input.GetKey("left shift"))
            {
                isSprinting = sprintModifier;
            }
            if (Input.GetKey("left shift") == false)
            {
                isSprinting = 1f;
            }
            jumping = false;
            jumpSpeed = 0;
            sideSpeed = .75f;
        }
        else
            jumpSpeed -= (gravity * 25) * Time.deltaTime;

        if (Input.GetKey("space"))
        {
            sideSpeed = .25f;
        }
        if (Input.GetAxisRaw("Jump") != 0 && !jumping)
        {
            jumping = true;
            jumpSpeed = jumpPower;
        }

        lastPlayerPosX = Player.transform.position.x;

        lastPlayerPosZ = Player.transform.position.z;

        Vector3 motion = new Vector3(horizontal * horizontalSpeed * sideSpeed, jumpSpeed, forward * forwardSpeed * isSprinting);
        characterController.Move((Player.transform.rotation * motion) * Time.deltaTime);
    }

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.name == "deathbarrier")
        {
            //Resets player to starting position
            Player.transform.position = new Vector3(20.5f, -2, -22.5f);
            //Is supposed to reset all inputs (including mouse)
            Input.ResetInputAxes();
            //Sets camera rotation to 0, but only for one frame before the stored mouse axes change it
            camera.transform.rotation = Quaternion.Euler(0, 0, 0);
        }
    }
}

Thanks for any tips!

sentences:
Directional lights (not) rotating with camera (opposite problem) I am trying to implement a shader for directional lights correctly, but I am bit confused as to why it works when it shouldn't and vice versa.

People usually encounter problem with lights changing direction with camera. This is corrected by multiplying normals with model(view) matrix.

But my problem is opposite.

When I don't multiply normals with model(view) matrix then it works and when I try to use (supposedly) correct version it is having that "lights rotating with camera" problem.

Any ideas?

Working vertex shader:

#version 330
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoord;
layout (location = 2) in vec3 normal;

out vec2 texCoord0;
out vec3 normal0;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main()
{
    normal0 = normal;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

Fragment shader:

#version 330
in vec2 texCoord0;
in vec3 normal0;
out vec4 outColor;

struct BaseLight
{
    vec3 color;
    float intensity;
};

struct DirectionalLight
{
    BaseLight base;
    vec3 direction;
};

uniform vec3 baseColor;
uniform vec3 ambientLight;
uniform sampler2D sampler;
uniform DirectionalLight directionalLight;

vec4 calcLight(BaseLight base, vec3 direction, vec3 normal)
{
    float diffuseFactor = dot(normal, -direction);

    vec4 diffuseColor = vec4(0,0,0,0);

    if(diffuseFactor > 0)
    {
        diffuseColor = vec4(base.color, 1.0) * base.intensity * diffuseFactor;
    }

    return diffuseColor;
}

vec4 calcDirectionalLight(DirectionalLight directionalLight, vec3 normal)
{
    return calcLight(directionalLight.base, -directionalLight.direction, normal);
}

void main()
{
    vec4 totalLight = vec4(ambientLight,1);
    vec3 normal = normalize(normal0);
    totalLight += calcDirectionalLight(directionalLight, normal);
    outColor = texture(sampler, texCoord0.xy) * vec4(baseColor, 1) * totalLight;
}

Draw method:

glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);

glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex::SIZE* 4, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)12);
glVertexAttribPointer(2, 3, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)20);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glDrawElements(GL_TRIANGLES, size, GL_UNSIGNED_INT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);

Matices:

ViewTranslate = glm::mat4(1.0f);
 cam->control(windowHandle, 0.01, 0.3, true, &ViewTranslate);
 cam->updateCamera(&ViewTranslate);

glm::mat4 Projection =
    glm::perspective(70.0f, 800.0f / 600.0f, 0.1f, 10000.0f);
glm::mat4 view = glm::lookAt(
    glm::vec3(0, 0, 1),
    glm::vec3(0.0f, 0.0f, 0.0f),
    glm::vec3(0.0f, 1.0f, 0.0f)
    );

shader->bind();
shader->setUniform("model", glm::value_ptr(ViewTranslate));
shader->setUniform("view", glm::value_ptr(view));
shader->setUniform("proj", glm::value_ptr(Projection));
shader->setUniform("ambientLight", ambientLight);

Not working shader code:

void main()
{
    normal0 = (model * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (transpose(inverse(model * view)) * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

...

Any ideas how I should do this correctly?

sentences:
Should competitive multiplayer games be pusposefully inbalanced so they don't get boring? I've had a discussion on the internet about game balancement. Actually, this was a Pokemon fansite, and the discussion started from a simple observation that some pokemon are OP while others are outright bad.
Now I know that Pokemon is a peculiar game... Still, I believe, this topic can be easily generalized to almost any competitve multiplayer game.
Namely, most people were making the argument that while Pokemon gameplay is very inbalanced, it is a good thing, because a perfectly balanced gameplay is inherently boring and dull.
Let me try to quote some of their arguments, (redacting them so that they become more readable outside of chat):

It'd just turn into a game of "lets use my favourite pokemon yayayay". The only thing that would matter than would be type matchups. Or, if the tank/glass cannon diversity was retained, then a team full of tanks would always win.
Pokemon is inherently unbalanced and that's what makes it interesting IMO.
"Optimal" gameplay, for anything, always becomes boring. What's fun to see is to see niche pokemon and gimmicks. There will always be something better that what you say is the best.
You could just make every pokemon 100 across the board and identical everything. Of course, that loses the point of the game.
Being able to use a "bad" mon well is one of the coolest things. There's an optimal team that wins a lot but cteaming exists and you can't really make it un-exist. It's always more fun to win with a stall team than a real shoot em up team.
Perfect games becomes boring, not optimal gameplay. If everyone plays well, there's nothing wrong with that; but if everyone has a perfect team, then what?

That goes right in the face of what I always believed about game balancement. In short, I believed that, regardless of the game's genre: If we have a mon, or unit, or champion, or whatever, which is known to have little to no place in any competetively viable strategy (the Pokemon case) or, if we have a "meta", that is, a strategy that is, in general, the only competetively viable strategy (the League of Legends case), then this is what makes gameplay dull and boring, since it clearly, almost by definition, greatly reduces the pool of viable picks and strategies; and that game designers ought to avoid these pitfalls. Thus, a "perfect" game should have many viable picks, each different than another but none clearly useless, (that is, we should avoid the situation that if one wants to pick A, picking B instead will always be a better idea - some picks may and should be niche and/or situational though), that can be mixed in a plethora of ways to make a plethora of different, but viable teams, thus creating a plethora of different, but viable strategies (this doesn't mean that each team is equivalent or that a team assembled randomly is viable; teams can still be good or bad, but we should avoid the situation that there is only one viable prescription for a good team).
However, what I was being told seems to boil down to something opposite. The people I quoted seemed to think that good balancement of a game can only be achieved at the cost of making all possible picks equivalent, to the point of making it matterless what to pick. They also seemed to think that therefore, in such a scenario, an obvious winning strategy would inevitably emerge, making the game trivial.
Is it really true that a game can only be well balanced if it sacrifices all of its diversity? Is it really true that getting rid of useless picks can only be achieved at the cost of introducing a trivial winning strategy??

sentences:
Move camera from wherever camera is to pinned point So, I need to switch/ move/ animate camera from point X (not point A,as I don't know where the camera is at that momemnt) to point B (place where you want your camera to move).

This is for cinematics...like when you press a button in game which does something (opens doors maybe) but you can't see where nor what did you activate, so you show the player with the camera where and what happened.

I tried to animate camera to position, camera just goes crazy.
Then I tried to make an empty object placed at the position where the camera should be and move camera with code to that objects
position.
I tried enabling Camera 2 and disabeling Camera 1 but it just doesn't work.

Enable/ Disable Code:

public var door: DoorAnim;

public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Update(){
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1)){
            Debug.Log("Door 1 built");
            camera1 = GameObject.Find("Camera1");
            camera1.enable = false;
            camera2 = GameObject.Find("Camera2");
            camera2.enable = true;
            door= GameObject.Find("door1");
            door.animation.Play();

    }

sentences:
Tips for building an AI for a 2D racing game I have a school project to build an AI for a 2D racing game in which it will compete with several other AIs (no collision).

We are given a black and white bitmap image of the racing track, we are allowed to choose basic stats for our car (handling, acceleration, max speed and brakes) after we receive the map. The AI connects to the game's server and gives to it several times a second numbers for the current acceleration and steering. The language I chose is C++, by the way. The questions are:

What is the best strategy or algorithm (since I want to try and
win)? I currently have in mind some ideas found on the net and one or
two of my own, but I would like before I start to code that my
perspective is one of the best.
What good books are there on that matter?
What sites should I refer to?

sentences:
How to specify font size in nifty GUI when using ttf fonts I'm trying to use a font with a larger size in a ttf file using nifty GUI. All questions and answers I've seen are concerned with making fonts in fnt fonts in a different size, but the size I want to use is actually included in the ttf file. I tried setting fontSize and size attributes with no effect (no errors but the font size does not change either)
Below is the xml excerpt where I'm trying to use the ttf font with a large size:
<control id="score"
name="label"
color="#fff"
text="0"
width="50%"
height="20%"
textHAlign="left"
font="Interface/Fonts/Kenney Future.ttf"/>

sentences:
Is it better to make a cpp and hpp file for every new object or is it better to make one parent class and define types in there? Let's say we make a game. The game has items, enemies, allies, etc and there are multiple of them, like zombies and robots as enemies. Do you think it would be better to make one parent class called "Enemy" (and the corresponding cpp/hpp files) and making a class for each enemy (zombie or robot in this example) and making 2 files per enemy or would it be better to make an enumcalled "type" in the Enemy class and having all child objects in that one class?

Thank you for your help!

sentences:
How can I build a graphical map for my MUD engine? I am working on a text-based game totally from scratch and one thing I am not sure how to do is the map system.

In my mud engine totally writen in Javascript (that will be executed in a Node.js environment), I use that kind of data to design an area and the links between rooms.

/**
 *       [003]-[004]
 *         |     |
 * [001]-[002] [007]
 *         |     |
 *       [005]-[006]
 **/
var map = {
    "001" : {
        "Id" : "001",
        "Name" : "Room 001",
        "Directions" : {
            "N" : "",
            "S" : "",
            "E" : "002",
            "W" : ""
        }
    },
    "002" : {
        "Id" : "002",
        "Name" : "Room 002",
        "Directions" : {
            "N" : "003",
            "S" : "005",
            "E" : "",
            "W" : "001"
        }
    },
    "003" : {
        "Id" : "003",
        "Name" : "Room 003",
        "Directions" : {
            "N" : "",
            "S" : "002",
            "E" : "004",
            "W" : ""
        }
    },
    "004" : {
        "Id" : "004",
        "Name" : "Room 004",
        "Directions" : {
            "N" : "",
            "S" : "007",
            "E" : "",
            "W" : "003"
        }
    },
    "005" : {
        "Id" : "005",
        "Name" : "Room 005",
        "Directions" : {
            "N" : "002",
            "S" : "",
            "E" : "006",
            "W" : ""
        }
    },
    "006" : {
        "Id" : "006",
        "Name" : "Room 006",
        "Directions" : {
            "N" : "007",
            "S" : "",
            "E" : "",
            "W" : "005"
        }
    },
    "007" : {
        "Id" : "007",
        "Name" : "Room 007",
        "Directions" : {
            "N" : "004",
            "S" : "006",
            "E" : "",
            "W" : ""
        }
    }
};

On the MUD game I am actually playing, the mud command display something like this:

I would like to know in pseudo-code the way to do this in the most efficient way.

Please note that it has a maximum character length for each lines and that the map is centered around You (@).

Thank you for your help!

sentences:
Getting an NRE when using delegates in Unity I have a game where I have balls bouncing and you shoot them. Since I need a way to end the level when the player shoots all the balls I though I would create a game controller script which will register to an event from the ball script. In the awake function in the ball script I'm using this:

if (this.gameObject.tag == "SmallestBall") {
        if(!touchedTheRope) {
            countBalls(false);
        }
    }

NOTE: In this code here I'm not performing a check if(event != null) then execute - because I already know there is a problem. In the game controller script in the awake function I'm using this code:

UniversalBallScript.countBalls += CountBalls;

In the method CountBalls in game controller script I have Debug.Log to print out the number of balls. Because the small balls are being instantiated I first just performed a test where I check if the tag == "SmallestBall" and I just Debug.Log in the console, it gives me 28 small balls, but when I use the code above to call the event (if (this.gameObject.tag == "SmallestBall") etc... I get 24 balls and 4 null reference exceptions. I dont know if it has something to do with the fact that the small balls are being instantiated but I'm calling event registration in Awake and I also call that event in the Awake function, I have also tried to put this code:

if (this.gameObject.tag == "SmallestBall") {
        if(!touchedTheRope) {
            countBalls(false);
        }
    }

In OnEnable and OnDisable and its the same problem, I get 24 balls and 4 null reference exceptions. And BTW the null reference exceptions appear first and after that other 24 balls pass regularly. Does anyone have any idea?

sentences:
How to validate that certain fields are nonempty before the program starts? I want to check that some fields are nonempty before any of the Start() functions run.

I tried to put checks in Awake() and Empty() and to quit Unity if they fail:

    #if UNITY_EDITOR
        Debug.Log("exit from editor");
        UnityEditor.EditorApplication.isPlaying = false;
    #else
        Debug.Log("exit from game");
        Application.Quit();
    #endif

It hits this code but it doesn't actually quit the game. I found that the Quit / isPlaying = false commands only work from Update

sentences:
XNA Textures dissappear when game window is resized [SOLVED] - See linked post in the P.S.

I have a set of Texture2Ds generated in the Load method with this function:

Texture Generation:

private Texture2D[,] createTextureSet(TileInfo[,] map)
    {
        Texture2D[,] texSet = new Texture2D[map.GetLength(0), map.GetLength(1)];

        using (SpriteBatch sprb = new SpriteBatch(GraphicsDevice))
        {
            for (int row = 0; row < map.GetLength(0); row++)
            {
                System.Threading.Thread.Sleep(10);
                for (int col = 0; col < map.GetLength(1); col++)
                {
                    RenderTarget2D renderer = new RenderTarget2D(this.GraphicsDevice, 300, 300);
                    System.Threading.Thread.Sleep(2);
                    GraphicsDevice.SetRenderTarget(renderer);
                    renderer.Name = map[row, col].buildings[0].buildingType;
                    GraphicsDevice.Clear(Color.Transparent);
                    sprb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Tile Backgrounds\" + map[row, col].tileType + @"\" + map[row, col].tileBackground + ".png"), renderer.Bounds, Color.White);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Buildings\" + map[row, col].buildings[0].buildingType + ".png"), (Vector2)map[row, col].buildings[0].pointWithinTile, Color.White);
                    sprb.End();
                    texSet[row, col] = renderer;
                }
            }
        }

        GraphicsDevice.SetRenderTarget(null);
        return texSet;
    }

The tiles are drawn on the screen using the following code:

Texture Rendering

for (int tx = -1; tx < 2; tx++)
        {
            for (int ty = -1; ty < 2; ty++)
            {
                gameSpriteBatch.Draw(mapTextureSet[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], determinePositionToDrawTile(gameCharacter, map[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], tx, ty, resizeX, resizeY), null, Color.White, 0f, Vector2.Zero, new Vector2(resizeX, resizeY), SpriteEffects.None, 0f);
            }
         }

These textures are then drawn on the screen based on where on the map the player is. The game runs fine, until the game window is resized by the user. After that, only the character sprite remains on the screen during the redraws, and the screen remains the default Color.BlanchedAlmond background of my game. Any help is thanked in advance.

[ ! ] P.S. [ ! ]

Before marking this as a duplicate! I have looked at this and tried most of the applicable solutions from it, none of which have worked, so I assume that this error is deeper than that one.

sentences:
How to convert relative position of child to parent into an absolute position? I am modifying a game that stores object positions with a 3d vector { x, y, z } and rotation as a 3d vector with degree angles { x, y, z }.
I want to place an object in relation to a parent object accounting for its rotation. I do not have access to the game code, so I have to provide a position of the child as an absolute position.
For example, I would like to place a child object at a relative position { 50, 0, 100 }: 50 units along the x axis and 100 units up the z axis from the parent's position.
Assuming the parent object is currently at position { 0, 0, 0 } with rotation { 0, 0, 0 } the resulting absolute position for the child object would be simply { 50, 0, 100 }.
But, if the parent has a position of { 0, 0, 0 } and a rotation of { 0, 0, 90° }, the child's absolute position would be { 0, 50, 100 }.
What would be the transformation function that, given the absolute parent position, parent rotation, and relative child position, outputs the absolute position of the child (taking into account all three axes of rotation)?

sentences:
Bounding Box not rotating based on draw rotation (Java) In the process of developing a 2D game and am having some issues with translating coordinates on rotation. The object being rotated is a sword that is attached to the player. The player currently points towards a Point (mouse pointer). I am having no problems drawing the rotation, but am a bit confused on how to update the local coordinates so that the bounding box will follow also, around the player.

The weapon (coordinates) is just stuck on the left side of the player(invisible), but the drawing of the weapon is rotating around the player. The bounding box is working fine, but who wants invisible collision detection. It basically just isn't following the draw rotation.

Here is my basic draw implementation for rotating this weapon around the player.

WEAPON CLASS:

/**
* Updates child weapon
*/
public void Update(Point mp)
{
    this.boundingBox = new BoundingBox(startX,startY,width,height);
}

/**
 * Draws weapon to player
 */
public void DrawTo(Graphics2D g2d,Player p)
{
   AffineTransform backup = g2d.getTransform();
   AffineTransform trans = new AffineTransform();
   trans.rotate(Math.toRadians(getRotation()), p.getCenterX(), p.getCenterY() );
   g2d.transform( trans );
   g2d.drawImage(this.getImg(), startX, startY,null);
   g2d.setTransform( backup );
}

GAME LOOP:

/**
 * Player collision with weapons
 */
for(int l = 0; l < weaponManager.getDroppedWeapons().size(); l++)
{
    Weapon w  = this.weaponManager.getDroppedWeapons().get(l);

    if(player.Collision(w))
    {
        //If player already has a weapon, update that weapons position, add others to list that are picked up later
        if(player.getWeaponEquipStatus() == true)
        {
            //Sets the picked up weapon to the left side of the player
            player.getCurrentWeapon().setX(player.getX()-player.getCurrentWeapon().getWidth());
            player.getCurrentWeapon().setY(player.getY()+((player.getHeight()-player.getCurrentWeapon().getHeight())/2));
        }
        else if(player.getWeaponEquipStatus() == false)
        {
            player.setCurrentWeapon(w);
            w.isPickedUp = true;
        }
    }
}

I am aware of the AfflineTransform's getTranslateX and Y() methods.  I have tried assigning these returned values to my x and y weapon values in the update method, but that is definitely not the solution.

Main issue: weapon coordinates aren't rotating, but the drawing is successful.

If anyone has any advice on where to start, based on my problem, it would be greatly appreciated.

sentences:
Avoiding use of XMVECTOR in XNAMath I don't want to use XMVECTOR which i currently use in my DirectX 11 C++ game code.
Because it is too much for me in memory.
I want to use XMFLOAT3 or 4, but the problem is there is no matrix/vector XNA Math function available for XMFLOAT*. It is pointless to use 6 fields or pass to the shader (XMVECTOR), if object represents only 3 or 4 (and operate with them only).
I don't want to convert types in any case just to do calculations. Can you please recommend me what to do? I really like using XNA math, but XMVECTOR is just dirty variant...

sentences:
How to optimize Floor Meshes with different material in unity I have several meshes (floor tiles) that consist of unique materials as they have different textures. I see that it is taking too many batches and it has around 100m vertexes.
Is there any way to improve it through programming? The long way, it should be ported to 3d modeling and combine.
I also see the mesh combine but it requires the same material.
Edit:

Around 17k Floor tiles (LoD 9) with details
around 5 or 6 large tiles (Floor LoD 7) with fewer details that are placed beneath the LoD 9 tiles
lod9 tiles are display-based camera culling otherwise LoD7 floor shows all the time.

Here are some of the screenshots:
Lod 7 Tile example (there total 16 tiles)

sentences:
Completely Pixelated Font in JavaScript Canvas? 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?

sentences:
Move Sprite in constant speed on squircle I'm creating a game and i need to move a sprite on squircle path.

https://en.wikipedia.org/wiki/Squircle

i created the path using the  equation :

    angle -= Gdx.graphics.getDeltaTime()*speed ;
    float x = (float) (R*Math.pow(Math.abs(MathUtils.cos(angle)),1/10f)*sgn(MathUtils.cos(angle)))+a;
    float y = (float) (R*Math.pow(Math.abs(MathUtils.sin(angle)),1/10f)*sgn(MathUtils.sin(angle)))+b;
    sprite.setPosition(x,y);

the result is :

My question is how to make the sprite move in a constant speed

Edit :
i used the formula found on Wikipedia :

sentences: UI Automation for Flash Games has anyone used or heard of a good selenium-like toolset for doing automated UI testing with Flash? I would ideally like to have the ability to record and playback events against my game and integrate this into our build server.

sentences:
Manually creating an instance of object derived from MonoBehaviour I'm currently "newing" an instance of a class I have that derives from MonoBehaviour and store it in a list. The value of this instance is "null" however, even though it has all the fields of my derived class in it so it passes as null in null checks. After more reading it seems it's a bad idea to manually new up an instance of an object that derives from MonoBehaviour.

The class is an Actor class. I have a situation where enemy actors are 3D models in my scene and so I want them to derive from MonoBehaviour, but the player actors don't have world representations really. I just have a picture of them in the corner. Similar to Legend of Grimrock.

I wanted the 1 Actor class since the data they need is all the same and I wanted to avoid having 2 classes for no seemingly reason other than not newing up a MonoBehaviour derived class.

What are my options with this requirement when my player actors don't need MonoBehaviour but my enemy actors do but they all need to have the same properties?

sentences:
Hook into League of Legends client I would like to write a small software which will hook into the League of Legends client and record my performances and store them locally, because Riot only stores last 10 matches. Is there some way through which I can trigger an event when I finish a game ? For those who know, I would like it to work similarly to League Recorder, but it will record only your final stats (KDA, Gold, Creep Score, etc.).
I was thinking of searching for the client in the process list, and doing some checks by getting the last 10 matches, but I don't know of any way to see which user is logged in and how to download the history. I'm currently not bound to any languages, and I can work in C++/C#/Java.

sentences:
Cycling through colors with the same brightness Ok.  So I have a game I am working on with a bunch of colored particles.  Each of them gets their own color however they are all close to a specific shade.

To explain that better I am using the HSV color space, and I have a global variable that is cycling from 0-360 (H) and each of the specific particles add or subtract a random amount from that.

I use HSV because it is the easiest way for me to cycle through colors because you can just change H.

This looks very nice and all, however the particles are supposed to be pure light that is colored.  Right now all they are are circles colored with the shade, but later on I might add glow effects and other shading techniques.

The problem is that not all shades (I dont mess with H or V) are equal as far as the brightness our eyes see, and this causes problems.  For example when all of them are shades of blue things look pretty dark.

Obviously in the shader I have to convert these HSV colors to RGB colors and doing some math I quickly saw what was wrong... the colors didn't have equal luminance!

As I understand it luminance is roughly (0.2126*color.r + 0.7152*color.g + 0.0722*color.b) which is why everything is off.

Is their a way to get it so I can still get all of the different chroma (colors on the wheels degrees) while maintaining a high luminance? Perhaps I should work with a different type of color then HSV, or perhaps their is a formula that finds a color at degree x on the color wheel with luminance of y?

Thanks much!

sentences:
How free is BSD / CC-BY usage? I looked at blendswap.com where there are models that I want to make walk along a wall in this level.
AFAIK I can take this file and sell it or did I misunderstand licensing?

sentences:
How to reduce image size without pixelation? I see lots of games with smooth edges characters and high res images, however when I try to reduce images to say 64x64 for my character I just get a pixelated mess. even if I start with a 64x64 canvas I get pixelated edges.

Should I be scaling with OpenGL? or is there some technique perhaps with photoshop or pixen that I am unaware of?

sentences:
Variable sized cube texture stretching problem I have a 1x1x1 cube made in Blender with a simple UVW mapping. It represents a 3D platform of variable size.

The thing is that this cube gets resized a lot, and I want to draw a "border" of a fixed-length on each cube.

Another problem is that I am using Static Geometry, so I have to use a shader (I am using openGL, so I have to use GLSL).

So far I made this (note that the second platform is big, so it has larger borders):

What would you recommend to achieve this effect?

sentences:
Manage vertical levels rendering I've been working on a semi-professionnal project for more than one year.
The game is in 3D with a TopView camera.
In this game, the player will be in very vertical spaces, with lots of ladder and stairs.

The actual problem is that I need to show only what is at the actual height of the player.

I have made a shader that 'cut' the objects above a given height.

The problem is that my mesh are open above this height, and we just see nothing inside.

If you have any idea on how to make something to fill an open mesh or any other system that will do the job, i'll be very pleased to read you :)

This is what I have

This is what I aim to (black above top of walls)

sentences:
UnityTeams: Files to publish but no Upload button I am using Unity 2019.2.14f1 to build a game.

As I am working with a team, we have decided to use Unity Teams for the collaboration.

The project escalated and we ended up having to architecture a different project structure, directories and files.

Due to that, I created standard folders, deleted others, moved files.

Changes were made, the project was saved and now I see the blue icon in the majority of folders and lots of items in the Project Folder.

If I look at the Collab button on the top right corner of the screen and hover the mouse it appears the message:

  You have files to publish

However, if I press the button, even though it shows the blue icon, that shows that I have files to upload, it appears:

  You are up to date!

This is the first time I saw this problem.

I have done some changes to one of the scenes to see if the problem disappeared, however it persists.

I have been waiting for quite some time now, and decided to ask you for some guidance.

Everything is fine with the network connection.

In this particular situation, the log system that will appear when I upload the files is going to be huge. Is this be the reason behind the problem? What shall I do to solve this?

sentences:
Which for basic RTS prototype: Unity or Torque? I'm wanting to test my hand at writing an RTS (something I've never gotten very far with), and so I'm looking for an indie engine that would give me the most success with a quick setup that I can then tweak and start to get the ins and outs of RTS design/development.

I've had a bit of familiarity with both Torque and Unity both, but never from that perspective.

Which would get me closer to base prototype faster?

sentences:
After creating DirectX11 Device, enumerating the DXGI Adapters seems to produce invalid results EDIT: This is part of an upgrade from DirectX10 to DX11.

When I create a DirectX 11 device with D3D11CreateDevice(), it chooses a video adapter for me. I access this object like so:

// removed HRESULT checks for brevity- normally I print errors on failed hr

IDXGIDevice1*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter = NULL;
pDXGIDevice->GetAdapter( &pAdapter );

// save pAdapter

However, later, when I enumerate the adapters, this adapter is not on the list:

IDXGIDevice*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter;
hr = pDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&pAdapter);

// so far so good: pAdapter matches my current adapter I saved from above

IDXGIFactory* pFactory;
pAdapter->GetParent(__uuidof(IDXGIFactory), (void **)&pFactory);

UINT i = 0;
while( SUCCEEDED( hr ) && hr != DXGI_ERROR_NOT_FOUND )
{
    IDXGIAdapter* padapter;
    hr = pFactory->EnumAdapters1( i, &padapter );

    // none of these padapters matches the current adapter!!
    i++;
}

After this section, I have a list of the enumerated adapters. My current adapter is not in the list! Instead there is a DIFFERENT adapter with the same name as my current one.

Most importantly (this is the part I actually need) if I call D3D11CreateDevice() with this enumerated (different) adapter specified, I get E_INVALIDARG.

What am I doing wrong to generate these alternative, invalid adapters?

sentences: Unable to add AR session I am new to unity and i am trying to make a AR app. I have installed AR foundation, Arcore Xr plugin, Arkit XR plugin via package manager. Then if i go to the Hierarchy panel to add a AR session and right click, I am not seeing any XR option to add a AR session. What should i do now? Anyone please help me.

sentences:
How will the velocities of two moving objects change once they collide? I'm making a small game where things can fly around and collide. Things like boxes and so on. For each object, I have an array of all forces acting upon it, I have it's mass, it's position and it's velocity in both directions (a 2D vector). I know how to detect collision between them, but I just don't know how to react.

I used to calculate their orientation towards each other, it they were on top one another, I would just negate their y speed (v.y = -v.y), and if they were next to each other on the x axis I would negate their x speed (v.x = -v.x).

Now, this isn't very realistic, so, how do I do it? All objects are rectangles represented by [x, y, w, h] vectors.

Objects can't rotate.

sentences:
How do I make voting to kick a "leader" player fair? My game has many rooms of around 10 people where they compete. It's basically one big guy against the other small 9 people.

However, sometimes the one guy will intentionally 'troll' and make for an unfun game for the other 9 people. These people would like to kick the one guy to replace him with one of the other 9.

If the vote was required to be unanimous (other than the guy being kicked), then him just having one friend in the game would prevent the vote from passing. Likewise, if you did unanimous minus one, then two friends could stop the vote, etc.

There there is the issue with small rooms. If a room has only two or three people, then one guy can trivially kick other people.

Has any research been done for optimal votes required to kick someone from a room depending on how many people are in the room?

sentences:
How can I create a walking zone logic for my player? First I will show a screenshot and explain the logic I think of and what I'm trying to do :

In the diagram the circle is the player the big rectangle is the zone area for increase/decrease speed movement of the player and the small black rectangle is the target.
What I'm trying to do is to add some rules for this case.
I'm controlling the player in third person movement with the keys WSAD and the mouse to rotate around looking around. This is the player structure screenshot in the Hierarchy :

There are few rules I'm trying to set for the player in this specific situation in the game and I want to make it generic so I can add the rules or create this behaviour in any place in the game when I need to.
The idea is when the player is getting inside the green zone rectangle facing the target make the player slow down to stop smooth. The green zone is the distance from the target to start slow down only if the player is facing the target.
If I rotate the player back facing away from the target in the green zone at any time increase the player speed back to normal speed.
The idea is that if in the green zone I rotate the player at any time and move hi he will decrease/increase the movement speed. Facing target decrease slowly to stop facing away from target increase the speed slowly to normal.

sentences:
Which better? Write all scripts on timeline or write it partially on `.as` file? I'm going to create a flash game. But I don't know which way for me to write my scripts.

Is it better if I write script part by part and by object so every object has they own script .. or write all of those object's script on single timeline?

sentences:
Should game services be global? (XNA) If one wants to use services, they can use the ones built in to XNA (Game.Services) and pass around the Game object to everything that needs to either query for a service or add a service.

Alternatively, one can create their own game services class and make it static to avoid having to pass around Game everywhere.

Instead of just passing Game to everything, just to query the services (a code smell already in my opinion, just pass the services) seems a bit silly to me. Instead of passing it everywhere, why not just make a public static GameServices class?

What are the advantages and disadvantages of each approach? Which do you normally opt for?

sentences:
Should I start to use DX11 Possible Duplicate:
  learning Direct3D 9, 10 or 11 ?

I have just started game dev and was wondering should I use DX11 or version 10?

I know AMD/nVidia now have DX11 cards but there are not many games using them now.

So should I wait untill they are mainstearm?

sentences:
computationally Intensive routine, ThreadPool or new Thread? I had to write a computationally expensive routine that runs in 20-30ms. This routine cannot run in the main thread since it would kill the frame rate. The routine runs on demand, when some data change.

I wonder what would be better to use in this scenario. While I think ThreadPool will be all right, I wonder what would happen on an extreme scenario where just one core is available. Would it be better than to create a new thread every time and set the priority to below normal? I wonder though if, in this case, I would end up with the routine struggling to complete within a decent time (although waiting 1-2 seconds would be all right)

My guess is that the ThreadPool is always better in a multi-core scenario, however I wonder if in a single core scenario, creating a thread with lower priority could be a better solution (since I don't care if the computation last longer than excepted).

sentences:
Blocks / tiles aren't responding to clicks I've recently finished a tutorial, UE4 Slide Puzzle by Nicholas Thompson. Halfway through the second tutorial, I found out that the blocks / tiles wouldn't respond to my clicks. For example, when I clicked on a tile, it wouldn't print out a Hello message.
I have watched the tutorial so many times already, I've searched it up, looked at my code thoroughly, and I can't find any problems. Here are my blueprints:

Event Graph
Get Move To (Function)

After some debugging, I found out that the problem occured at the start of the function, Mesh Clicked in the Event Graph.
Please help, it would be greatly appreciated. Thank you!

sentences:
How to move the object(tanker ) on slope image in chipmunk Spacemanager I have used one polygon shape image (terrain)in my game its just like mountain and now i want to move the tanker on mountain path from one direction to other and then its turn on touching of the screne and move back and move like this continuously, i am not getting the method to move the tanker on slope(image) path in chipmunk spacemanager.

b.when collision detection happen like that if any bomb will fall on slope(image of mountain) then i want little damage on slope(image of mountain) like this video i want to please see this video for more details.

http://www.youtube.com/watch?v=vleq3Wa_jZs

i have used this code but my object(tanker) is following terrain path with rotation i want to just move like tanker moving and follow terrain path.

-(void)AddWheel
{
    cpShape *localPlayerShape;
    cpCCSprite *localPlayerSprite;

    localPlayerShape = [mySpaceManager  addCircleAt:[self GetStartingWheelPosition] mass:2 radius:7];
    localPlayerSprite = [cpCCSprite spriteWithFile:@"enemy1.png"];

    localPlayerSprite.shape=localPlayerShape;

    localPlayerSprite.shape->group=kItemIsPartOfTheTankGroup;
    localPlayerSprite.shape->collision_type=kItemIsPartOfTheTankGroup;

    localPlayerSprite.shape->u=4.5;

    localPlayerSprite.tag=100;

    [mySpriteLayer addChild:localPlayerSprite z:15];
}

Thank waiting for you all reply .

sentences:
How to render the sprites for a 2D soft body physics system This is not a question as to how to achieve soft body physics, but rather if I have a mass-spring system how to modify a sprite with that information.
I am using unity so I dont have access to vector based graphics.

sentences:
Implementation details of Command Pattern in conjunction with Entity Component System I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components.
There is an Engine that has a list of the entities, a table of the components and a list of the different types of systems (update and draw systems).

I was working on handling input when I reached a conflict: how I would resolve opposing inputs (for example, pressing left and right at the same time). So I decided to try and implement the Command Pattern to work with the ECS.

But I'm stumped. I'm not sure how to create a command, let's say moveLeftCommand, without knowing the intimate details about each entity that would effect.
Also, since all my logic is in the systems, (if I understand the Command Pattern) it should have an execute function which will carry out the command. How do I populate the execute command if there isn't any logic that "belongs" to an entity?

Thanks for any help!

sentences:
DX9 Deferred Rendering, GBuffer displays as clear color only I'm trying to implement Catalin Zima's Deferred Renderer in a very lightweight c++ DirectX 9 app (only renders a skydome and a model), at this moment I'm trying to render the gbuffer, but I'm having a problem, the screen shows only the clear color, no matter how much I move the camera around.

However, removing all the render target operations lets the app render the scene normally, even if the models are being applied the renderGBuffer effect.

Any ideas of what I'm doing wrong?

sentences:
Creating a hexagonal wraparound map I'm trying to create a wraparound map for a hexagonal map, so when you exit a tile on one side of the big hexagon-shaped map, you enter a tile on the other side.

Example image from Red Blob Games article on Hexagonal Grids.

In the image, the pale tan hexagonal chunk in the center is our map. The greenish/reddish chunks around it are shifted copies of the same map. If we stand on the blue tile under the cursor and walk off the main map into the green copy to the right, that's the same as wrapping around our map to the corresponding point on the other side: here, walking from the blue tile in the lower-right-hand red copy into the bottom-right corner of the center map.

I used an approach with a lookup table first. But as soon as those maps get too big, the lookup tables get even bigger. I'm searching for a solution which works without a lookup table.

sentences:
Aiming in a twin stick shooter I am trying to implement a twin stick shooter game, sometimes referred to as dual stick shooter where the left stick controls movement, and the right stick aims a gun.

What I do now, is directly map the stick angle to the gun angle, if the deflection is large enough. In pseudo code:

// jx in [-1,1]
// jy in [-1,1]
if lenght (jx,jy) > 0.5 :
    gun_angle = toangle( jx, jy )

This gives a very unsmoothed, twitchy signal for the aim.

The gun can flicker in any direction in a single frame.

In theory, the most responsive scheme, but on-screen looks far too twitchy.

So I wonder: should I sacrifice some responsiveness for a smoother signal?

Should I make the gun swivel around as I reverse the direction of the joystick, or just set it hard, like I do now?

I've been considering using the stick signal as input to a PID controller that does the actual gun rotation, but would like to know whether that's an appropriate solution for this application.

sentences:
OpenGL float[][] not working? I have a float[][] array in my terrainFragmentShader to load render the biomes, however the code simply does not work. No errors are being cast and when I remove the code biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)] by either deleting that section or manually setting it, it loads the appropriate texture.

vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

if(c < 0)
    textureColour = texture(sandTexture, pass_textureCoordinates);
else if(c < 32)
    textureColour = texture(stoneTexture, pass_textureCoordinates);

All three textures load just fine and are rendered when not using this method and the biomes are being properly loaded and initialized.

Loading:

public void loadBiomes(float[][] biomeMap) {
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            super.loadFloat(location_biomeMap[x][y], biomeMap[x][y]);
        }
    }
}

Initializing:

    location_biomeMap = new int[Terrain.VERTEX_COUNT][Terrain.VERTEX_COUNT];
    for(int x = 0; x < Terrain.VERTEX_COUNT; x++) {
        for(int y = 0; y < Terrain.VERTEX_COUNT; y++) {
            location_biomeMap[x][y] = super.getUniformLocation("biomeMap[" + x + "][" + y + "]");
        }
    }

And finally here is the entire terrainFragmentShader:

#version 400 core

in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;
in int biomeSize;

out vec4 out_Color;

uniform sampler2D backgroundTexture;
uniform sampler2D sandTexture;
uniform sampler2D stoneTexture;

uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

uniform float biomeMap[128][128];

uniform float offsetX;
uniform float offsetZ;

const int levels = 32;

void main(void){

    vec4 textureColour = texture(backgroundTexture, pass_textureCoordinates);

    float c = biomeMap[int(pass_textureCoordinates.x)][int(pass_textureCoordinates.y)];

    if(c < 0)
        textureColour = texture(sandTexture, pass_textureCoordinates);
    else if(c < 32)
        textureColour = texture(stoneTexture, pass_textureCoordinates);

    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);

    float nDotl = dot(unitNormal,unitLightVector);
    float brightness = max(nDotl, 0.25);

    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);

    vec3 totalDiffuse = brightness * lightColour;

    out_Color = vec4(totalDiffuse,1.0) * textureColour;

}

Why isn't the biome not loading? Is it an issue in me not getting the appropriate [x][y] from the pass_textureCoordinates?

sentences:
Getting XOrg Keyboard layout Maybe I shouldn't be asking for this but I cant find any tutorial about it. How do I get the key pressed and the character representation of it in Xorg like in Win32 that I know ESC_KEY is the ESC_KEY no matter the keyboard layout. Right now I only can get the physical key but not the virtual key.
Edit:
I am using xlib and I dont want to use a higher level library like glfw or sdl since I want to learn to interface with xorg

sentences:
Identifying quad patterns in a two-dimensional array In the tech demo I'm trying to make, tetrominoe-style blocks will be placed by the player, at which point the game checks to see if they've made a quad with any existing shapes on the board (a 2D array). If so, the quad should be processed in some way.

I have a 2D array like so:

[ [0, 0, 0, 1, 1, 1],
  [0, 1, 1, 1, 1, 1],
  [1, 0, 0, 1, 1, 1],
  [1, 0, 0, 1, 0, 1] ]

And I need to identify 'quad' patterns such as that in the top-right corner, e.g.

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

I'm not sure of the best way to do this. I've had a look at some two-dimensional array pattern matching algorithms, which all seem to flatten the 2D array into 1D, then use a 1D text searching algorithm (e.g. KMP) to identify any matches. My problems with that idea are that the quad can be any size, as long as it's rectangular and bigger than an arbitrary minimum (in my case, 2 x 2).

I also thought about using some variant of the 4 way flood fill algorithm or connected-component labelling, for each position of the newly-place tetrominoe. But I'm not quite sure how to best follow the path out and establish the bounds of a quad (for example, capturing this:

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

out of this:

[ [1, 1, 1, 1],
  [1, 1, 1, 0],
  [1, 1, 1, 0] ]

My latest though is perhaps a floodfill to get all interconnected parts after a tetrominoe lands, then 'round off' the jagged edges, maybe by checking the number of neighbours of each block, if it's 1, remove it, repeating the process until all remaining blocks have 2 or more neighbours. But this seems like it could be slow.

Has anyone any experience of this problem, or any pointers about how best to accomplish this task? I'm sure there's a common or at least applicable algorithm, I just don't know it!

sentences:
Libgdx Box2D and Screen Viewport Scaling I am currently having problems getting an easy to manage system of scaling my units for use with box2D. Normally I would create virtual units to go along with me viewport and camera but since I am using a screen viewport this is not as easy as it seems. I have tried scaling my viewport by setting the units per pixel to 1/100 which will then scales my world by 100 times. Then I set set my sprite batch projection to be 1/100 as well as my tiles map renderer scale to be 1/100 this led to my box2D elements of size .64 to be 64 pixels large which leads to a good looking simulation as well as a good size. The only problem is then any sprite I use must also be scaled with a scale of 1/100. Also my scene 2d HUD must also be scaled. This works but it is confusing to manage and very time consuming to write out all the scaling etc. I am looking to see if there is a way to use world units where 1 world unit is 100 pixels to make my box2D elements and use screen coordinates for the rest of my drawing etc. Also if there is an easier way to do this that I am not thinking of please let me know. I will try to post code later tonight when I am back at my computer.

EDIT:
I created a test project to work on just the scaling factor of my game and here is my test code.

@Override
public void create () {
    camera = new OrthographicCamera();
    camera.translate(new Vector3(camera.viewportWidth / 2, camera.viewportHeight / 2, 0));
    vp = new ScreenViewport(camera);
    vp.setUnitsPerPixel(1/100f);

    batch = new SpriteBatch();
    img = new Texture("badlogic.jpg");
    sprite = new Sprite(img);
    sprite.setScale(1/100f);

    world = new World(new Vector2(0, (float) -9.8), true);
    BodyDef bdef = new BodyDef();
    bdef.type = BodyType.DynamicBody;
    bdef.position.set(1, 1);
    body = world.createBody(bdef);
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();
    shape.setAsBox(1, 1);
    fdef.shape = shape;
    body.createFixture(fdef);

    dr = new Box2DDebugRenderer();

    map = new TmxMapLoader().load("Levels/bricksTest.tmx");
    mapRenderer = new OrthogonalTiledMapRenderer(map, 1 / 100f);
}

@Override
public void render () {
    camera.update();
    sprite.setX(body.getPosition().x - sprite.getWidth() / 2);
    sprite.setY(body.getPosition().y - sprite.getHeight() / 2);
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    mapRenderer.setView(camera);
    mapRenderer.render();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    batch.end();
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    dr.render(world, camera.combined);
}

@Override
public void resize(int width, int height) {
    vp.update(width, height, true);
}

This code runs and produces the expected results, but I feel there has to be some easier way. Also ignore any of the size numbers/horrible sloppiness of this code because this is only a test project and is not from my actual game.

This is a picture of the final result. Note: The box2D box is not the same size as the image because I wanted the box to be about the size of a character from my game for this test. I also moved the position of the box to x = 5 and y = 5 so it is easier to see.

sentences: How To Resize Existing Texture In OpenGL 4.3 I would like to know how to resize an existing OpenGL 4.3 texture while keeping the current contents.  i'm using glTexImage2D().  Do I simply re-call glTexImage2D() with nullptr for the data paramater?

sentences:
Scale screen space quads (used in font rendering) I have quads positioned in <0, 1> x <0, 1> coordinates. I use this system for font rendering.

In vertex shader I have:

gl_Position.xy = 2.0 * POSITION.xy - 1.0;

that brings the position to the screen space <-1, 1> x <-1, 1>.

My quads are created from two triangles ABD, BCD

D-C
|\|
A-B

Now, I want to scale the quad by a scale factor. Can I achieve this with this data?

I have tried to change geometry and store quad center and half-sizes, then calculate the final position as

gl_Position.xy = 2.0 * (CENTER_POSITION.xy + HALF_SIZE.xy) - 1.0;

This way, I can translate points to origin, scale them and translate them back. However, this scale single quad correctly, but the two closely neigboring quads are no longer closely neigboring, since the space between them is constant.

So the final question. How can I scale quads used for font rendering, so that the text is still readable without large gaps between glyphs?

sentences:
Why is integer value not updating as a text? I have a space shooter game and I am trying to create a shield power for the player ship. My mechanic for shield is working. When I press the shield power button(P), the shield power decreases from 100 to 0 at a certain pace.

Problem is that I am trying to draw this shield power value on screen but it's just showing the starting shield power value(which is 100) and not showing the decrease in shield power value when I press the shield button.

What am I missing?

Here's the relevant code:
Game.cpp

if (keyboard->IsKeyPressed('P'))
{
    if (player_->shield == true)
        player_->shield = false;
    else
        player_->shield = true;
}

if (player_->shield && player_->shieldPower > 0)
{
    if (keyboard->IsKeyPressed(VK_SPACE))
    {
        XMVECTOR playerForward = player_->GetForwardVector();
        XMVECTOR bulletPosition = player_->GetPosition() + playerForward * 10.0f;
        SpawnBullet(bulletPosition, playerForward);
    }

    player_->shieldActive = true;
    if (GetTickCount() - player_->time > 100)
    {
        player_->time = GetTickCount();
        player_->shieldPower--;
        if (player_->shieldPower <= 40)
        {
            player_->shieldPowerLow = true;
        }
        else
        {
            player_->shieldPowerLow = false;
        }
    }
}
else
    player_->shieldActive = false;

TextClass.cpp

void TextClass::OnRender(System *system)
{
Graphics *graphics = system->GetGraphics();
FontEngine *fontEngine = graphics->GetFontEngine();
Player *player = new Player();

Game *game = system->GetGame();
game->RenderEverything(system->GetGraphics());

std::stringstream buffer;
buffer << player->shieldPower;

fontEngine->DrawText(buffer.str().c_str(), 50, 100, 0xffffffff,
FontEngine::FONT_TYPE_SMALL);
}

Player.h

class Player
{
public:

int shootDelay;
int time;
int shieldPower;
bool shield;
bool shieldActive;
bool fullShield;
bool shieldPowerLow;
bool shoot;
}

Player.cpp

Player::Player() :
shootDelay(500),
shieldPower(100),
fullShield(true),
shieldPowerLow(false),
shield(false),
shieldActive(false),
shoot(false)
{
}

sentences:
Voxel river flow simulation I am making a Voxel game and I'd like to add rivers that can be redirected. So I thought that if a player replaces a river block or digs up a block next to a river block the river would repath itself to the sea. The rivers path would have a direction and a speed in that direction.

The rivers path would be determined by these rules:
If the river can go down in its direction it will and then pick up speed.
or if it has a speed under 2 and it can go sideways and down it will and keep its direction. Otherwise it will keep going in its direction until blocked, where it will pick a new direction. If the river can't go anywhere it will fill up the layer its on like a bathtub and go up.
Repeat until it reaches the ocean.

However I can't figure out how you can know what to fill. The data would be stored in some sort of height map. 1 = same level, 0 = down a level, 2 = up a level

For example:

222222
211112
211112
211112
211112
222222

I can tell that the 2s completely surround the 1s meaning that all the 1s should get filled with water if the river goes up. But how can a computer tell?

sentences:
Function Not Storing New Value of Variables? I'm currently building a small-scope RPG and running into an issue with modifying variables.  My goal is to alter my character's stats when I run a procedure to change their equipment.  My code is as follows:
public class Player: MonoBehaviour   {
    //Base stat variables
        public static int PAtk = 12;
        public static int PDef = 6;
    //Battle-exclusive stats.  Will have equipment added onto them.
        public static int Attack = PAtk;
        public static int Defense = PDef;
    //Equipment variables.
        public string weapon;
        public string armor;

    private void Awake()
    {
        //Get equipment
        EquipWeapon("Bronze Sword");
        EquipArmor("Bronze Armor");
    }

void EquipWeapon(string WeaponName)
    {
        weapon = WeaponName;
        EquipmentManager.GetComponent<Equipment>().EquipStatIncrease(PAtk, Attack, PDef, Defense, WeaponName);
    }
void EquipArmor(string ArmorName)
    {
        armor = ArmorName;
        EquipmentManager.GetComponent<Equipment>().EquipStatIncrease(PAtk, Attack, PDef, Defense, ArmorName);
    }
}

public class Equipment: MonoBehaviour  {
    //Create dictionary to give each weapon a key ID.  This will be used for calling items in another array.
        Dictionary<string, int> WeaponDictionary = new Dictionary<string, int>();
    //Create weapon array for stats.
    public int[,] WeaponStats;

    // Start is called before the first frame update
    void Awake()
    {   //Declare weapon IDs
            WeaponDictionary.Add("Bronze Sword", 0);
            WeaponDictionary.Add("Bronze Armor", 1);
        //Declare stat array
        //Table: ID, Atk, Def
        WeaponStats = new int[,]
        {
            {0,4,0},
            {1,0,4}
        };
    }

    public void EquipStatIncrease(int BaseAtk, int BattleAtk, int BaseDef, int BattleDef, string Equipment)
    {
        BattleAtk = BaseAtk + WeaponStats[WeaponDictionary[Equipment], 1];
        Debug.Log(BattleAtk + "Battle Power");
        BattleDef = BaseDef + WeaponStats[WeaponDictionary[Equipment], 2];
        Debug.Log(BattleDef + "Battle Defense");
    }
}

The general gist of it is once EquipWeapon or EquipArmor is ran, the equipment variables in the Player class will be updated.  Afterwards, another function in the Equipment class will be ran with variables from the Player class passed over, in order to be modified by the WeaponStats array.
The Debug logs in EquipStatIncrease show me that I am getting the desired results.  However, the Attack parameter that is being placed into the function is not being permanently modified.  During the first execution of the EquipStatIncrease method, I will get a result of 16 BattleAtk and 6 BattleDef, due to the weapon being equipped.  However, once it's run a second time to equip the armor, I'm shown a result of 12 BattleAtk and 10 BattleDef, even though BattleAtk should have stayed at 16.  This leads me to believe that the variables I'm trying to transform are not being modified, and I'm not sure what to do about this.  In the EquipStatIncrease parameters, BattleAtk gives the message Parameter 'BattleAtk' can be removed if it is not part of a shipped public API; its initial value is never used  However, I don't know what action to take to resolve this.
I'm aware of being able to use an int function instead of void, but unless I'm missing something, that only works if I'm trying to change one variable.  If I want to have an equipment object that affects 2 different stats at once(ex. a weapon that increases BattleAtk and BattleDef), then I don't see how an int function would work.

sentences:
Compute spheres 2D speeds in perspective projected animations I created two animations that consist of spheres moving in a perspective projected 3D space, which means that the size and speed of the spheres vary with the distance: they increase when they are closer to the viewer (the camera) and decrease when they move farther away from the viewer. Both animations are played on a computer 2D screen.

In the Random Movement Animation, the spheres are moving randomly in different directions (GIF 1). In my code, I computed their spherical coordinates (sphere.position.xyz) with the two angles theta and Phi (see below the formulas used for the position and their derivates).

In the Optic Flow Animation, it is the camera that moves along the z-axis (camera_z -= .1) and the spheres don't move (GIF 2).

In the context of a neuroscientific experiment, I need to match the perception of speed between the two animations, thus I need to first compute the 2D speed in both animations (By 2D, I refer to the screen coordinates rather than the world coordinates). What are the respective speed formulas for each animation? Does the speed of each sphere in the optic flow calculation equal to the camera's speed?

How I generated Spheres coordinates in the Random animation:

for sphere in spheres:

        sphere.position.xy = np.random.uniform(-25, 25, size=2)
        z = np.random.uniform(near_z, far_z)

        sphere.position.z = z
        sphere.position.x *= z/-50
        sphere.position.y *= z/-50

        sphere.theta_deg = np.random.rand(1) * 360
        sphere.phi_deg = np.random.rand(1) * 360

        theta_rad = sphere.theta_deg * np.pi / 180
        phi_rad = sphere.phi_deg* np.pi / 180

        sphere.dx = speed * np.sin(-phi_rad - theta_rad) / frameRate
        sphere.dy = -speed * np.cos(phi_rad + theta_rad) / frameRate
        sphere.dz = -speed * np.cos(theta_rad) / frameRate

sentences:
Is it a good option to simultaneously work on a game and a game engine? I'm considering this, now I work on 3d game but I want also to make in slow tempo, iteratively a game engine is it a good choice?
The game what I working on is with non custom engine (Unity, Unreal Engine 4 - I not yet selected, switching from engine to engine)
and also I want to develop a custom 3d engine but this engine will not be heavy but lightweight so with selected features. So I'm not talking about making Unity like engine but still 3D thank you for answer :)
And this engine will contain:

c#
opengl
existing physics engine (Bullet or sth)
...

what I not considering:

editor
multiplayer
characters

so just API
Additionally I have linear algebra background but no experience with shaders
edit: currently I want to make game in existing game engine
but in future I want to migrate with game to custom game engine

sentences:
2D pathfinding - finding smooth paths I was trying to implement a simple pathfinding, but the outcome is less satisfactory than what I intended to achieve. The thing is units in games like Starcraft 2 move in all directions whereas units in my case only move in at most 8 directions (Warcraft 1 style) as these 8 directions direct to next available nodes (they move from a tile to next neighboring tile). What should I do in order to achieve the result as in Starcraft 2? Shrink the tile size?

On the picture you can see a horizontal line of rock tiles being obstacles, and the found path marked as green tiles. The red line is the path I want to achieve.

sentences: Android build has white image over game In unity when I am playing my game it displays fine, but when I build and run it to my nexus 5 there is this white something I don't even know over my game. Any suggestions for fixes?

sentences:
OpenGL render to texture causing edge artifacts This is my first post here so any help would be massively appreciated :)

I'm using C++ with SDL and OpenGL 3.3

When rendering directly to screen I get the following result

And when I render to texture I this happens

Anti-aliasing is turned off for both. I'm guessing this has something to do with depth buffer accuracy but I've tried a lot of different methods to improve the result but, no success :( I'm currently using the following code to set up my FBO:

GLuint frameBufferID;
glGenFramebuffers(1, &frameBufferID);
glBindFramebuffer(GL_FRAMEBUFFER, frameBufferID);

glGenTextures(1, &coloursTextureID);

glBindTexture(GL_TEXTURE_2D, coloursTextureID);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,SCREEN_WIDTH,SCREEN_HEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,NULL);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

//Depth buffer setup

GLuint depthrenderbuffer;
glGenRenderbuffers(1, &depthrenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, SCREEN_WIDTH,SCREEN_HEIGHT);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);

glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, coloursTextureID, 0);

GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, DrawBuffers); //

if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        return false;

Thank you so much for any help :)

sentences: How to change FPS when using a sprite sheet and AnimationPlayer? With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer?

sentences:
Consistency of DirectX models Is there a way to check the consistency of a DirectX model (.x) ?

Whilst compiling .x files with XNA GameStudio 3.1 compilation is aborted with the following error message:

Error  2   Could not read the X file. The file is corrupt or invalid. Error code: D3DXFERR_PARSEERROR. C:\WFP\Browser\Content\m.x  KiviBrowser

Some models compile correctly without any error/warning and some abort as described. The files of each model have several thousand lines.

I am creating the files in Googles SketchUp 8 where they all look fine and don't show any sign of corruption.

Suppose I have such a model my XNA compiler won't compile because their is an inconsistency somewhere in the file - how could I identify this in order to correct it ?

sentences:
How can I process continuously-held keys with SDL? I have created a cube in opengl using SDL. Now I am trying to move the camera in X direction if user presses left or right arrow keys and Y direction if user presses up or down arrow keys. Right now the camera moves by a fixed amount in a particular direction if the key gets pressed once. It doesn't matter how long does a person hold the key down, it moves by that fixed amount only. I want the camera to move continuously as long as the key is pressed.

Below is the code for keyboard polling.

        while ( SDL_PollEvent( &event ) )
        {
            switch( event.type )
            {
            case SDL_ACTIVEEVENT:
                if ( event.active.gain == 0 )
                isActive = FALSE;
                else
                isActive = TRUE;
                break;
            case SDL_VIDEORESIZE:
                surface = SDL_SetVideoMode( event.resize.w,
                            event.resize.h,
                            16, videoFlags );
                if ( !surface )
                {
                    fprintf( stderr, "Could not get a surface after resize: %s\n", SDL_GetError( ) );
                    Quit( 1 );
                }
                resizeWindow( event.resize.w, event.resize.h );
                break;
            case SDL_KEYDOWN:
                handleKeyPress( &event.key.keysym );
                break;
            case SDL_QUIT:
                done = TRUE;
                break;
            default:
                break;
            }
        }

And below i have mentioned the keypress handler function

void handleKeyPress( SDL_keysym *keysym )
{
    switch( (keysym->sym) ){
        case SDLK_ESCAPE:
            Quit(0);
            break;
        case SDLK_LEFT:
              eye[0] -= 0.1;
              break;
            case SDLK_RIGHT:
              eye[0] += 0.1;
              break;
            case SDLK_UP:
              eye[1] -= 0.1;
              break;
            case SDLK_DOWN:
              eye[1] += 0.1;
              break;
            default:
              break;
      }

    return;
}

What changes should I make in my code to handle continuous keystroke detection?

Note:
The following code does the required job but I don't understand why

if ( ( SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL ) ) )
{
        fprintf( stderr, "Setting keyboard repeat failed: %s\n",
             SDL_GetError( ) );
        Quit( 1 );
}

sentences:
Moving A Sprite In The Direction Its Facing XNA There are many questions on this site that explain this except they seem to all be in Java.
I want to move a sprite in the direction it's facing, in XNA. I know you must use Radians and lots of complicated maths which I am not too familiar with. I tried doing this:

position.X += RotationAngle * 5;

This code obviously makes no sense whatsoever, and that's why I need help with it. How can I accomplish the rotation?

sentences:
How do you prevent inflation in a virtual economy? With your typical MMORPG, players can usually farm the world for raw materials essentially forever. Monsters/mineral veins/etc are usually on some sort of respawn timer, so other than time there really isn't a good way to limit the amount of new currency entering the system.

That really only leaves money sinks to try to take money out of the system. What are some strategies to prevent inflation of the in-game currency?

sentences:
Obscuring stored info in a flat-text file I have an idea for an addon for World of Warcraft which would basically be a minigame within the game itself. Eventually, I'd like to have players be able to compete against each other directly. The game would have some RPG-like elements, particularly statistics and abilities, which it would be undesirable for the end users to modify.

So the fact that this is a client-side script, where everything (logic and data storage) are all in flat text files, means that it's impossible for me to truly secure things. But I'd like to at least make it non-trivial to alter things, e.g. so that you can't just open up a file in notepad and type in 'Strength = 256'.

I'm looking for any ideas on how I might obfuscate the data, preferably something which is easy to implement as it's not really what I feel like spending my time on, but probably more sophisticated than ROT-13.

As an example, one idea I had, which I'm not sure if it's feasible (have never made an addon for WoW before) is to serialize the data in base-64.

sentences:
Swift gamedev options for linux I recently tried out Swift. I found it to be awesome. But I'm unable to find any libraries for game development as I'm on Linux. Everything seems to be made for MacOS & iOS development.

There were one or two SDL bindings on Github. But they were not ready for 'public consumption' as listed on their pages. An option is to use Glfw. But then I would have to use OpenGL for everything.

Is there any game development library you know? Even simple to use graphics libraries will be helpful to me.

If possible, please make a list of useful gamedev related libraries you know of in Swift. Thanks!

EDIT: Please don't list MacOS only libraries. As I said before, I'm a Linux user and am looking for libraries that I can use on Linux.

sentences: Can I transfer C# coding I do in Unity for practice to another 3d engine? If I use a C# coding in Unity 4, can I transfer that coding into another non-Unity engine as long as it accepts C# too? I hope this question makes sense. Thank you in advance.

sentences: Distorted edges in model rendering xna The edges of my model are not rendered smooth in xna. See here. What can i do for this, as when designer renders the same model in maya, edges are smooth. And is it possible to render models in xna which provide same results as Vray pugin renders in maya or max.

sentences:
How to handle player input with fixed rate variable fps time step? I've made a system which uses the ideas from "Fix your Time Step" in order update physics.  I'm having trouble finding standard methods for dealing with this when user input affects player movement outside of a time-step.

If we want to integrate player movement within the "fixed time step, variable fps" system, I guess I would have to queue up player actions somehow, when accumulation hasn't yet completed. But then how do I integrate several different player actions within said timestep?  IE lets say within timestep of N milliseconds, the player executes a move forward, move right and move backwards, where there is an infinite collidable wall in front.

I could always calculate the last input, but in this case, it wouldn't be correct to do so. The player actually should be blocked by the wall, and then moving right and back would move them to the right, and back, to the right of where only processing the last input would lead.
Similarly, if all movement was accounted for together, it might result in a player having an impossible vector for the final position, but if all moves were taken independently, there might have been a valid path (ie around a corner).
If I process all inputs then the player made during the time-step, it could conceivably be costly if they made a million tiny movements (collision check at each movement), though with exact physics (as far as a fixed time step simulation is concerned).
Even if we thought the last bullet wasn't that bad, as soon as you add multiple players to the equation, it starts looking really bad, especially with a server.

Are my only options to process all actions or only process a subset of them?

sentences:
How to make tank track rig? On unity How to rig an unity tank track? Does it use animation or it use some another ways.
Can anyone explain how to do this. thanks

sentences:
Why is my TextMesh always on top? I have a 2-d game that I am making, using 3-d assets, including TextMeshes for text. I have decided that in some instances, I would like to have the TextMesh appear behind objects in the foreground. The below is one such example.

It seems that the TextMesh is always in front. I have tried a number of things to get the text between the map and object layers, with no success. These include:

Moving the text between the map and object.
Changing the SortingLayers and SortingOrder. The map, objects, and labels are on 3 different layers, with the Objects being the highest layer, the map the lowest, and default and label in between.
Using a perspective camera, not orthographic.

Any ideas as to what else could be going on? Thanks!
How can I make the TextMesh appear that isn't on the top layer? Thanks!

sentences:
The camera does not capture movements in z-axis I want to make a simple drag and drop card in Unity, where the card pops up a bit towards the screen when the drag begins (lifting effect), and then drops down back on the table when the drag ends.

My script looks like this:

public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
    void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z - 10);
    }

    public void OnDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, -10);

    }

    public void OnEndDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + 10);

    }

}

The card is an image, and it is child of the canvas.
The render mode for the canvas is Screen Space - Overlay.

The drag works correctly, but I cannot capture the movements in the z-axis.
It does capture the movements in the z-axis when I change the render mode. However, then the card is too far away in the z-axis, and it moves with an offset with respect to the mouse pointer.

As far as I understood, I need to do something about realtive distances, but I how can I force the mouse pointer to be on z=0 plane.

sentences:
LibGDX and Sound Priorities According to a post I found, the setPriority of a Sound in LibGDX is not only a hint, but does nothing on desktop, and I can confirm this.

I really need priorities for sounds in my desktop game.

The first thing that comes to mind is to roll some kind of simple "sound system" with, say, a PriorityQueue, but I'm not quite sure of how I would implement it exactly, and I'd like to re-use code as much as possible... has anyone here perhaps rolled one that I could use?

sentences:
How to get plane geometry associated with primitive 3d plane in unity3d I assume there should be a plane (struct) associated with a primitive 3d plane in unity3d, how to get that?
Or if not associated, can we build plane struct object somehow using corner vertices of 3d plane. Can somebody help me how to get cornor vertices of 3d plane mesh.

Update:
What I am trying to achieve is to use Plane.Raycast on a 3d Plane, but I am not certain whether there is any plane geometry component associated with it, or Is there any way to build a plane geometry which should be going through all the corners of the 3d plane, so that I'll be able to use Plane.Raycast from the normal direction of 3d plane towards itself.

sentences:
SQLite Query from unknown table based on known column value single query I'm working on a database to back up my online TCG. It's currently SQLite, but I'm going to transition it to a MySQL database later.

Currently, I have three distinct types of cards with their own unique fields. For example. However, all cards have a single uniqueid that I use to refer to them.

TABLE cards {
    CARD_ID as INT
    CARD_TYPE as INT
    TYPE_ID as INT
}

TABLE creature_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ATTACK as INT
    DEFENSE as INT
    ELEMENT as INT
    FLAGS as INT
    MANA_COST as TEXT
}

TABLE spell_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    SPELL_TYPE as INT
    ELEMENT as INT
    MANA_COST as TEXT
}

TABLE mana_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ELEMENT as INT
}

I'm trying to figure out how to build a query that will allow me to get all fields from a specific table without knowing the table I need to pull from ahead of time.

Basically, I want to be able to supply CARD_ID, query the cards table, and use the CARD_TYPE and TYPE_ID to return the row from creature_cards where CARD_TYPE is 1, spell_cards where CARD_TYPE is 2, and mana_cards where CARD_TYPE is 3.

I'm currently doing this through two separate queries and doing the logic on the backend, but I'm wondering if there's a way to get the data all in one query, because my queries can be quite time consuming.

Would it just be better to jam all card fields into one table, rather than keeping them in three separate tables?

sentences:
Blender Edge Split Alternative What other options/alternatives are there to "edge split" for smooth shading low poly game models.

As I understand it, edge split does what it say's, its splits the mesh therefore increasing the vert count.  I have considered manually marking the edges as sharp however I would imagine this leaves artifacts on the model(in-game) ?

Cheers.

sentences:
How to panning camera on XZ axis with different angles I have an Orthographic camera where the position is { x:0, y:100, z:0 } and is pointing/looking at { x:0, y:0, z:0 }. At this point, I'm able to capture the mouse movement and translate it to make the pan correctly. If the mouse goes 10 px down/y I just have to move Z in the 3D world.

The problem is that I don't know how to calculate if the camera position is in perspective, let's say:

position: { x:50, y:50, z:50 }
lookAt: { x:0, y:0, z:0 }

I guess I have to use some trigonometry, but I'm very lost, to be honest. Any guide would be very helpful.

sentences:
Problem with coroutines unity 3d I cannot understand why the coroutines are not waiting the designated number of seconds before executing the code below it. At the moment, the animation bleeds into the next state. I could get around this by using .time and if statements but I thought the whole point of coroutines is that you can avoid that sort of mess.

         public IEnumerator LoadBow()
     {
         this.gameObject.GetComponent<Animation>().CrossFade("Load_Bow");
         yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Load_Bow"].length);
         aimStates = AimStates.Draw;
     }

     public IEnumerator DrawBow()
     {
         this.gameObject.GetComponent<Animation>().CrossFade("Draw_Bow");
         yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Draw_Bow"].length);
         aimStates = AimStates.Aim;
     }

     public void Aiming()
     {
         moveTarget.SetActive(false);
         switch(aimStates)
         {
             case AimStates.Load:
                 StartCoroutine(LoadBow());
             break;

             case AimStates.Draw:
                 StartCoroutine(DrawBow());
             break;

sentences:
Inconsistent accessibility error in xna Hey all, you may remember me asking a question regarding a snake game I was creating about two weeks ago.

Well I'm quite far now into making the game (thanks to a brilliant tutorial I found). But I've come across the error described named above.

So heres my problem;

I have a SnakeFood class that has a method called "Reposition". In the game1 class I have a method called "UpdateInGame" which calls the reposition method to load an orange that spawns in a random place every second.

My latest piece of code changed the reposition method to allow the snake I have on the screen to not be overlapped by the orange that randomly spawns.

Now I get the error (in full):

Error   1   Inconsistent accessibility: parameter type 'TheMathsSnakeGame.Snake' is less accessible than method 'TheMathsSnakeGame.SnakeFood.Reposition(TheMathsSnakeGame.Snake)'   C:\Users\Tom\Documents\Visual Studio 2008\Projects\TheMathsSnakeGame\TheMathsSnakeGame\SnakeFood.cs 33  21  TheMathsSnakeGame

I understand what the errors trying to tell me but having changed the accessiblity of the methods, I still can't get it to work.

Sorry about the longwinded question.

Thanks in advance :)

Edit: Code I'm using

 (Game1 Class)
private void UpdateInGame(GameTime gameTime)
    {
        //Calls the oranges "reposition" method every second
        if (gameTime.TotalGameTime.Milliseconds % 1000 == 0)
            orange.Reposition(sidney);
        sidney.Update(gameTime);
    }

(SnakeFood Class)
 public void Reposition(Snake snake)
    {
        do
        {
            position = new Point(rand.Next(Grid.maxHeight),     rand.Next(Grid.maxWidth));
        } while (snake.IsBodyOnPoint(position));
    }

sentences:
OpenGL Calculate Matrices Im trying to switch from the glTranslate etc to my own Matrices, but for some reason it does not work. Here are my 2 functions to create the view- and projection matrix:

public Matrix4f getViewMatrix() {
    Matrix4f viewMatrix = new Matrix4f();
    viewMatrix.setIdentity();
    viewMatrix.translate(game.player.position);
    viewMatrix.rotate(game.player.rotation.x, new Vector3f(1.0f, 0.0f, 0.0f));
    viewMatrix.rotate(game.player.rotation.y, new Vector3f(0.0f, 1.0f, 0.0f));
    viewMatrix.rotate(game.player.rotation.z, new Vector3f(0.0f, 0.0f, 1.0f));
    //System.out.println(viewMatrix);
    return viewMatrix;
}

public Matrix4f getProjectionMatrix() {
    FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL_MODELVIEW_MATRIX, projectionBuffer);
    Matrix4f projectionMatrix = new Matrix4f();
    projectionMatrix.load(projectionBuffer);
    return projectionMatrix;
}

I send those 2 matrices to the Vertex shader with a uniform, and use:

gl_Position = view_matrix * proj_matrix * vec4(in_position, 1.0);

Where in_position is the coordinate of the vertex.

I do see some things on the screen, but it's very, very buggy, and nothing is right about it.
If I use the build-in gl_ModelViewProjectionMatrix in the shader and use glTranslate and glRotate in OpenGL, it works perfectly fine.

What am I doing wrong here?

Here is the output of me view projection together with the camera position:

0.5095141 0.0 -0.8604623 1.1625774
0.7321221 0.52541286 0.43351877 16.980185
0.45209795 -0.8508474 0.26770526 0.8665553
0.0 0.0 0.0 1.0

Vector3f[1.1625774, 16.980185, 0.8665553]

sentences:
Efficient fog-of-war visibility searching Every game I look into that uses fog of war tends to have the AI ignore fog of war completely. I'm starting to see why.

I have a RTS game I'm working on, with lots of units moving around. All units are on a grid, and I use a predefined search pattern to scan the grid points around the unit to find the nearest target. So far so good.

However, I have another unit type who's job it is to run around the map and collect scrap from destroyed units. As with combat units, I want it to look around and select the closest scrap it can find. However, unlike combat units, this search isn't limited to it's own vision radius. It should be able to take advantage of the player's entire fog of war. If another unit or building has revealed some scrap, it should be available for the unit to go pick up.

While scanning the vision radius of a unit is simple, I'm having trouble thinking of an efficient way to determine which grid points to scan in this much larger case. Any grid points within view of a building will be fairly static, but things other units see will change every frame, as they are constantly moving.

The two options I see are to record per-player visibility flags within the grid points themselves, and then (somehow) update those flags each frame, or to just loop through all units and buildings and perform individual searches to build a list of visible scrap. The first would be difficult to keep updated without re-scanning the entire map, and the second would be very redundant if there were many units or buildings in a small area.

Is there another method I could use to build a list of visible scrap within a player's entire fog of war view, given that that view is constantly changing?

sentences:
Filling of a multidimensional array with string I'm trying to fill a dropdown with a lis,t if some input is correct.

now when trying to create the list from a text file (to save the program) i should split the line on a comma so i have 3 settings for one asset:
For ex asset1,colour,used,broken.
the list should show the asset if the item is broken (0 is not broken, 1 is broken).

 public string[,,,] UsedAssetList;

string[] lines = System.IO.File.ReadAllLines(@"" + Application.persistentDataPath + "/assetlist.txt");
    cmbAssetNumber.ClearOptions();
    for (int i = 0; i < lines.GetLength(0); i++)
    {

        UsedAssetList = ***lines[i].Split(',')***;
        if (UsedAssetList[i,0,0,1] == "1")
        {
            list = new Dropdown.OptionData(UsedAssetList[i,0,0,0]);
        cmbAssetNumber.GetComponent<Dropdown>().options.Add(list);
        }
    }

The lines[i].Split(',')gives me the error:

Error   CS0029  Cannot implicitly convert type 'string[]' to 'string[*,*,*,*]'

I think everything is on point, except the filling of my list. any idea on how i can get this right?

EDIT: I was thinking the list should look like this: {{"asset1","Gold","1","0"},{"asset2","Green","0","1"} , ... }

EDIT: While the text file looks like:

asset1,Gold,1,0

asset2,Green,0,1

...

sentences:
How can I cast a std::shared_ptr to the correct derived class? I'm trying to implement a component based design for a game I'm making. I decided to write it in C++, but I'm not very good at it. Coming from a Java background I encountered a problem when trying to manage the std::vector for the components. Right now each entity has a vector of components that can be of different derived classes such as "Transform Component" which has an x and y field that I will access later. From what I've read I have to use a std::shared_ptr for each component, and that has worked fine except when I retrieve a component and try to cast it I start getting errors.

The code looks like this:

Component.hpp

class Component
{
public:
    virtual ComponentType getType() = 0;

    virtual ~Component() { }
};

Transfrom.hpp

class Transform : public Component
{
public:
    float x, y;

    virtual ComponentType getType() { return ComponentType::TRANSFORM; }
};

Entity.hpp

class Entity
{
public:
    Entity() : m_components() { }

    Component& getComponent(ComponentType type);
    void addComponent(std::shared_ptr<Component> comp);
    bool hasComponent(ComponentType type);

private:
    std::vector<std::shared_ptr<Component>> m_components;
};

And when I try to use it:

// This gives an error!
Transform comp = std::dynamic_pointer_cast<Transform>(entity.getComponent(ComponentType::TRANSFORM));

How can I fix this?

sentences:
Avoiding singletons for puzzle system Say for instance I have a puzzle with 3 switches that need to be in some configuration (say all on) in one room, that opens a door in another, with a load screen separating, so I can't link the switches directly to the door. My first thought was to create a singleton that stored the state of each "solution element" which in this case is the switches, but could be a correctly turned knob, ect. then a given "Puzzle Gate" like a locked door would check the required solution elements to decide it's own state, but I'm hesitant to use singletons for all of the commonly given reasons.

What alternatives do I have to singletons that would give me the same or similar control?

sentences:
source development kit tutorials I'm looking to create a demo using the source development kit.
Because i want it to have a similar style to portal, but one I'm wondering can i get the portal 2 authoring tools without owning the game,
and two I'm finding it very difficult to find any form of tutorials for it, could anyone link me to some preferably PDF format or eBook i rather read them.

sentences:
How to handle physics of moving platforms in a platformer? So after a few hours of searching on the internet, I have yet to find a pleasing answer on how to handle moving platforms in a 2d platform game. So I decided to make a simple prototype where you interact with 2 different platforms, one that moves vertically and one horizontally. I would love some help to dissect and see what isn't working, and how to fix them. I have submitted the .fla file + .as file below, accompanied with a link to the playable .swf.

The goal is to make the Hero interact with the platforms as if they were solid objects that he can stand on, pushed alongside with, jump on/under etc etc.

The problems with my prototype are these:

When you stand on the horizontally moving platform, without moving (not touching any keys), the Hero moves along with platform, but with a slight delay causing hero to slide back a little.
When you stand on the horizontally moving platform, and jump, you move along with the platform midair (some games prefer having it like this, but it doesn't feel natural and is not wanted here). Which might be caused by the Hero retaining the velocity on the X-axis from the platform.
When you jump up to the bottom side on the vertically moving platform, whilst the platform is moving downwards, you sink inside it for a brief second. Hero penetrates through as if the collision was non existent for a moment.
When you jump on vertically moving platform, the veloctiy on Y-axis is retained, so when you walk off the platform, you fall down at a higher speed. With the speed of the retained velocity, + gravity that is added (this is mostly because I cant figure out a way to reset velocity on Y-axis to 0 when you land on the platform, without the player freezing midair).

I'm a novice programmer so I am sure there are BETTER ways to do this, and I would love to hear them all. Any ideas on how to improve the code or other methods in which you can implement moving platforms into a Tilebased game are welcome. In the end, I am trying to find a solid way to handle moving platforms in 2d platformers.

Playable SWF:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.html (Move with arrow keys, Jump with X key, Run with Z key)

Sourcecode AS-file: http://dl.dropbox.com/u/28271061/Platformerhowto.as

SourcefileFLA:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.fla

If you prefer just to read the code through Pastie online: http://pastie.org/2266764

sentences:
Blending textures together, texture fade over / fade in What is the best way to render a texture overlapping effect?

Like in this example:

I want either the grass to fade in to the snow texture, or the other way around. No rough edges. Somehow make them blend over. So the grass has a bit of snow or the snow has a bit of grass How is this possible during runtime? If that's possible.

I don't render this by using the SpriteBatch, since the ground isn't rectangles (they can be moved).

This is the way I render each shape (each one of those squares):

// LoadTexture
// Apply EffectPass

device.DrawUserIndexedPrimitives<VertexPositionNormalTexture>
(
    PrimitiveType.TriangleList,
    render.Item.Points, // Array of VertexPositionNormalTexture
    0,
    render.Item.Points.Length,
    render.Item.Indexes, // Array of int indexes (triangulation)
    0,
    render.Item.Indexes.Length / 3,
    VertexPositionNormalTexture.VertexDeclaration
);

sentences:
How do I modify textures in SDL with direct pixel access? I'm trying to use SDL_LockTexture and SDL_UnlockTexture for directly editing pixels in a texture. I'm using SDL 2.0. Setting the pixel value using the following code doesn't modify the texture:

void *pixels;
int pitch;

SDL_LockTexture(mytexture, NULL, &pixels, &pitch);

// Set pixel 100,100 to blue
((uint32_t *)pixels)[100 * 100] = 255;

SDL_UnlockTexture(mytexture);

sentences:
Cocos2D: Upgrading from OpenGL ES 1.1 to 2.0 I have recently starting upgrading my ios game to the latest Cocos2D (2.0 rc), and I am having some difficulties upgrading my texture generation code to OpenGL 2.0.

In the old version I generated images with this code:

CCRenderTexture *rt =
[CCRenderTexture renderTextureWithWidth:WIDTH height:HEIGHT];

[rt beginWithClear:bgColor.r g:bgColor.g b:bgColor.b a:bgColor.a];

glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)nVerts);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);

[rt end];

But since OpenGL 2.0 works differently this code won't work. What is the best way to use the new OpenGL?

sentences:
How can I check the multisample quality level count? I can check it with ID3D11Device::CheckMultisampleQualityLevels(). So to use it I need to create the device: D3D11CreateDeviceAndSwapChain(). To call it I need to fill the DXGI_SWAP_CHAIN_DESC which, among others, specifies... the multisample quality level. Vicious circle.

Do I have to split D3D11CreateDeviceAndSwapChain() into creating the device and the swap chain separately? Or what?

sentences:
Questions about the details of implementing a component-based entity system I started reading about component-based entities, and overall it seems like a good idea, but many of it seems to skip over a lot of details and not give many real examples, so there are things that don't really make sense to me. Note that I'm also mainly talking about the architecture where components only hold data and act as keys that trigger systems to be run for that entity, but this still mostly applies with each component having an update method that's called by the entity.

When to think if it, many entities have things in common (like, for example, enemies with collision and physics), plus behavior that's specific to only that one kind of entity. Do I need to create lots of systems that are only good for one kind of entity, and are not at all generic/reusable?
How should components interact with each other? I heard of using message queues, but that seems like it would be slow, plus how would I stop it from queueing messages that will never be read? Or is just setting fields in the component (to be checked by the other system) considered good?
What's the best way to handle collision detection? A system that checks for collisions and sends events/stores the colliding objects in a component?  Would just giving the world/entity manager a method (that would freely be used by different systems) to find colliding entities that have a certain component be a good idea? Or is there another way?
How to handle animations changing based on events? if I have a component telling the animation component to switch to a certain animation, doesn't that make it so that the component can't be used with a different animation?
In 2D, how would drawing order be handled? Especially if there are multiple kinds of drawing systems?
With OOP you can store a reference to an object in another object, and call methods on it. How would the equivalent be done with an entity/component system, considering entities are not guaranteed to have certain components?

So how are these issues normally solved? Or am I thinking about this completely the wrong way?

sentences:
How to make a more accurate lap time? get_timer() LIMITATION? In the room there are 22 cars. All cars have a different speed.

The cars are numbered from 1 to 22 with the help of the variable carNumber.

CODE - obj_Car / Set car speed (Create Event):

velocity=10-((carNumber-1)*0.01);

Here's how there is a difference in car placement near the end of the lap:

However, even with this difference, the times of many cars are repeated:

The detection of lap time looks like this.

CODE - obj_Car / Time lap (Collision with obj_Finish) :

other.orderLapTime[car]=get_timer()-other.discount;

Discount = this is the exact time when the room starts (cars already start running).

CODE - obj_Finish / Set discount (Create Event):

discount=get_timer();

The display is made with a modifier (multi, to simulate actual track times).

CODE - obj_Finish / Draw time lap (Draw Event):

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i]*obj_Seth.multi/1000000,1,3));

Even taking the multiplication and increasing the number of decimal places, there are still many repeated times:

Some inconsistencies including. Cars with slower speeds marking faster times.

I could slow down the base speed (10) to solve such a problem, but I already think in the long run. The races can't take so long. In addition I intend to give the player the option to set the speed with which the race takes place (a multiplier, more frames, etc).

It could also increase the difference between the speeds (0.01 to 0.05), but I would like a general resolution, so that I can notice through the lap time, if only by one thousandth (0.001).

EDIT 1 - Attempts made based on answers and comments from Bálint and TomTsagk:

That is what I tried to do.

CODE - obj_Car / lap time (Step Event):

unit+=velocity/60*0.001;

Below the results...

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,3));

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,5));

The speed difference between the cars is 0.01.

sentences:
Unity3d - Find out if current animator animation is playing? I need to call a function immediately after animator animation finished playing, I know I could solve this by adding an event to my animation, but I try it without.

How can I find out if the current animator animation is playing?

On normal legacy animations I solved it by writing a coroutine:

public static IEnumerator playAndWaitForAnim(Animation anim, string clipName, Action callback)
{
    anim.Play(clipName);

    //Wait until Animation is done Playing
    while (anim.IsPlaying(clipName)) {
        yield return null;
    }

    //Done playing. Do something below!
    callback();
}

Which I use like this:

StartCoroutine(AnimationHelper.playAndWaitForAnim(
    myAnimation,
    "ToSettings",
    () => {
        Debug.Log ("Finished playing");
    }
));

But how does this work with mecanim animator animations?

sentences:
Continuously get keyboard input from user and remember last character [Java] I want to write a Snake game in Java. How can I continuously monitor input and if user pressed W set variable Char lastDirection = 'w'; //hence, Direction.UP?

I know about the Scanner method: Scanner scan= new Scanner(System.in);... But then user would have to hit enter each time he presses the button. Document Listener (Swing) seems better, but then I would have a long string of user input saved somewhere that I don't need. What is the right method for listening to keyboard and remembering the last character?

sentences:
How can I keep chase camera behind player when player rotates? I have implemented a follow camera in Unity 3D. However, if the player object rotates, the camera does not rotate with it. To fix this I used RotateAround as follows:

playerRotation = CastPositive(player.EulerAngles.y) //guarantees 0-360
cameraRotation = CastPositive(transform.EulerAngles.y)
difference = playerRotation - cameraRotation
transform.RotateAround(player.position, Vector3.up, difference * time.deltaTime)

This works in general. However at some point the difference snaps from -50 to 210. When this happens, the camera swings in the opposite direction all the way round the player object, instead of continuing on its orbit.

How can I avoid this value jump?

I've tried clamping the various values to no avail, but maybe I've missed something?
Quaternions?

sentences:
2D isometric: screen to tile coordinates I'm writing an isometric 2D game and I'm having difficulty figuring precisely on which tile the cursor is. Here's a drawing:

where xs and ys are screen coordinates (pixels), xt and yt are tile coordinates, W and H are tile width and tile height in pixels, respectively. My notation for coordinates is (y, x) which may be confusing, sorry about that.

The best I could figure out so far is this:

int xtemp = xs / (W / 2);
int ytemp = ys / (H / 2);
int xt = (xs - ys) / 2;
int yt = ytemp + xt;

This seems almost correct but is giving me a very imprecise result, making it hard to select certain tiles, or sometimes it selects a tile next to the one I'm trying to click on. I don't understand why and I'd like if someone could help me understand the logic behind this.

Thanks!

sentences:
Why does editing the client's memory in some MMOs allow them to cheat? Why editing the memory of the game client works? Why so many "Hack protection" tools coming with the clients?

If I were to design a client-server game, everything would happen at the server (the simulation of the game world) and clients would be only passive consumers receiving status updates of the part of the world near their characters, sending only some information like keystrokes or move/action commands. Maybe I missing something here, but with that design, any hack like raising my STR by 200 in the client memory (if the value is present at all), just won't have any effect.

The only explanation I can think is that games in which memory editing works let parts of the simulation run in the client and the server then just synchronize all the clients periodically. I can understand that design for Real Time Strategy games with a fixed number of players once a match is configured, but, why in MMORPGs? Is it a strategy to reduce server load?

sentences:
Why does this geometry shader slow down my program so much? I have an OpenGL program, and I'm rendering a terrain mesh. I displace the vertices in the vertex buffer and don't really color them in the fragment shader yet. I'm adding a geometry shader one part at a time.

Before I added the geometry shader, when I was just programming the fragment and vertex shading steps of the pipeline, I was getting framerates of about 30+. Enough that I couldn't notice any choppiness. After adding the geometry shader, I get around 5 frames per second. Why? This is the entirety of the geometry shader:

#version 420

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

void main()
{
    for (int i = 0; i < gl_in.length(); i++)
    {
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Isn't this exactly what OpenGL was doing without the geometry shader?

sentences: How to use an A* Pathfinding System across uneven environments? I am developing a game in Unity3D. I want an enemy character to follow the player around. The problem is, my surface is uneven and full of mountains. I am using aarongranberg's pathfinding project. Every time that a player climbs a hill or a mountain, the enemy stops because the grid is flat and it considers the mountain to be an obstacle. How do I solve this problem ?

sentences:
Creating a static 2D background at runtime I'm using unity for a 2D game.

We have a lot of props for grass, plants, flowers, etc that are static and always in the background. I'd like to optimize the background and reduce the drawcalls as much as possible by making a big image with the final result of the background.

The idea would be to draw on a texture all the elements in the background, and then use this texture as the background. This way a single element has to be drawn.

How can I create these background texture at runtime, so it is generated as soon as the scene is loaded?

sentences:
Space Invaders: Getting the aliens to move as one I'm having issues getting my invaders to move together. Currently they hit the edge of the screen and then go crazy.

Here is the code for the Alien:

#include "Alien.h"
#include <iostream>
#include <stdlib.h>
#include <time.h>
Alien::Alien()
{
}

void Alien::Init(ISprite * a,  float hp, float vp, int sValue)
{
    srand(time(NULL));
    alien = a;
    horizontalPos = hp;
    verticalPos = vp;
    rev = false;
    bombInterval = float(rand() % 10 + 1);
    lastDropped = 0;
    scoreValue = sValue;
    alive = true;
}

bool Alien::testCollision(Rocket R)
{
    if(R.getX() >= horizontalPos &&
       R.getX() <= (horizontalPos + 32) &&
       R.getY() >= verticalPos &&
       R.getY() <= (verticalPos + 32)) {
           return true;
}

    return false;
}

void Alien::Update(float move, DResourceManager& drm)
{

    if(rev){
            horizontalPos -= (move);
    }
    else{
        horizontalPos += (move);
    }

    if(horizontalPos >= (640-32))
    {
        drm.alert();
    }
    if(horizontalPos < 32)
    {
            drm.alert();
    }
        // Check to see if we are colliding with any rockets.
        if(drm.getRocketCount() > 0)
        {
            for(std::vector<Rocket>::iterator roit = drm.getRockets().begin(); roit != drm.getRockets().end(); ++roit) {
            if(roit->alive){
                if(testCollision(*roit))
                {
                    setDead();
                    roit->setDead();
                    drm.getRockets().erase(roit);
                    return;
                }
            }
        }

    }
}

int Alien::getScore()
{
    return scoreValue;
}

void Alien::reverse()
{
    rev = !rev;
}

bool Alien::isAlive()
{
    if(alive){
        return true;
    }

    return false;
}

void Alien::setDead()
{
    alive = false;
}
float Alien::getX()
{
    return horizontalPos;
}

float Alien::getY()
{
    return verticalPos;
}

void Alien::setPosX(float x)
{
     horizontalPos += x;
}

void Alien::setPosY(float y)
{
     verticalPos += y;
}

void Alien::draw()
{

        alien->draw(int(horizontalPos),  int(verticalPos));
}

void Alien::destroy()
{
    alien->destroy();
}

Alien::~Alien(void)
{
}

And the update and draw functions of my DResourceManager class.

void DResourceManager::update(float time)
{
    player->update(time, this);
    int direction = 1;
    float max = 0;
    float min = 0;
    for(std::vector<Alien>::iterator it = aliens.begin(); it != aliens.end(); ++it)
    {
        if(it ->isAlive()){
            it->Update(time, *this);
        }
    }
    if (rev)
    {
        for(std::vector<Alien>::iterator it = aliens.begin(); it != aliens.end(); ++it)
        {
            it->setPosY(5);
            it->reverse();
            rev = false;
        }
    }

    // Update rockets if we have any.
    if(rocketCount > 0){
        for(std::vector<Rocket>::iterator roit = rockets.begin(); roit != rockets.end();     ++roit) {
            if(roit == rockets.end()){
                return;
            }
                if(roit->alive){
                    roit->update(time);
                }
            }
    }

}

/* Draw all objects to the screen */
void DResourceManager::draw()
{
    player->draw();

    for(std::vector<Alien>::iterator it = aliens.begin(); it != aliens.end(); ++it) {
        if(it->isAlive())
            it->draw();
    }

    for(std::vector<Rocket>::iterator it = rockets.begin(); it != rockets.end(); ++it) {
        if(it->alive)
            it->draw();
    }
}

Your help with getting these aliens to move as one would be much appreciated.

sentences:
Unity Custom EventManager, multiple arguments, and order I have some hard question for me...
I have a nice EventManager, who handle multiple arguments. (no argument, one int, one bool, a GameObject and a bool... but for each sort, I have to create a special dictionnary for this...

public class EventManager : SingletonMono<EventManager>
{
        //here I have many, many class who handle all sorte of different arguments...
         private class UnityEventInt : UnityEvent<int>  {    }

        //here definition of all dictionnnary for each class...
        private Dictionary<GameData.Event, UnityEvent> eventDictionary;
        private Dictionary<GameData.Event, UnityEventInt> eventDictionaryInt;

    private void Awake()
    {
        Init();
    }
    void Init()
    {
        //here initialise all dictionnary
        if (eventDictionary == null)
            eventDictionary = new Dictionary<GameData.Event, UnityEvent>();
        if (eventDictionaryInt == null)
        eventDictionaryInt = new Dictionary<GameData.Event, UnityEventInt>();
        //...
    }

    //One of the startListening
    public static void StartListening(GameData.Event eventName, UnityAction<int> listener)
    {
        if (!Instance)
            return;

        UnityEventInt thisEvent = null;
        if (Instance.eventDictionaryInt.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new UnityEventInt();
            thisEvent.AddListener(listener);
            Instance.eventDictionaryInt.Add(eventName, thisEvent);
        }
    }

    //one of the stop
    public static void StopListening(GameData.Event eventName, UnityAction listener)
    {
        if (EventManager.Instance == null)   //au cas ou on a déja supprimé l'eventManager
            return;
        UnityEvent thisEvent = null;
        //si on veut unregister et que la clé existe dans le dico..
        if (Instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }

    //and one of the trigger
    public static void TriggerEvent(GameData.Event eventName, int param1)
    {
        if (EventManager.Instance == null)   //au cas ou on a déja supprimé l'eventManager
            return;
        UnityEventInt thisEvent = null;
        if (Instance.eventDictionaryInt.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(param1);
        }
    }

And... when I want, in some script I do:

EventManager.StopListening(GameData.Event.PlayerAddScore, SomeFuncntion);
EventManager.StartListening(GameData.Event.PlayerAddScore, SomeFuncntion);

EventManager.TriggerEvent(GameData.Event.PlayerAddScore, 1);

here SomeFunction take 1 argument, but if i wanted to have 2... i have to hard code the case in my EventManager

So... My question is... how can I make that dynamic ? with only one Dictionary ? with only one list ? with good OOP or something ?

And secondly, how can I handle order or the call ?
Let's say 2 functions are listening for PlayerAddScore from 2 different script, how can I handle an order between the 2 function ?

Thanks you for help.

sentences:
Loss of texture detail in XNA (Banding 16 bit issue) I'm loading in a background texture for my game, it's not vert detailed, it's just there too add some variance. The problem is that there looks like a large reduction in detail. I've included images below so you can see what I'm talking about. What would cause this to happen and how can I get my detail back?

More info:
 Verticies are VertexPositionTexture
 Load method Texture2D.FromStream
 Effect BasicEffect

Also the project is a Silverlight/XNA mix

Source Image:

Image from game:

Note: the images don't match up completely but you should get the idea.

sentences:
UE4 Navmesh precision I'm trying to make my very tiny man pathfind his way through a map of a school but the navmash won't recognize some of the hallways cause they are very narrow like this.

So as you can see the man can fit but the navmesh says no so can anyone help and keep in mind that i am very new to unreal engine so please make your explanation easy to understand.

sentences:
Unity: How to work with forms Today I learned some cool tricks about sizing containers and its children, I mainly using this, because I need to build some forms.

But now... It is some preffered way how to handle forms? Or some unity component? I imagine something like get values of all InputFields, when the button is clicked.
Originaly I had script, which cycled through all children of container, registered them and I could from the script call method to get values in array. But now I have input fields in the more complex structure, for using of unity scripts for sizing and placement, so the cycle is now not so easy.
So, does unity have some script, or there is some unified way how to do this? How do you handle the forms? And of course, the biggest question, how do you handle standard behaviour as tabing through input fields and submit all on enter press?

sentences:
How do I restrict the movement of a point to within a radius of another? I have a situation where a sprite's center point needs to be constrained within a certain boundary in 2D space. The boundary is circular, so the sprite is constrained within a radius. This radius is defined as a distance from the center of a certain point.

I've got this code, but it only tells me when the center has overstepped the allowed radius:

float distance = Vector2.Distance(centerPosition, spritePosition));
if (distance > allowedDistance) {
    // Point is outside allowed range
}

I would like to also return the sprite's center to the closest point within that radius whenever it oversteps the bounds.

How can I do that?

sentences:
Lua GameDev iOS - Code on win and mac I am searching for a simple framework like http://getmoai.com where you can simply code a game in lua for iOS. I want to build it along with a friend. I am using a Mac, he prefers windows so the fw needs to be used in Windows 7. Preferably something like LOVE2D but then offcourse also for iOS!

Thanks in advance

sentences:
How to ignore one unity package in source control I've just installed the Unity quick search package. This is an editor extension which each developer should choose if they want installed or not. My problem is that because this was added as a package it also made changes to my project which would end-up in our repository.
The changes are:
Project root/
|── Assets/
|   |── Assets.index
|   └── Assets.index.meta
|── Packages/
|   |── manifest.json
|   └── packages-lock.json
|── UserSettings/
    └── QuickSearch.settings

Questions:

Should this files be added to source control?
How can I ignore the changes in manifest.json and packages-lock.json without filters?

sentences:
Offscreen waypoint indicator using X and Y screen position I was wondering how I could achieve an offscreen indicator effect that helps direct the player to the next waypoint.  My game is 3D, most solutions I have found are for 2D games (i.e Asteroids).
See this example of Warzone.  I have highlighted the parts that I am interested in creating.

The engine I am using has an API call to convert from world to screen position.  This only returns the X and Y components though.  Do I need the Z component to achieve what I am after?
From what I understand so far:

Check if target is off screen
If off screen convert 3D world position to 2D screen position (only X and Y components)

The Math for snapping the 2D UI icon to the side of the screen so it moves around is where I get lost.  I read something about slope intercept is something that can solve this but am not sure how to apply it to my problem.
If it helps I will be writing this in JavaScript, however, I'm not after a language specific solution, am really interested in understanding the Math so I can write it myself for any language.

sentences: Unsure how to decide ray intersection interval I'm coding an intersection algorithm with AABB, as found here. However, I'm absolutely unsure what to pass in as t0 and t1. The paper states that it's a ray intersection interval, but the only material I've been able to find on this is that it's some kind of guess or bound as to the final values. Any suggestions as to how to define t0 and t1?

sentences:
SpriteKit - How to jump to specific position? I'm would like to achieve something like Object A will jump to position A in parabolic way. For example:

I am able to make the object jump but i do not know how to calculate to make the object jump to the precise location.

sentences:
How to solve ArrayList outOfBoundsExeption? I'm getting:

    09-02 17:15:39.140: E/AndroidRuntime(533): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
    09-02 17:15:39.140: E/AndroidRuntime(533):  at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)

when I'm killing enemies using this method:

    private void checkCollision() {
    Rect h1 = happy.getBounds();
    for (int i = 0; i < enemies.size(); i++) {
        for (int j = 0; j < bullets.size(); j++) {
            Rect b1 = bullets.get(j).getBounds();
            Rect e1 = enemies.get(i).getBounds();
            if (b1.intersect(e1)) {
                enemies.get(i).damageHP(5);
                bullets.remove(j);
                Log.d("TAG", "HERE: LOLTHEYTOUCHED");
            }
            if (h1.intersect(e1)){
                happy.damageHP(5);
            }
            if(enemies.get(i).getHP() <= 0){
                enemies.remove(i);
            }
            if(happy.getHP() <= 0){
                //end-screen                           !!!!!!!
            }
        }
    }
}

using this ArrayList:

        private ArrayList<Enemy> enemies = new ArrayList<Enemy>();

and adding to array like this:

   public void createEnemies() {
    Bitmap bmp = BitmapFactory.decodeResource(getResources(),
            R.drawable.female);
    if (enemyCounter < 24) {
        enemies.add(new Enemy(bmp, this, controls));
    }
    enemyCounter++;
}

I don't really understand what the problem is, I've been looking around for a while but can't really find anything that helps me. If you know or if you can link me someplace where they have a solution for a similar problem I'll be a very happy camper!

sentences:
How to manipulate 2d image as different objects Hello Im very new to this so I don't even know what this process is called exactly.
Im posting image of flappy bird here in which it consist all the objects day, night, birds, font etc Here :

So how to use them in 2D game? this is just example i have used. How to manipulate different objects at different coordinates ? Thanks.

sentences:
Are metal slug art assets free use? I'm making a mobile game and I've gotten by with completely free art assets so far, but I have an explosion from metal slug. I love it and it's perfect, but I don't want to get sued. I've seen metal slug art assets posted around the internet on various clip art websites, but haven't found any statements outright saying they're free to use in one's own commercial application.

Could someone show me a link saying whether or not metal slug assets are free to use?

sentences: What is the difference between OpenGL ES and OpenGL? Android uses OpenGL ES, what is the difference between it and OpenGL?

sentences: NullReferenceException when importing model This error most certainly is not caused by an error in my Script. I don't know where it came from, I don't know why it's here and I don't understand what problems it causes because everything seems to work just fine. But I've been getting this error for quite a while now every single time I run the Game Engine:

sentences:
How to know if mouse coordinates is delta or absolute on Window and Android in Unity? I wrote sample application, that allows to "rotate" object by mouse. Rotation occured by rotating of camera object around central object and the code is following:

float mouseX = -Input.GetAxis("Mouse X");
float mouseY = -Input.GetAxis("Mouse Y");

float magnitude = transform.position.magnitude;

Vector3 mouseSwipe = new Vector3(mouseX, mouseY, 0);
Vector3 startPoint = new Vector3((float)camera.pixelWidth / 2, (float)camera.pixelHeight / 2, magnitude - 1);

Vector3 startPointWorld = camera.ScreenToViewportPoint(startPoint);
Vector3 endPointWord = camera.ScreenToViewportPoint(startPoint + mouseSwipe);

Vector3 mouseSwipeWord = endPointWord - startPointWorld;

float dragLat = mouseSwipeWord.y;
float dragLng = mouseSwipeWord.x;

Vector3 oldPosition = transform.position / magnitude;

float lat = Mathf.Asin(oldPosition.y);
float rsmall = Mathf.Acos(oldPosition.y);

float lng = Mathf.Atan2(oldPosition.z / rsmall, oldPosition.x / rsmall);

lat += dragLat * 10 * 2 * Mathf.PI;
if( lat*180/Mathf.PI > 80 )
{
    lat = 80 * Mathf.PI / 180;
}
else if( lat*180/Mathf.PI < -80)
{
    lat = -80 * Mathf.PI / 180;
}

lng += dragLng * 10 * 2 * Mathf.PI * 2;

float y = Mathf.Sin(lat);
rsmall = Mathf.Cos(lat);

float x = rsmall * Mathf.Cos(lng);
float z = rsmall * Mathf.Sin(lng);

Vector3 newPosition = new Vector3(x, y, z);
newPosition *= magnitude;

transform.position = newPosition;

LookAtTarget();

The code assumes that mouse returns delta value on each swipe and this works well on Windows. For example, if I do several separate swipes, I can gradually rotate object for full circle.

Unfortunately, when I run this on Android, it doesn't happen. Each swipe object restarts from some position, depending on swipe point. I.e. on Android, swipes return in absolute value.

Is it possible to know, whether swipes retunrs delta or absolute values and how? Is it possible to claim compatible return units?

sentences:
Procedual terrain generation and biomes/predetermined variation So I already have some (currently 2D possibly 3D later) simplex noise generation going, and with some experimenting I can make a map for plains, hills, mountains, etc

The problem now is I want to combine those together to create a larger more interesting map. For each "pixel" in the height map I provide/generate a biome type which has a bunch of parameters to define how the height value is calculated etc. i.e. I want to be able to say mountains here, river through there, flood plains next to it, etc and have them blend together.

The problem is this leaves nasty borders since between them even the simplex input values change suddenly (due to the x/z scaling being different, perhaps not the best way?). I considered just doing like a post process to smooth out the height values along the borders, but this would still leave often steep (and uninteresting near constant gradient) slopes since I could have a valley one side and a mountain peek the other side.

I am sure there must be a better fairly standard way to do this, but have not found much searching around, at least for this sort of noise function (midpoint displacement can be seeded with initial values at a low resolution, but doesn't seem viable if not generating the entire map at once)

double getHeight(int x, int z, Biome biome)
{
    double nx = x;
    double nz = z;
    nx *= biome.xzNoiseScale();//e.g. 1/64
    ny *= biome.xzNoiseScale();
    double noise = fbm(nx, nz, biome.noiseOctaves(), biome.noiseLacunarity(), biome.noiseGain());
    return biome.baseHeight() + noise * biome.heightVariation();
}

double fbm(double x, double z, int octaves, double lacunarity, double gain)
{
    double amp = 1;
    double freq = 1;
    double sum = 0;
    for (int i = 0; i < octaves; ++i)
    {
        sum += amp * noise(x * freq, y * freq);
        amp *= gain;
        freq *= lacunarity;
    }
    return sum;
}

sentences:
Why do mesh classes still contain vertex arrays if VBO's exist? I find I'm a bit confused about the practical use of resource management in combination with memory not tied to the CPU. Correct resource management is often recommended in game tutorials, books and on websites to ensure the same heavy data is not loaded in memory more than once, but cached and passed out whenever needed. This seems to be a valid idea and I've built a couple of resource management classes more than once.

Resource caches work perfectly for, say, level data or audio files, but my understanding always comes crashing down as soon as we're talking about memory residing on the GPU (vbo's, textures). It would seem to me that a mesh resource class should have to store nothing more than a vbo index, yet every mesh class I look at (e.g. Ogre3D) manually stores vertex lists in mesh classes. I can't seem to grasp why that is done. What's the use of vbo's if you're storing the mesh data in your usual memory anyway?

This question is not about how vbo's work (I understand them conceptually), but more about how they're practically applied in game development.

Could someone please elaborate?

sentences:
ASP.NET MVC & SQL Server vs. PHP & MySql I'm going to develop a strategy browser-based game with ASP.NET MVC and SQL Server.

However, as I explored the web to get some ideas and patterns from existing games, I found out that none of them developed by .NET tools.

So, it made a question for me that what's the reason behind this...:

1) Is there any big draw back for microsoft technologies in this area?

2) Why all of games in this field are developed with PHP & (maybe1?) MySql?

3) Is there any performance issue with above mentioned microsoft technologies in this area?

Thanks in advance

sentences:
How to use a normal map for light effects with an AnimatedSrpite? I am trying to add light effects with normal map on an AnimatedSprite. I was following that tutorial but with no success.
I am using a Ligth2D, this sprite sheet:

and have created a shader on Material to apply the normal map with this code:
shader_type canvas_item;

uniform sampler2D normal_map;

void fragment(){
    NORMAL = 2.0 * texture(normal_map, UV).rgb - 1.0;
}

Here is the result:

One can observe a light reflection on the left upper of the hourglass, but the light is neither smooth nor consistant.
NB: I have made the spirte sheet myself, feel free to use it.

sentences:
Why don't raytracing algorithms include the speed of light? From what I understand about ray-tracing, it is instantaneous in its speed from the light source to the user. Is there a type of ray-tracing where the "rays" move at the speed of light or are affected by gravity? Such methods would be useful in simulating large scale systems (like planets).

Also, can the same method be applied to sound?

sentences:
Manually update rotation of only Y-axis on Agent I have some code to manage to rotation of my Navmesh agents:

if (Agent.isActiveAndEnabled && Agent.hasPath)
        {
            if (Agent.velocity.sqrMagnitude > Mathf.Epsilon)
            {
                transform.rotation = Quaternion.LookRotation(Agent.velocity.normalized);
            }
        }

It's causing my some issues with some odd rotations on the x/z axis for 1-2 frames every now and then, is there some way I can get this exact behaviour but only modify the y-axis?

sentences:
How to get which gameobject the mouse is over in Unity? So I'm working on a simple drag-n-drop based trading card game for my own amusement.

There is a card inspector included.

What I want to achieve is to change values in the inspector (which has its own Inspector.cs, so I would change the variables in it) based on which card I hover over with my mouse.

Each card has its own Card.cs attached from which I want to read the values of the current card.

If I try to do this from within the Inspector.cs by something like this: Name.text = gameobject.GetComponent<Card>().Name;, then obviously it won't work, because using gameobject in the current context is not valid.

So solution No1 would be to properly reference the gameobject over which the mouse is, which I don't know how to do.

When I try to do the same from within Card.cs, I cannot use an event trigger OnPointerEnter and run the code through that, because I have to have a reference to the gameobject that contains that function. ( And I cannot do that in a prefab, only in gameobject already existing in the level.)

So could anyone tell me how I could achieve what I want, please?

sentences:
Find hexes on a hex grid given an angle I'm trying to find an elegant solution to calculating the x, y values of hexes that are crossed or intersected by a line or ray at a given angle from a given hex position on a hex grid. I do not want to use linear interpolation with an end point. I want a function that can calculate values to an arbitrary length with just the the angle. Pretend someone is standing at hex 4, 4 and shoots a bullet at angle 30. Which hexes will it cross? In the case of angle 30 where the angle is exactly between two hexes, default to the clockwise hex. I think there must be an elegant solution and at a certain point the number of "straight" moves vs. shifts "right" or "left" must form a repeating pattern. Furthermore, for a given angle, it will only shift right or left at some repeating interval, but never both. How do you calculate this? My grid uses x, y, (z) coordinates with "pointy top" hexes.

The function I'm trying to write would look like this: getXYOffsets(angle):Array of int;

The return value being a list of x, y offsets used to calculate the next hex's xy indefinitely (like I said, the offset pattern will repeat at some point).
For example, angle 0 will return an array of [1, 0] because a line shot that direction will move in the x direction infinitely and I just loop over that 2 value array to find my next x, y coordinates indefinitely.
For second example, angle 30 will return an array of [0, 1, 1, 0] because I would draw my line from 0, 0 -> 0, 1 -> 1, 1 -> 1, 2 -> 2, 2... indefinitely.
Obviously, less roundable angles will give longer returns arrays because you might have straight stretches that last a long time before finally "shifting". That's ok. I'll limit that after I get a solution to this math problem.

I just know this calculation is possible but my math is too weak to solve it. Any help would be SO appreciated!

sentences:
Season system Implementation system in unity So I am planning on implementing a seasons system for a 2D top-down game. Each season will have a characteristic terrain feature e.g. summers will have patches of grass spread out .. which I wanna reproduce by green bloat spread around on a 2D plane or quad...  These features will need to generate dynamically for every season. The implementation will be simplistic nonetheless... using green bloats for grass patches, blue bloats for waterholes.. Can you guys give me like pointers to solve this problem?

Some Reference images:-

Notice how the backdrop/background changes for each season
Green Patches denotes grass
Light blue denotes unfrozen water, dark blue denotes frozen water
These bloats are to be generated dynamically, with some conditions like frozen water and unfrozen water need to spawn next to each other

Summer Season #### Monsoon Season #### Winter Season ##

sentences:
How to properly scale SCNNode so SCNPhysicsShape would be scaled for model too? It stays in old size I wrote a script that would match all models in one size, no matter the original size of source model. So now I have these models fit precisely in the scene, but unfortunately when I'm adding SCNPhysicsBody to them (with SCNPhysicsShape) - their colliders (shapes) are old-sized. They do not match the current scale of a node.
How to fix this?

sentences: Efficiently representing a dynamic transform hierarchy I'm looking for a way to represent a dynamic transform hierarchy (i.e. one where nodes can be inserted and removed arbitrarily) that's a bit more efficient than using a standard tree of pointers . I saw the answers to this question ( Efficient structure for representing a transform hierarchy ), but as far as I can determine the tree-as-array approach only works for static hierarchies or dynamic ones where nodes have a fixed number of children (both deal-breakers for me). I'm probably wrong about that but could anyone point out how? If I'm not wrong are there other alternatives that work for dynamic hierarchies?

sentences:
Unity 2D map and walkable collisions I have a 2d player who can only walk on black area. There is a red collider so player can't walk past it.

Player has capsule collider.

The problem is player can't walk toward the edge with his feets becasue of the it's collider. But player would probably want to walk toward the edge.

Here is a sketch I've made.

Is there a way to tweak this ?

sentences:
Unity 2D - Object following target instead of moving towards it I'm making a 2D game with Unity that's based on avoiding/evading enemies.
The problem i'm facing right now is i can't get the enemies to move towards the target/player, but instead they follow it. So they never actually "attack" because they only follow it around and don't even come close to it. Also if the target/player stops moving, they stop moving.

I'm wondering if it could be something in my scene, since i've asked this question on multiple forum threads in the unity forums section and everyone seems to answer with the same lines of code.

Extra information:

My enemy has a box collider on it with no rigidbody 2D.
My player has a box collider on it with a rigidbody 2D.

Kind regards.

using UnityEngine;
using System.Collections;

public class BeeBehaviour : MonoBehaviour {

  public Transform target;
  public float moveSpeed = 3;

  void Start () {
    target = GameObject.Find("MainObject").transform;
  }

  void Update () {
    Chase();
  }

  void Chase () {
        Vector3 targetDirection = target.position - transform.position;
        transform.position += targetDirection * moveSpeed * Time.deltaTime;
  }
}

sentences:
Generate 4 vectors rotated in cardinal directions from a central vector There is some unit vector, which is a coordinate in a spherical space. It is necessary to obtain from it 4 vectors diverted in different directions (right, left, forward, backward) by a certain number of degrees. For these actions I use the following code:

Vector3 center = point;
Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
Vector3 right = Quaternion.Euler(30, 0, 0) * center;
Vector3 back = Quaternion.Euler(0, 0, -30) * center;
Vector3 front = Quaternion.Euler(0, 0, 30) * center;

The problem is that this works when point is equal or close to Vector3.up. When deviating from the vertical position, the lateral vectors begin to "stick together".

Here is a visualization of what I need:

Test code is attached:

using System.Collections;
using UnityEngine;

public class Test : MonoBehaviour
{
    public GameObject centerGO;
    public GameObject leftGO;
    public GameObject rightGO;
    public GameObject backGO;
    public GameObject frontGO;

    ArrayList list = new ArrayList();

    void Start()
    {
        SetCenterPoint(Vector3.up);
    }

    void Update()
    {
        DrawDebugRays();

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            SetCenterPoint(hit.point);
        }
    }

    void SetCenterPoint(Vector3 point)
    {
        Vector3 center = point;
        Vector3 left = Quaternion.Euler(-30, 0, 0) * center;
        Vector3 right = Quaternion.Euler(30, 0, 0) * center;
        Vector3 back = Quaternion.Euler(0, 0, -30) * center;
        Vector3 front = Quaternion.Euler(0, 0, 30) * center;

        centerGO.transform.position = center;
        leftGO.transform.position = left;
        rightGO.transform.position = right;
        backGO.transform.position = back;
        frontGO.transform.position = front;

        list.Clear();
        list.Add(center);
        list.Add(left);
        list.Add(right);
        list.Add(front);
        list.Add(back);
    }

    void DrawDebugRays()
    {
        for (int i = 0; i < list.Count; i++)
        {
            Color color = Color.red;
            switch (i)
            {
                case 0:
                    color = Color.green;
                    break;
                case 1:
                case 2:
                    color = Color.blue;
                    break;
            }
            Debug.DrawRay(Vector3.zero, (Vector3)list[i], color);
        }
    }
}

sentences:
Is the 'partially checked' build sufficient to run the debug version of Direct3D 9? To run Direct3D 9 in debug, it is necessary to "install a 'checked' version of the OS".

The checked version of Windows comes in both full and partial flavors. It seems that the partial version is much less obtrusive to install than the full version. But, will that be sufficient to run Direct3D 9 in debug mode?

sentences:
How can I effectively manage a hobby game project? How can I successfully finish a hobby game project in my free time?

How do I motivate myself to keep it up and drive right through to the finish without losing interest or motivation along the way?

sentences:
Get the game state using Multithreading in Java Monkey Engine 3 I’ve been trying out Java Monkey’s multi threading recently via the wiki’s tutorial. Since I just wanted to test a prototype clinet, I made a program which creates some cubes using the ‘Cubes’ library (hub.jmonkeyengine.org/wiki/doku.php/jme3:contributions:cubes), and then serializes it to some byte data (which is what the server would do to the map chunks near a player). The aim is to imitate a chunk being sent from the server, which would occur in a separate thread, as mentioned in the networking tutorial on the wiki (hub.jmonkeyengine.org/wiki/doku.php/jme3:advanced:networking).

Each chunk would have it’s own node to store it, and the chunk would be replaced if the server sent either an update of the chunk, or if the player moved into a new region (which would cause the chunk to be replaced). The code is here. The issue is though, is that I need to recreate an empty chunk before I can read from the bytes, which requires collecting the application settings. As well as this, I cannot modify the game scene within a separate thread (which the function does). The code below is from line 93+.

//...
//(In Update Loop)
if (future.isDone()) {
    //Binds the temporary data to the clone object
    blockTerrainClone = (BlockTerrainControl) future.get();
    future = null;
//...

Callable<BlockTerrainControl> serverInput = new Callable<BlockTerrainControl>() {
    public BlockTerrainControl call() {
        /*Creates a temporary data storage object, then assigns the data.
        I can't mutate the current BlockTerrainControl which is being rendered,
        as this is a seperate thread.*/
        BlockTerrainControl data = new BlockTerrainControl(CubesTestAssets.getSettings(app), new Vector3f());
        CubesSerializer.readFromBytes(data, serializedBlockTerrain);

        //Returns the data
        return data;
    }
};

The multithreading wiki article (near the bottom) does partially cover how to modify the scene and get access to the game state, but not into much detail. Would anyone be able to expand on that section, and explain how I may be able to transfer the blocks from the server to the client in a separate thread (or in this case, make the data transfer from one thread to another)?

If I missed out anything in the question, I'd be happy to add it!

sentences:
Can't work with universal tween engine while having added it to gradle I'm actually developing a game with libgdx and I'd like to create a splash screen. To do this, I must use the Universal Tween Engine. To add the Universal Tween Engine, I followed the instructions of the libgdx doc at this link: https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine

I created a new directory called "libs" in my project directory (not with Eclipse) and put on it the universal tween engine files I got by downloading the universal tween engine.
At this time, I had this:

After that, I made the edits in the dependencies sections of "build.gradle" (by adding this: compile fileTree(dir: '../libs', include: '*.jar') )

Then I tried to refresh the gradle dependencies (by right clicking on my core and android projects and pressing "refresh".)

After restarting eclipse, I tried to work with the universal tween engine by trying to import some of the tween engine (I typed on the top of my main class "import aurelienribon.tweenengine.TweenAccessor;").

The problem is that I got a problem message saying "the import aurelienribon cannot be resolved", even after trying to fix the project setup, I got a message saying that this problem is unresolvable.

What shall I do?

Thanks for your answers.

sentences:
What do you call the sounds that play when players place/destroy blocks? I'm working on a game and trying to find sounds for it. I'm not sure what terminology to use when searching to find the kinds of sounds I need.

Specifically I'm looking for sounds that make sense for when a player places or destroys a block in my game. What are these sort of incidental environment background effects called in general, so I can better refine my searches?

sentences:
Google Play 3rd Party Payment Allowed? Does Google allow 3rd party payment solutions to be enabled in developers' apps (i.e., Paypal, carrier/SMS payment), especially in countries where Google Checkout isn't present? Or does this violate any policy of theirs?

Please reference the policy in your answer if you can, and thanks in advance to all who answer.

sentences:
Multi-threading for rhythm game? I'm trying to recreate a rhythm game. However trying to get the key-presses with SDL2 I ran into the problem, that you can only get an event every time a frame has been successfully rendered (I can't poll the events from another thread than the main thread). As you could separate game-logic from rendering, I thought I could run the game logic (including the polling of the events) for every 1ms and render the screen for every 16ms (60fps).

I read some articles stating that it doesn't make much sense to use multi-threading for that usage, but 16ms are quite a lot of latency for a rhythm game (which has about 30ms to determine a better rating for a better high-score).
(The problem is also described here: Accuracy and frame-rate in a rhythm game)

EDIT: Here It's being said that multi-threading shouldn't be used:

What is the best way to handle event with SDL/C++

Now my question is:"Should I really not separate game-logic from render logic, as I don't need visual feedback for this kind of game and accuracy is more important"

sentences:
Having trouble setting a game object as a child of another. What is wrong here? So I'm trying to raycast on mouse click if it hits any thing make that object a child of the sender (in this case the parent). Below is my code...

public class PhysGun : MonoBehaviour
{
    private GameObject Player;

    void Start ()
    {
       Player = GameObject.Find("Player");
    }

    // Update is called once per frame
    void Update ()
    {
        Vector3 fwd = transform.TransformDirection(Vector3.forward);

        if (Input.GetMouseButton(0) && Physics.Raycast(transform.position, fwd, 10))
        {
            //this.transform.parent = Player.transform;
            transform.SetParent(Player.transform);
            Debug.Log("There is something in front of the object!");
        }

   }
}

The script is attached to a child of the player and I will eventually attatch it to a motion control (Vive).

What am I doing wrong exactly? I've tried multiple ways to do this and none of them work (or present any errors). Also to clarify the issue it's not parenting the game object hit by the ray cast to the Player like I want it to.

sentences:
Nine Patch Images in DirectX In Android development I found nine patch images very useful to draw images that have a fixed border. When the image is scaled the inner part scales, but the border stays at a fixed size.

I was looking for something similar in DirectX. Does anyone have information/pointers to nine patch images in DirectX?

sentences:
2D mouse coordinates from 3d object projection Not entirely certain of the nomenclature here -- basically, after placing a model in world coordinates and setting up a 3D camera to look at it the model has been projected onto the screen in a 2D fashion.

What I'd like to do is determine if the mouse is inside the projected view of the model.

Is there a way to "unproject" in the XNA framework?  Or what is this process called as, so that I can better search for it?

sentences:
Theory behind worm like movement? I don't want code or anything that will make this too easy for me, but I'm just starting the development of a little game and I want to add worms to it, I want the worms to be Terraria like. My current idea is to make the worm be composed of multiple entities, one being the head and the rest parenting each other leading downwards from the head. However, this in my opinion sounds inefficient and might be lag inducing when there are a large number of worms in the entity map. Does anyone have any other theories on how I can implement a worm- like movement?

Terraria worm video: http://www.youtube.com/watch?v=PhFR8bDQA5w

sentences:
About floating point precision and why do we still use it Floating point has always been troublesome for precision on large worlds.

This article explains behind-the-scenes and offers the obvious alternative - fixed point numbers. Some facts are really impressive, like:

"Well 64 bits of precision gets you to the furthest distance of Pluto from the Sun (7.4 billion km) with sub-micrometer precision. "

Well sub-micrometer precision is more than any fps needs (for positions and even velocities), and it would enable you to build really big worlds.

My question is, why do we still use floating point if fixed point has such advantages? Most rendering APIs and physics libraries use floating point (and suffer it's disadvantages, so developers need to get around them).

Are they so much slower?

Additionally, how do you think scalable planetary engines like outerra or infinity handle the large scale? Do they use fixed point for positions or do they have some space dividing algorithm?

sentences:
Is it considered poor programming to do this with xna components? I created my own Menu System that is event driven.

In order to have a loading screen and multithreaded loading to work, I devised this sort of implementation:

//Let's check if the game is done loading.
if (_game != null)
{
    _gameLoaded = _game.DoneLoading;
}

//This means the game is loading still,
//therefore the loading screen should be active.
if (!_gameLoaded && _gameActive)
{
    _gameScreenList[2].UpdateMenu();
}

//The loading screen was selected.
if (_gameScreenList[2].CurrentState == GameScreen.State.Shown && !_gameActive)
{
     Components.Add(_game = new ParadoxGame(this));
     _game.Initialize(); //Initializes the Game so that the loading can begin.
     _gameActive = true;
}

In the XNA Game Component that contains the actual game, in the LoadContent method I simply created a new Thread that calls another method ThreadLoad that has all the actual loading.

I also have a boolean variable called DoneLoading in the XNA Game Component that is set to true at the end of the ThreadLoad.

I am wondering if this is a poor implementation.

sentences:
Should Animations in Turn-Based Games Happen Before or After State Transitions? I'm planning a roguelike game and I'm unsure how to design for animations. Since a roguelike is turn-based, the game model is discrete and would have no intermediate states during an animation(?). I've come up with two possible approaches:

Perform state transitions immediately upon input and compute the animations that occurred. In the case of a moving character, draw the animation as a member of the destination tile (instead of the static sprite) and coming from the origin tile.
Compute animations before transitioning and transition the state asynchronously after the animation completes. Draw moving objects as members of their origin tile so that they arrive immediately before the state transition.

Do developers of this type of game tend to prefer approach 1 or 2 (or some third option) and why?

sentences:
Bullet Physics Integration - direct movement of rigid bodies I'm adding bullet physics to my engine. The physics simulation bits are all working nicely, but one bit I'm struggling with is being able to move objects using their co-ordinates, and then have them affect other bullet objects. I currently have this code just before I step the simulation, and this moves all of the objects to the co-ordinates that the game engine thinks the object should be, due to outside movement.

btTransform trans;
trans.setFromOpenGLMatrix(glm::value_ptr(host->getTransMat() * host->getRotMat()));

motionState->setWorldTransform(trans);
body->setWorldTransform(trans);

Then I step the simulation, and move every object to where bullet thinks it should be. I am aware there are nicer ways to do this part (custom written motionstate classes I think) but I want to get the logic down first. This works, but moving a cube directly into another causes the second cube to just shake a bit.

I've read in  few places I should be applying forces to objects, but:

I don't really want to expose the btRigidBody and physics stuff to the core gameobject, and
I have a lot of code that does it's own movements using co-ordinates, and I don't really want to rewrite it, although I will if it's the only way.

Could I replace the code below with something that compares the position of the gameobject to the rigidbody's position, and applies the correct force to make that happen? How would I implement this code? It can't be as simple as F = MA can it, given that this would happen any frame?

Edit 1:

I have implemented the formula provided by DMGregory and I've not had any success. I've tried swapping this out for applyCentralImpulse too. The objects just stay stationary and anything falling just goes into hyper speed. This runs for every  physics object just before step sim, and then the simulations positions are applied to back to their hosts.

    if (host == nullptr)return;

btVector3 newPos = convert(host->getPos());

btVector3 oldPos = body->getWorldTransform().getOrigin();

btVector3 dist = newPos -oldPos;

btVector3 acc = 2 * ((newPos - oldPos -( body->getLinearVelocity() * timeStep)) / (pow(timeStep, 2)));

if (dist.length() > btScalar(0.1f))
{
    std::cout << acc.length() << "large acc \n";
}

body->applyCentralForce(mass * acc);

sentences:
What is the kd tree intersection logic? I'm trying to figure out how to implement a KD tree.

On page 322 of "Real time collision detection" by Ericson

The text section is included below in case Google book preview doesn't let you see it the time you click the link

text section

Relevant section:

The basic idea behind intersecting a ray or directed line segment with a k-d tree is straightforward.  The line is intersected against the node's splitting plane, and the t value of intersection is computed. If t is within the interval of the line, 0 <= t <= tmax, the line straddles the plane and both children of the tree are recursively descended.  If not, only the side containing the segment origin is recursively visited.

So here's what I have: (open image in new tab if you can't see the lettering)

The logical tree

Here the orange ray is going thru the 3d scene.  The x's represent intersection with a plane.  From the LEFT, the ray hits:

The front face of the scene's enclosing cube,
The (1) splitting plane
The (2.2) splitting plane
The right side of the scene's enclosing cube

But here's what would happen, naively following Ericson's basic description above:

Test against splitting plane (1).  Ray hits splitting plane (1), so left and right children of splitting plane (1) are included in next test.
Test against splitting plane (2.1).  Ray actually hits that plane, (way off to the right) so both children are included in next level of tests.  (This is counter-intuitive - shouldn't only the bottom node be included in subsequent tests)

Can some one describe what happens when the orange ray goes through the scene correctly?

sentences:
How to stop jumping again when 3D character is in air (double jump)? I'm working on simple rpg and having some trouble with player jumping. I'm trying to use unity's raycast to check colliders under the player before jumping again. The problem appears that no matter how many tweaks I make to the distance or the validation of the canJump function, the raycast the player seems to at max jump twice. At lower levels the player can even hover if timed correctly. Could someone overlook my code since it appears that I might have a noob glitch somewhere?

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

public class Player : MonoBehaviour
{

    public float speed;
    public float jumpForce;
    public float turningSpeed;

    private bool canJump;

    void Start()
    {

    }

    void Update()
    {

        RaycastHit hit;
        if (Physics.Raycast(transform.position, Vector3.down, out hit, 1.01f))
        {
            canJump = true;
        }

        ProcessInput();

    }

    void ProcessInput()
    {
        if (Input.GetKey("right") || Input.GetKey("d"))
        {
            transform.position += Vector3.right * speed * Time.deltaTime;

        }

        if (Input.GetKey("left") || Input.GetKey("a"))
        {
            transform.position += Vector3.left * speed * Time.deltaTime;

        }

        if (Input.GetKey("up") || Input.GetKey("w"))
        {
            transform.position += Vector3.forward * speed * Time.deltaTime;
        }

        if (Input.GetKey("down") || Input.GetKey("s"))
        {
            transform.position += Vector3.back * speed * Time.deltaTime;
        }

        if (Input.GetKeyDown("space") && canJump)
        {
            canJump = false;
            GetComponent<Rigidbody>().AddForce(0, jumpForce, 0);
        }

    }
}

sentences:
loading 3d model data into buffers I am using assimp to load 3d model data. I have noticed that each loaded model is made up of different meshes. I was wondering should each mesh have it's own vertex/index buffer or should there just be one for the whole model? From looking through the index data that is loaded it seems to suggest that I will need a vertex buffer per mesh but I'm not 100% sure.
I am using C++ and DirectX9

Thank you,

Mark

sentences:
What is the name for a single 2D polygon on a UV Mapped texture? When UV Mapping a polygon/texture, is there name that describes a single polygon on the texture.

Does this name differentiate if from the same geometry once it has been mapped to a face?

Would sometime like "UV Tile" or "UV Face" be clear?

sentences:
How much mathematics is involved in video game development? I'm average at maths. Maybe a tad below average. If I was going into a normal career I'd be fine. But I want to create video games. Is a career in video game development still on the cards for me?

I want to be a creative director, but I don't just want to write screenplays, create 3D models and draw concept art (areas I excel at.). I want to actually touch the code. I've been learning web development now for 8 months, and I understand pretty in depth concepts such as serverside fragment caching, and it would damn depressing to throw all those skills away and just hire some programmers when I move into video games. I want to develop alongside them. Is developing video games (with a team) similar to web development, in that it's all OOP and logic but with relatively little arithmetic? I'm not on about creating a 3D engine, I'm sure that's filled with physics and theorems of momentum, I'm on about simply using a ready made 3D engine.

Do you need to be a substantially better at maths than most to develop video games?

sentences:
Front Face Culling with Shadowmapping To avoid shadow acne I usualy use front face culling which works great. But for my current implementation the mesh is a quite complex terrain (depending on the lod level) and than the shading (dot product of the normals face with the negative light direction) is not always correct as some normals are actually facing the light. But still there is no information in the shadowmap to shadow these fragments in the shadowmap because of the front face culling ( like it is not exact enough).
What I end up with, is that there are some bright spots in the shadowed area.
I am not really sure why this does not work, because that would mean, that the front face culling is also culling some back faces, if the mesh has a very high level of detail, right?

In the Image with Front Face Culling (top picture) you can see these bright lines in the shadowed area where as without FF Culling (bottom image) the shadowed area is completely black.

My current workaround is, that I check the highest LOD level that is currently displaying and than according to that switch back an forth between ff culling and bias.

I use OpenGL:

The front face culling:

glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);

The shading in the fragment shader:

float shading = max(dot(normal,-lightDir), 0.0);

sentences:
Unity: Animate Sprite Shape Sprite? Is it possible to animate a sprite shape?  I don't see the Sprite Shape Profile in the animator properties, so I was just wondering if there's another way to do that.
To clarify:
Our game is 2D animated by hand, and one level has conveyor belts that span the level.  We can animate it normally, but that will end up taking more video memory than if we were able to animate the conveyors as tiled sprite shapes.  It may not end up being worth the effort to save the memory, but I figured it was worth a shot.  Because the sprites span the level, they end up taking up lots of space in a sprite atlas.

sentences:
Add Atten property in Unity Shaderlab In Unity Shaderlab shader, Is there any way to apply _Atten value?
Using surface shader, and vertex/fragment shader I can do it easily.
But, I didn't find any reference to do that in Shaderlab syntax.

Shader "Diffuse" {
    Properties {
        _Atten ("Light Attenuation Power", Float) = 1.0 // <= how to apply?
        _Color ("Main Color", Color)            = (1,1,1,1)
        _MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
    }
    SubShader {
        Pass {
            SetTexture[_MainTex]
            {
                  constantColor [_Color]
                combine texture * constant, texture * constant
            }
        }
    }
}

this makes syntax error.

constantColor [_Atten * _Color]

sentences:
How to rotate model 180º with XNA I got a model, and a camera pointing at this model, I think my camera position is the problem.
Its showing the front of the model, but I want it to show its back like in third person.
My camera code is:

Vector3 thirdPersonReference = new Vector3(0, 100, -100);
public Camera(Vector3 landscapePosition, Player _player)
    {
        this.player = _player;
        rotationMatrix = Matrix.CreateRotationY(this.player.Rotation);
        Vector3 transformedReference = Vector3.Transform(thirdPersonReference, rotationMatrix);
        this.position = transformedReference + this.player.Position;
        viewMatrix = Matrix.CreateLookAt(this.position, this.player.Position, new Vector3(0.0f, 1.0f, 0.0f));
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, this.player.AspectRatio,
            1.0f, 1000.0f);
        terrainMatrix = Matrix.CreateTranslation(landscapePosition);
    }

What is that Im doing wrong???

sentences:
Strange deviations while implementing alpha compositing I've been trying to create my own 2d renderer for my game (for learning purposes) and I'm trying to implement alpha compositing. The formula I'm using is very trivial, which is color = alpha * src + (1 - alpha) * dest.

Everything seemed to be going and looking well until I started comparing it to existing 2d canvas implementations. I've tested my canvas against OpenGL, the JS canvas, and a BufferedImage in Java, and they have all been getting slightly different results to the formula I use.

For example, let's say I have a background with a red value of 1 and shape with a red value of 0.49 and an alpha of 0.026. From plugging in the values to the formula, I got a red value of 251.6187 (multiplying the original result by 255), which can be rounded to 252. However, every canvas implementation I've used returns a red value of 251.

I'm keeping all my color values in a float between 0 and 1. However, I've tried experimenting with rounding it to increments of 255 and it still had no effect. For the js canvas implementation, I simply multiply the 0-1 by 255. (BufferedImage and OpenGl both accept a float from 0-1)

Here is a program to illustrate the issue: https://editor.p5js.org/SarahJ/sketches/VTzi0r5c7

I initially thought I needed to apply round, floor, or ceil function to my result, but while that helped this example, it caused problems for others.

Is this not the alpha compositing formula that most 2D canvas implementations use, or am I doing something wrong? Any advice is appreciated. Thanks!

sentences: Finding enemy object in player's forward direction within a range I would like to know the way by which I can find enemy objects tagged with "player" in a forward direction within a range say 3 units from the player.

sentences:
Direct3D reducing DrawIndexed CPU usage I am trying to optimise some of my rendering to get is useable on lower end machines (in my case a 2GHz i5 laptop with a GT 520M).

A quick investigation showed that the GPU isnt actually getting to 100%, but both CPU cores are. While most of this is non-rendering stuff (which I can likely make faster), I was surprised to find the piece of code below is apparently using 10% (20% of a core).

void RenderStaticTerrain()
    SetShadersInputLayoutConstantsEtc();
    for region in regionsInView: //about 20
        region->SetVertexAndIndexBuffer()
        for texture in regoin->UsedTextures(): //around 100
            d3dContext->SetAsShaderResource(texture);
            d3dContext->DrawIndexed(...);

I used the Windows Performance Analyzer sample based profiling and that points at some AMD or Nvidia DLL's as being where the CPU spends its time, largely I believe within the DrawIndexed (found via QueryPerformanceCounter. The sampling results seemed to dump the dll time just in RenderStaticTerrain itself).

The textures, buffers, etc are all immutable usage so don't see anything obvious to consume CPU there like moving vertices about or anything like that.

Two idea I have which (both of which look like some work) is texture arrays and using a few very large textures containing the others. However I am not sure how viable either of those are, and if it would actually make any performance difference.

For texture arrays it seems I can have upto 2048 which is plenty. However I am not sure if the GPU is going happy with what seems to me like effectively random access via a vertex buffer field. The major problem  however is it appears all the textures need to have the same size, while most of mine are in the 32x32 to 128x128 range, with some even larger ones.

Another idea was to pack them into some really big textures, but this always seems to cause problems with mip-mapping and texture filtering, since even if I repeat each textures border pixel a few times, a few mip levels down and I have one pixel in the small texture being made from pixels of unrelated textures.

Not sure what other options there are. I am still not really sure why that loop uses much CPU at all.

The current code is only D3D11 targeting D3D11 hardware, but I do plan to support older hardware and OpenGL.

sentences:
Unwanted rotations with transform.RotateAround I didn't tough i would have issues with this, but unfortunatly I did. I have a Character (which is more a pile of cube) with a body, a empty GameObject for each leg attached to the body with a join and 2 cubes for leg too. The body and the two empty gameobject are child of a Empty gamebject. The 2 cube that represent leg are both child of one of the empty gameObject. What I want to achieve is to rotate the leg around the position of its empty parent by doing this:

if(Input.GetKey("l"))
    {
        l_leg.transform.RotateAround(l_leg.transform.parent.transform.position, new Vector3(1,0,0), 75 * Time.deltaTime);
    }

unfortunatly, I only want it to rotate on x, but all of the axis are changing, which lead to unwanted rotation. Now, I know rotations aren't independant like translations, but I don't know how to fix this. If possible, i'd prefer to rotate locked joint via script but I have now idea how, I haven't seen anything about it when I looked up]2

sentences:
Are dice-rolls for damage calculation bad design for a tactic focused game? I'm trying to come up with a combat system for a turn-based RPG that is inspired by pen & paper RPGs, but with more importance on positioning and strategy.

I feel like in games where a good strategy is important, a dice roll for damage calculation like in Dungeons & Dragons, etc is really bad, because your best strategy can and (eventually) will be ruined by a bad roll or a very good roll of the enemy.

The two most obvious solutions to prevent the player from this frustration are to do a fixed damage calculation without dice or to reduce the impact of the dice rolls, but they both just don't feel right.

So is it considered bad design to do a dice-based calculation model or is there a better approach to combine those two key features?

sentences:
How does Starcraft 2 load its metadata? Lets say you are playing Starcraft 2 melee map. The game loads the map.
Melee maps have the following dependencies:

Liberty (Mod)
Liberty Multi (Mod)

I think the game engine will load the data from Liberty (Mod) first, then from Liberty Multi (Mod). For data that exists in both dependencies, the engine will use the one from
Liberty Multi (Mod). Is this correct?

Liberty Multi (Mod) is updated with each patch of Starcraft 2.
Does the game engine load just the latest version of Liberty Multi (Mod)?
  or
Does the game engine load all the versions and overwrite duplicate data with the latest version?

sentences: How to eliminate roll rotation? Let's say I have Rotation(0, 0, 180) [pitch, yaw, roll]. How to do it that I would have Rotation(180, 180, 0) which is exactly the same?

sentences:
My texture is doing weird, either not loaded correctly or not rendered correctly. DirectX11 I'm loading a texture from a file called owl.png. But it renders really weird.

Original picture(512 X 512):

But it renders like this:

It's rendered on a square, that is initialized like this:

 { XMFLOAT4(-0.5f, -0.5f, 0, 0), XMFLOAT2(0,1) },
 { XMFLOAT4(-0.5f,  0.5f, 0, 0),XMFLOAT2(0,0) },
 { XMFLOAT4(0.5f,  0.5f, 0, 0), XMFLOAT2(1,0) },
 { XMFLOAT4(0.5f,  -0.5f, 0, 0), XMFLOAT2(1, 1) }

Where the XMFLOAT2 are the tex coords.
It's loaded like this:

ID3D11ShaderResourceView* m_texture;
DirectX::CreateWICTextureFromFile(device, fileName, 0, &m_texture);

My samplerDesc looks like this:

samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MaxAnisotropy = 4;

And I use the normal sample method in my PS.

What did I do wrong?

sentences:
Combine rotation XZ (horizontal) with YZ (vertical). Math formula I'm trying to make a rotation vertically and horizontally around a point at the same time but I'm not able to combine both.

I have this formula for the horizontal rotation:

camera.position.x = x * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - x * Math.sin(inc)

And this one for the vertical:

camera.position.y = y * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - y * Math.sin(inc)

I guess I need to use a Matrix, but not sure how. Here an example with Three.js:
https://codepen.io/josema/pen/xyQoga

sentences:
Occasional lag-spikes in performance in heavily optimized game (profiler screenshots included) So I've been working on a mobile-based platformer for a few years now. I've spent more than a year optimizing the game for mobile as much as I could. Almost every single one of my meshes are using Mobile/Diffuse shader. When I test the performance of my game (on my phone) with the profiler, the frame rate stays at clean 60 fps for the most part. The CPU time fluctuates between 16 ms and 17 ms. The rendering statistics are also excellent, with draw calls fluctuating between 18 and 25, triangles fluctuating between 1.0k and 2.0k and vertices fluctuating between 2.0k and 3.1k. Below is a screenshot of the Rendering profiler when the game is running smoothly. I believe that for a mobile device, these should be very good numbers.

However, every now and then, I see a spike in the profiler window (see below):

According to the profiler, the spike is being caused by Render.OpaqueGeometry.

Under normal scenarios (when the performance is smooth), Render.OpaqueGeometry takes between 1 ms and 2 ms of CPU time. However, as you can see in the screenshot above, Render.OpaqueGeometry is taking 5.36 ms of CPU time and the total CPU time has jumped to 24.16 ms.

Based on my observations, this spike shows up once or twice per minute. Sometimes, several minutes go by without any spikes. And in very rare occasions, the spike can show up 3 times in a single minute (although I don't think that happened the last couple of times I tested it).

So why do you guys think this is happening despite the game being heavily optimized? I read in a post in Unity Answers that Render.OpaqueGeometry spikes are frequent in all games and it's nothing to worry about. But do you think 2 spikes per minute is too frequent for a simple platformer?

sentences:
legal disclaimers and lisence type for a free multiplayer browser game I have created a multiplayer browser game. The game is completely free (donations are welcome) but I would like:

(a) to protect my concept in some way.
(b) to provide legal notes that the user should accept before registering.

In some games (i.e. Travian) there are legal notes such as Terms and Conditions, Privacy Policy. Should I include things like these? Where can I get/create such legal texts? I can barely afford hosting, not to mention a lawyer to write all those things for me.

What should I do?

Chris

sentences:
Multiple Object Collision SDL I figured this is would be the correct place to ask the following ...

1) How would I go about making multiple object collision detection (Bullets For Example)?

2) How would I make it efficient enough so that I can have many objects be able to detect collision of other objects.

The only idea I currently have is for each bullet to iterate through the other game objects and check collision individually. But that could/would have a terrible impact on time, considering that there can be many objects in the scene. I have also considered multi threading, but I really don't know how to apply it in game programming. Any Suggestions?

sentences:
Configure VR support that enables to "look" around and receive user input (Google Cardboard button) When the user moves the head this means that the phone in the HMD also moves and there are sensors that can detect the direction of the phone so that the image can update correctly. Also to note that the HMD has a button that can be clicked and trigger an action.
In early 2019, in order to implement both of the above mentioned functionalities (look around and click), stared by configuring Settings > Player > XR Settings and add Cardboard as Virtual Reality SDK. Then, I've used the prefab GVR Editor Emulator. It was basically going to this link, download Google VR SDK for Unity, drag it into Unity and import.
Once the import finished, it's possible to see in Assets a folder named Google VR. The prefab can be found then under Assets > Google VR > Prefabs > GvrEditorEmulator, copy and paste in our scene.
Now, more than 1 year after, when I go to the GvrEditorEmulator page, can see

November 6, 2019 update:

There's a new open source Cardboard SDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR
code scanning. We recommend that all developers actively building for
Google Cardboard migrate to the new Cardboard SDK: iOS, Android NDK,
Unity XR Plugin (SDK)

What changes in the process considering this update?

sentences:
How to convert font size to pixels? I'm trying to add text to my game using SDL_TTF, and it's working pretty well.

Except for one thing :

My text's SDL_Surface needs a width and a height, if I don't give it one it will automatically set it to 0, making the text invisible.

However, if I insert a value like 100 width and 100 height, it will stretch the image.

I need to know how I would convert ANY font size on the font arial to pixels in width and height.

sentences:
Apply Secondary Normal Map to Standard Shader by Script I have a material with an existing normal map.  I added a secondary normal map to represent damage via script.  I assign to the appropriate texture property _DetailNormalMap, assign the required keywords, _DETAIL_MULX2 _NORMALMAP, and set a scale via _DetailNormalMapScale.
I have ensured there is a material in the resources folder with the same settings, to ensure that the variant is available in builds, though this shouldn't be an issue in editor.
However, it does not show up, at least not initially:

If I do darn near anything with it in the editor, even alt+tabbing, will cause the secondary normal map to show up:

I recall back in the day keywords were the issue, but I clearly have done that. I recall this working in the past. I am still using Unity 2018.4.6f1, so I would be surprised if there are any major changes.
Thanks for your assistance.

sentences:
Can a user / a game developer get their credit back in dollars? If yes, at what cost? You can find every information about how to give money to facebook, but when it comes to take it back…

If I give credits to a user, can he get it back in dollars?

If a user gives me credits, can I turn it into dollars?

If so, how much does it cost?

sentences:
How can I make this tile map correctly? I'm having the following problem creating this hexa tiled map.

this is what I wanted :

[EDIT]
Ok I've Managed to do this:

const float scaleX = ((float)tileWidth) / 10000,
    scaleY = ((float)tileHeight ) / 10000;
    const float hexagon_r = scaleY / 2;
    const float hexagon_dx = hexagon_r * cosf(30*3.14f / 180.0);
    const float hexagon_dy = hexagon_r * sinf(30*3.14f / 180.0);
    const float hexagon_gx = 2.0*hexagon_dx;
    const float hexagon_gy = 2.0*hexagon_dx*sinf(60*3.14f / 180.0);
    Vector2 auxPos;
    auxPos.x = 0;
    auxPos.y = 0;
    float j = 0;
    for (unsigned int y = 0; y < layer->layerHeight; y++, j += hexagon_gx * 2)
    {
        auxPos.y = y * (hexagon_gy * -2 );
        auxPos.x = j;
        for (unsigned int x = 0; x < layer->layerWidth; x++)
        {

            auxPos.x += hexagon_gx * 2;

            float angle =90 * 3.14f / 180;

            auxPos.y += hexagon_gy * 2;

            SetData(stack->vData, stack->vCounter + 0, auxPos.x + ((-scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 1, auxPos.y + ((-scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 2, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 3, auxPos.x + ((scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 4, auxPos.y + ((scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 5, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 6, auxPos.x + ((scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 7, auxPos.y + ((scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 8, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 9, auxPos.x + ((-scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 10, auxPos.y + ((-scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 11, layer->layerDepth);
        }
    }

can't seem to make this work...

sentences:
Unity3d - Do I need to destroy gameobject AND script? From proper leak protection do I need to delete both of these or will getting rid of one take care of both?

Currently I am destroying the script AND the gameobject

private void OnDestroy() {
    Destroy(this.gameObject);
    Destroy(this);
}

sentences:
What data should be cached in a multiplayer server, relative to AI and players? In a virtual place, fully network driven, with an arbitrary number of players and an arbitrary number of enemies, what data should be cached in the server memory, in order to optimize smooth AI simulation?

Trying to explain, lets say player A sees player B to E, and enemy A to G. Each of those players, see player A, but not necessarily each other. Same applies to enemies. Think of this question from a topdown perspective please.

In many cases, for example, when a player shoots his gun, the server handles the sound as a radial "signal" that every other entity within reach "hear" and react upon.

Doing these searches all the time for a whole area, containing possibly a lot of unrelated players and enemies, seems to be an issue, when the budget for each AI agent is so small.

Should every entity cache whatever enters and exits from its radius of awareness? Is there a great way to trace the entities close by without flooding the memory with such caches?

What about other AI related problems that may arise, after assuming the previous one works well? We're talking about environments with possibly hundreds of enemies, a swarm.

sentences:
Free scripting in Construct 2? In Construct 2 example about creating an animated player, they used more than 8 events:

4 events to store movement direction into Direction variable from Player.8Direction.MovingAngle

4 events to select animation based on Direction value

1 event to stop animation

Apparently if would be much easier to do the same with simple if-else code with 4 or 5 cases. Is it possible in Construct 2?

UPDATE

I didn't find scripting, but was able to express the same example in more condensed way:

All names are from example.

sentences:
DirectX11 pixel shader in pipeline is missing I'm writing a program which displays a MS3D model using DirectX, and unfortunately, the result shows nothing on the screen.
When I use the Graphics Debugger from Visual Studio 13, I notice that the pixel shader is missing from the pipeline, as it is shown in the below picture

This is my pixel shader source code:

 cbuffer SkinningTransforms
 {
    matrix WorldMatrix;
    matrix ViewProjMatrix;
 };
//--------------------------------------------------------------------------------
// Inter-stage structures
//--------------------------------------------------------------------------------
struct VS_INPUT
{
    float3  position        : POSITION;
    int4    bone            : BONEID;
    float4  weights         : BONEWEIGHT;
    float3  normal          : NORMAL;
    float3  tangent         : TANGENT;
    float2  tex             : TEXCOORD;
};
//--------------------------------------------------------------------------------
struct VS_OUTPUT
{
    float4 position         : SV_Position;
    float3 normal           : NORMAL;
    float3 light            : LIGHT;
    float2 tex              : TEXCOORDS;
};

Texture2D       ColorTexture : register( t0 );
SamplerState    LinearSampler : register( s0 );

//--------------------------------------------------------------------------------
VS_OUTPUT VSMAIN( in VS_INPUT input )
{
    VS_OUTPUT output;
    //Transform vertex and pass them to the pixel shader
    return output;
}

//--------------------------------------------------------------------------------
float4 PSMAIN( in VS_OUTPUT input ) : SV_Target
{
    // Calculate the lighting
    float3 n = normalize( input.normal );
    float3 l = normalize( input.light );

    float4 texColor = ColorTexture.Sample( LinearSampler, input.tex );

    float4 color = texColor * (max(dot(n,l),0) + 0.05f );
    return( color );
}

As I was known from Graphics Debugger, all of the graphics event are right. I listed in below important events, which might be relating to Pixel Shader:

106:(obj:4) ID3D11Device::CreateDepthStencilView(obj:24,NULL,obj:25)*
108:(obj:5) ID3D11DeviceContext::OMSetRenderTargets(8,{obj:1,NULL,NULL,NULL,NULL,NULL,NULL,NULL},obj:25)*
109:(obj:5) ID3D11DeviceContext::ClearRenderTargetView(obj:1,addr:21)*
111:(obj:5) ID3D11DeviceContext::ClearDepthStencilView(obj:25,1,1.000f,0)*
119:(obj:4) ID3D11Device::CreateSamplerState(addr:24,obj:27)*
134:(obj:4) ID3D11Device::CreatePixelShader(addr:27,21056,NULL,obj:30)*
135:CreateObject(D3D11 Pixel Shader,obj:30)
136:(obj:5) ID3D11DeviceContext::PSSetShader(obj:30,NULL,0)*
137:(obj:5) ID3D11DeviceContext::PSSetSamplers(0,1,{obj:27})*
139:(obj:4) ID3D11Device::CreateTexture2D(addr:28,addr:5,obj:31)*
140:CreateObject(D3D11 Texture2D,obj:31)
142:(obj:4) ID3D11Device::CreateShaderResourceView(obj:31,NULL,obj:32)*
143:CreateObject(D3D11 Shader Resource View,obj:32)
144:(obj:5) ID3D11DeviceContext::PSSetShaderResources(0,1,{obj:32})*
146:(obj:4) ID3D11Device::CreateRasterizerState(addr:29,obj:33)*
147:CreateObject(D3D11 Rasterizer State,obj:33)
152:(obj:5) ID3D11DeviceContext::RSSetState(obj:33)*
154:(obj:5) ID3D11DeviceContext::RSSetViewports(1,addr:30)*
156:(obj:4) ID3D11Device::CreateBlendState(addr:11,obj:34)*
157:CreateObject(D3D11 Blend State,obj:34)
159:(obj:5) ID3D11DeviceContext::OMSetBlendState(obj:34,addr:31,-1)*
162:(obj:4) ID3D11Device::CreateDepthStencilState(addr:32,obj:35)*
163:CreateObject(D3D11 Depth-Stencil State,obj:35)
165:(obj:5) ID3D11DeviceContext::OMSetDepthStencilState(obj:35,0)*

I debugged all of the function in the above list, and all of them return OK. Nothing wrong.
My question is what is the reason the pixex shader is missing from pipleline, which in turn may result in the empty screen.

sentences:
Why is perlin noise generating flat terrain in Unity? I am trying to generate terrain using perlin noise however the terrain being generated is a plateau. Here is the code that I'm using:

var xlength = 65.0;
var ylength = 65.0;
var scale = 4.1f;
var heights = new float[xlength, ylength];
function Start () {
    for (var i = 0; i < xlength; i++)
        for (var j = 0; j < ylength;j++)
            heights[i,j] = Mathf.PerlinNoise(Time.time * i / xlength * scale/1000,Time.time * j / ylength * scale/1000)*i*j;
    gameObject.GetComponent(Terrain).terrainData.SetHeights(0,0,heights);
}

What am I doing wrong here?

sentences:
AndEngine Making Chase Camera Follow Player I am playing around with the AndEngine Race Game example.  I am trying to make the camera follow the car as the player moves around.  The Tile Map is larger than the player's screen but the camera does not follow the car when it moves.

Here's my code:

this.mScene = new Scene();
//this.mScene.setBackground(new Background(0, 0, 0));

/** Tiled Map Test **/
try {
    final TMXLoader tmxLoader = new TMXLoader(this.getAssets(), this.mEngine.getTextureManager(), TextureOptions.BILINEAR_PREMULTIPLYALPHA,
            this.getVertexBufferObjectManager(), new ITMXTilePropertiesListener() {
        @Override
        public void onTMXTileWithPropertiesCreated(final TMXTiledMap pTMXTiledMap, final TMXLayer pTMXLayer, final TMXTile pTMXTile,
                final TMXProperties<TMXTileProperty> pTMXTileProperties) {
            /* We are going to count the tiles that have the property "box=true" or "boxBool=true" set. */
            if(pTMXTileProperties.containsTMXProperty("box", "true")) {
                SpeedsterGameActivity.this.numBoxes++;
            }
        }
    });
    // Load the TMX file into an Object
    this.mTMXTiledMap = tmxLoader.loadFromAsset("tmx/level3.tmx");
            this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText( SpeedsterGameActivity.this, "Box count in this TMXTiledMap: " + SpeedsterGameActivity.this.numBoxes, Toast.LENGTH_LONG).show();
        }
    });
} catch (final TMXLoadException e) {
    Debug.e(e);
}

// Get the first TMX Layer and add it to the scene
final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
this.mScene.attachChild(tmxLayer);
        /* Make the camera not exceed the bounds of the TMXEntity. */
this.mBoundChaseCamera.setBounds(0, 0, tmxLayer.getHeight(), tmxLayer.getWidth());
this.mBoundChaseCamera.setBoundsEnabled(true);

/* Debugging stuff */
Debug.i( "Game Info", "Height & Width: " + tmxLayer.getHeight() + " x " + tmxLayer.getWidth() );

int[] maxTextureSize = new int[1];
GLES20.glGetIntegerv( GLES20.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);
Debug.i("Game Info", "Max texture size = " + maxTextureSize[0]);
/**********/
        /* Calculate the coordinates for the face, so its centered on the camera. */        final float centerX = (CAMERA_WIDTH - this.mVehiclesTextureRegion.getWidth()) / 2;
final float centerY = (CAMERA_HEIGHT - this.mVehiclesTextureRegion.getHeight()) / 2;
        /* Create the sprite and add it to the scene. */
final AnimatedSprite player = new AnimatedSprite(centerX, centerY, this.mVehiclesTextureRegion, this.getVertexBufferObjectManager());
this.mBoundChaseCamera.setChaseEntity(player);
/********************/

this.mPhysicsWorld = new FixedStepPhysicsWorld(30, new Vector2(0, 0), false, 8, 1);

sentences:
How simulate the return effect of the wheel of fortune needle I am trying to create a spinning wheel which slows down after a specific time.
I managed to simulate the slowdown of the wheel but I need also to put a needle which go up and down with an angle of 45°.

Here my wheel with the needle :

My wheel turn in clockwise and the needle (object in red in the above scheme) rotate in counter clockwise.

Once done the needle back to his original position slower than the previous movement.

The code i wrote :

// Once 3 seconds are passed, the speed rotation start to decrease
If RealMillisecs() -_fRotateTime > 3000 Then
    If _fSpeedRotation > 0 Then
        _fSpeedRotation = _fSpeedRotation - 0.001
    Else
        _fSpeedRotation = 0
    EndIf
EndIf

_fWheelRotation -= _fSpeedRotation * dt.frametime

// If the needle is not going back to its orginal position then is going up
If not _bAnimBackNeedle Then
    _fNeedleRotation = _fWheelRotation Mod 45 * -1

   /* If its previous rotation greater than actual position
    it's mean that the needle has reach its max angle (45)*/
    If _fNeedleRotation < _fPreviousNeedleRotation Then
        _bAnimBackNeedle = True // The going back animation to true
    EndIf

    _fPreviousNeedleRotation = _fNeedleRotation
EndIf

// If the going back animation is set to true or the wheel has stopped to turn
// get the needle back to its position at constant speed
If _bAnimBackNeedle Or _fSpeedRotation = 0 Then
    _fNeedleRotation -= 0.5 * dt.frametime
    If _fNeedleRotation <= 0 Then
        _bAnimBackNeedle = False
    EndIf
EndIf

My code doesn't make what i hope.

The needle doesn't come back to its original position when the wheel is stopped.

How can I managed the code to have the wheel and the needle with a good behaviour?

sentences:
solid color to sprite (javascript game) Hi I recently created a javascript game, in this game, math random is used to pick a random shape.
The shapes are in strings, and the associated numbers within the string are then used to show a color.
Is there any way to replace the simple hex colors with an image?
For example:
else if (shape === "H"){
    return [[8,8,8],
            [8,8,8],
            [8,8,8]];

The "8" ties into the following string to get the #F10B38 color.
const color = [null,"#FF2D00","#FF9300","#51FF00","#00FF93","#0087FF","#4E49A7","#9649A7","#F10B38"];

sentences:
XNA 4.0: Trouble Aligning an Animating Sprite (Texture Origin) I'll try to explain this as best as I can.

I'm trying to build a game where there exists a "Surfer" who is surfing down a rail.
I have a sprite sheet for the surfer however I have been running into animating the surfer for the following reasons:

The source rectangles for each animation are sometimes different
The feet of the surfer are at different locations within each texture animation.

What do I mean by #2?
For instance, I have an animation for the surfer to jump rails.
My spritesheet is built so that my surfer's feet might be positioned on the left side of the texture at the start of the animation and after the jump (iterating through the textures) his feet are now at the right hand side of the texture.

This is causing me problems because in order to align the feet to the rail for each animation I tried to offset the origin of the texture so that it points at his feet.

(The origin is given in the SpriteBatch.Draw call)

However this isn't working :(

Any recommendations on how to properly set this up?

PS: I Hope I explained it well, if not I can edit it and retry.

sentences:
How can I draw sprites in layers based on their Y position? I am trying to figure out the most efficient way to draw sprites in a way that they layer properly based on their Y position.

Lets say I have four objects of the same class named A, B, C, and D, and they all must be drawn. Their respective Y positions are 12, 16, 13, and 17. If I draw A then B then C then D, they will draw and lay over the tops of each other in a weird manner. I want to draw them "largest y is closest." I know you could probably use a sort routine to sort them all based on Y, but I would imagine that would generate a huge amount of lag because of all the calculations, especially when you're needing to draw about fifty or sixty objects.

What's the right way to go about drawing them? How would I modify this to include two different types of objects with similar properties (ie, "creatures" and "projectiles" ?)

sentences:
How can I get a list of servers hosted by my players? I'm writing a multiplayer 2D online game, where game servers are hosted by the players. I want to show players a list of the currently hosted game servers.

How would I do that? I know how to let players host servers. But how would I then get a server list? Should I use a database? Is there an easier way?

sentences:
Is there an easy way to calculate the velocity of an object on a pendulum? Want to have a rope travel to the mouse on  m2 click and then act as the pivot of a  pendulum, with the player being the bob.
Used some math I don’t really understand to get the angle of the mouse from the player,  and can get the distance very easily. Is that enough information to calculate the velocity of the bob? If not what other information do I need? How do I calculate velocity from that?
Using sfml. Beginner to programming so apologies if this is a stupid question.
Edit: Found out how to find the period and frequency of a pendulum, how do I apply those to velocity?

edit 2: https://youtu.be/9iaEqGOh5WM this video was very helpful

sentences:
Why do Monsters drop things? Why do Monsters drop things in so many games?
It creates all sorts of problems, including:

in-game gold hyper-inflation

questionable moral implications, if there is a strong incentive toward killing things but no incentive not to

Monster-killing giving XP is equally bad - you rename an ingame currency to XP, the mechanics stay the same. Here you have something like "fighting force inflation," so after some levels you have to have giant giants attacking your small figure or it stops being interesting. This is just hyper-inflation written a different way.
Is it enough reward if a monster stops killing you?
What benefits of monster-killing rewards make up for these problems, or how can we compensate for those problems?

sentences:
How can I disable a RigidBody? I have tried to set Rigibody enabled to false with this code but I get multiple errors. What is the correct version of this code?

GetComponent<RigidBody>().Enabled = false;

sentences:
How do you calculate a gradient value within multiple colors (gradient stops) In WPF/Silverlight XAML you can have a brush with multiple gradient stops at different points along the color line.

I was able to replicate this behavior with two colors, a single color lerp, from this answer to my previous question: Code to generate a color gradient within a texture using a diagonal line

How do I do the same thing in that question, but with multiple color steps even at different widths from each other.

sentences:
How do I handle loads of (prefab?) objects in Unity2D/3D? I have been looking around for information regarding this process but I was unable to come across anything that would help me out. Basically, in a game where you may have many items or enemies or player objects, how would one go about creating these objects?

Am I supposed to be creating every single one of these objects as a prefab and then load them into the game when needed? Or is it possible to create one object that has references to the different variables needed to create the above objects and then load in from an external source all the necessary information? And then during run time, depending on what object I am looking at, the script will 'create' the object with the information from the external source.

Meaning, if I decide to have 50 different enemies in my game, do I need to make 50 prefabs, one for each enemy? Or just one prefab that loads in data pertaining to the 50 different enemies and then build upon that information?

Thank you!

sentences:
C# Timers for game development I want to find out the best way of creating time based events in games. Lets talk for example about Texas Holdem Poker. Server can handle thousands of tables and in every table we have timers: turn timer, hold seat timer and so on.

What is the best way of timers realization for this purpose?

Is System.Timers.Timer class can handle this or it will be more reasonable to create a separate thread with sorted time queue (for example an ascending sorted list with int values which represent time in ms remained)?

Thanks in advance, Valentin

sentences: Is Opengl 2.x still usable? i've used opengl core profile for a while now and i was wondering if it was possible to create a "decent" application (like a game/game engine) with good graphics. I have a machine which can run only OpenGl 2.1(raspberry pi3), i already know the advantages of core profile, but is Opengl 2.x still usable for today's standards?

sentences:
Is it possible to apply a texture inside a GL_LINE_LOOP? I am creating a game using Box2D and OpenGL ES 1.1.

I am taking the b2PolygonShape vertices and converting them into an OpenGL ES 1.1 GL_LINE_LOOP. The debugging view looks great, but now I want to apply textures to the inside of the line loop.

Is this possible? I used line loop instead of triangles because I am not sure how to handle complex polygons using triangles.

sentences:
DirectX: Render the black bars I'm still quite a beginner in the industry. I'm working on a game with some friends and I would like to add a cinematic between 2 levels like in the attached picture.

My question is how can I render the black bars in DirectX 9 or 11? Moreover, do I need to change the aspect ratio when I'm playing the cinematic?

sentences:
Is Quadtree Terrain Decimation applicable today? It all started from that page.
https://www.gamasutra.com/view/feature/131841/continuous_lod_terrain_meshing_.php?print=1

I didn't quite got what it was all about, so I've looked at this.
https://www.researchgate.net/publication/3410916_Terrain_decimation_through_Quadtree_Morphing

Then I've got some understanding. It was about decimating the more distant patches of the terrain.
And then I've just wondered about one thing. At every frame, the mesh is re-generated and re-uploaded. Wouldn't it be kinda of slow?

Ran the demo provided in the first link and got just 3 fps. What's the big idea of this "optimization"?

My current code has 1048576 vertices for 1024x1024 heightmap, undecimated, and it runs way faster. His code makes my laptop hot.

Another link.
Quadtree vs multiple resolution grids for terrain rendering

That is more useful. It turns out that there might be some mipmapped meshes on the GPU, and the quadtree decides which of them are turned on.

The first question. Is my last guess correct?
Second - am I right the first link isn't useful anymore?
Third - how this applies to modern Android development (I mean at least GLESv2).

sentences:
Given an angle for an arrow, how do I find its X and Y velocities? I want to fire an arrow toward the mouse location.

X0 = the players X location
X1 = the mouse X location
Y0 = the players Y location
Y1 = the mouse Y location

I want to make a method which takes degrees as a parameter, and sets the Yspeed and Xspeed accordingly, so the arrow can reach the mouse position, starting at the player position.

I am using float coordinates (i.e. float x, y, z).

How can I do this?

sentences:
How do I calculate logical velocity / direction? I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.

I want to make them movable when the user touches the circle. But I want them to be movable from the point where it's touched to its logical velocity direction.

How do I set the velocity / direction of the body after the touch so that it moves to the point that is logical to the touch?

10x

sentences:
Unity's Animator.GetBehaviour always returning null I have the following line:

As you can see "transitionOutAnimator" is null before the line runs. transitionOutAnimator is a StateMachineBehaviour of type ThoughtBubbleTransitionOutAnimator.

We can check that the StateMachineBehaviour of the correct type is actually stored in the run time animator:

Yet when the line runs:

Am I doing something obviously wrong? Is this a bug? I have another identical instance in the code where I do this, and it works perfectly.

EDIT: Immediate window:

EDIT: This is still a problem as of Unity 5.3.5f1.

sentences:
ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND I've stared at this for at least half an hour now and I cannot figure out what directx is complaining about.  I know this error normally means you put float3 instead of a float4 or something like that, but I've checked over and over and as far as I can tell, everything matches.

This is the full error message:

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

This is the vertex shader's input signature as seen in PIX:

// Input signature:
//
// Name                 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// POSITION                 0   xyz         0     NONE  float   xyz
// NORMAL                   0   xyz         1     NONE  float
// COLOR                    0   xyzw        2     NONE  float

The HLSL structure looks like this:

struct VertexShaderInput
{
    float3 Position : POSITION0;
    float3 Normal : NORMAL0;
    float4 Color: COLOR0;
};

The input layout, from PIX, is:

The C# structure holding the data looks like this:

[StructLayout(LayoutKind.Sequential)]
public struct PositionColored
{
    public static int SizeInBytes = Marshal.SizeOf(typeof(PositionColored));

    public static InputElement[] InputElements = new[]
    {
        new InputElement("POSITION", 0, Format.R32G32B32_Float, 0),
        new InputElement("NORMAL", 0, Format.R32G32B32_Float, 0),
        new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0)
    };

    Vector3 position;
    Vector3 normal;
    Vector4 color;

    #region Properties
    ...
    #endregion

    public PositionColored(Vector3 position, Vector3 normal, Vector4 color)
    {
        this.position = position;
        this.normal = normal;
        this.color = color;
    }
    public override string ToString()
    {
        StringBuilder sb = new StringBuilder(base.ToString());
        sb.Append(" Position=");
        sb.Append(position);
        sb.Append(" Color=");
        sb.Append(Color);
        return sb.ToString();
    }
}

SizeInBytes comes out to 40, which is correct (4*3 + 4*3 + 4*4 = 40).  Can anyone find where the mistake is?

sentences: Drawing geometry to an SDL_Texture? As a direct result of this question that I asked a few days ago, I want to draw potentially-complex geometry to a SDL_Texture or, I suppose, an SDL_Surface. Ultimately, I want the foreground of a 2D platformer on this texture so that I cant draw a specific portion to the screen, as explained in the above link. Most of the geometry will be simple rectangles, but I would also like to draw slopes and possibly circles. Diving into OpenGL seems like a viable option at this point, but if I could avoid it, that would be grand.

sentences:
Client side prediction on FPS game I've recently attempted to develop a simple client prediction for an FPS based on Gaffer on Games famous blog (http://gafferongames.com/game-physics/networked-physics/).

Now I've gotten to the point that everything works (more or less), my main problem is crossing the message sent from the server and finding the appropriate snapshot on the client. I can use the last/average ping time to find a very near state, but it will never be exactly timed/placed as on the server.

So my question is - how exactly can I sync and find the time stamp sent from the server to the client and find which snapshot is the correct one on the client?

sentences:
Object not Augmenting on small marker I am new to Augmented reality. I am developing a jewellery try on app with vuforia using unty3D editor.
What I want is to augment a ring on the marker. I download an image(attached bellow) and used it as my marker and it was working fine but when I resized the image in paint to fit to finger the marker stopped augmenting the object.
any help.

What should be the marker size or anything else which I am missing ?
Please help me.

sentences:
Make a platform appear and disappear constantly I am building a platformer. In this game, I need one of my platforms to constantly activate and deactivate.

Here is how I have tried to code this so far, but it causes Unity to freeze:

void Update(){
    for (i = 0; i <= 2; i++) {
        platform.SetActive (false);
        if (i >= 1 ) {
            i--;
            platform.SetActive (true);
        }
    }
}

sentences:
Does the order of vertex buffer data when rendering indexed primitives matter? I'm building a 3d object's triangles. If I can write them to the buffer in the order they are calculated it will simplify the CPU code. The vertices for the triangles will not be contiguous.

Is there any performance penalty for writing them out of order?

sentences:
How to debug shaders running on Android 4.x devices? I have tried some of the existing inspectors such as RenderDoc and gapid, but none of them can be used with Android 4.x. Latest version of gapid requires Android 6.0 and RenderDoc requires Android 5.0.

But I need to debug shaders in my app running on a Galaxy Tab 3 8.0 (SM-T311, ARM Mali 400), which uses Android 4.2.2. I cannot upgrade its Android version.

The app was made with Unity 2018.4 and targets Android 4, ARMv7. How can I inspect & debug my shaders running on this kind of device?

sentences:
How to space actors in scene uniformly? I have a Array data structure right now, which contains 10  soldiers in my army.

They can setup initially in various formations  -
e.g.

 o  o  o
 o  o  o
o  o  o  o

The user can move one of the soldier(currently selected) with the joystick.

 o  o  o
 o  o  o
o  o  o
         o

When he moves I want to automatically adjust the rest of the soldiers position so that they occupy equal areas in the scene, as well as still follow their orignal formation to some extent.

Somehow like this http://arborjs.org/halfviz/#/Mzg

How do I do this? What kind of algorithms should I look at?
How should store my soldiers? which data structure?

sentences:
Why is Metal is rendering textures SLIGHTLY darker than they should be? I already checked this question. Using [MTKTextureLoader.Option.SRGB : false] in texture loader options doesn't work. All that happens is when I do [MTKTextureLoader.Option.SRGB : true], it's a lot darker instead of slightly darker. There must be something else. Here is an example of this unwanted behavior.

As you can see I am using the mouse to hold the original packed ice texture over the rendered one. It's considerably lighter, even with [MTKTextureLoader.Option.SRGB : false].

Here is my fragment function:

fragment half4 TextureFragment(VertexOut VertexIn [[stage_in]], texture2d<float> Texture [[texture(0)]]) {
    constexpr sampler ColorSampler(mip_filter::nearest, mag_filter::nearest, min_filter::nearest);
    float4 Color = Texture.sample(ColorSampler, VertexIn.TexCoord.xy / VertexIn.TexCoord.z);
    return half4(Color.r, Color.g, Color.b, 1);
}

How can I fix the problem? How can I render the actual texture instead of a darker version?

Note: I must fix the problem, not work around it. A workaround would be like return half4(Color.r, Color.g, Color.b, 1); from the fragment shader. I must fix the problem from the root.

sentences:
DirectX10 How to use Constant Buffers I'm trying to access some variables in my shader, but I think I'm doing this wrong. Say I have a constant buffer that looks like this:

cbuffer perFrame
{
    float foo;
    float bar;
};

I got an ID3D10EffectConstantBuffer reference to it, and I can get a specific index by calling GetMemberByIndex, but how can I figure out how many members perFrame has so that I can get each member without going out of bounds?

sentences:
Get original image size in Ren'py I'm building a visual novel and in one scene, I want to have a couple of different images move from one position to another and change size as it moves.

My first position is called "doorway", my second is called "left2".
Here's the code:

init:
    $ doorway = Transform(xpos = 0.34, xanchor = 0, ypos = 0.6, yanchor = 1.0, size = (100, 400))
    $ left2 = Transform(xpos = 0.4, xanchor = 0.5)

label room1:
    show room1

    show laura normal at doorway
    show laura normal at left2 with move
    hide laura with dissolve

    show annie normal at doorway with dissolve
    show annie normal at left2 with move

My problem is that when I run this, both laura and annie stay at (100, 400) size. I'd like them both to revert to their original size once I move them.

I wondered whether I could write size = (0.5, 0.5) instead of (100, 400) to halve them (this would work for my purposes) and then put size = (1.0, 1.0) in the left2 Transform declaration to bring them back to full-size, but that didn't work at all and actually didn't show their images whatsoever.

Is there a way to do it with relative sizing, or another way entirely? Thanks :)

sentences:
algorithm to "explode" mesh i have a simple triangle mesh which i want to explode.
so i am looking for an algorithm that makes every triangle to move outwards from the centerpoint.
is there already something premade like this?

thanks!

sentences:
How to cover the widest range of computers when publishing? When you plan a game, or even when you already made a game, and its time to publish, you wonder how much of your audience is covered by the game technology demands.

I'm directing this essentialy to casual games, as I constantly see people having old laptops and being unable to replace them. Laptops with integrated cards whose OpenGL version doesn't even support textures larger than 1024x1024. These people may be avid gamers as well, and a reasonable share of the audience to consider giving them the chance to play casual games, once they cannot play any blockbusters.

As I've seen happening, a very "noticeable" example is Angry Birds. It's gameplay is merely casual (I think nobody disagrees here) and still, it uses so high resolution textures that at least OpenGL 2.0 or around is needed, which blocks away a lot of people.

So, the actual question is: what is a good tradeoff for this issue? Would it be better to just sacrifice the texture resolution for everyone, but have more supported hardware? Would it be better to keep the high quality and just slice the textures into smaller ones, sacrificing the performance a little bit? What else?

Any ideas about this topic are welcome for discussion.

sentences:
Character Movement and Collision with Ragdoll Rigidbodies/Colliders? I have a player character that I'm moving with a character controller script and it is moved by applying velocity to a Ridigbody.

This works when I have a rigidbody component on the player but my character also has ragdoll colliders and rigidbodies on each body parts (set up with Untiy's ragdoll wizard).

What I'd like to do is remove the ridigbody and collider that are on the player and use the ragdoll colliders and rigidbodies instead for physics movement and collision.

But it's not working! When I use the rigidbody from the skeleton Root and try to apply velocity the character won't move (animation plays but she keeps running on the same spot). What do I need to do to get this working?

Another issue is that if I leave the player rigidbody on but remove the large capsule collider I can move the character but collision doesn't work and she runs through static objects. I already tried with convex set to true on static meshes but it doesn't make a difference.

Does somebody know what causes movement and collision not to work with the ragdoll rigidbodies and colliders?

sentences:
opengl rotations for a human I currently can rotate around a pivot point by first translating to the pivot point then performing the rotation and finally translating back to the origin. I do that easily enough for the shoulder in my example. However I cannot figure out how to also add in a rotation around the elbow for the forearm.

I've tried the following for the forearm rotation around the elbow:

translate to shoulder, rotate, translate to origin, translate to forearm, rotate, translate to origin
translate to shoulder, rotate, translate to forearm, rotate, translate to shoulder, translate to origin

Neither work for me. Any suggestions? I'm really stuck on this one.

sentences:
OpenGL assets and new OpenGL context So I have a bunch of meshes, materials, etc and then all of a sudden the window needs to be torn down and then recreated (such as switching on fullscreen with GLFW) which means I will get a new OpenGL context and my old OpenGL data is invalid.

What is the best way to reload all my OpenGL assets - do I save all the mesh and material data in system RAM (which is quite a waste isn't it? if you do not recreate the window during the game, it does absolutely nothing for alot of RAM) -OR- do you map the filepaths to all assets, and then re-read from disk when you reload them? (could lead to alot of file i/o)

Or is there a better alternative? What is the best-practice here?

sentences: What is the general strategy to pre-load game data(entities/map) I'm new to games programming and am wondering what tactics games use to pre-load entity and map data. Will a game initialise with the fundamental map data stored in memory?

sentences:
How can I get a reference to an actor that's already in a scene in Unreal? I'd like to know if there is a way to get a reference to the instance of an Actor (written in c++) in the scene from a blueprint even if it's not in the scene, or at least without making a new one using that Actor as base class.

I know there's a method to get all the objects in the scene, but it wouldn't be that cool to iterate over each one of them, so i absolutely want to avoid something like this.

Basically, i have a class called ABoard, that inherits from an AActor where i got some methods to deal with the board itself. Also i have some blueprints that will show the MainMenu, and someother stuff, and what i want to do, is to call a method in the ABoard from one of these blueprints to be able to set up some stuff, like: "Play as single Player, whatever it is". But, i cannot do this because (of course) the blueprint does not have a reference to the object/instance in the scene i'm talking about.

Since i'm relatively new to Unreal Engine, i have no idea how to solve this kind of problem.

sentences:
Drawing each sprite at different location I can draw multiple sprites but they are all on top of each other at (0,0). How would I make each sprite appear after one another in a row?

My Rect class and Draw function:

class Rect(pygame.sprite.Sprite):
    def __init__(self,color,width,height,value=0):
        super().__init__()
        self.image = pygame.Surface([width, height])
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.value = value
        self.x = 0
        self.y = 0
    def change_value(self,color,value):
        self.image.fill(color)
        self.value=value

def DrawRects():
    rect1 = Rect(red, boxW, boxH)
    rect2 = Rect(black, boxW, boxH)
    rects.add(rect1, rect2)

    rects.draw(screen)

sentences:
Why do RPGs let you know how much XP you need to level up? I was reading this article called Behavioral Game Design, and it says:

  ...how do we make players maintain a high, consistent rate of activity? ... the answer is a variable ratio schedule, one where each response has a chance of producing a reward.

RPGs (I'm thinking of traditional JRPGs like Final Fantasy 1-6) don't do this when it comes to leveling up characters.  You can always pause the game and look at how much XP you need to level up again.  I haven't played WoW before, but I suspect it lets you know how much XP you need to level up, too.  In WoW, there's plenty of examples of "variable ratio schedule" elsewhere in the game, so why not when it comes to XP you need to level up?

I suspect most professional game designers know the lessons in this article.  So why is it typical for the XP you need for the next level to be known?  They could design the game so that it's random, where you never know how many enemies you need to kill for that next level.  So why don't they use this as an opportunity to have a "variable ratio schedule"?

sentences:
When several classes need to access the same data, where should the data be declared? I have a basic 2D tower defense game in C++.

Each map is a separate class which inherits from GameState. The map delegates the logic and drawing code to each object in the game and sets data such as the map path.
In pseudo-code the logic section might look something like this:

update():
  for each creep in creeps:
    creep.update()
  for each tower in towers:
    tower.update()
  for each missile in missiles:
    missile.update()

The objects (creeps, towers and missiles) are stored in vector-of-pointers. The towers must have access to the vector-of-creeps and the vector-of-missiles to create new missiles and identify targets.

The question is: where do I declare the vectors? Should they be members of the Map class, and passed as arguments to the tower.update() function? Or declared globally? Or are there other solutions I'm missing entirely?

When several classes need to access the same data, where should the data be declared?

sentences:
More Precise PathSmoothing I'm reading a book about AI - Path planning and path smoothing. Yet this book is using c++ code. And i'm coding in c# with the XNA framework.

I have a path smoothing working, yet the book says it can be more precise (but being a bit slower).

This is the code i have until now:

    public static LinkedList<Vector2> SmoothPathEdgesQuick(LinkedList<Vector2> path, Player player)
    {
        LinkedList<Vector2> newLinkedList = new LinkedList<Vector2>();
        List<Vector2> toBeDeleted = new List<Vector2>();

        var edge1 = path.First;
        var edge2 = path.First.Next;
        while (edge2 != null && edge2.Next != null)
        {
            if (player.CanWalkBetween(edge1.Value, edge2.Next.Value))
            {
                toBeDeleted.Add(edge2.Value);
                edge2 = edge2.Next;
            }
            else
            {
                edge1 = edge2;
                edge2 = edge2.Next;
            }
        }
        foreach (var vector2 in path)
        {
            if (toBeDeleted.Contains(vector2))
                continue;
            newLinkedList.AddLast(vector2);
        }
        return newLinkedList;
    }

And this is working as it should work.
But the book says it can be more precise by using this code:

void Raven_PathPlanner::SmoothPathEdgesPrecise(Path& path)
{
  Path::iterator e1, e2;

  e1 = path.begin();

  while (e1 != path.end())
  {
    e2 = e1;
    ++e2;

    while (e2 != path.end())
    {
      if ( (e2->Behavior() == EdgeType::normal) &&
            m_pOwner->canWalkBetween(e1->Source(), e2->Destination()) )
      {
        e1->SetDestination(e2->Destination());
        e2 = path.erase(++e1, ++e2);
        e1 = e2;
        --e1;
      }

      else
      {
        ++e2;
      }
    }

    ++e1;
  }
}

Somehow i don't know how to update my original code to the one below to make my pathsmoothing more precise.

sentences:
Adaptive AI (Artifical Intelligence) I was thinking to make my arcade game match the players strength in the hard level mode. Like checking the score and if the human player's score is above computer's for certain number of units then the computer player would automatically increase the speed of its reactions, just like a human companion who gets more determined to fight back.

Does this sound a good idea to you? Are there other ways to approach this, so to make a game, like air hockey for a crude example, permanently challenging for anybody?

EDIT:
I agree with the answers below. I believe that most people like to win about 70% time over the computer in order to be motivated. Hence an adaptive intelligence must not be become too superior to the player and depending on human player's concentration and some random elements in the game (good 'old' quantum RND), the outcome should be always uncertain.

A nice thing about this is that such a system could handle week and strong players and would adjust to the human's learing curve.

sentences: Nvidia RTX ray tracing OpenGL extension I can't seem to find any OpenGL headers for the RTX ray tracing extension, seems like they only want you to use Vulkan and optix with RTX

sentences:
How to align angular velocity wit target rotation in 3D? I'm making a space crew sim (controlling a ship) and have recently posted a question about how to calculate ETA between two rotations. I how now a new question more well defined.

Background:
I have Qtarget and Qcurrent(the ships rotation) and can find Qdelta using Qdelta = Qcurrent ^-1*Qtarget.
And I have the angular velocity in rotation speed around the world axis from the Unity.

I want to control the ship only using delta angular velocity around ships axis.

I want to get the angular velocity aligned with Qdelta so i can just use that angular velocities e.g. x part and the angel to solve for if I should accelerate or decelerate and just decelerate along the y and z axis. After that I want to rotate that data back to ship rotation.

I have this test code:

using UnityEngine;
using System.Collections;

public class RoationTest : MonoBehaviour {
    public Vector3 startAngularVelocity = new Vector3();
    public Vector3 targetRoation = new Vector3();
    public Vector3 maxShipDeltaAngularVelocity = new Vector3();

    // Use this for initialization
    void Start (){
        rigidbody.angularVelocity = startAngularVelocity*Mathf.Deg2Rad;
        rigidbody.WakeUp();
    }

    // Update is called once per frame
    void Update () {
        Vector3 currentAngularVelocity = rigidbody.angularVelocity*Mathf.Rad2Deg;   //This seams to work
        Quaternion deltaRoationQuat = Quaternion.Inverse(rigidbody.rotation) * Quaternion.Euler(targetRoation); //This seams to work

        float deltaAngel = Quaternion.Angle(rigidbody.rotation,Quaternion.Euler(targetRoation));    //This seams to work

        Vector3 xAxis = new Vector3(1,0,0);
        Vector3 deltaRotationAxis = deltaRoationQuat.eulerAngles;
        Vector3 deltaRotationAxisClampedToShortestDist = ClampEulerAngelsToClosest(deltaRotationAxis);
        Quaternion AlignQuat = Quaternion.FromToRotation(deltaRotationAxisClampedToShortestDist, xAxis);

        Vector3 angularVelocityAligend = AlignQuat*currentAngularVelocity;  //This should be Quaternion.Inverse(AlignQuat)*currentAngularVelocity; But that does not work as I think I should but this do.
        Vector3 maxDeltaAngularVelocityGlobalRotaion = rigidbody.rotation*maxShipDeltaAngularVelocity;  //Transform max delta angular velocity from ship rotation to global space. The same as maxShipDeltaAngularVelocity*Quaternion.Inverse(rigidbody.rotation) but Unity do not suport that.
        Vector3 maxAlignedDeltaAngularVelocity = AlignQuat*maxShipDeltaAngularVelocity;
    }

    private Vector3 ClampEulerAngelsToClosest(Vector3 rotation){
        if(rotation.x>180){
            rotation.x = rotation.x-360;
        }
        if(rotation.y>180){
            rotation.y = rotation.y-360;
        }
        if(rotation.z>180){
            rotation.z = rotation.z-360;
        }
        return rotation;
    }
}

Questions:
Why do this
Vector3 angularVelocityAligend = AlignQuat*currentAngularVelocity; align y axis with x axis?
It should be Vector3 angularVelocityAligend = Quaternion.Inverse(AlignQuat)*currentAngularVelocity; in my understanding.

Also how can Vector3 maxDeltaAngularVelocityGlobalRotaion = rigidbody.rotation*maxShipDeltaAngularVelocity; be right?

General thoughts:
Is this clear enough or am I taking the wrong approach? I general words I want to find the optimal solution in every frame on how to reach target rotation only using delta angular velocity limited by a max value (the ships engines effect) and also receive and ETA. I understand this is an approximation I state above since i assumes no rotation perpendicular to Qdelta but this solution will do for a start.

sentences:
Android threads trouble wrapping my head around design I am having trouble wrapping my head around game design. On the android platform, I have an activity and set its content view with a custom surface view. The custom surface view acts as my panel and I create instances of all classes and do all the drawing and calculation in there.

Question: Should I instead create the instances of other classes in my activity?

Now I create a custom thread class that handles the game loop.

Question: How do I use this one class in all my activities? Or do I have to create a separate instance of the extended thread class each time?

In my previous game, I had multiple levels that had to create an instance of the thread class and in the thread class I had to set constructor methods for each separate level and in the loop use a switch statement to check which level it needs to render and update. Sorry if that sounds confusing.

I just want to know if the method I am using is inefficient (which it probably is) and how to go about designing it the correct way. I have read many tutorials out there and I am still having lots of trouble with this particular topic. Maybe a link to a some tutorials that explain this? Thanks.

sentences:
What is an acceptable input delay? It is common knowledge that if the framerate of a game is over 25-30 fps, we humans perceive it as running smoothly. More is better, but if it is above that, it at least doesn't lag.

I have been looking for research as to how long  a mouse input can take to reach the screen, and still feel instantaneous to the average person, for example. I'm sure it may vary a little bit, from person to person, but I'm sure we all have a limit on how fast anyone can perceive small time differences between events.

I'm interested in this because I want to try and statically update the data for my game, for example every 0.05 seconds, instead of as soon as I get a new input. This will save computer power, while still not causing delay in the game.

What is an acceptable input delay?

sentences:
Collision Detection Tips I need collision detection for my 3D racing game but it isn't going well right now. I think I understand the concept of testing boxes and generating a response, however implementation part is a nightmare for me. OpenGL makes everything more complicated than it has to be.

How can I use a shape that is constructed with glVertex*? Should I create the bounding boxes with some Vector3D class?

sentences:
Strange 3D game engine camera with X,Y,Zoom instead of X,Y,Z I'm using a 3D game engine, that uses a 4x4 matrix to modify the camera projection, in this format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

Strangely though, the camera does not respond to the Z translation parameter, and so you're forced to use X, Y, Zoom to move the camera around. Technically this is plausible for isometric-style games such as Age Of Empires III. But this is a 3D engine, and so why would they have designed the camera to ignore Z and respond only to zoom? Am I missing something here? I've tried every method of setting the camera and it really seems to ignore Z.

So currently I have to resort to moving the main object in the scene graph instead of moving the camera in relation to the objects.

My question: Do you have any idea why the engine would use such a scheme? Is it common? Why? Or does it seem like I'm missing something and the SetProjection(Matrix) function is broken and somehow ignores the Z translation in the matrix? (unlikely, but possible) Anyhow, what are the workarounds? Is moving objects around the only way?

Edit: I'm sorry I cannot reveal much about the engine because we're in a binding contract. It's a locally developed engine (Australia) written in managed C# used for data visualizations.

Edit: The default mode of the engine is orthographic, although I've switched it into perspective mode. Its probably more effective to use X, Y, Zoom in orthographic mode, but I need to use perspective mode to render everyday objects as well.

sentences:
How do I get the full path of Content? To display an image from Content in a .NET Forms Dialog, I'm trying to make a function that loads an image through .NET's Image.FromFile(string fileName) function, but instead of taking a whole path, it takes the path you'd usually put in Content.Load<T>(string assetName).

For this, I need to be able to get the complete root directory of the Content folder, but how do I get that?

I've already tried Content.RootDirectory, but that seems to give only a relative file path (in my case, it just says "Content" because I left it at default)

Thanks in advance!

sentences:
Voxel clouds rendering in Unity I would like to have realistic voxel clouds in Unity game - I found a very promising article on fast fluid simulations, however the the output of the algorithm itself is 3D grid of cloud densities (=3D texture). My question is - how can I render such 3D texture into clouds?

My research so far:
The original article suggest two pass rendering of particles for each voxel, in first pass reading output after each particle(!) is rendered. This approach is both slow and outdated not leveraging modern shader pipeline in addition to being overly complicated.
Searching for voxel clouds in Unity suggests using ray marching while the actual implementations does not seem to do any ray marching, but rather using Fractal Brownian Motion to same 2D noise texture. This approach gives decently looking results (with some problems addressed in horizon zero dawn slides), but would not make use of my realistic simulation.
The most promising source I could find was this answer, namely last paragraphs. However the answer itself rather vague on actual algorithm and links it provides are either broken or inacessible.

sentences:
How to define type-specific scripts when using a 'type object' programming pattern? I am in the process of creating a game engine written in C++, using the C/C++ SQLite interface to achieve a 'type object' pattern. The process is largely similar to what is outlined here (Thank you Bob Nystrom for the great resource!).

I have a generally defined Entity class that when a new object is created, data is taken from a SQLite database and then is pushed back into a pointer vector, which is then iterated through, calling update() for each object. All the ints, floats, strings are loaded in fine, but the script() member of Entity is proving an issue. It's not much fun having a bunch of stationary objects laying around my gameworld.

The only solutions I've come up with so far are:

Create a monolithic EntityScript class with member functions encompassing all game AI and then calling the corresponding script when iterating through the Entity vector. (Not ideal)
Create bindings between C++ and a scripting language.

This would seem to get the job done, but it feels like implementing this (given the potential memory overhead) and learning a new language is overkill for a small team (2-3 people) that know the entirety of the existing game engine.

Can you suggest any possible alternatives? My ideal situation would be that to add content to the game, one would simply add a script file to the appropriate directory and append the SQLite database with all the object data. All that is required is to have a variety of integers and floats passed between both the engine and the script file.

sentences:
What's the best server architecture for real-time games? I'm developing a Real-Time game which should hold thousands of players in real-time (FPS like. max 1s lag). What would be the best infrastructure for this?

My idea was using 2 server clusters - one for the Server End (all the computing side) and one for the Database end, where a load balancer is "responsible" for each of the clusters. One main server will receive the requests from the users and send back the IP address of the relevant server that the user can work this.

The database cluster will use database replication for consistency between the databases.

There should be a geographical load balancer as well - so it will assign the regional load balancer to each user for best response.

I'm using .NET + MSSQL for the game.

Thanks!

sentences:
How to use caching to increase render performance? First of all I am going to cover the basic design of my 2d tile-based engine written with SDL in C++, then I will point out what I am up to and where I need some hints.

Concept of my engine
My engine uses the concept of GameScreens which are stored on a stack in the main game class. The main methods of a screen are usually LoadContent, Render, Update and InitMultithreading. (I use the last one because I am using v8 as a JavaScript bridge to the engine.
The main game loop then renders the top screen on the stack (if there is one; otherwise, it exits the game) - actually it calls the render methods, but stores all items to be rendered in a list. After gathering all this information the methods like SDL_BlitSurface are called by my GameUIRenderer which draws the enqueued content and then draws some overlay. The code looks like this:
while(Game is running) {
    Handle input
    if(Screens on stack == 0) exit

    Update timer etc.
    Clear the screen

    Peek the screen on the stack and collect information on what to render

    Actually render the enqueue screen stuff and some overlay etc.

    Flip the screen
}

The GameUIRenderer uses as hinted a std::vector<std::shared_ptr<ImageToRender>> to hold all necessary information described by this class:
class ImageToRender {
private:
    SDL_Surface* image;
    int x, y, w, h, xOffset, yOffset;
};

This bunch of attributes is usually needed if I have a texture atlas with all tiles in one SDL_Surface and then the engine should crop one specific area and draw this to the screen.
The GameUIRenderer::Render() method then just iterates over all elements and renders them something like this:
std::for_each(
    this->m_vImageVector.begin(),
    this->m_vImageVector.end(),
    [this](std::shared_ptr<ImageToRender> pCurrentImage) {
        SDL_Rect rc = { pCurrentImage->x, pCurrentImage->y, 0, 0 };
        // For the sake of simplicity ignore offsets...
        SDL_Rect srcRect = { 0, 0, pCurrentImage->w, pCurrentImage->h };
        SDL_BlitSurface(pCurrentImage->pImage, &srcRect, g_pFramework->GetScreen(), &rc);
    }
);
this->m_vImageVector.clear();

Current ideas which need to be reviewed
The specified approach works really good and IMHO it is really has a good structure, however the performance could be definitely increased. I would like to know what do you suggest, how to implement efficient caching of surfaces etc so that there is no need to redraw the same scene over and over again?
The map itself would be almost static, only when the player moves, we would need to move the map. Furthermore animated entities would either require updates of the whole map or updates of only the specific areas the entities are currently moving in. My first approaches were to include a flag IsTainted which should be used by the GameUIRenderer to decide whether to redraw everything or use cached version (or to not render anything so that we do not have to Clear the screen and let the last frame persist). However this seems to be quite messy if I have to manually handle in my Render method of the screen class if something has changed or not.

Edit: Possible optimizations I was reminded of
I have been rendering every frame all tiles of the map one by one which became... yeah quite some heavy work to do for both CPU and GPU. Currently I am working on drawing all layers into one surface for each layer which holds all static tiles. In my current test it is much easier to draw n surfaces (where n is the number of layers) rather than about n*3600 small 16x16 tiles.
Though I am not thinking right now of culling this could be worth some thoughts. However I have to find out how to efficiently render entities, like items to interact with (signs, doors, ...) and NPCs which actually can walk on their own - but that is another problem and not really linked to this one.

sentences:
Why does changing Texture of Particle System using Material Property Block changes texture, but Particle System is still emitting old texture? I try the code in Start, checking in Editor shows new texture, but Particle System still emits old texture. The script works for SpriteRenderer, but not ParticleSystem. I tried to Play/Stop emission - no difference.

    ParticleSystemRenderer renderer = gameObject.GetComponent<ParticleSystemRenderer>();
    MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
    renderer.GetPropertyBlock(materialPropertyBlock);
    materialPropertyBlock.SetTexture("_MainTex", texture);
    renderer.SetPropertyBlock(materialPropertyBlock);

sentences:
How to clamp a mouse angle within a field of view range of the facing direction In my top down shooter game, the player can face in any of the 8 compass directions using the keyboard.
Depending on the direction, the player will have a 90 degree field of view to turn based on the angle selected by the mouse position. Obviously the mouse can go anywhere so it has to be restricted within -45 and 45 of the angle faced.
The eight direction angles:
    135 90 45
180            0
   225 270 305

So if the player is facing to the left at 180, their range of view will be -45 and 45 of that ie 135 to 225. So it's simply mouseAngle - facingAngle, which works fine, except if the player is facing around 0, 45 or 305 degrees where the mouse angle passes zero causing issues in calculation.
As it is I'm using this formula.
private void setAngleFOV() {
    if (facing == 0 || facing == 360)
        facing = mouseAngle < 360 && mouseAngle >= 180 ? 360 : 0;
    angleFOV = mouseAngle - facing;
    angleFOV = Math.max(Math.min(angleFOV, 45), -45);
}

It can either be 0 or 360 for either facing or mouseAngle, whichever works best but I haven't found an ideal solution. The above formula works for facing right at angle 0, but not with diagonal angles 45 and 305.
It could maybe work with lots of if statements and such, but I feel there must be a better way?

sentences:
2D Terrain Generation Possible Duplicate:
  How can I create a random “world” in a tile engine?

I need some advice as to how I should go about coding a 2D Terrain Generator for a game written in C.  I need to create a terrain generator similar to the game minecraft, but in a 2D landscape.

sentences:
LWJGL: loading textures of various types I googled around a bit and nobody seems to have asked this question.

I have images in multiple color formats (all of them are PNGs).  Most of them are ARGB but my bitmap fonts are gray scale, and I would like them to stay that way.  All I want to do is find out what format BufferedImage uses to store my pixel data and then use that information with glTexImage2D.  Java, in all its wisdom, seems to be determined to hide that information from me at all costs...

I also need to know how BufferedImage aligns its pixel data in both of these formats (glTexImage2D cares).

Could someone please tell me how to:

Determine the pixel format of my BufferedImage.  If it is ARGB32, I'm going to have to reorder the bytes and use GL_RGBA.  If it's grayscale, I will be using GL_INTENSITY.
Extract the actual bytes from the image.  I have seen a few examples on the web that use BufferedImage.getRaster().getDataBuffer().  This is nonsensical.  Why are there different types of buffers like DataBufferInt?  Because of Java's strong typing, I need DataBufferByte.  If this is the only way, could somebody give me specific directions to use the different type of buffers with glTexImage2D?
Figure out how the aforementioned image data is aligned.  I will use this information with glPixelStorei.

In addition, I come from C and C++ programming.  In C this was 100 lines of simple libPNG and GL calls.  Should I expect more trouble like this in the future?

sentences:
How do I successfully implement Google Mobile Ads and Google Play Services into my Unity arcade game? I have been trying for like a month now to properly implement Google Play Services and Google Mobile Ads into my Unity Android Game. I have had success in getting Google Play Services to work but when I added Google Mobile Ads at first it didn't work. I just didn't see any ads pop up. Now when I build my app it won't open it just crashes. Not exactly sure what I did.
I have configured all the services correctly according to my knowledge and I'm am just using code from the documentation for the ads.
Heres that code:

public static AdManager Instance { set; get; }

public string bannerId;
public string videoId;
public string deviceId;
BannerView bannerView;
InterstitialAd interstitial;

private void Start ()
{
    Instance = this;
    DontDestroyOnLoad(gameObject);
    interstitial = new InterstitialAd(videoId);
    AdRequest request = new AdRequest.Builder().AddTestDevice(deviceId).Build();
    // Load the banner with the request.
    interstitial.LoadAd(request);
}

public void ShowInterstitial()
{
    if (interstitial.IsLoaded())
        interstitial.Show();
}

I am using the correct ad Ids, I double checked that. I don't know what else to do.
I can provide any other information you may need upon request.

Anyone with experience with this would be super helpful! Thanks!

sentences:
How to change player objects when switching scenes? I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can select character they want to use.
Now when starting game, i would like to switch scene to the game scene when all players are ready. I have been reading the API, documentation, and different stack questions, but i cant seem to find any info on how this should work. On NetworkManager i can do scene schange which will be changed on all clients. But how do i persist data over multiple scenes? And if the lobby characters are destroyied how are the game characters instansiated according to the choises made in lobby? How does the client connection persist between multiple scenes?
Do i just manage the character locally and use syncHooks to synchronize over the server? Do i need to create somesort of container gameobject that holds the player connection information and some extra stuff?
EDIT
Reading the soruce code of mirror i fouind that NetworkManager holds the connection of the client, sort of. So now the issue has come down to replacing the prefab for the connection.
I have the following code:
 public void switchScene()
    {
        GameObject obj = NetworkClient.connection.identity.gameObject;

        NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

        NetworkServer.Destroy(obj);
        ServerChangeScene(gameScene);
    }

This should switch the prefab for connection and then switch scene, but i keep getting error
InvalidCastException: Specified cast is not valid.
Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets/Mirror/Runtime/NetworkIdentity.cs:362)
Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:837)
Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:697)
LobbyManager.switchScene () (at Assets/LobbyManager.cs:51)

And i dont understand why this is happening. New prefab has networkIdentity and networkTransform. Old prefab only has network transform. Up until this point everything wors, but once i want to switch scenes, it breaks.

sentences:
Mobile Game - Do I need visual feedback? I am currently on a game for windows phone 8.1 where the user can use items. If the user tries to use a item which he doesn't own a sound gets played. If now a user plays without sound or listens to music it might be that he doesn't realize that he tries to use it without realizing why it won't work.

Should I make a visual feedback?

sentences:
Player fatigue for tablets? I'm thinking about making games for tablets. Coming from a PC/console background, I'm keenly aware of the huge differences in the user interfaces, and that I need to design it with the target platform in mind.

One aspect I'm worried about is player fatigue. The input devices used on PCs and consoles - keyboards and game controllers - are optimized for extended play and have mature, ergonomic designs. Most seasoned players can easily use them for an hour, clocking in thousands of key/button presses, without suffering from fatigue. Designers can depend on this when designing the user experience, with consequences ranging from size/length of levels, steps required to execute commands, pace of the game and many more.

What about touch-screen tablets? Do players become fatigued faster, or are unable to execute as many taps/swipes per unit of time? If so, are there any resources or guidelines about this matter?

sentences:
Is it efficient to have a only-data MonoBehaviours on lots of game objects? I'm working on a voxel based game and this solution would make the implementation of networking and other features a lot more easier, it is less error-prone, easier to edit in the Editor, etc.

So the question is:

How bad is it performance-wise to have lots of MonoBehaviours in the scene, if they don't implement any of the MonoBehaviour methods?
(So they only have primitive data stored in them)

sentences:
Getting BEPUphysics to draw its entities Isn't there a way, to force BEPUphsyics to show what it is doing?
I am here with my existing XNA project, starting to put in BEPUphysics,
but I am not seeing what it is doing.

Take my model for instance. I think I made a StaticMesh here:

public BEPUphysics.Collidables.StaticMesh PhysicsMesh;
public Space space;
private Hero _hero;

public override void LoadContent()
{
   //...

   space = new Space();
   Vector3[] vertices;
   int[] indices;
   TriangleMesh.GetVerticesAndIndicesFromModel(_model.getCoreModel(), out vertices, out indices);
   PhysicsMesh = new BEPUphysics.Collidables.StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -40, 0)));

   space.Add(_hero.PhysicsMesh);
   space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);
}

That's the only thing I made BEPU-Wise in my game. All other models don't have
physics attached to them.

But, like I said. I see nothing when the game is running. Only my model, not falling, not doing anything.

I would like to see the full thing BEPU is doing in runtime.

sentences:
What is the state of the art in procedural character animations? I'm a programmer and I'm interested in programmatic character animation — walking or running, bipedal or many-legged: what is the state of the art today?

I heard about NaturalMotion's Euphoria system and Ubisoft's IK Rig, and they look amazing. Where can I find more info about similar algorithms?

sentences:
Efficient collision detection - tile based HTML5/Javascript game I'm building a basic RPG game and I'm looking at collisions/pickups etc now.

It's tile based and I'm using HTML5 and Javascript.

I use a 2D array to create my tilemap.

I'm currently using a switch statement for whatever key has been pressed to move the player.

I have if statements to stop the player going off the edge of the map and viewport. If the player is about to land on a tile with tileID 3 then the player stops.

Here is the statement:

canvas.addEventListener('keydown', function(e) {
    console.log(e);
    var key = null;
    switch (e.which) {
        case 37:
            // Left
            if (playerX > 0) {
                playerX--;
            }
            if(board[playerX][playerY] == 3){
                playerX++;
            }
            break;
        case 38:
            // Up
            if (playerY > 0) playerY--;
            if(board[playerX][playerY] == 3){
                playerY++;
            }
            break;
        case 39:
            // Right
            if (playerX < worldWidth) {
                playerX++;
            }
            if(board[playerX][playerY] == 3){
                playerX--;
            }
            break;
        case 40:
            // Down
            if (playerY < worldHeight) playerY++;
            if(board[playerX][playerY] == 3){
                playerY--;
            }
            break;
    }

    viewX = playerX - Math.floor(0.5 * viewWidth);
    if (viewX < 0) viewX = 0;
    if (viewX+viewWidth > worldWidth) viewX = worldWidth - viewWidth;

    viewY = playerY - Math.floor(0.5 * viewHeight);
    if (viewY < 0) viewY = 0;
    if (viewY+viewHeight > worldHeight) viewY = worldHeight - viewHeight;

}, false);

Is there a more efficient way of handling collisions, than loads of if statements for each key?

The reason I ask is because I plan on having many items that the player will need to be able to pickup or not walk through like walls cliffs etc.

sentences:
How do I hide the camera object in Unity Editor I have 2019 Unity Editor
I have a huge camera object that is blocking all the other objects that I need to move in the scene,
I want to hide this object, but I cannot find a hide/show menu item anywhere or when I right click on the hierarchy

sentences:
How to control jump strength by how long the player presses the jump button? In a platformer game I am working on, I want my character to have controlled jumps. If I simply tap the jump key it will jump a just a little or if I hold it for a time it will jump higher.

What do I need to do?

sentences:
Game loops using Hard realtime systems vs Soft realtime systems I have read the article here about realtime systems and am looking for examples specific to game loops.

Am I correct in saying:

Hard realtime systems will lag and slow down gameplay causing slow motion if processing of AI, collision detection, or user input is delayed past the rendering deadline set by the realtime system. Example, must render every 1/30 sec but processing caused delay to 1/20 sec.

Soft realtime systems will render at 30 FPS regardless of the other subsystems processing but if there is a delay in AI, collision detection, or user inputs, the game will be presented in stop motion instead of slow motion every 1/30 sec.

sentences:
(Unity) Optimised networking solution for many moving objects I've currently undertaking quite an ambitious project. In short, it's a real time multiplayer strategy game which has bacteria mechanics.

Essentially, I have two remote players in the environment, and they can spawn bacteria-like units which attack each other and multiply, duplicating themselves until a resource limit is hit.
This often results in around 200+ game objects being rendered to the screen, each with their own state and movement. This sounds bad, but the local gameplay against a bot is actually very good, and I've managed to make it quite performant.

However, the issue arises when I try to network this game. I have already attempted to follow this guide to implement this feature: http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/

This produces quite a slow, displeasing game experience even with the best latency. This is likely caused by having to transmit movement data for hundreds of units.

The question I am posing:

How can I optimize the networking and synchronization of many moving units between two clients?

I've already thought of one way to do this. After spawning a unit, they will only travel in one direction until they hit something - perhaps I can synchronize only when units are spawned and when they interact with another object? Would this have much benefit? What's the ideal way to implement this?

Thanks in advance for responses!

sentences:
Rendering Performance: num Draw Calls == num Texture Bindings I'm making a game with Libgdx 1.6.4 and experience some lag issues on iPhone 4 and then discovered:

// in the constructor
GLProfiler.enable();

...

// in the render method
Gdx.app.debug("draw calls: " + GLProfiler.drawCalls);
Gdx.app.debug("texture bindings: " + GLProfiler.textureBindings);
GLProfiler.reset();

What the log shows is that the number of draw calls is always equal to the number of texture bindings. Do you know if this is ok?

It seems strange because I have all images as TextureRegion in only one TextureAtlas with size 1024x512. Isn't it supposed to be that I will have for example 50 draw calls and only 1-2 texture binding instead of 50 draw calls and 50 texture bindings. Can this be the source of the lag?

Another clue may be, that I use a SpriteBatch and Scene2d Stage at the same time, but they both use the same TextureAtlas. The Scene2d Skin is loading the TextureAtlas and SpriteBatch draws TextureRegions from the skins' regions.

Thank you for any help.

--- Update ---

The main SpriteBatch (it's only one) is making 9 totalRenderCalls. The value of maxSpritesInBatch is 26. These values seem normal from what I read in the Docs and the FPS during rendering with the SpriteBatch is 60 FPS. Which is ok, no problem there.

The problem with the lag is when I use a Scene2D Stage to display a Dialog above the GameScreen. The Stage has it's own batch which I don't manipulate directly. When the Dialog is displayed the frame rate drops to 49-50 and the Animations in the Dialog are crappy. I guess the problem has something to do with Texture Binding of the main SpriteBatch and the Stage's SpriteBatch.

sentences:
Keeping an object constrained to a 2d radius based off of the camera A few weeks back I posted a question about keeping an object on the screen.  What I would like to do now is clamping an object around a 2d radius based on the camera.

I'm need this for a reticule for this on rail shooter I've been making. (like that of starfox)

Here is the current code I am using :

        Vector3 movementx = transform.TransformDirection(Vector3.right * Input.GetAxis("Mouse X") * aimSpeed);
        Vector3 newPosx = transform.position + movementx;
        Vector3 offsetx = newPosx - centerPt.position;
        transform.position = centerPt.position + Vector3.ClampMagnitude(offsetx, radius);
// the same for the y axis

The problem with this set up is that I'm restricting it around 3-dimensional objects base off their locations in the world. (this is restricting the players movement towards the edges not letting the player to move the reticule to the side)

So this is what I've tried:

   Vector3 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
   Vector3 shipOnScreen = Camera.main.WorldToScreenPoint(Ship.position);

        Vector3 movementx = transform.TransformDirection(Vector3.right * Input.GetAxis("Mouse X") * aimSpeed);
        Vector3 newPosx = screenPosition + movementx;
        Vector3 offsetx = newPosx - shipOnScreen;
        transform.position = shipOnScreen + Vector3.ClampMagnitude(offsetx, radius);
// the same for the y axis

This just seems to send the empty (which the ship is pointing at) off some where else in the world I cant even tell if I'm moving it or if its just moving with the parent object. (I've tried different variations with this moving the screenPosition swapping it with the transforms position in world space to no avail)

My guess is that its not converting 2d space to 3d space when I try to clamp a 3d object within that radius.

I would like to keep my reticule at an empty point on the screen and not replace it with the cursor.

Edit:

Okay i have now thought up a new system that still needs some work. Having an empty object next to the reticule. With this I cut out the need for a 2d radius but I need this object object follow the ship on on the screen with taking in account the perception of the camera.

I have taken a measure of the height and width of the camera. Its not too exact but it should do.

So i guess I would like to know how the coordinate system on the camera is set up. like where is (0, 0)

update:

Okay I've found a way to do this but it took a quite a bit of math on my part and a bit of estimation on my behalf.

The way I've set it up is that I moving the pivot the same way I'm moving the ship only I'm multiplying it times the proportion of distance the ship can move side to side vs the distance the pivot can move side to side. I still have not built in an equation that will allow me to move the point farther back with more accuracy but this is a good temporary fix and if i really have to move it I'll i do the math again. but I would still like to have the equation of the rate of change. I'm not that brilliant at related rates. If you want to see my math I noted it down.

but if i can have an equation out of this it would work perfectly while changing

  ship distance (constant) (61.6209, 27.5131)

  first measure  distance : 100

  point A distance  (320.5, 143.1)

  5.20115872075484 y-multiplier

  5.200473802917458 x-multiplier

  so the multiplier at 100

  5.2

  distance : 50

  point B distance  (192.0436, 85.74551)

  3.11633 y-multiplier

  3.11633 x-multiplier

  so the multiplier at 100

  3.11633

  Rate of change  (5.2-3.1165)/(100-50) = ROC

  ROC = 0.04166934

  mt = 0.042

  y = No idea

  x = distances from ship

  =0.042

Oh in case your wondering how i got my measurements I measured the distance manually with points.

sentences:
Filling a room with random furniture This is a rather complex question and I'm more hoping for general algorithms anyone might have heard of.

I wish to generate randomly sized rooms. Each of these rooms has a type and a corresponding list of furniture to be placed inside it (ie: kitchens can have fridges, both kitchens and living rooms can have TVs, etc). Each piece of furniture has it's own collider (cylinder, cube, mesh...). Are there any good algorithms to randomly lay them out?

The best idea I've managed so far is to subdivide the room into a grid the size of the smallest piece available. Then I would randomly place the furniture until every grid square is at least partially filled. However, this is hardly ideal and the rooms would more or less look like warehouses.

[Optional]How do I randomly place the furniture in such a way as to make it at least look slightly realistic?

sentences:
How can I roll up a plane with a vertex shader? I have plane that I want to roll up using a vertex shader, like this:

I found a math demo that shows the kind of curve I want my mesh to follow. I tried implementing this in my shader code, but the results don't form a roll as expected:

Shader " Custom/Rolling "
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Bend("Bend",Float) = 1
_Strength("Strength",Float) = 1
}

SubShader
{
Tags {"Queue"="Geometry" "IgnoreProjector"="true" "RenderType"="Opaque"}
Cull Off

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

struct v2f
{
half2 texcoord  : TEXCOORD0;
float4 vertex   : SV_POSITION;
};

sampler2D _MainTex;
float _Bend;
float _Strength;

v2f vert(appdata_full v)
{
v2f o;

//I don't know what should I write here for rolling ,please help me.
//v.vertex.y *= ???
v.vertex.y *= exp(_Bend+(v.vertex.x*_Strength)); // something like this but this hasn't twist effect
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
return o;
}

float4 frag (v2f i) : COLOR
{

float2 uv = i.texcoord.xy;
float4 tex = tex2D(_MainTex, uv);

return tex;
}
ENDCG
}
}
Fallback Off
}

Instead of a neat roll, the end of my plane shoots up into the sky!

sentences:
Find point in 3D plane I have four points in a 3D space, example:

(0,0,1)
(1,0,1)
(1,0,2)
(0,0,2)

Then I have a 2D position on that square plane:

x = 0.5
y = 0.5

I need to find out the 3D space point of that position in the plane. In this example it's easy: (0.5,0,1.5) Because Y is zero. But imagine that Y was not zero (and not all the same), that the plane is leaning in some direction. How would I calculate the point in that case?

I imagine this should be a pretty easy thing to solve, but I can't figure it out. Please answer in programming terms and not in straight math terms.

Update with image: The gray plane (made out of two triangles) are the real one actually existing. I create a non-existing plane on top of this, the ABCD corners are exactly the same, however it doesn't slope. What I need to do is project a pixel (blue one in example) from the non-existing plane to the existing plane. It will be in the exact same location, except that it has gained a Y value from the sloping plane.

What I've been able to work out so far on my own is which one of the two triangles to use in the gray plane and the normal of triangle. I basically just need to figure out how I can project the pixel.

sentences: Full map image loading, vs individual tile loading I want to make a isometric tile game in java, like a lot of strategy games out there. What is the best approach to loading the map for this game? Would it be better practice to load one single image for the whole map, or would it be better to make images for each tile and render each tile using a int array?

sentences:
How to prevent players from getting lost during the onboarding phase of an RPG? I've created a new RPG and tested it with some players. They like it, but get lost at certain points.

For example, I'm using hotkeys to open modals, T to talk, and other buttons that do various things. Moreover, some of the quests aren't entirely clear.

To fix this, I'm trying to think of a good onboarding approach.

I'm implementing three methods for onboarding:

1) Cutscenes: The cutscenes, especially the opening scene, will give the backstory and explain where they are

2) The NPC dialog: Through conversations with NPCs, they will give hints as to what you should do. Right now, I include, somewhat awkwardly, things like:

  "Hi there, I'm Bob. You can press T to talk".

3) Onscreen Tooltips: These blink on screen until the player completes the current onboarding task. For example, the tooltip disappears when the player clicks their minimap:

I'm looking for a more cohesive strategy for onboarding users to the game, or good tutorials for this. Two things I'm weary of are:

I don't want to be overbearing with help, and am attempting a good Discovery Phase to let the player explore.
I don't want the player to leave the game out of frustration with being lost

I've seen a lot of techniques for various game genres, and even things like Google apps, where they have a glowing choice for the user to click on. I'm a sole developer, and some of these techniques seem quite complicated to implement.

Thanks!

sentences:
Any way to combine instantiated sprite renderers into one texture so I can apply into a plane at runtime? So I am procedurally generating a tile set in Unity by instantiating different tiles that only have a transform and sprite renderer components. I managed to pack the sprites using unity sprite packer assigning them a packing tag so that I reduce the draw calls drastically.

But Im still having to deal with a great amount of game objects in the scene when the camera zooms out, increasing the batching and giving me problems when I try to apply light to them for example.

So I am trying to find a way to combine all these sprite renderers into a texture.So I can then apply this to a plane and Ill only have to deal with one plane gameObject for the map. But I cant figure out how to do this. I cant really use the combine meshes way as they are sprites only, not meshes. I tried taking a screenshot at run-time but It comes up a bit blurry. Any idea how can accomplish this?
Thank you for your help.

sentences:
How can I change existing hierarchy in Unity regarding animations? I made a bunch of animations in Unity.  Now I need to adjust the hierarchy.  For example:

My animator used to change things in this tree, where the head, legs, and arms were animated:

Player
-->Torso
----->Head
----->Arms
----->Legs

Now I added another layer in my hierarchy so that it is:

Player
-->Body
----->Torso
-------->Head
-------->Arms
-------->Legs

And it cannot find the existing animation, since the hierarchy path is different.  How can I insert the body in my animation hierarchy so that I can keep my new hierarchy without having to redo all of the animation?

sentences:
How can I get my meshes to work with Bullet Physics? The problem is that I'm trying to use my meshes with Bullet Physics for the collision part of my game.

When I attempted doing this method with my GLM(model loading library by nate robins) model, I get a segmentation fault in the debug, so I figured that it doesnt like the coordinate variables of the model.

If i use blender to export my model as a collision file, what type of file should I use?

I have heard of a .bullet exporter, but i dont know hot to integrate this python script into my Blender 2.5 program.

sentences:
How to handle large scene/game in unity3d? I have a very very Big/Huge scene to load and I can't load it at once.

The one strategy i know is that  I divide the scene into multiple scenes and load my scenes it into async manner as my character controller move. I am moving my character controller and accordingly loading (its near)scenes by matching its position. But it is not smooth. . .

How do I load big scene smoothly? what will be the strategy? Is this right strategy which I am doing or there is any other feasible and easy to use solution available.?

sentences:
2D Sidescroller Gravity Ive looked up implementing gravity on several sites. Subtract a constant gravity (9.8 * DeltaTime) from the velocity each frame. My problem is, when implementing it as they say, when walking off a ledge the player will float off, not vertically, just accelerates too slowly as he falls.

World->Gravity = -9.8 * PixelsToMeters;   // PixelsToMeters = 32
CurrentAcceleration = Vector2(0.0f, World->Gravity);
CurrentVelocity = (CurrentAcceleration * DeltaTime) + PrevVelocity;
Vector2 halfATSq = currentAcceleration * 0.5f * Square(DeltaTime);
Vector2 vt = CurrentVelocity * DeltaTime;
CurrentDelta = halfATSq + vt;
CurrentPosition += CurrentDelta;

Now the thing is, with the 1/2at^2 + vt + p calculation, the character does fall about 20 meters in 2 seconds, (I think those are the numbers I used, that was a couple hours ago), so it seems the calculations are right. Ive played quite a few side scrollers and none of them have this floating feel.

So, I tried calculating the gravity based on a TimeInAir variable that multiplies the World->Gravity on the third line, instead of DeltaTime.

CurrentVelocity = Vector2(currentAcceleration.X * DeltaTime, currentAcceleration.Y * TimeInAir) + PrevVelocity;

He no longer floats, he falls as expected. Even jumping looks better. However, now he falls 20 meters in 1 second. Ill deal with this, it is only a game and not reality.

Question is, why is it that this works instead of the original code? Or do I have an error somewhere? Because I have to rework the physics code to get it to look right for everything, instead of just using the basic equations. Is it because its all calculated in pixels? Im wondering if I need to add a full gravity to the velocity on the first frame instead of gravity * DeltaTime? This works for falling off a ledge, but not for jumping.

Im testing these questions as I think of them in my code, and still not getting it. These ideas dont seem to work. Thanks for looking and whatever help or ideas you can give!

sentences:
How to quickly calculate the sight area in a 2D tiled game? I have a matrix of tiles, on some of that tiles there are objects. I want to calculate which tiles are visible to player, and which are not, and I need to do it quite efficiently (so it would compute fast enough even when I have a big matrices (100x100) and lots of objects).

I tried to do it with Bresenham's line algorithm, but it was slow. Also, it gave me some errors:

----XXX-        ----X**-     ----XXX-
-@------        -@------     -@------
----XXX-        ----X**-     ----XXX-
(raw version)   (Besenham)   (correct, since tunnel walls are
                              still visible at distance)

(@ is the player, X is obstacle, * is invisible, - is visible)

I'm sure this can be done - after all, we have NetHack, Zangband, and they all dealt with this problem somehow :)

What algorithm can you recommend for this?

For my needs, I'll define visible like this: tile is visible when at least a part (e.g. corner) of the tile can be connected to center of player tile with a straight line which does not intersect any of obstacles.

sentences:
How do I handle my collision resolution using a delegate scheme? My physics engine is coming along quite nicely, and I'm ready to start working on some more advanced features. I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs.

Say we have object A, object B, and object C in the physics simulation. I want to be able to inform a delegate about a collision between A and B, and also inform a potentially different delegate about a collision between A and C.

I have a known interface for the delegate, I have the potential of storing a state for my collision detector, although I currently do not, and have the ability to store states in the objects, themselves. Similarly, I use this delegate model to handle collision resolution, simply setting the physics engine as the delegate for all objects by default, and allowing the user to change the delegate if desired.

I have already tried having each object store it's own collision delegate, that would be informed when a collision occurred. This didn't work, because when the objects had the same collision delegate, the same collision was handled twice. When I switched to only using the delegate of the first object (however that was decided), the order of simulation became an issue. I want to use a dictionary, but that introduces a significant amount of overhead. However, that seems like the direction I need to be heading.

How do I handle my collision resolution using a delegate scheme?

sentences:
How to create a "retro" pixel shader for transformed 2D sprites that maintains pixel fidelity? The image below shows two sprites rendered with point sampling on top of a background:

The left skull has no rotation/scaling applied to it, so every pixel matches perfectly with the background.
The right skull is rotated/scaled, and this results in larger pixels that are no longer axis aligned.

How could I develop a pixel shader that would render the transformed sprite on the right with axis aligned pixels of the same size as the rest of the scene?

This might be related to how sprite scaling was implemented in old games such as Monkey Island, because that's the effect I'm trying to achieve, but with rotation added.

Edit

As per kaoD's suggestions, I tried to address the problem as a post-process. The easiest approach was to render to a separate render target first (downsampled to match the desired pixel size) and then upscale it when rendering a second time. It did address my requirements above.

First I tried doing it Linear -> Point and the result was this:

There's no distortion but the result looks blurred and it loses most of the highlights colors. In my opinion it breaks the retro look I needed.

The second time I tried Point -> Point and the result was this:

Despite the distortion, I think that might be good enough for my needs, although it does look better as a still image than in motion.

To demonstrate, here's a video of the effect, although YouTube filtered the pixels out of it:

http://youtu.be/hqokk58KFmI

However, I'll leave the question open for a few more days in case someone comes up with a better sampling solution that maintains the crisp look while decreasing the amount of distortion when moving.

sentences:
Unity Error importing any video clip When I try to import a video file to play in a VideoPlayer component, I get the following errors in the Console:

WindowsVideoMedia error 0xc00d5212 while reading C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4

Context: Setting media type for first video stream
Error details: No suitable transform was found to encode or decode the content.
Track types:
   Audio Track, type: U
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
Error while reading movie: C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
VideoClip import error for Assets/Videos/output.mp4
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
WindowsVideoMedia error 0xc00d5212 while reading C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4

Context: Setting media type for first video stream
Error details: No suitable transform was found to encode or decode the content.
Track types:
   Audio Track, type:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The video file is just an ordinary H.264/AAC MPEG-4 video file transcoded using ffmpeg. But I also tried the same format and H.264/AAC QuickTime MOV (both rendered from Blender) and AVI (JPEG) from Blender as well.

System Details:

Unity 2018.4.12f1 (LTS) Personal
Build target: Android (Minimum API Level 25)
Windows 7 Home Premium 64 Bit (SP1)
Blender 2.80
ffmpeg version N-85588-g6108805

I tried to post this to the Unity Forums before, but as of writing this, the thread has yet to be greenlighted by moderation, so I might as well try posting it here, as you usally get an answer much more quickly

sentences:
Random/Procedural vs. Previously Made Level Generation What the advantages/disadvantages of using random/procedural generation vs. pre-made levels?

There seems to be few that I can think of, other than the fact that items may be a problem to distribute in randomly generated terrain, and that the generated terrain may look weird.

The downside to previously made levels is that I would need to make a level editor, though. I cannot decide what is better to use.

Could answers include code/examples of both procedural and premade generation, as well as the pros/cons?

sentences:
Java: AI to make a mob face the player working half-way correctly While creating some basic AI for my "ghost" mob that is just up for testing at the moment, I thought of allowing it to face the player, depending on the player location. I get it to work correctly, but it doesn't act exactly as I want it to. Here is the current code I use for when getting the ghost to face the location of the player:

if (player.getX() < this.getX())
    dir = 3;
else if (player.getX() > this.getX())
    dir = 1;
else if (player.getY() < this.getY())
    dir = 0;
else if (player.getY() > this.getY())
    dir = 2;

It will switch viewing position as I want along the x-axis, but along the y-axis I have to be exactly lined up for it to face me as so (the sprite below the first one is the player, I am just using the same sprite for the ghost at the moment):

As long as I am down there I would like it to face that location, but if I adjust one pixel this happens:

For the mapping, I want it to act similar to this, positions will change within a certain range is what I really want though, so if I were to move to the left side of the ghost, it would switch to that view, but if I were to stay at the bottom, I want it to stay facing that way:

My problem is that I want the ghost to face the player depending on the location, and I just can only get it to face the way I want it to on the x-axis, and not how I want on the y-axis, I have to be exactly lined up by the pixel for the y-axis for the ghost to face the player vertically. How would I accomplish this?

sentences:
Strategies for monster targeting AI in a turn-based combat system I am making a Final Fantasy-style battle system.

I have a random generator that select the monsters move when it is their turn; different moves have different chances to be performed. I also have reactions and conditional actions for the monster to create simulated intelligence... but what I can't figure out is targeting.

I could just choose randomly between the five player characters, but I was looking for something that would make the game more challenging by adding some kind of strategy to the monsters' actions.

I code in C++.

Does anyone have an idea how to implement a system for the monster to choose who to attack besides completely random?

sentences:
How can I make the player "look" to the mouse direction? (Pygame / 2D) Here's my code:

import sys
import pygame
pygame.init()

screen_width = 640
screen_height = 480
screen = pygame.display.set_mode((screen_width, screen_height))
running = True

class Actor:

    def __init__(self, x, y, w, h):
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.surface = pygame.image.load("GFX/player.png")
        self.rotated_surface = self.surface.copy()
        self.rect = self.surface.get_rect()

class Player(Actor):

    def __init__(self):
        Actor.__init__(self, 0, 0, 32, 32)
        self.directions = [False, False, False, False]
        self.speed = 0.1

    def rotate(self, angle):
        rot_image = pygame.transform.rotozoom(self.surface, angle, 1)
        rot_rect = self.rect.copy()
        rot_rect.center = rot_image.get_rect().center
        self.rotated_surface = rot_image

    def move(self):
        if self.directions[0]:
            self.y -= self.speed
        if self.directions[1]:
            self.y += self.speed
        if self.directions[2]:
            self.x -= self.speed
        if self.directions[3]:
            self.x += self.speed

    def draw(self):
        screen.blit(self.rotated_surface, (self.x, self.y))

player = Player()

def redraw():
    screen.fill((75, 0, 0))
    player.draw()
    player.move()
    pygame.display.flip()

while (running):
    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            sys.exit()
        elif e.type == pygame.KEYDOWN:
            if e.key == pygame.K_ESCAPE:
                sys.exit()
            if e.key == pygame.K_w:
                player.directions[0] = True
            if e.key == pygame.K_s:
                player.directions[1] = True
            if e.key == pygame.K_a:
                player.directions[2] = True
            if e.key == pygame.K_d:
                player.directions[3] = True
        elif e.type == pygame.KEYUP:
            if e.key == pygame.K_w:
                player.directions[0] = False
            if e.key == pygame.K_s:
                player.directions[1] = False
            if e.key == pygame.K_a:
                player.directions[2] = False
            if e.key == pygame.K_d:
                player.directions[3] = False
        elif e.type == pygame.MOUSEMOTION:
            mouse_x = pygame.mouse.get_pos()[0]
            mouse_y = pygame.mouse.get_pos()[1]
            angle = math.atan2(mouse_y - player.y, mouse_x - player.x)
            angle = angle * (180 / math.pi)
            player.rotate(angle)

    redraw()

Here's the image:

The blue arrow represents the "weapon" / "eyes" of the shooter, and the green arrow represents the mouse cursor. How can I use the transform module to rotate the image "in the direction" of the mouse cursor?

sentences:
2D character controller in unity (trying to get old-school platformers back) This days I'm trying to create a 2D character controller with unity (using phisics). I'm fairly new to physic engines and it is really hard to get the control feel I'm looking for. I would be really happy if anyone could suggest solution for a problem I'm finding:

This is my FixedUpdate right now:

public void FixedUpdate()
{
    Vector3 v=new Vector3(0,-10000*Time.fixedDeltaTime,0);
    _body.AddForce(v);

    v.y=0;
    if(state(MovementState.Left))
    {
        v.x=-_walkSpeed*Time.fixedDeltaTime+v.x;
        if(Mathf.Abs(v.x)>_maxWalkSpeed) v.x=-_maxWalkSpeed;
    }
    else if(state(MovementState.Right))
    {
        v.x= _walkSpeed*Time.fixedDeltaTime+v.x;
        if(Mathf.Abs(v.x)>_maxWalkSpeed) v.x=_maxWalkSpeed;
    }

    _body.velocity=v;

    Debug.Log("Velocity: "+_body.velocity);
}

I'm trying here to just move the rigid body applying a gravity and a linear force for left and right. I have setup a physic material that makes no bouncing and 0 friction when moving and 1 friction with stand still. The main problem is that I have colliders with slopes and the velocity changes from going up (slower) , going down the slope (faster) and walk on a straight collider (normal). How could this be fixed? As you see I'm applying allways same velocity for x axis.

For the player I have it setup with a sphere at feet position that is the rigidbody I'm applying forces to.

Any other tip that could make my life easier with this are welcomed :).

P.D. While coming home I have noticed I could solve this applying a constant force parallel to the surface the player is walking, but don't know if it is best method.

sentences:
Constant 2D Bullet movement in a shmup I've been following the pixelnest tutorial to make a 2D shmup (http://pixelnest.io/tutorials/2d-game-unity/player-and-enemies/).

While working on this I've experimented with increasing the firing rate to get a continuous stream of bullets, and I've noticed that bullets are more spaced apart if the ship is moved backwards, and they get clumped up when the ship is moved forwards. Is there a way to maintain constant distance between bullets no matter the movement of the player?

Should I even care? I get the feeling that if the player moves backwards then the firing rate is essentially slower (at least until they reach the edge of the screen) and vice versa if you move forwards.

sentences:
How can I load an asset from a file after I exported the build? I am seeking possibility to switch character textures for game, even after I have compiled and built the binary.

For example I have a troll with a Sprite from "/assets/texture1.png"

Now after the game has been released, I can change this sprite.

Currently I have found this method

func _ready():
    var texture = load("res://textures/troll1.png")
    sprite.texture = texture

But after the export, when I change the troll1.png, the texture in the game remains the same.

sentences:
Water/Ocean simulation and physics I'm looking for some references about water simulation, and how to model it's interaction with bodies (like boats, ships, submarines).

I've found a lot of references on the visual aspects of water (waves, reflection, etc), but very little about how to deal with the way it should interact with bodies. My experience with game development is very limited, and I'm really stuck here.

Bascally I would like to be able to make the position of a ship variates according to the waves. How can I do this?

I'm using Panda3D, but hope to hear about techniques and implementations used in any available technology.

sentences:
How to make a map (game world) based on a real world place or city? As a disclaimer before my real question, I have little experience in game development, only basic Unity knowledge.

I noticed a lot of games are based on real world places and cities, for example GTA 5 on Los Angeles and Watch Dogs. What is the process of making such a virtual version of a real world place or city? Or at least, what is a good starting point?

I imagine you could get some sort of map data or satellite images and import this in a tool, from which you can start modelling the buildings etc. But if this is the case I don't know how to do that.

sentences:
Make openGL program only update every 1/60 seconds I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu intensive. I have managed to make it only perform rendering every 16.7 ms or so, but the outside loop that is waiting to render still is iterating as fast as my computer can handle.

This is the full main.cpp:
http://pastebin.com/KaCW7wZw

This is the main loop at line 95:

while (!terminate) {
    if (SDL_GetTicks() >= time_start + frame_rate)
    {
        time_start = SDL_GetTicks();
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT) {
                terminate = true;
                break;
            }
        }

        glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        renderLoop(entities, &counter);
        SDL_GL_SwapWindow(m_window);;
        counter += 1.0f;
    }
}

I've tried googling and haven't found anything concrete (obviously), except that using some kind of sleep is bad design for these loops.

So how can I alter this to slow the whole thing down, and avoid having 100% cpu usage for a program that's not doing much at the moment?

sentences:
Calculating distance travelled I am working on a road fighter kind of game. The game has its tracks moving to give the effect of  car movement. The car accelerates and decelerates as expected with certain keys pressed. But How do I give the notion of distance travelled by the car and how to calculate it?

For some reference, here's how the movement of tracks is sped to simulate acceleration and deceleration:

void Update ()
        {
        if (Input.GetKey(KeyCode.F))
        {
            if(speed<=35f)
            {
            speed = speed + 3f* Time.smoothDeltaTime;

            }

        }
        if (Input.GetKeyUp(KeyCode.F))
        {

                speed = speed - 7f * Time.smoothDeltaTime;

        }

        if(Input.GetKeyDown(KeyCode.S))
          {
            speed = speed - speed/2;
        }
        this.transform.Translate (Vector3.right * Time.smoothDeltaTime * speed);

        }

sentences:
Collision detection without classes, in Pygame I am writing a game in Pygame and want to get collision detection working. The aim is that when an object hits another, the target object disappears. I want to avoid having classes for now, to keep things simple. This makes it difficult to get collision detection working, because the Rect method in Pygame assumes classes.

The logic I want to achieve is:

if object hits a target object
    target object disappears

What's the minimal code I'd need to achieve this?

sentences: How do I access the pixels of an SDL 2 texture? How exactly can one get to the RGBA pixel arrays of SDL 2.0 textures? Does the texture need to be specially initialized and locked down?

sentences:
GLSL - Drawing 2D UI elements over objects in 3D space I posted a similar question earlier but I wasn't specific enough about what I wanted to do.

I have meshes being rendered in 3D space as expected. What I would like to do is display 2D billboarded UI elements over these objects at their 2D positions in screen space, facing the camera like billboards and with uniform scale regardless of the distance to the 3D mesh.

Right now I calculate gl_Position for the meshes like this:

gl_Position = projection * (vec4(position, 1.0) * (transformation * inverse(view)));

I've tried a couple things, like setting the upper 3x3 portion of the transformation * inverse(view) product to the identity:

mat4 bbTransformation = transformation * inverse(view)
bbTransformation[0][0] = 1.0;
bbTransformation[0][1] = 0.0;
bbTransformation[0][2] = 0.0;

bbTransformation[1][0] = 0.0;
bbTransformation[1][1] = 1.0;
bbTransformation[1][2] = 0.0;

bbTransformation[2][0] = 0.0;
bbTransformation[2][1] = 0.0;
bbTransformation[2][2] = 1.0;
gl_Position = projection * (vec4(position, 1.0) * bbTransformation)

but the final result is slightly offset if the camera is not looking directly at the object, and the 2D elements are still scaled with distance.

This is what I currently have:

And this is what I want (mocked):

How can I get the effect I want?

sentences:
Smooth input handling in Java I am writing a Java game.

My problem is to get a really smooth input. If I hit the key W the character has to go forwards, but if I hit A and release the W key, the character doesn't go left ways :( .

It isn't smooth. Which ways are given in common game developing for a smooth input?

My current source code
(Input.java): http://pastebin.com/9Z9qtXik
(MainLoop.handlingInputs): http://pastebin.com/Vx8BzSpL

sentences:
How to deal with data that needs to be accessed by all objects? I have a World class that currently only has one instance. It has data and methods that need to be accessed by all other game objects. Right now I'm hardcoding a reference to the global variable world in all of my methods, and this doesn't seem to be the right approach.
Another idea I tried was a dependency-injection-esque approach, where each object stores its own reference to the world object, but this clutters memory with unnecessary references, so I don't think this is the right approach either.
Another approach I tried was passing world as an argument directly into the method call, but this led to repetitive code as I was constantly passing world into any function that needed it.
A bit of research hasn't worked for me because it's hard to summarise my problem into a few words that can return Google search results. It seems this isn't a problem in the majority of applications, so I'm wondering if this is mainly a gamedev situation.
What is the best way to solve this problem?

sentences:
What's wrong with my food generating code? This script is intended to produce amount of (food) objects for the players over the network. What should happen is that when a player eats one food, another food object gets created in another random place. Somehow it doesn't do that.

Here's the script.

 public class FoodManager : Photon.MonoBehaviour {

 [SerializeField] GameObject smallCirclePrefab;
 [SerializeField] float widthOfBoard = 100;
 [SerializeField] float heightOfBoard = 100;
 [SerializeField] int amtOfSmallCircle = 100;
 [SerializeField] int sizeOfCircle = 5;
 // Use this for initialization
 void Start()
 {
    if(PhotonNetwork.isMasterClient)
    produceSmallCircle(amtOfSmallCircle);
 }
 // Update is called once per frame
 void Update()
 {
 }
 void produceSmallCircle(int n)
 {
     Vector2 position;
     GameObject circle;
     float positionX, positionY;
     int ratioOfSize = 5;
     for (int i = 0; i < n; i++)
     {
         positionX = Random.Range(-widthOfBoard / 2, widthOfBoard / 2);
         positionY = Random.Range(-heightOfBoard / 2, heightOfBoard / 2);
         position = new Vector3(positionX, positionY,0);
         circle = PhotonNetwork.InstantiateSceneObject(smallCirclePrefab.name, position, transform.rotation, 0,null) as GameObject;
         circle.transform.localScale = new Vector3((float)sizeOfCircle / ratioOfSize, (float)sizeOfCircle / ratioOfSize, (float)sizeOfCircle / ratioOfSize);
     }
 }

 }

and here's the other script

 using UnityEngine; using System.Collections;

 public class FoodCollision : Photon.MonoBehaviour {

 public static float amtOfIncreaseSpeed = 1f;
 public static float amtOfIncreaseHealth = 1f;
 public static float ratioOfSpeed = 150.0f;
 public static float increaseSize = 0.001f;
 PhotonView photonView;
 BoxCollider2D boxCollider;
 SpriteRenderer sp;
 void Awake()
 {
     photonView = PhotonView.Get(this);
     boxCollider = GetComponent<BoxCollider2D>();
     sp = GetComponent<SpriteRenderer>();
 }
 // Use this for initialization
 void Start()
 {
 }
 // Update is called once per frame
 void Update()
 {
 }
 public void DestroyGO()
 {

     photonView.ownerId = PhotonNetwork.player.ID;
     boxCollider.enabled = false;
     sp.enabled = false;
     photonView.RPC("DestroyRPC", PhotonTargets.MasterClient);

 }
 [PunRPC]
 void DestroyRPC()
 {
     PhotonNetwork.Destroy(gameObject);
 }

 }

sentences:
Why spritebatch.Draw shows blank output? In my code below, I think it's correctly done. But idk, the image called by _bg is does not shown up. The screen only show White. Weirdly, there is 0 error message when I run it.

(The RenderTarget2D is for default-ing my view into landscape mode)

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameName2
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Game
    {
        GraphicsDeviceManager _graphics;
        SpriteBatch _spriteBatch;
        Texture2D _bg;

        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _bg = Content.Load<Texture2D>(@"background");
            // TODO: use this.Content to load your game content here
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // TODO: Add your update logic here

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            // TODO: Add your drawing code here
            _spriteBatch.Begin();
            _spriteBatch.Draw(_bg,
                new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height),
                null,
                Color.White,
                0,
                Vector2.Zero,
                SpriteEffects.None,
                0);
            _spriteBatch.End();

            base.Draw(gameTime);

        }
    }
}

I use xnb file. And I put it in Content folder in the project. I've set 'Content' and 'Copy if newer' to the file property.

This is the .png file I use before converted into xnb:

Or maybe the problem is in my .png file?

Any idea?

sentences:
Vector3 Array serialization ReorderableList I've been working on a ReorderableList, but it's given me quite the headache. I've come to the point where I want to define a "drawElementCallback" -callback, which looks like this:

list.drawElementCallback = (rect, index, active, focused) => {
    EditorGUI.PropertyField(rect, list.serializedProperty.GetArrayElementAtIndex(index), GUIContent.none);
};

What it's supposed to draw is one Vector3 object from an array of Vector3 objects. I get this property like this: ("property" is a SerializedProperty that contains the property that I need)

SerializedProperty locationsProperty = property.FindPropertyRelative("locations");

The array is declared as follows:

public Vector3[] locations;

Inside a container class that is marked as "Serializable".

The problem I kept getting with different code is that the ReorderableList shows all the Vectors correctly but it doesn't allow me to reorder any of the items, nor delete them (I can add new Vector3 objects and change them as expected).

With this code, I wanted to fix that issue. However, now I keep getting the following error:

"InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)"

I wanted to make a reorderable list because it seemed easy, but I can't figure out the problem and I honestly wish I hadn't started working on it. It's taken up most of the past 3 days.

If anyone knows how to fix this, I would be very grateful.

To clarify, this code shows the array properly:

list.drawElementCallback = (rect, index, active, focused) => {
    SerializedProperty item = locationsProperty.GetArrayElementAtIndex(index);

    EditorGUI.BeginChangeCheck();
    item.vector3Value = EditorGUI.Vector3Field(rect, string.Empty, item.vector3Value);
};

But doesn't allow me to remove or reorder items. I thought I should show the code to demonstrate that there are indeed array items.

sentences:
How can I implement smart scripting, in my game? I'm developing a game engine. It is supposed to be an entity/components based one. For developing my game, itself, I thought to use some scripting language to actually create the entities.

For example, if I want to add a kind of monster that is aggressive to the player, it will be an entity with several components; those components will change with the monster type, so if I have one hundred different types of monsters, in my game, I will not have to create a new method for each of them straight in my game code.

Should I use a scripting language to describe this entity, in term of components or is there something else that would work better? More generally, how should I use scripting, in my game?

sentences:
How do I linearly interpolate between two vectors? I have a velocity vector where my client is at and where its going, and I have the same vector that comes from the server telling where the client should be. Sometimes its a bit different, so I want to interpolate between my current position to the server correct position.

The black arrow is the client velocity vector, the red arrow is the client velocity  vector on the server and the blue arrow is the one that I want to calculate and interpolate to.

How do I calculate the blue vector? Then, how can I linear interpolate between them?

sentences:
How can randomly paired players fairly select a map? I'm developing a website for a board game that revolving around user-created boards.  Matches are currently created by selecting two people who have been waiting in a queue the longest and creating a match for them.  We will later implement matchmaking with specific users.

What is an appropriate way to select a map when a match is created with two random people?

Should one player be allowed to pick the map?
Should a random map be selected?
Maybe the players should rank a collection of popular boards by preference, then select the one with the highest average rating?

sentences:
Global PostProcess in UnrealEngine 4.10.2 I am new to UnrealEngine and following few tutorials to get started with.

I am trying to find "Global PostProcess" (in World Outliner) in UnrealEngine 4.10, but I am not able to find it. Has it been changed compared to previous version of UnrealEngine? If so whats the alternative of it?

Thanks.

Update

This is what I have:

And it doesn't look anything like whats there in this link (see Assigning to a Post Process Volume)

https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/PostProcessMaterials/PostProcessDemoMaterialOverview/index.html

sentences:
Unity Particle System collision detection problem I'm using Unity 3.5.5f3 wich has the Shuriken particle system.

I've made a blood particle system based on Unity's demos. (Exploding paint [Blood])
The blood is flowing and when it collides with a Plane Transform wich I've created a small pool of blood spawns as a Collision Sub Emitter.

My main problem is that when I want to add another object to collide it just doesn't want to work. When I create a cube, and set it as a collision plane the collision will only occur at the half of the cube.

I want this to happen: When it reaches the cube's surface the sub emmiter activates, and when the surface is horizontal it appears horizontally, and if it's vertical then vertically. Now it just appears horizontally everytime like in the picture.

How could I solve it?

sentences:
How to connect a UPhysicsConstraintComponent of an AActor to an FKSphylElem (capsule body) of a ragdoll? I'm trying to connect an Actor's UPhysicsConstraintComponent to a capsule body of a ragdoll. The reason I do it this way, instead of just using sockets on the constraint, is bodies may have offsets from bones, and than connected things things would look incorrect. I'd like to connect to the physics bodyFKSphylElem  instead of the bone/socket.
The Physics Asset has a TArray<UPhysicsConstraintTemplate> called ConstraintSetup, which I am adding my "Actor constraint" to. It also has a TArray<USkeletalBodySetup> . These USkeletalBodySetups contain the geometries I'd like to connect to,in this case capsules as FKSphylElems.
I wrote some code to give my idea a test.
I am setting up bone and component names for the new constraint, but it does not connect objects, although the new UPhysicsConstraintTemplates and FConstraintInstances are added to the Phats ConstraintSetup (checked in the debugger).
   void UBPLibrary::ConnectConstraintToSkeletalMeshActorPhysicsAsset(
       UPhysicsConstraintComponent* Constraint,
       USkeletalMeshComponent* Mesh,
       FName BoneName) {

     if (!IsValid(Mesh) || !IsValid(Constraint))return;

     UPhysicsAsset* Phat = Mesh->PhysicsAssetOverride;

     if (!IsValid(Phat))return;

     UPhysicsConstraintTemplate* constraintTemplate = NewObject<UPhysicsConstraintTemplate>();

     FConstraintInstance * ConstraintInstance = &Constraint->ConstraintInstance;

     ConstraintInstance->ConstraintBone1=BoneName;
     ConstraintInstance->ConstraintBone2=FName(Constraint->GetName());

     constraintTemplate->DefaultInstance = *ConstraintInstance;

     if (!IsValid(constraintTemplate))return;

     Phat->ConstraintSetup.Add(constraintTemplate);

     //apply changes to the ragdoll
     UWorld* world = GetWorld(Constraint);
     FPhysScene* PhysScene_PhysX = world->GetPhysicsScene();

     Mesh->TermArticulated();
     Mesh->InitArticulated(PhysScene_PhysX);
 }

sentences:
Procedural rock algorithm I'm looking to create some procedural low poly rocks and boulders for a game.

I haven't found much interesting information on the internet other than 3D software articles. Not sure what way to go.

sentences:
How do I draw a world rectangle as a GUI I would like to draw a perspective green rectangle that glows (=it constantly changes its alpha between 0 an 1).

I already achieved this, but not as a GUI element, but as a real 3D object.

In order to show this rectangle in front of everything else, I have to turn this into a GUI element. And I don't know how I would draw a perspective rectangle that constantly changes its alpha on the GUI.

I do not only mean the math behind it, but also how to do it exacetly:
Do I use actual materials, or do I use an image in the size of the green box?

Thank you.

Edit:

This is what I'm trying to rebuild:

sentences:
Unable to Set-Up unity remote? I have installed Android Studio and set the path in unity. And I am able to build apks with no problem. But when I try to test in unity remote unity gives an warning as

  Set-up Android SDK path to make Android remote work

I don't know what is happening. If Android SDK path is not set then how am I able build the apks.

I tried to solutions like enabling usb debugging mode , running unity editor first then opening Unity Remote , installing Google USB driver component of Android SDK but none of them worked for me.

sentences:
Large vertex buffer vs multiple draw calls I'm just getting started with OpenGL, and I'm attempting to use it to create a 2D game. In this game, I have a hexagonal grid made up of a very large variety of differently-colored hexagons. As a newbie OpenGL programmer, I see two ways of drawing this grid:

Using a vertex buffer with the data for a single hexagon, then using a uniform offset value and iterating on the CPU to draw the same program many times until I have a grid.
Creating a singular very large pre-calculated vertex buffer that draws all the hexagons in a single call.

What's the most efficient method? Is there a better way of doing this?

sentences:
Best option to narrow a known set of triangles? I am building collision detection and response in a custom engine. This routine happens between the moving player, and static entities on the map.

In the first phase, the broad phase I am moving the player and looking for any new AABB to AABB collisions between the player and static entities.

In the second phase, the narrow phase. I then do a swept-spehere to triangle detection. I move the players collision sphere through the triangles in the colliding AABB.This phase can be expensive because the colliding AABB may have complicated geometry with many triangles.

I need to narrow down the set of triangles being detected. Some solutions I have in mind are:

Get the "overlap box" the space where both AABB's overlap in the broad phase.

Then do a pass on all the triangles in the colliding AABB and return just the ones in the overlap box.
My understanding here is I'll have to use a SAT algorithm to detect if the AABB and triangles collide or not and I'll still have to iterate over all the triangles in the colliding AABB. I'm not sure if this is any more performant.
Sort the triangles by distance to the AABB collision

If I sort the triangles by their distance to the AABB collision I will be able to exit from the narrow phase before the entire set of triangles has been processed.
I'm not sure what the performance implications of resorting the triangles each frame would be. I'm thinking not great...
Use a spatial partitioning data structure OctTree or quadTree to narrow down the triangles.

It may be extensive work to build one of these structures together for my engine and populate it with all the entities triangles. I'm not sure if they will give me any improved granularity. Will they be more precise than the AABB overlap?

I wanted to ask for help first before I start building one these solutions and reviewing the performance. Any other ideas are greatly appreciated.

sentences:
How can I approximate walking physics via simpler sliding physics? I am modeling walking insects.  I implement them as cuboids and use forces (including friction and drag), to control motion.  However, the movement characteristics of this 'sliding box' physics don't match those due to a legged creature.

For example, legged creatures near-instantly accelerate to their top speed; whereas applying a force to a box takes time to accelerate it.

The applied force can be increased along with the counteracting drag, giving much quicker acceleration (via force) to a max speed (via drag).  However, this also means the force that creatures can exert when pushing on other objects is increased.

Does anyone know of any techniques using a physics engine to cheaply model walking creatures?

sentences:
How do I account for the velocity difference between a ship and it's fired projectile? In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.

The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity?
This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.

I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:

public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;

}

sentences:
Load FBX material data I have the following piece of C++ code which I use to load triangle vertices from an FBX file:

FbxNode *node = scene->GetRootNode()->GetChild(0);
FbxGeometryConverter fbx_converter(node->GetFbxManager());
fbx_converter.Triangulate(node->GetNodeAttribute(), true);
mesh = node->GetMesh();
int num_vertices = mesh->GetPolygonVertexCount();
FbxVector4 *fbx_vertices = mesh->GetControlPoints();
int *fbx_triangle_vertices = mesh->GetPolygonVertices();
double x, y, z;
vector<vertex> vertices;
for (int vertex_index = 0; vertex_index < num_vertices; ++vertex_index)
{
    int index = fbx_triangle_vertices[vertex_index];
    x = (double)fbx_vertices[index][0];
    y = (double)fbx_vertices[index][1];
    z = (double)fbx_vertices[index][2];
    vertices.push_back(vertex(vector3(x, y, z), material(color(1, 0.5, 0.5), 0, 0, 0, 0, 1, 0)));
}

Currently, I am only loading vertex coordinates from the file. Now I want to load the vertex's material data (instead of assigning it manually like I did in the code snippet using material(color(1, 0.5, 0.5)...).

I see that an FbxNode object has a GetMaterial() method, but I don't know how to obtain this data since I am working with fbx vertices which are FbxVector4s, not nodes.

sentences:
Isometric objects are mapped incorrect angle, but the map is fine. What am I missing? I laid out my iso map and it's fine, but when I add my sprite actors they get located in the correct location but they are laying down not standing up. I tried rotating them on the z by 45 but then they moved to the wrong location.

Anyone have any idea what I'm doing wrong? looks like a steam roller ran over my object :-)

I'm going to try and upload pics.

https://picasaweb.google.com/114100917691803291674/20140120?authuser=0&feat=embedwebsite

**correct location,but the image is laying down...

**standing up, but wrong map position..

sentences:
rotate sprite and shooting bullets from the end of a cannon Possible Duplicate:
  How to Align Gun with Bullets

Hi all i have a problem in my Andengine code,

I need , when I touch the screen, shoot a bullet from the cannon (in the same direction of the cannon)
The cannon rotates perfectly but when I touch the screen the bullet is not created at the end of the turret

This is my code:

private void shootProjectile(final float pX, final float pY){
    int offX = (int) (pX-canon.getSceneCenterCoordinates()[0]);
    int offY = (int) (pY-canon.getSceneCenterCoordinates()[1]);
    if (offX <= 0)
            return ;
    if(offY>=0)
                    return;

    double X=canon.getX()+canon.getWidth()*0,5;
    double Y=canon.getY()+canon.getHeight()*0,5 ;
    final Sprite projectile;
    projectile = new Sprite( (float) X, (float) Y,
                    mProjectileTextureRegion,this.getVertexBufferObjectManager() );

    mMainScene.attachChild(projectile);

    int realX = (int) (mCamera.getWidth()+ projectile.getWidth()/2.0f);
    float ratio = (float) offY / (float) offX;
    int realY = (int) ((realX*ratio) + projectile.getY());

    int offRealX = (int) (realX- projectile.getX());
    int offRealY = (int) (realY- projectile.getY());
    float length = (float) Math.sqrt((offRealX*offRealX)+(offRealY*offRealY));
    float velocity = (float) 480.0f/1.0f;
    float realMoveDuration = length/velocity;

    MoveModifier modifier = new MoveModifier(realMoveDuration,projectile.getX(), realX, projectile.getY(), realY);
    projectile.registerEntityModifier(modifier);
}

@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_MOVE){

        double  dx = pSceneTouchEvent.getX() -  canon.getSceneCenterCoordinates()[0];
        double  dy = pSceneTouchEvent.getY() -  canon.getSceneCenterCoordinates()[1];

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 180 / Math.PI;
        canon.setRotation((float)Angle);

        return  true;

    }
    else if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN){

        final float touchX = pSceneTouchEvent.getX();
        final float touchY = pSceneTouchEvent.getY();

        double  dx = pSceneTouchEvent.getX() -  canon.getSceneCenterCoordinates()[0];
        double  dy = pSceneTouchEvent.getY() -  canon.getSceneCenterCoordinates()[1];

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 180 / Math.PI;

        canon.setRotation((float)Angle);
        shootProjectile(touchX, touchY);
    }

    return false;
}

Anyone know how to calculate the coordinates (X,Y) of the end of the barrel to draw the bullet?

sentences:
How do we adapt our game to work over a network? A friend of mine has made a Java version of a popular board game in Java, and has it working for multiplayer on one PC with different turns for each player. He's mentioned he wants it to eventually run from a webserver and people around the world can play the game together, but he's dismissed this as impossible (translated: Too hard to be worthwhile).
I'd like to make this happen for him, and I'm wondering:

Do we need to completely rebuild or can we just adapt the existing code, for the game to work across a network?
What are the advantages of a GWT based browser game, compared to a swing based client side game that updates to a server?

What is the common practice here, for going from one instance on one PC to multiple instances across several networked PCs?
Edit:
The game code is very well broke and down and generalised; game logic and display are completely seperate. The main GUI is a scroll pane with a dungeon, squares are coloured for monsters, players, doors, floors etc, and are just JButtons essentially. Players have turns and then the monsters have a turn. It's very simple in essence.

sentences:
3D collision detection on non flat surface I am developing a game which needs an accurate collision detection algorithm, when an object travels down a slope which isn't flat.  To be more precise I need to simulate a skier who travels down a ramp.

My first idea was to create simple bounding box around the skies and the ramp. Then place the skier in mid air and start calculating gravity. When the two bounding boxes intersect => collision detected (this is how I did it in 2D). But the problem is that the skies are flat and the slope isn't. So there is a chance that the ski will stick into the jump (due to curved surface of the jump) or even worse the skier  will go under the jump (I don't want the skies to "sink" into the jump as well) .

What would be the best way of solving this?
What I could think of is:

when collision is detected, rotate the skies until the front and the back end of the skies are colliding with the surface.

Is this idea any good? Did any face this kind of problem? Would be better to morph the skies according to the slope (but this would probably be an overhead I can't afford)?

P.S. if I didn't explain enough, write a comment and make a sketch.

sentences:
How do I make games that interact with desktop windows? I want to know how games like desktop pet games like Sheep work, so I can make my own:

In this game, the creatures are being rendered directly to the desktop or over top other windows. How do they accomplish this task? How are they getting the window information? Do they take and process screenshots?

sentences:
What are known game mechanics to disallow player to become infinitely rich still keeping it fun to progress? I want to make an online game with a leaderboard. A player should be able to gather tools/resources to continue exploring/harvesting. The problem I want to solve is that someone can find a way to harvest things like money, food, ammo, crafting resources, etc. infinitely but I don't want it to happen, because: 1) it can potentially ruin the leaderboard 2) it potentially disconnects old players from new players because they become interested in different things having nothing to talk about to share the gaming experience. The player should sometimes to be forced to go back to start but it should be still fun.

For example, games about zombies. AFAIK, the game Project Zomboid had zombies amount growing and resouces were limited in such way that you was losing in any way. Why would it be still fun? Because there is a challenge in how many days you can survive.

Another example -- Realm of the Mad God. There you get into the leaderboard only when you die. So once you reach the goal you start from the level 1 again. You can't be in the leaderboard and keep progressing. Why doesn't it ruin the fun? Maybe because you don't lose the loot that you've saved in a "vault" and while you are now level 1 and can't use most of your loot immediatelly it's still there, not lost.

Rogue games like Nethack, Stone Soup, Cogmind -- basically the world has limited size and once you clean the level you have nothing else to do other than go to the next level. It's still fun because once you master your skills in the game the competition changes from maximizing your progress to minimizing steps you've used to reach the end goal. Like spent steps, time, abilities used, etc.

Rust -- in this one players are playing against each other and you lose almost everything when your base is raided. The base is an object in 3d world and to raid it the opponent have to make nearly a straight hole to the center. So the amount of resources you have to spend on armoring your base is X^3 where X is amount of resources needed to raid you. This makes it impossible to infinitely armor yourself and so finally you get raided anyway. Why is it still fun? Maybe because everything gets wiped once in few weeks and there are game updates that make it not boring to start again because the game will be a bit different.

There is a game mechanic in The Elder Scrolls Online that prevents trading guilds becoming infinitely rich as I understand. I'm not the guild owner and so I can be wrong but every week there is a bidding that forces guilds to pay as much as they can to win a bid to, simply saying, have a benefit during the week. AFAIK all the bids are gone and this is how the amount of money the guilds have in the MMO game with no wipes is limited.

I want my game to have some sort of "death" that would reset the progress to effectively keep players away from having infinitely large base, amount of money, etc. while still being fun to start again. What are some other game mechanics for this that I missed?

sentences:
Rotating object along bezier curve: not rotating enough? I tried to follow the instructions from the threads on the forum (Cocos2d rotating sprite while moving with CCBezierBy) with Unity, in order to rotate my object as it moves along a bezier curve. But it does not rotate enough, the angle is too low, it goes up to 6 instead of 90 for example, as you can see on this image (the y eulerAngle is at 6, I would expect it to be around 90 with this curve) :

EDIT: here is the solution :

Vector3 v3 = newPos - oldPos;
v3.y = 0.0f;
transform.rotation = Quaternion.LookRotation(v3);

Here is the code (in c# with Unity) : (I am comparing x and z to get the angle, and adding the angle to eulerAngles.y so that it rotates around the y axis)

void Update () {
        if ( Input.GetKey("d") ) start = true;
        if ( start ){
            myTime = Time.time;
            start = false;
        }
        float theTime = (Time.time - myTime) *0.5f;
        if ( theTime < 1 ) {
            car.position = Spline.Interp( myArray, theTime );//creates the bezier curve
            counterBezier += Time.deltaTime;

            //compare 2 positions after 0.1f
            if ( counterBezier > 0.1f ){
                counterBezier = 0;
                cbDone = false;
                newpos = car.position;
                float angle = Mathf.Atan2(newpos.z - oldpos.z, newpos.x - oldpos.x);
                angle += car.eulerAngles.y;
                car.eulerAngles = new Vector3(0,angle,0);
            }
            else if ( counterBezier > 0 && !cbDone ){
                oldpos = car.position;
                cbDone = true;
            }

Thanks

sentences:
Bullets Are Spawning Weirdly in my Java/LibGDX Plane Shooting Game What I'm trying to do

Have bullet's spawn in the center ( or close enough, the exact number can be played with after ) of my player sprite.

What's going wrong:

They're spawning super weirdly. The first one always spawns at the bottom left corner. Than they spawn all over the place though not completely random. If I shoot on only the right side of the screen, bullets don't spawn on the left side.

How I'm doing it:

Creating a New Bullet and Managing them , Methods:

Method Placement:

Drawing (In Batch):

Also:

I know that I'm not using LibGDX arrays, or objects, or array of objects, or sprites for the bullets. ( I used sprites for the player ) though I was going through confusing complications and this strategy with batch drawing seems inefficient but simplified for my development ability.

I also haven't made a bullet disposal/reset system yet. I'm still working on this part first.

Anyone know what I'm doing wrong or a solution?

EDIT: ManageBullets is just so the bullet's go up once they spawn. ( Shooting )

sentences:
Checkerboard like rendering does not save performance I have a simple scene in Unity with a camera and a quad facing the camera filling the whole viewrect.
The quad has a material with the following shader:
Shader "Skip"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                float4 screenPos : TEXCOORD0;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.screenPos = ComputeScreenPos(o.vertex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                int2 screenUV = (i.screenPos.xy / i.screenPos.w) *_ScreenParams;
                bool skip = (screenUV.x + screenUV.y) % 2 == 0;
                if (skip) {
                    return fixed4(1,0,0,1);
                }else{
                    fixed4 clr = fixed4(0,0,1,1);
                    for (int i = 0; i < 10000; i++)
                    {
                        clr += i % 2 -0.5;
                    }
                    return clr;
                }
            }
            ENDCG
        }
    }
}

The shader returns simple color for an even pixel and runs an expensive computation for an odd pixel.
There is no performance difference between running the expensive operation on all the pixels and running it on just half the pixels.
bool skip = (screenUV.x + screenUV.y) % 2 == 0; // ~13fps
bool skip = true; // ~2300fps
bool skip = false; // ~13fps

Why is there no improvement in performance?

sentences:
rotating objects in a double orbit I have a object at the center. Other set of objects rotating around center in first orbit. Now i want other objects to rotate around the objects in 1st orbit.

In the above fig, set of triangles are rotating around the square and circles are rotating around the triangle.
I have the code which works for 1st orbit, but i am  not able to render that second orbit.

I am calling display in loop. i is static global variable.
which transformations will do the second orbit?

sentences:
How to await async operations / coroutines? I'm looking for a generic / reusable way to wait for coroutines and asynchronous operations to finish in Unity 5, similiar to C#5's await keyword.

The simplest way I can think of is something like this:

 public class SomeUtility {
     public bool IsDoingSomething { get; private set; }

     public IEnumerator DoSomethingAsync() {
         IsDoingSomething = true;
         yield return new WaitForSeconds(2);
         IsDoingSomething = false;
     }
 }

and then in another coroutine:

 while(!someUtilityInstance.IsDoingSomething)
     yield return null;

However this is not very nice because it clutters the code with while statements, is not reusable (needs instances and dedicated classes even for simple utility functions!) and a lot of singleton or static stuff where it's not even needed.

The closest I found is using Unity's AsyncOperation. This here works very nicely:

public static IEnumerator Await(this AsyncOperation operation) {
    while(!operation.isDone)
        yield return operation;
}

yield return SceneManager.LoadLevelAsync("blaaaah").Await();

However.. the problem is: How to create an AsyncOperation? A few services, for examples SceneManager are using it, but the documentation completely lacks anything about creating custom operations or wrapping existing coroutines etc.

So, is there a way to create a simple, generic and resuable "await" for custom coroutines?

sentences:
Why is my primitive xna square not drawn/shown? I have made this class to draw a rectangle, but I cant get it to be drawn, I have no issues displaying a 3d model created in 3dmax, but shown these primitives seems much harder

I use this to create it

board = new Board(Vector3.Zero, 1000, 1000, Color.Yellow);

And here is the implementation

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Shapes;
using Quadro.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Quadro
{
    public class Board : IGraphicObject
    {
        //Private Fields
        private Vector3 modelPosition;
        private BasicEffect effect;
        private VertexPositionColor[] vertices;
        private Matrix rotationMatrix;
        private GraphicsDevice graphicsDevice;
        private Matrix cameraProjection;

        //Constructor
        public Board(Vector3 position, float length, float width, Color color)
        {
            var _color = color;

            vertices = new VertexPositionColor[6];
            vertices[0].Position = new Vector3(position.X, position.Y, position.Z);
            vertices[1].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[2].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[3].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[4].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[5].Position = new Vector3(position.X + length, position.Y + width, position.Z);

            for(int i = 0; i < vertices.Length; i++)
            {
                vertices[i].Color = color;
            }

            initFields();
        }

        private void initFields()
        {
            graphicsDevice = SharedGraphicsDeviceManager.Current.GraphicsDevice;
            effect = new BasicEffect(graphicsDevice);
            modelPosition = Vector3.Zero;

            float screenWidth = (float)graphicsDevice.Viewport.Width;
            float screenHeight = (float)graphicsDevice.Viewport.Height;
            float aspectRatio = screenWidth / screenHeight;
            this.cameraProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
            this.rotationMatrix = Matrix.Identity;
        }

        //Public Methods
        public void Update(GameTimerEventArgs e)
        {

        }

        public void Draw(Vector3 cameraPosition, GameTimerEventArgs e)
        {
            Matrix cameraView = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                effect.World = rotationMatrix * Matrix.CreateTranslation(modelPosition);
                effect.View = cameraView;
                effect.Projection = cameraProjection;
                graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 2, VertexPositionColor.VertexDeclaration);
            }
        }

        public void Rotate(Matrix rotationMatrix)
        {
            this.rotationMatrix = rotationMatrix;
        }

        public void Move(Vector3 moveVector)
        {
            this.modelPosition += moveVector;
        }
    }
}

sentences:
Why doesn't this movement script work, while the other one does? Im trying to get a rigidbody2D to move around and got it working with this script:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rigidbody2d;
public float speed = 5.0f;
Vector2 movement;

void Start()
{
    rigidbody2d = GetComponent<Rigidbody2D>();
}

void Update()
{
    movement.x = Input.GetAxis("Horizontal");
    movement.y = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    rigidbody2d.MovePosition(rigidbody2d.position + movement * speed * Time.deltaTime);
}

but not with this, and I can't understand why:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rb2d;
float horizontal;
float vertical;
public float speed = 5f;

private void Start()
{
    rb2d = GetComponent<Rigidbody2D>();
}

private void Update()
{
    horizontal = Input.GetAxis("Horizontal");
    vertical = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    Vector2 position = this.rb2d.position;
    position.x = position.x * speed * horizontal * Time.deltaTime;
    position.y = position.y * speed * vertical * Time.deltaTime;

    rb2d.MovePosition(position);
}
}

sentences:
OpenGL - question about glColorPointer So, I'm just starting out with LWJGL, and my current task is to render two colored cubes on the screen. I can render them, however, I'm looking for some advice on the most efficient way to specify the colors. Currently, I'm doing this:

// specify vertices and colors
vertexData.put(new float[] { -0.5f, -0.5f, 0, 0.5f, -0.5f, 0, -0.5f,  0.5f, 0, 0.5f,  0.5f,  0, // 1st cube vertices
                             -1.0f, -2.5f, 0,    0, -2.5f, 0, -1.0f, -1.5f, 0,    0, -1.5f,  0 }); // 2nd cube vertices
colorData.put(new float[] { 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, // colors for 1st cube
                            1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1 } ); // colors for 2nd

In the render loop:

glVertexPointer(vertexBufSize, GL_FLOAT, 0, 0L);
glColorPointer(colorBufSize, GL_FLOAT, 0, 0L);
...
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // 1st cube
glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); // 2nd cube

This works, but I can't help but think that since I'm specifying the exact same color values for both cubes, I'm wasting memory. I was hoping to just have one set of vertex colors that could be applied to each cube that gets drawn. Can it be done? If so, what is the best way to do it?

Thanks

sentences:
How do I find an optimal FPS for best user experience while preserving battery life? I'm developing an Android game. The "graphics" I'm using need little CPU/GPU, so they run with high FPS. Because saving energy is important on Android devices, I want to limit frame-rate (if deltaTime < limitDeltaTime -> Thread.sleep(...) ).

How high should the frame-rate be to get an optimal balance between saving resources and a "fluid" gameplay experience. At which point is the user experience optimal or no longer improving?

sentences:
Quality Current Free UDK Tutorials? I'm just getting started with the UDK, with experience in Unity, and would like a good tutorial series about getting to know my way around the basics of level design and a touch on programming. I have found some basic tutorials on level creation, but they are pretty old, and would like to know more.

Thank you!

sentences:
Detect left and right movement of sprite I have a sprite of ball which moves when a player tap and holds the ball and move finger on the screen. I have a attached animations on it. straight, left, right and when the ball hits something.

Here is my code:
ball.cs

 public RuntimeAnimatorController straight;
    public RuntimeAnimatorController left;
    public RuntimeAnimatorController right;
    public RuntimeAnimatorController ballHit;

    Animator animator;
    Vector2 prevPos;

    private void Start()
    {
        animator = gameObject.GetComponent<Animator>();
    }

    void Update ()
     {

         //Gets the world position of the mouse on the screen
         Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

         //Checks whether the mouse is over the sprite
         bool overSprite = this.GetComponent<SpriteRenderer>().bounds.Contains(mousePosition);
         if(GameObject.Find("GameController").GetComponent<brickMovement>().gameOver == true)
        {

            animator.applyRootMotion = true;
            animator.updateMode = AnimatorUpdateMode.UnscaledTime;
            animator.runtimeAnimatorController = ballHit;
        }
         //If it's over the sprite
         if (overSprite)
         {
             //If we've pressed down on the mouse (or touched on the iphone)
             if (Input.GetButton("Fire1") && GameObject.Find("GameController").GetComponent<brickMovement>().gamepaused == false && GameObject.Find("GameController").GetComponent<brickMovement>().gameOver == false)
             {
                 float x = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
                 float y = Camera.main.ScreenToWorldPoint(Input.mousePosition).y;
                 //Set the position to the mouse position
                 prevPos = this.transform.position;

                 //Debug.Log(animator.runtimeAnimatorController);
                 if ((x > -1.938 && y > -4.51) && (x < 1.98 && y < 4.5))
                 {
                    //Debug.Log("Previous Pos: " + prevPos.x);
                    Debug.Log(IsThisObjectMoving());
                    if (this.transform.position.x < 0 && IsThisObjectMoving())
                     {
                        animator.runtimeAnimatorController = left;
                     }
                     else if (this.transform.position.x > 0 && IsThisObjectMoving())
                     {
                        animator.runtimeAnimatorController = right;
                     }
                     else if (this.transform.position.x == prevPos.x)
                     {
                        animator.runtimeAnimatorController = straight;
                     }
                     this.transform.position = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,
                     Camera.main.ScreenToWorldPoint(Input.mousePosition).y,
                     0.0f);
                 }
             }
         }
     }

    bool IsThisObjectMoving()
    {
        Vector3 sek0pos;
        Vector3 sek1pos;

        sek0pos = gameObject.transform.position;
        StartCoroutine(delay());
        sek1pos = gameObject.transform.position;

        if ((sek1pos.x - sek0pos.x) > 0f)
            return true;
        else
            return false;
    }

    /*

    Make function out of the above function that will check if object is
    moving left or right.

    */
    IEnumerator delay()
    {
        yield return new WaitForSeconds(1.0f);
    }

I am having issue in detecting if ball is moving left or right. When ball is not moving straight animation should be played. but when it is the respective direction animation should be played.

Secondly when I do a hit animation it ends quickly without getting played properly.

sentences:
Slicing irregular spritesheet (automatically?) If found a cool sprite sheet on the internet but its irregular.

Is there any way besides manually cutting sprites to extract the separate pngs?
I need to pack them then again into the Texture Atlas under proper names.

Maybe theres some smart online tool that uses deep learning or something like that?

sentences:
How to get current Microphone Frequency in Godot Let us say I want to create a singing game similar to SingStar, and for this purpose I want to get the audio pitch the microphone is getting, in real time, or as close as possible.
I know I can get audio input in Godot. Even record the microphone to a file, there is an official demo project that does that (mic_record). I also know there are libraries that can analyze the audio.
How can I get the microphone pitch in real time?

Yes, I'm answering my own question. This question is inspired on a similar one on StackOverflow, which asked for a library to do this, which lead to the question getting closed, and the asker deleted it instead of editing the question… Before I noticed. As it turns out, you don't need libraries to do this. This is a means to answer the question I believe that person should have asked.

sentences:
Integrating specular, diffuse reflection and refraction I am implementing an MLT bidirectional path tracer. I have a problem integrating diffuse, specular reflection and refraction.

1) The first problem is diffuse and specular reflection. Diffuse reflection is done by sampling ray in a hemishere. But specular reflection is done by finding the ray that have an angle to the normal equal to the incident ray with the normal. However, an object can have both diffuse and specular reflection. When to use specular reflection or diffuse reflection for a ray?

2) Same as the first question but this time integrating reflection with refraction.

I've seen a few research papers and websites online where the scene have specular, diffuse reflection and refraction, but they have no tutorial on how to do this.

sentences:
How to synchronize a parent and child position? When watching this video of Unity development, I was following along trying to learn Unity and for the most part understood everything conceptually.

Where I got lost was when I tried using some of the same code and setup in Unity. I got the code working fine, but I got in trouble when I tried to implement the parent-child behavior seen in the video at around 7 minutes regarding the Enemy objects.

The solution described is set up as follows (someone correct me if I didn't understand it properly from the video).

Parent Object

Contains the script which drives behavior and movement
Is located at the origin of the scene (reset the transform in other words)

Child Object

Contains the graphics renderer which draws the actual sprite or 3D object
Is located at the enemy spawn point

For me to get this setup working, I had to run the Translate function explicitly against the child object:

transform.GetChild(0).Translate(dir.normalized * distThisTurn)

However, in the video, it appears to work just fine with only:

transform.Translate(dir.normalized * distThisTurn)

Once he fixes the rotation issue, at about 7 minutes in, this works beautifully, and the enemy travels the path exactly as expected. When I tried this exact same approach, my enemy sprite jumps all over the place. It took me several hours to figure out that I needed to add the .GetChild(0) part. The behavior I saw with the setup from the video is that the invisible parent object moved correctly along the path, and the child went crazy and followed some alternate version of the same path, as if the origin was different or offset, or the path was reflected across some axis.

My question is: what did I do wrong? Can anyone spot how my setup is different than the one used in the video? Did I miss some detail of how he set up his parent-child objects, particularly for the enemies? Or could this be some different behavior due to the version of Unity he is using (I believe mine is newer as I installed it just this week). I think it could also be some small gizmo or feature he neglects to mention that allows you to synchronize the movement of a parent object with its children.

The reason for this setup (at least as given in the video) is it allows you to easily swap out the graphics. The scripting is tied to the parent, so all you have to do is exchange the child for one with different graphics and you're done. That part makes sense, I just don't understand why the exact same code he uses did not work for me. I'm talking only about the Enemy object here - the creeps that move along the path (it's a tower defense game).

I just want to know because I may have to use this extra GetChild call quite a bit, and I feel like it shouldn't be necessary, especially after seeing it work so well in the video. Doing this would also make my scene design a little easier.

I have already read the comments on that video for additional info, as well as looked through Unity forum posts, other posts here on Game Dev.SE, and Google results. It would seem as if this is either old behavior, or there is some small detail neglected to explain in the video of how to synchronize movement of parent and child objects.

sentences:
Building meshes conforming to terrain deformation I have an uneven terrain on which the player is supposed to build buildings. For most structures I can just fudge the foundations, have them extend through the terrain.
For roads, pipes, tracks and such I do have however the problem how to make them line up. What techniques can I best use to make the meshes of adjacent pieces line up, making it conform to the terrain?

sentences:
How can I change the rotatearound radius in real time when the game is running? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;

    private void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Using the xradius and yradius sliders I want to change the transform.RotateAround radius in real time.

UPDATE:

I added this to the Update:

if (radius > 0)
        {
            var newPos = (transform.position - Turret.transform.position).normalized * radius;
            newPos += Turret.transform.position;
            transform.position = newPos;
        }

The problem is now that some times when the radius the distance from the Turret is small for example 20 or less some times the transform is getting right above the turret not sure why. I want it to rotate around the turret at the fixed set distance(radius) but not to be above the turret. Can't figure out why sometimes it's moving right above the turret then after some time it's getting back to the set distance.

sentences:
Would it be too much overhead to keep a HashMap of variables on a server per object for the purpose of syncing object changes with the client? I am currently writing a server for a multiplayer game. I am trying to find a good solution for synchronizing GameObjects across the server. The server sends each client a snapshot of every object in range over TCP once every 1/15th of a second and it sends minor updates over UDP every 1/30th of a second. I've come to the point in the code where after I've handled login and the basic information exchange I need to start synchronizing objects between the client and server. My original solution was to keep a boolean flag inside of each GameObject class to tell if it had been changed that update cycle or not and then send a serialized version of it across the server. However, the problem with that is that that sends the entire object even if only one variable was changed which wastes bandwidth not to mention the fact that I would need to serialize a representative class and not the actual one that may contain information that should only be server-side. A friend proposed the solution that I should write a class that contains a HashMap of variables that maps Strings to NetVars(a class containing the value and an index for referring to it). All variable changes would go through a get and set function so that we could tell if it had been modified. Each GameObject would keep one of these and when the server goes through its update cycle it would send the updates as a serialized list of NetVars that have been changed for each object to the clients who should receive them along with the object's id.

My question is would that be too much overhead? Would it slow down the server by having a NetVars class for each GameObject? and finally are there any better solutions than these and if so what?

Extra info:
Using Java with Kryonet for networking and the game is expected to have a fair number of entities in player view at any one moment.

sentences:
libgdx scene2d DelayAction and SequenceAction I'm trying to get the delay action in scene2d working correctly. I have multiple image objects which I store in an array and I have managed to get them all displaying, scaling and moving correctly. I can't however seem to get them moving independently using the delay action.

I have tried using the sequence action and that isn’t working either…

I’m trying to create transition effects using little squares that move off the screen.

I have included a sample of the code im using below:

for (i = 0; i < scaleActions.length; i++) {
    ScaleByAction scaleAction = new ScaleByAction();
    scaleAction.setAmount(-0.1f);
    scaleAction.setDuration(0.5f);

    scaleActions[i] = scaleAction;
}

float increase = 0;
for (i = 0; i < delayActions.length; i++) {
    DelayAction delayAction = new DelayAction();
    delayAction.setDuration(0.05f+increase);
    increase += 0.1;
    delayActions[i] = delayAction;

}

for (i = 0; i < boxArray.length; i++) {
    SequenceAction sequence = new SequenceAction(scaleActions[i],moveActions[i],delayActions[i]);
    boxArray[i].setOrigin(boxW / 2, boxH / 2);
    boxArray[i].addAction(sequence);

    //boxArray[i].addAction(sequenceActions[i]);
    //boxArray[i].addAction(scaleActions[i]);
    //boxArray[i].addAction(moveActions[i]);
    //boxArray[i].addAction(delayActions[i]);
}

public void addToStage() {

    for (i = 0; i < boxArray.length; i++) {

        stage.addActor(boxArray[i]);
    }
}

Everything seems to be moving and scaling at the same time, the delay doesn’t look like it is even working.

Hope you guys can help point out what I'm doing wrong.

sentences:
Loading scene doesn't reactivate gameobjects I have some levels and a main menu. When starting the game from the main menu (in the editor debug mode) I can select a level a load it, no problem. However, when I wish to go back to the main menu using

SceneManager.LoadScene(index);

A whole lot of my gameobjects throw exceptions like

  The gameobjects is destroyed, but you are trying to access it

and

  Missing reference exception

and so on.

However, when i start the level from the editor (and not using the main menu), I can go back to the main menu, it works as it should.

NOTE that I don't have any persistent gameobjects. I do have singletons, but no persistence here. Any ideas what could cause the issue?

sentences:
Unity shader set to GameObject position I have a shader with acts like a magnifying glass that I downloaded and I have to attach to the camera scene.

My issue with this I want it in the same fixed position as the sprite but being attached to the camera when I changed the screen size for different devices it wonders to the upper right of the screen.

I am completely new to shaders so I and their scripts so I am not sure if this can be done.

private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
    if (mtrl == null || mtrl.shader == null || !mtrl.shader.isSupported)
    {
        enabled = false;
        return;
    }

    if(Input.GetMouseButton(0) || !detectMouseButtonDown)
    {
        mtrl.SetFloat("_Radius", radius);
        mtrl.SetVector("_Mouse", new Vector4(740, 480, 0));
        mtrl.SetFloat("_Distortion", distortion);
        mtrl.SetFloat("_ScaleArea", scaleArea);
        if(isMagnifyingGlass)
        {
            mtrl.EnableKeyword("IS_MAGNIFYING_GLASS");
        }
        else
        {
            mtrl.DisableKeyword("IS_MAGNIFYING_GLASS");
        }
        if(warpType == WarpType.POW)
        {
            mtrl.EnableKeyword("WARP_TYPE_POW");
            mtrl.DisableKeyword("WARP_TYPE_EXP2");
        }
        else
        {
            mtrl.DisableKeyword("WARP_TYPE_POW");
            mtrl.EnableKeyword("WARP_TYPE_EXP2");
        }
        Graphics.Blit(src, dest, mtrl, 0);
    }
    else
    {
        Graphics.Blit(src, dest);
    }
}

Shader:

Shader "Hidden/MagnifyingGlassFisheyeWarpImageEffect"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 3.0
            #pragma multi_compile WARP_TYPE_POW WARP_TYPE_EXP2
            #pragma multi_compile _ IS_MAGNIFYING_GLASS

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float4 pos : SV_POSITION;
                float4 scrPos : TEXCOORD0;
                float2 uv : TEXCOORD1;
            };

            sampler2D _MainTex;
            float4 _MainTex_TexelSize;

            float2 _Mouse;
            float _Radius;
            float _Distortion;
            float _ScaleArea;

            v2f vert (appdata v)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.scrPos = ComputeScreenPos(o.pos);
                o.uv = v.uv;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                float4 c = 0;
                float2 uv = i.scrPos.xy/i.scrPos.w;
                float2 mousePos = _Mouse.xy / _ScreenParams.xy;
                float wh = _ScreenParams.y / _ScreenParams.x;
                uv.y *= wh;
                mousePos.y *= wh;
                if(length(uv - mousePos) <= _Radius)
                {
                    uv -= mousePos;
#if defined(IS_MAGNIFYING_GLASS)
                    float newLength = _ScaleArea * _Distortion;//_ScaleArea * pow(length(uv) / _Radius,  _Distortion);
#else
#if defined(WARP_TYPE_POW)
                    float newLength = _ScaleArea * pow(length(uv) / _Radius,  _Distortion);
#endif
#if defined(WARP_TYPE_EXP2)
                    float newLength = _ScaleArea * exp2(length(uv) / _Radius * _Distortion);
#endif
#endif
                    uv *= newLength;
                    uv += mousePos;
                }
                uv.y /= wh;

                c = tex2D(_MainTex, uv);
                return c;
            }

            ENDCG
        }
    }
}

Here is what it looks like over the gold selector. It is in the correct position.

Now if I change the screen size for a different device the magnifying effect has shifted to the right

sentences:
Merging several textures into one using RGB channels Would it be possible to place a texture into each RGB channel?

Example:
Red = wood.png
Blue = tiles.png
Green = metal.png

The advantages I could see are saving space, memory and draw calls and the resolution might not suffer. (unless I'm missing something)

I've seen people pack many textures into one but they have to be scaled to fit which lowers resolution.

sentences: Should I finish high school or teach myself? I want to become a game developer, I am an A student in 11th grade and feel like I am wasting my time in High School. I'm thinking of switching to homeschooling so that I have more time to focus on learning game development on my own while finishing high school at home. Some people I spoke to about this say its better to stay in school and go to college, some say I can get my diploma through homeschooling and this way I can get a head start on what I love to do, and get hands on experience. I am not sure what to do and was wondering if there are any experienced programmers out there that can give me advice on what route I should take??

sentences:
C++ Generate random float values between a range In my current situation I have a game world, in that game world I want to place loads of tree models. It is a waste of time for me to actually explicitly define the x y and z values of each tree model, so I want to do this with the help of random logic, so that it can just set the values for me. I don't want true randomness, so I do not need to seed the random logic, I want to generate the positions of all the trees randomly so that I don't need to type each one myself, but each time I run the game the trees are in the same position, so it is not truly random but that is what I want.

My current attempt is as follows:

for (int i = 0; i < numOfTrees; i++) {
        treeObjects.push_back(
        (new Entity(Vector3f(//x, y and z position value of each tree
                             rand() % 200 + (-200), //random value for x
                             0.0f,                  //y value kept as 0.0f
                             rand() % 200 + (-200)) //random value for z
//above code positions the trees, the rest of the code is irrelevant
}

The issue with this is that all the trees are very tightly packed together, so I am very skeptical that they are getting a value between -200 and 200, because if they were they would be much more spread out. Does someone know of a better solution to produce what i'm after? maybe there is an issue with the way I am doing it?

sentences:
How to set a global alpha-blending value in Direct3D 9? Is it possible to set an alpha value globally in Direct3D 9, which modulates the pixel alpha values of every subsequent draw?

I would like to let a whole scene fade in/out. I know that for example ID3DXSprite::Draw() lets you set this in the Color parameter, but I'm using pixel shaders to draw 2D circles and rectangles as well, so I would have to pass the alpha value to each of them.

sentences:
Detect clusters of tokens on an x y grid Ok, so I have a two dimensional grid working on integer x and y coordinates.

Each of this coordinates can have one and only one token on it.

The tokens have the capability of check and return an adjacent token given a direction in which to search (they'll return null in case nothing is there)

I now need an algorithm to check the grid for clusters of 3 or more adjacent tokens and add each cluster to a dedicated variable (meaning than, instead of just stopping after return one cluster, it needs to check for all clusters on the board)

I've been thinking for a while but came out with nothing, any help?

sentences:
Two Army Battle Simulator I'm currently developing a small game project on unity (with purpose of learning C#) where each player controls a base and can build buildings, do research, build units, pretty much the basis.

I arrived where the each player may send their army of different sizes to attack the other player's base. Each army can be composed of three different unit types, being Infantry, Archers and Cavalry. They work as a kind of rock-paper-scissors, meaning infantry beats cavalry given equal resources (horses cost more than warriors, so 1 on 1, cavalry still wins), cavalry beats archers and finally, archers beats infantry given a long distance.

Every unit has different stats, health, damage, armor and range (mouvement speed exists but I do not want to consider it in battle).

I want the battle to be split in rounds and that it is not because you have less soldiers than the other player that you should loose. What would be an interesting way of solving the battle taking account of all those variables ?

Sort of solution I have is to give each player some decisions as to what would he do first (either archers attack first, cavalry waits for flanks, etc.) but nit seems too complicated and I still don't know how each parameter should be calculated. Should luck be included too ?

Thanks,
luisarcher.

EDIT

After comments, here is my question more clearly. What would be the best way to simulate a battle of two armies composed of those units (with their weaknesses and strengths) where both armies would loose troops in X amount of rounds ?

I want the results to evolve with time so the players can react to it (either retreat, or maybe small commands). I'm not looking for a piece of code, but more of a guideline of how should I use every attribute of each unit (health, damage, armor and range).

EDIT2

By best, I mean an interesting resolution where each unit feels unique to be built and where players won't feel forced to build only 1 kind of units since it has the most cost effective hp/damage per amount of resource spent. I'm thinking of something like all those web-based strategy games like Grepolis, Tribal Wars, oGame, etc.

sentences:
UDK: Checking actor type in projectile ProcessTouch So, to be brief, I'm trying to teleport a pawn when it's struck by a projectile (or damaged by any weapon in my game.)

Right now, I'm trying to just call Pawn.SetLocation in the projectile's ProcessTouch. That's a problem because ProcessTouch will hit any actor, not just a pawn. Additionally, any attempts to check the ProcessTouch's "Actor Other" throws errors.

I've tried a bunch of solutions (including making a event TakeDamage in the Pawn controller class,) but to no avail.

    simulated function ProcessTouch(Actor Other, Vector HitLocation, Vector HitNormal)
    {
         if (Other != Instigator)
         {
              //This is where the Other.TakeDamage goes if we are using a traditional gun.
              if (Other == Pawn);
              {
                   Other.SetLocation(0,0,0);
              }
         }
    Destroy;
    }

This code complains that Pawn's a bad expression. How else should I check actor type here?

sentences:
Collision works except for when coming from right side I am trying to make a bomberman clone. I'm having problems with the collision on the walls that is not on the sides of the map (see image). When I come from the right (going left), the red square (player) goes through the wall but when I come from other sides (up, left, down) the collision works well and the player does not go through. The collision on the side walls works well also even when I come from the right and going left.

I am using Tiled and LibGDX and here is the code:

private void checkCollision(float delta) {
    //player.getVelocity().scl(delta);
    Vector2 position = player.getPosition();

    // just to see if it overlaps because this is the location of the
    // rectangle when getTiles is called when player moves left as shown in the image
    Rectangle rect = new Rectangle(128, 128, 64, 64);
    if(player.getRectangle().overlaps(rect)) {
        System.err.println("overlap");
    }

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE - 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left"); // this doesn't show
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    //player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

sentences:
Box collisions between vehicles in traffic pattern I'm working on a traffic simulator. Right now, I have ways to manage 4-way stop intersections and a solution for efficiently determining which vehicles are colliding with one another. All vehicles operate independently of each other and will overlap/ignore any vehicles they pass.

I'm looking to build a way to resolve collisions between vehicles such that a Vehicle will follow the Vehicle in front of it. If a Vehicle stops at an intersection, any Vehicles that follow thereafter should stop and wait as well.

Below are the relevant components I already implemented:

TileGrid containing road segments.
TravelGraph graph of waypoints for Vehicles to travel along the TileGrid.
CollisionTracker for efficiently determining which vehicles are colliding, i.e. O(1) lookup for get_collisions(<vehicle_id>) -> List[<vehicle_ids>]
Intersection for determining which vehicles are waiting at an intersection and determining which Vehicles may pass through it.

The only seemingly-viable algorithm right now is:

Calculate velocities and position of all vehicles after tick
Determine which vehicles are in a collision
Determine which vehicles are in a "collision group" (e.g. if A collides with B, collides with C, then (A, B, C) are in a group)
Determine the order of the vehicles in each group based on their velocities (e.g. if A, B, and C are moving to the right and C is the rightmost, followed by B, followed by A, then the order is [C, B, A]).
Recalculate the positions of all vehicles, in order from front to back (e.g. C, B, A) such that they reside adjacent to, but not touching the Vehicle in front of them.

Problems with this solution:

This requires a lot of recalculations. If there's a line of n vehicles waiting on a light, I'd effectively compute 2*n positions per tick in addition to all other overhead for establishing groups, order, etc.
If the vehicles are following each other around a turn, the logic for finding the "vehicle order" becomes more complex, adding on to the computations per tick.

Ideally moving the vehicles would require n calculations per tick.

I'm open to any/all suggestions here. I've tried building my code as modular as possible, so I'll happily rewrite large parts of it if there's a better architecture to solve this problem.

Below is the visual representation of the TileGrid (black), TileGraph (purple), and Vehicles (circles).

sentences:
How can I store all my level data in a single file instead of spread out over many files? I am currently generating my level data, and saving to disk to ensure that any modifications done to the level are saved.

I am storing "chunks" of 2048x2048 pixels into a file.  Whenever the player moves over a section that doesn't have a file associated with the position, a new file is created.

This works great, and is very fast.  My issue, is that as you are playing the file count gets larger and larger.

I'm wondering what are techniques that can be used to alleviate the file count, without taking a performance hit.  I am interested in how you would store/seek/update this data in a single file instead of multiple files efficiently.

sentences:
Server-side "Fog of War" I am working on my custom server for my online game and I was wondering if there is any way to accomplish this in a more performant way.

Basically I will be spawning and despawning objects (such as other players) to clients based on the distance between their positions. Basically, if you are within, say, 500 meters away from another character, the server will send you a "Spawn character" packet to spawn that character on your client. If you move more than 500 meters away from that client, the server will send you a despawn packet.

The only way I can think of doing this on the server is a nested for loop. For every character on the server, check every other character position. That's expensive and obviously as the character count grows, so does the time it takes for process the loops.

Can anyone think of any different approach to this that will be better performant? Most survival games don't do this, and you just have all characters spawned on every client, but this allows for ESP hacks (Extra Sensory Perception which basically is a hack that shows you exactly where everyone is, even if the client isn't rendering them because they are far away) and I don't want that as a possibility.

If you need any other information let me know, thanks.

sentences: The .apk file for my built game is much larger than expected Assets of my game are 15 MB, Player Settings are default, but my .apk file is 45 MB. I tried to change Player Settings and convert PNG images to JPEG, but this didn't work.

sentences:
pause Menu only working in one scene and not in others Hi I'm working on a game for a school project but I'm still pretty new at game dev, I decided to add a pause menu to my game but for some reason, it only works in one of the scenes in unity, and I can't tell why it won't work on any of the other ones
Here is a video showing the problem: https://youtu.be/28fD9UEtfpg
and here is my script just in case
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;

public GameObject PauseMenuUI;

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            Pause();
        }
    }
}

public void Resume()
{
    PauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

void Pause()
{
    PauseMenuUI.SetActive(true);
    Time.timeScale = 0f;
    GameIsPaused = true;
    Cursor.lockState = CursorLockMode.None;
    Cursor.visible = true;
}
}

sentences:
Making up everything from single pixels I recently saw a game which looked a bit like minecraft, but it was a RPG.
The enemies in this game consist completely of voxels and if they die, they collaps and every single voxels falls down, splattering on the floor.

That looked great and I think it could also look good in a 2D Shooter.
But I cannot think about an approach to handle such an amount of pixels.
What I want to achieve is: The enemies (and also the player) should consist of pixels, but not in a way that let them look like a pixel mess. They should have certain shapes etc.
But everything should be loose. So for example, if there is an endboss with some tentacles or big weapons, it should be possible to destroy these bit by bit. And everytime a bit is destroyed, the single, now loose pixels fly away in all directions.

How is this usually done for voxels?
Will this even be possible with pixels (I cannot see why not)?
How could be an approach to implement such an idea?

sentences:
How to store the state of the world for a fixed time step? Most of the posts on fixed time steps say something like this:

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;   // note: max frame time to avoid spiral of death
     currentTime = newTime;

     accumulator += frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );

How do they calculate and save a State snapshot of the whole world?  do they just make memcpy's or something?  I'm working in Flash and don't have that kind of cloning capability.

sentences:
does XNA have 3x3 matrix? I've checked intelisence and googled for it but it seems there is no 3x3 matrix in xna. I'm just wondering should I just write a matrix class for xna to work freely with matrix class?

by the way I'm trying to multiply vector3 into 3x3 matrix to have both rotation and translation in one matrix class.

sentences: In Unity shaders, how is IN.worldRefl calculated? I want to know how the world reflection vector in shaders is calculated so that I can manipulate it, but there is no documentation on what it does or how Unity calculates it. How is the reflection vector calculated and exactly what does it do?

sentences:
Side scroll game with 8000xScreen_Height, which technique is best I got one new requirement for iOS side scroll game with screen size : 8000xScreen_Height

For this, tileMap is best or normal texture based is best? I need to use parallax background too.

Help me to find right technique.

Thanks in advance.

sentences:
Elegantly exposing properties in Unity inspector There are various game objects in my scene that share some common characteristics, so I created an interface, like so:

public interface IHasLimitedRangeOfMotionAlongZAxis
{
    float MinimumZ { get; }
    float MaximumZ { get; }
}

For certain types that implement this interface, I would like MinimumZ and MaximumZ to be publicly assignable in the Unity inspector. Therefore, I would like to be able to expose these properties in Unity.

I am aware that one approach is to write C# scripts in the Editor folder to implement an ExposePropertyAttribute (see here).

However, this approach is unsatisfactory for two reasons:

My solution is not co-located with my Assets folder. I write my code in a separate solution, and then use pdb2mdb.exe to import my scripts into my Unity scenes. (The reason for doing this is to avail myself of C# language features introduced beyond C# 4.0, which nonetheless target .NET Framework 3.5.)
I shall have to create a custom editor for every single type that implements the interface with publicly assignable properties. This leads to a lot of boilerplate code.

Is there a more elegant approach than adding private backing fields with the SerializeField attribute for all of my public properties?

sentences: Pass parameters from html page to start() function in unity3D webplayer application I want to pass a parameter from web browser to Unity3D web player as soon as it is loaded. I know that, as soon as the web-player is loaded, the start() function is execute inside web-player. So I want to pass parameter from  web browser to this start() function.

sentences:
Road Intersection mesh generation For the last month I was learning about meshes and how procedurally generate them. For what I need it looks very straightforward.
For my little app I planning to have a road tool (very simple), user draws lines and curves and road is generated with specific width (flat).
So I can now create a drawing tool and generate simple mesh along the curve or line.
Next step is to be able to construct intersections...
I looked at lots of example but couldn't find any descriptions how it is done.

Could you please advice what approach to take, how to identify intersection of two or multiple curves and generate mesh junction?

Also could you please advice on bigger picture, should I have sort of underline system for city building app, like graph, to know where to place road intersections, buildings and so on?

Thank you
This is a quick prototype I did (not in code)
https://youtu.be/1TxxB-ofLAo

sentences:
Optimised server structuration I've been wondering a lot lately about how to make an optimised server structuration, and i came to the conclusion that i severely lack knowledge on the subject.

I'll be doing this with either C, C++ or C#, with a preference for the latter.

Context:

I have a server that can operate more than 3K clients at one time.

This server is a game server, hence it only receives key inputs from the clients, for security measures.

Therefore the server is doing every operation on the user's data, and send back enough information to the client in order to display a personal GUI. (The server is of course a console application, don't get me wrong.)

Approaches:

1- 1 Client = 1 Logic Thread

(The thread does the player calculation)

Pros: every client runs his own server code, the server is more responsive to a particular client's request.

Cons: I do not have the insurance that a particular client will iterate its code 14 times while another would have iterated it 10, (so the two players, side by side, if it was for a movement operation, can become 4 squares afar, which should not be the case, as every player should move at an exact same speed)

Locking every thread to perform actions until a next logic loop happens can be quite devastating if something bad happens on any of the client, leading to severe lags in worst cases.

2- 1 Client = 1 Entry Thread, Main logic loop

(The thread receives the keys pressed by its client)

Pros: As the logic is all in the same loop, there is no desynchronization problems anymore.

Cons: Iterating ALL the game logic in one loop will most probably cause severe latency if the operations becomes advanced.

Moreover, if many clients are to catch up with all the current data being processed (sudden peak of connections), it would also cause additional latency, a partial solution would be to retrieve those datas in the Entry Thread.

3- 1 Client = 1 Entry Thread, X Logic threads, 1 Logic Thread synchronizer

(Entry thread receives keys, register the client in the concerned threads (One for each kind of action (Moving, Acquiring user data, Battle, Etc...)), Those threads gives the information whenever they can, and the Logic thread synchronizer ensures that tasks that needs to be "Ordered" in time are ordered.)

Pros: Share computation resources among all the Logic Threads, ensuring minimum latency for clients.

Cons: High vulnerability to resources concurrency, and if a particular task is done faster than another task that is to be synchronized with it, becomes as slow as the latter.

Question:

As i said earlier, i certainly lack knowledge about networking, threading, and concurrency, to efficiently order the structure of my program. Therefore, I'm asking it here:

What would be the best approach to take, and how should the global skeleton should be ordered to minimize latency, and permits a large number of synchronous users to play on the server.

Additional information

Maybe a bit of information about the idea behind this all will help.

My goal here is to create a server that will be used to run a simple RPG, which needs to have movement synchronization on the map (old school square-to-square movements), turn by turn instanciated battle (e.g. Dragon Quest, Final Fantasy, Pokemon), and exchange of user data (seeing X's profile, see how many monsters he killed, his guild, etc.)

If i'm asking for more than 3K clients at the same time, it is because i do not want to make a pile of junk that holds in place by a miracle. I want to further my knowledge on networking and its applied logic, would it be programmative logic or structuration logic.

So basically the problem is "Having a maximum of clients, on a minimally powerful server, therefore optimizing it as much as possible."

sentences:
Why aren't my Unity Ads showing "real" ads? I don't have "Enable Test Mode" checked under in the ads setting in Services, but when ads pop up on my published game, it's showing Unity ads as if the test mode is on. How can I fix this? Thanks!
This is the code I use to add the ads:
Advertisement.Initialize(GooglePlay_ID, GameMode);
Advertisement.Show();

sentences:
How can I fix glitchy Collision on my 2D game? Update: I fixed the Negative axis glitch but the Invisible wall glitch still exists
I have made a 2D game in Java and I rewrote collision as I added chunks.
I have been having problems with the collision detection function, in the negative x-axis coordinates you fall through the world, and in the positive X-axis you sometimes hit into an invisible wall when there are no blocks next to you in that position.
I have tried altering all the numbers until it worked but the problems still happen
Here is the collision function (True = Yes, they are colliding with a Block | False = They are not colliding):
public boolean isCollidingWithBlock(final Point2D.Double pt1, final Point2D.Double pt2) {
        for(int i=0;i<Level.Chunks.size();i++) {
            if (Math.floor((x)/(Level.chunkX*Tile.tileSize)) == Level.Chunks.get(i).chunkNumber) {
                int chunkN = Level.Chunks.get(i).chunkNumber;
                Point2D.Double chunkpoint = pt1;
                if (chunkpoint.x >= 0) {
                    chunkpoint.x = chunkpoint.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint.x = (chunkpoint.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }
                Point2D.Double chunkpoint2 = pt2;
                if (chunkpoint2.x >= 0) {
                    chunkpoint2.x = chunkpoint2.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint2.x = (chunkpoint2.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }

                for (int x = (int)((this.x) / Tile.tileSize); x < (int)((this.x) / Tile.tileSize + 3.0); ++x) {
                    for (int y = (int)(this.y / Tile.tileSize); y < (int)(this.y / Tile.tileSize + 3.0); ++y) {
                        int chunkXPos = 0;
                        if (x >= 0) {
                            chunkXPos = (x%(Level.chunkX));
                        } else {
                            chunkXPos = (x%(Level.chunkX))+((Level.chunkX)*1);
                        }
                        if (chunkXPos >= 0 && y >= 0 && chunkXPos < Level.Chunks.get(i).blockData.length && y < Level.Chunks.get(i).blockData[0].length && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.air && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.water && (Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint) || Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint2))) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

sentences:
Reset 3ds Max 2017 keyboard shortcuts to default I somehow messed up my keyboard shortcuts for 3ds Max 2017. How can I restore them to the default? Is there a default shortcut file I can restore them with?

I'm aware there's a Reset button inside the Keyboard options, but my 3ds Max crashes when I hit that button.

sentences:
How do I implement a programming system in my game that is both accessible, powerful, and fast to code in? I'm currently working on a space-based sandbox game which will heavily feature the ability to custom program your systems. I want to implement this in a way that is both

accessible,
powerful (bare minimum would be turing-completeness)
fast to code in.

Text-based languages generally only satisfy the latter two requirements, and while it's not to difficult to design a visual language which satisfies the first two, visual languages are a pain to program in due to requiring extensive mouse use. While there are some very accessible text-based languages, I want complete non-programmers to be able to ease themselves into programming.

sentences:
Creating a 3D map for XNA? Is anyone aware of a nice 3D map tutorial (how to import and use the map) using XNA without any engine but not limited to an external application (like Tiled for 2D maps) ?

I did a search arund here but have'nt found anything towards xna 3d maps only 2d.

PS: I am looking for material that can be read online with no cost if possible.

I would be very interested in knowing any other contents related to this subject other then what  Ricket contributed.

Best regards.

sentences:
Build and Run results in an empty window 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:

sentences:
How to make unitypackage from allseen alliance's android sdk? Im making an offline multiplayer for Android device by Unity and I found only one way to do this is the allseenalliance sdk. After download its from here I found that to use it I need to create an .unitypackage file but I cant understand the tutorial they give
> Open a CMD window.
>     Add the path to Unity.exe (the Unity IDE) to your PATH, if it is not there already.
>         For example, set PATH=%PATH%;C:\Program Files\Unity\Editor
>     CD to each "unity" folder in the SDK, and run the following command in each location:
>         Unity.exe -batchmode -nographics -quit -projectPath %CD% -exportPackage Assets AllJoyn.unitypackage
>     This command creates the AllJoyn.unitypackage file.

Please give me a noob tutorial for this or the package file, thanks.
p/s:Is there another way to connect mobile device without internet in unity3d?

sentences:
Unity3D behaves differently in scene and game view We are having AI being able to shoot. Everything works fine when having them play in Scene view, but when going into Game view the position they are shooting from is different.

Does anyone know what could cause this? That the Unity "Scene view" behaves other than "Game view"?

Hope there's anyone there to help us out, thanks in advance.

sentences:
Entitiy spawn on Button press I'm trying to create a little 2D-Zombie-Shoot game. I'm pretty much at the beginning of programming. At least, I can create a player that is moving with arrow keys and stuff. My question is: How do I spawn a Zombie on a button-press? I've already tried it, but with no good results. Here's the code:

//A variable, for the amount of zombies spawned
public int zombie = 0;

 public void tick() {
 //The rest of the code is irrelevant
 ...........

    if (mouse1.isPressed()) {
        zombie++;
    }

}

public void render() {
    //The rest of the code is irrelevant
    ...........

    //Player
    g.drawImage(playerImage, x, y, null);

    //Check how many zombies should be created
    if (zombie > 0) {
        g.drawImage(zombieImage, zX, zY, null);
    }
    ...........

sentences:
Examples of transforming camera in its local coordinates vs world coordinates OpenGL I am trying to learn OpenGL and am doing some beginners learning exercises. One of the exercises is to translate and then to rotate the camera along its own local coordinates and not the world coordinate system.

I am at a loss at how to do one vs the other. I'm aware how to perform translations and rotations using glTranslatef() and glRotatef() functions. Through research I'm also aware of using the 4x4 transformation matrix to multiply our vector/s with to create the desired transformations, although I've not yet messed around with it personally so I'm not too familiar with the transformation matrix.

This being said, I still have questions regarding the local vs world coordinates. I understand that we can put into effect translations and rotations via these functions or the transformation matrix, but I'm concerned with understanding how we do one vs the other. I haven't found any explicit code/examples of transforming a camera (or a model, but I'm more concerned with the camera in this instance) with respect to the world coordinates, and likewise for transforming it with respect to its local coordinates. I feel like at this point I need something rather explicit, because I've felt confused for several days now.

Furthermore, there may be some conceptual things I am confused about. This is to my understanding: If we strictly move objects and the camera (which to my understanding functions like any other object in the world) by the local coordinate system, does that mean that all the local coordinate systems share the same position of their origin with each other and the origin of the world coordinate system? Then, on the other hand, if we strictly move objects/camera with respect to the world coordinate system, then all objects will always be on their own local coordinate system's origin, right? And assuming no object is positioned on the same spot, then no local coordinate systems origin will be positioned on the same spot, right?

sentences:
Basic Use of ApplyImpulse I am trying to apply a force to a bunch of b2_dynamicBodys, but it seems to only work for a random number of items and then stops with an error.

     //create some items to move
     bodyDef.type = b2Body.b2_dynamicBody;
     for(var i = 0; i < 5; ++i) {
        fixDef.shape = new b2PolygonShape;
        fixDef.shape.SetAsBox(1,1);
        fixDef.friction = 1;
        fixDef.restitution = .1;
        bodyDef.position.x = Math.random() * 10;
        bodyDef.position.y = Math.random() * 10;
        bodyDef.linearDamping=1;
        bodyDef.angularDamping=.8;
        itemsArray.push(world.CreateBody(bodyDef).CreateFixture(fixDef));  // store for later
     }

then i try to apply a force later with:

angle = 20;
for (var xIdx=0; xIdx<itemArray.length; xIdx++) {
    itemsArray[xIdx].GetBody().ApplyImpulse(new b2Vec2(50*Math.cos(angle*Math.PI/180),50*Math.sin(angle*Math.PI/180)););
}

the error I receive is

TypeError: 'undefined' is not an object (evaluating 'c.x')

Is there something wrong with saving the items for later use when I am creating them?  Does anyone know what is causing this.

sentences:
zoom to cursor calculation I want to be able to zoom in and out of the map using the scroll wheel. I want to zoom towards the cursor like google maps does but I'm completely lost on how to calculate the movements.

so far, all I have is the resizing but I now need to change the map position.

What I have: map x and y; map width and height; cursor x and y.

Any help would be most welcome.

sentences:
Unity TextMeshPro bounds.size is wrong when hovering first time over gameobject I have this weird issue, which I am not able to fix. This is my third attempt and I need some help. Basically I have a hover element which spawns when I hover over a gameobject. The height of the element is determined by the amount of text (TextMeshProUGUI).
The issue happens only when I hover first time, also not always (I have no clue how to reliably to reproduce it).
Here is what happens (sec 10~):
https://vimeo.com/449387131
I have tried to add these everywhere and different combinations:
LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
hoverElementRect.ForceUpdateRectTransforms();
Canvas.ForceUpdateCanvases();
txtMeshPro.ForceMeshUpdate();

They dont seem to help. I assume the problem is here:
float bgHeight = txtMeshPro.bounds.size.y + 25;

The bounds.size.y is wrong the first time I hover, but I have no clue why.
Here is the whole code for spawning the GUI element:
public static void SpawnGeneralHoverElement(string descText, RectTransform hoverOverRect, float guiWidth) {
    Canvas hoverCanvas = instance.hoverElementGeneral.GetComponent<Canvas>();
    EnableCanvas(hoverCanvas);

    TextMeshProUGUI txtMeshPro = hoverCanvas.GetComponentInChildren<TextMeshProUGUI>();
    RectTransform hoverElementRect = hoverCanvas.GetComponentsInChildren<RectTransform>()[1];

    float scale = hoverCanvas.GetComponent<RectTransform>().localScale.x;

    txtMeshPro.text = descText;

    // Need this to be dynamic, if I change hover element size, it will still work
    float hoverElementWidth = guiWidth;

    // Forces canvas update because of: stackoverflow.com/questions/55417905/why-is-textmeshpro-not-updating-textbounds-after-setting-text
    Canvas.ForceUpdateCanvases();
    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    txtMeshPro.ForceMeshUpdate();

    // Need this because otherwise the element spawns too far away on smaller resultions
    float spawnOffset = (txtMeshPro.bounds.size.y * hoverCanvas.GetComponent<RectTransform>().localScale.x) + (Screen.height * 0.022f);

    float bgHeight = txtMeshPro.bounds.size.y + 25;

    hoverElementRect.position = new Vector3(hoverOverRect.position.x, hoverOverRect.position.y + spawnOffset,
        hoverOverRect.position.z);

    hoverElementRect.sizeDelta = new Vector2(guiWidth, bgHeight);
    Debug.Log(hoverElementRect.sizeDelta);

    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    Canvas.ForceUpdateCanvases();
    txtMeshPro.ForceMeshUpdate();

    // Slide in form left to right if off bounds, need for traps for example
    float leftOffset = hoverElementRect.position.x - ((hoverElementRect.sizeDelta.x * scale) / 2);
    if (leftOffset < 0) {
        hoverElementRect.position = new Vector2(hoverElementRect.position.x + (leftOffset * -1) + 15, hoverElementRect.position.y);
    }

    // Slide in form right to left if off bounds, need for traps for example
    float rightOffset = Screen.width - (hoverElementRect.position.x + ((hoverElementRect.sizeDelta.x * scale) / 2));
    //Debug.Log("Screen width: " + Screen.width + "\nrightOffset: " + rightOffset);
    if (rightOffset < 0) {
        hoverElementRect.position = new Vector2(hoverElementRect.position.x - (rightOffset * -1) - 15, hoverElementRect.position.y);
    }

    LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);
    hoverElementRect.ForceUpdateRectTransforms();
    Canvas.ForceUpdateCanvases();
    txtMeshPro.ForceMeshUpdate();

}

sentences:
Monogame distorting skinned models I'm developing a game using Monogame and the last few days I've been trying to work with keyframe animations without no success so far.

I tried using both Xna Skinned sample from Microsoft and Better skinned sample from this site but still my characters get distorted as seem below:

(Not only my model distorts and only happens within the game, anywhere else is fine)

Both SkinnedSample from Microsoft or the Better Skinned sample  results in the same distortion.

Have any of you any clue of what (importer, processor or my own code) that could be causing this problem and what could be a solution for this?
My code is exactly like the Better Skinning sample mentioned above and uses the default SkinnedEffect.

sentences:
How to determine the end of list has been reached? I'm trying to animate my object according to a set of recorded values from kinect skeleton stream by saving the (x,y,z) stream from the skeletal data into a list and then set my objects x and y position from the x,y of the list. However, once the list end has been reached it starts to animate again from the start. I don't want that - I just want the model position to keep going in the positive X direction. Is there any way I can check if end of the list has been reached and to just update the model position in x direction?

Or is there any other way to continue moving my sprite once the points in the list are over... i dont want it to start animating all the way again..

   protected override void Update(GameTime gameTime)
        {

            //position += spriteSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

            //// TODO: Add your update logic here
            using (StreamReader r = new StreamReader(f))
            {
                string line;
                Viewport view = graphics.GraphicsDevice.Viewport;
                int maxWidth = view.Width;
                int maxHeight = view.Height;

                while((line = r.ReadLine()) != null)
                {

                    string[] temp = line.Split(',');

                    int x = (int) Math.Floor(((float.Parse(temp[0]) * 0.5f) + 0.5f) * maxWidth);
                    int y = (int) Math.Floor(((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);

                    motion_2.Add(new Point(x, y));
                }

            }

                position.X = motion_2[i].X;
                position.Y = motion_2[i].Y;

            i++;

            a_butterfly_up.Update(gameTime);

            a_butterfly_side.Update(gameTime);

            G_vidPlayer.Play(mossV);

            base.Update(gameTime);
        }

sentences:
How are bullets simulated in video games? I have been playing games like MW2 recently and, as a programmer, I tend to ask myself how do they make the game so immersive. For example, how to they simulate bullet speed.

When an NPC fires a bullet from his gun, does the bullet really travel from his gun to the given target or do they they completely ignore this part and just put a bullet hole on the target?
If the bullet is really travelling from the gun to the target, at what speed is it actually travelling?

sentences:
Does it make sense to export and use skeletal animation as sprites? As tools like Dragonbones, Spine lets you export animations as both sprite atlas and skeleton data (JSON/binary), I'm not sure which format to use when importing to Unity.

I have few concerns:

Will there be any differences between the quality of the animations, when imported as atlas vs skeleton data?
Any other pros and cons, using one over the other?

If I use a sprite atlas, I don't have to depend on a third party runtime though. It is for mobile, so performance is also a concern.

sentences:
Floating point determinism with respect to procedural generation, clustering and GPU offloading I've been designing a distributed procedural generation system for a while now in my spare time and one of the problem's I've been thinking about recently, with respect to the broader architecture, is that of floating point determinism inconsistency when you can't ensure that you have a homogeneous cluster of machines running a persistent world.

Part of my design requires that any given machine can regenerate procedural content as needed, allowing for unimportant but resource-hungry content to be destroyed and recreated as needed on whatever machine is available to do the work.

I have been running on the basic idea that I will use high-precision 32/64 bit integers for most things, and that generally works fine, but the standard coherent noise algorithms all use floating point values in their calculations.

Do I need to implement custom non-floating-point versions of all those algorithms (i.e. using longs) or is there a better approach?
Should I be using fixed-point types for this kind of thing, and if so, how does that impact my desire to have the option to offload some of the PCG work to the GPU, when possible? Also, are fixed point types fast enough for heavy use within a game engine?
Can I ignore floating point precision issues if I can get away with a maximum level of precision? i.e. If I'm happy to use no more than, say, six decimal places of a result, does that keep me safe across different machines and architectures?

Note: my engine is purely the simulation side of things. It doesn't matter to me if there are slight rendering inconsistencies when a user is playing the game; all that matters is that the procedurally-generated source data is consistently regenerated no matter which machine in a cluster is doing the work.

sentences:
Collision with player following mouse I'm making a RPG with libGDX. I've loaded a TiledMap and now I'm implementing the player movement. The view is top-down.

In my game I want two ways of input: one is using the ARROW keys to move the player. This implementation works pretty well, including collisions. The second one is a movement based in the mouse. When I click, then the player starts to follow the mouse pointer

 private void autoMove(float speed)
{
    //Start or stop moving
    if (Gdx.input.justTouched())
    {
        autoMoving = !autoMoving;
    }

    //Start follow the mouse
    if (autoMoving)
    {
        //Get direction
        Vector3 point = this.getStage().getViewport().getCamera().unproject(new Vector3(Gdx.input.getX(),Gdx.input.getY(),0));
        dir = new Vector2(point.x - pos.x, point.y- pos.y);

        //Normalize
        dir.nor();

        //Set correct animation
        if (Math.abs(dir.x) <= 0.5)
        {
            if (dir.y >= 0)
            {
                lookingDirection = UP;
            }
            else
            {
                lookingDirection = DOWN;
            }

        }
        else
        {
            if (dir.x >= 0)
            {
                lookingDirection = RIGHT;
            }
            else
            {
                lookingDirection = LEFT;
            }
        }

        //Scale to speed and move
        dir.scl(speed);
        pos.add(dir);
    }

As you can see, I use global variable dirto store the direction of the player. Now I want to handle the collisions with this input. However, I'm not able to do this. I've tried, for example, using pos.add(dir.scl(-1.0f)) but doing this the player gets blocked in every direction. After that, I tried to make the same but blocking only x or y movement based on the lookingDirecion variable. However, player can be looking at right and move a bit upwards, to it's possible to "hack" the system and introduce the player inside the block. I tried with more complex if structures but they didn't worked at all.

The collision code looks like this, if it's useful.

public void checkBounds(float speed)
{
    for (int i=0; i < map.getWidthInTiles(); i++)
    {
        for (int j=0; j < map.getHeightInTiles(); j++)
        {
            //bound is player's rectangle. colBounds are map's impenetrable objects.
            if (bound.overlaps(map.colBounds[i][j]))
            {
                if (!autoMoving) //Control with ARROW keys
                {
                    if (lookingDirection == UP)
                    {
                        pos.y -= speed;
                    }
                    else if (lookingDirection == DOWN)
                    {
                        pos.y += speed;
                    }
                    else if (lookingDirection == RIGHT)
                    {
                        pos.x -= speed;
                    }
                    else if (lookingDirection == LEFT)
                    {
                        pos.x += speed;
                    }
                }
                else
                {
                    //MOUSE COLLISION DETECTION
                }
            }
        }
    }

The question is: how can I implement the collision detection for this kind of movement?

Thank you!

sentences: How to select parent of currently selected object? When i select an object, i can't find a function to select its parent. Does this basic feature exist ? I want to select the parent of selected object and then step up to find parent of parent so on without using the hierarchy window.

sentences:
uNet - Client cant see server spawned objects I'm facing a problem where when I connect with the host, all the towers spawn. After I connect with a client only to find out there are no towers visible and I can walk through them when looking at the host screen.

My tower spawn script ( GameManager.cs ) :

public int numberOfDestroyedTopTowers = 0;
public int numberOfDestroyedMidTowers = 0;
public int numberOfDestroyedBotTowers = 0;

public GameObject[] topTowerSpawns;
public GameObject[] midTowerSpawns;
public GameObject[] botTowerSpawns;

public GameObject towerPrefab;

void Start() {
    CmdSpawnTowers();
}

[Command]
void CmdSpawnTowers() {

    for (int i = 0; i < midTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = midTowerSpawns[i].transform.position;
        currTower.name = "Tower [MID] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < topTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = topTowerSpawns[i].transform.position;
        currTower.name = "Tower [TOP] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < botTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = botTowerSpawns[i].transform.position;
        currTower.name = "Tower [BOT] " + i;
        NetworkServer.Spawn(currTower);
    }

}

The script is derived from NetworkBehaviour and it does have a Network Identity on it (Server Only checked). Also on my towerPrefab I also have a network identity with server only checked.
I have added my tower prefab under the network manager "Registered Spawnable Prefabs".

sentences:
Creating a UI health bar image for each enemy object I would like to create a small health bar on top of each enemy in my game. I know how to do this for one enemy, but I'm not completely sure how best to expand it to work for each enemy in the game. I'm guessing I should instantiate the UI health bar prefab somewhere, each time an enemy is spawned maybe? Currently, I don't even have an enemy spawner, I'm just testing by dragging enemy prefabs into the scene. I'll post the relevant scripts.

public class EnemyHealthBarController : MonoBehaviour
{
    private Image remainingHealthImage;

    private EnemyHealth enemyHealth;

    void Start()
    {
        remainingHealthImage = transform.Find("Remaining Health Image").gameObject.GetComponent<Image>();

        enemyHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent<EnemyHealth>();
    }

    void Update()
    {
        remainingHealthImage.fillAmount = enemyHealth.currentHealth / enemyHealth.maxHealth;

        if (enemyHealth.isDead)
        {
            gameObject.SetActive(false);
        }
    }
}

and

public class ClampEnemyHealthBar : MonoBehaviour
{
    private GameObject enemyHealthBar;

    private Vector3 offset;

    void Start()
    {
        enemyHealthBar = GameObject.Find("Enemy Health Bar");

        offset = new Vector3(0f, 30f, 0f);
    }

    void LateUpdate()
    {
        Vector3 desiredPosition = Camera.main.WorldToScreenPoint(transform.position) + offset;
        enemyHealthBar.transform.position = desiredPosition;
    }
}

Right now, I'm using GameObject.Find to set a reference to the preexisting enemy health bar in the scene. Also, I'm only finding the EnemyHealth component of one of the enemies. How might I better structure this in order to do the kind of thing I'm trying to do?

sentences:
Unity tiles with wierd border flickering when moving horizontal 2D I recently made some Tiles using a program called Pyxel Edit to create some placeholder graphics. The problem I'm having is that when I move the camera horizontal the edge of the tiles starts to flicker, however if I move the camera vertical it wont.

This is my settings for the Tilemap, I have sliced them up inside the sprite editor.

This is a gif of what I'm talking about:

The image maybe isn't that clear but if you watch closely you can see some borders appear when I'm moving.

Do anyone know what could have caused this and what could be done to fix it?

EDIT: Second image for clarity:

sentences:
Exposing type definitions to modders in Unity Note that this question is not about modding assets/data and not about security, I plan to rely on community trust.
I don't know much about DLL's and I was wondering how I can provide interface and attribute definitions for modders.
For Kerbal Space Program modders only have to reference the Assembly-CSharp.dll, UnityEngine.dll and UnityEngine.CoreModule.dll files of a games build, to create and compile their own DLLs.

Are there certain things I have to do, to mimic this behavior, or does this work out of the box?
Are there gotchas to this approach?
Will a mods DLL, that was compiled using an older version of Assembly-CSharp.dll, break if the Assembly-CSharp.dll is updated, even though no types relevant to the mod changed?
Will modders be able to use Visual Studios debugging features for their DLLs?
Is there a better approach to provide type definitions?

My question is related to this question. But I would argue that that question is kind of broad, while mine is about one specific aspect.

Might not be needed for the question, but here are the two levels of modding that I would like to support for my game:
1. Easier modding
I want to compile .cs files of modders that implement special interfaces like IAbility, IItem, etc. I will use Roslyn or cs-sript to do so.
2. More advanced modding
I also want to load .dll's that modders compiled, allowing them to register their own Types in the games DI-Framework, mark methods/classes with attributes like CallMethodOnLevelLoad and use Harmony.

sentences: Are there specific benefits to using XNA for 2D development if you don't plan on releasing on xbox/windows phone? I've been using XNA for a while to tinker with 2D game development, but I can't help but feel constrained by the content pipeline when targeting PC only. Things like no vector fonts or direct use of graphics files make it a pain while other frameworks do these things with no problem. I like XNA because it's robust and has a lot of support, but what are the specific benefits that I'd get developing exclusively for PC, if there are any at all?

sentences:
Why Won't Image Drawing Work In JavaScript In my game at the beginning the first thing that you'll see is a campfire with this code:

 var campfire = new Image();
   campfire.onload = function () {
      ctx.drawImage(campfire, campfireX, campfireY);
 };
 campfire.src = "Sprites/Campfire.png";

However, it doesn't work, I put an

alert("All systems a-ok");

at the end and i get the alert so i don't understand why it's there. You can find the actual image file here   and the full code here. Sorry if I didn't format this well or something, I'm not very good at this =3

This may seem similar to an older question of mine in which I stated how to add a sprite onto the canvas, though in this case, I'm asking why the image doesn't appear on the canvas at all, even though there's no errors.

sentences: Calculate angles between two other angles I am trying to implement a FOV for my light casting algorithm. In the diagram below each white line represents a ray cast from a std::vector<float> of normalized radians. How can I only include angles which lie between the two green lines? (The FOV min and max).

sentences:
How best to detect device performance capabilities and set quality setting accordingly when using Unity I am developing a Mobile game for Android and iOS on Unity.

Currently Im in the optimisation stage of development and trying to work out what is the best way to detect device capabilities, with the aim of then setting an appropriate quality setting.

OS/platform detection is simple, but how can I detect between a high performance android device and a low or medium performance device at runtime?

I did find this question that is similar https://stackoverflow.com/q/21565468/4148676 but the question is old, the answers not great and hoping there's a better way in the last 4 years of solving the problem.

The only other solution I have is monitor the average FPS and adjust the quality based on the frame rate.

Any advice would be appreciated.

sentences:
Run a physics simulation on both client and server? I'm implementing a multiplayer asteroids clone to learn about client/server network architecture in games.  I have spent time reading GafferOnGames and Valve's publications on their client/server tech.  I am having trouble with two concepts.

Currently I have an authoritative game server simulating physics with box2d and sending out the state of the world to clients about 20 times per second.  Each client keeps track of the last few snapshots it received and lerps between two states to smooth out the movement of sprites.  However it's not that smooth.  It can be smooth for a while, then jerky a bit, then back to smooth, etc.  I have tried both TCP and UDP, both are about the same.  Any idea what my problem might be?  (Note: I implemented this for single player first, and the sprite movement is perfectly smooth at 60fps when updating the physics world only 20 times per second).

In order to solve the first problem I thought maybe the client should run a box2d simulation as well and just update the positions of its sprites to match the server snapshots when they don't match.  I thought this might be smoother since my single player implementation is smooth.  Is this a good idea?
Even if it won't fix the above problem, is it necessary for client-side prediction?  For example, if a player attempts to move their ship, how will they know if they hit an asteroid, wall, or enemy ship without a physics simulation?  It seems like their ship would appear to pass through the object it should collide with before they receive a snapshot from the server that says they hit the object.

Thanks!

sentences:
Calculating ln (natural logarithm) in games I am developing a game for tablets using the Marmalade SDK and Cocos 2dX.

In my game I have implemented a separation steering behavior in order to keep some of my characters separated from eachother. Currently I am calculating the magnitude of this steering force using a y = -ln(x) function, in which ln is the natural logarithm.

However, I am wondering if this is a wise choice of function, because it may be costly for the processor to calculate this, just like the square root function.

What do you think, should I try to replace my function for something similar to optimize my game's performance, or there will be minimal gain in replacing a logarithm function for a 1 / x function, for example.

sentences:
Need opinions on my component based design I have an Entity class and a Component class. The Entity class has a list of attached components, and each component also has a member variable that is a reference to the entity that it is attached to (cyclical design).

Then, there is the EntityManager class, which has a list of (you guessed it!) entities, and each entity also has a reference to its encapsulating entity manager.

The reason for this cyclical design is due to data reliance. To explain further, my Entity class is essentially just a giant bucket of data: any data any type of entity needs already exists on this class when it is instantiated. However, in order to make use of this data, the Entity needs the relevant components attached. For example, my Rendering component takes the Entity's spriteData member and draws it to the backbuffer. Without a rendering component, spriteData is not utilized. Since my components need to access the Entity's member variables, each component needs a reference to the Entity it is attached to.

For an example of why my entity needs a reference to the entity manager, it is because some components (such as collision) need to access other entities' data buckets in order to function (for collision, this would be checking nearby entities' position vector and comparing it to the component's referenced entity).

There is more to it than this, but I just wanted to highlight the central idea of what I was doing, and wanted opinions on whether a cyclical approach like this (with little data encapsulation as well..) is a good idea or not. Maybe I'm just overthinking it /shrug. Opinions on how to steer the design would be hugely appreciated, as well.

sentences:
Where should I save game object's attributes (hp, score) in Swift? Scenario: I have a game with several game objects on screen. Each can have different score and hitpoints. When I use collision detection for cannonball vs. ship (example) I need to know which ship is hit and how much hitpoints it has.

Problem: I had several approaches from extending SKSpriteNode or SKPhysicsBody but all failed. SKSpriteNode doesn't work, because Swifts collision detection only returns physicsBody and since you can't extend physicsBody, it didn't work to save there ships attributes as well.

Question: What would be a good approach to save such data to my game objects? I do not need code - because I think I can write it myself - but I would be happy to read a good suggestion. But if you have already some code written and a good solution for this problem, I would not be angry to read it ;)

sentences:
Reading from Streaming Assets in WebGL I'm trying to set up my Unity game for WebGL, but I quickly found out that you can't access your streaming assets as you would in a standalone build. For example, I have a code snippet below of how I load in all of my game's text for localization (i.e. get english translations of all text in my UI).
public void LoadLocalizedText(string fileName) {
        localizedText = new Dictionary<string, string>();
        // StreamingAssetsPath will always be known to unity, regardless of hardware
        string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
        if (File.Exists(filePath)) {
            string dataAsJson = File.ReadAllText(filePath);

            // deserialize text from text to a LocalizationData object
            LocalizationData loadedData = JsonUtility.FromJson<LocalizationData>(dataAsJson);

            for(int i = 0; i < loadedData.texts.Length; i++) {
                localizedText.Add(loadedData.texts[i].key, loadedData.texts[i].value);
            }
        }
        else {
            // ideally would handle this more gracefully, than just throwing an error (e.g. a pop up)
            Debug.LogError("Cannot find file");
        }

        isReady = true;
    }

I've been looking at online examples, and there's a lot of obsolete examples regarding the use of unity's WWW class and php. From what I understand the UnityWebRequest is now the way to go, but I'm confused how to use it with regards to the example above. I'm also trying to figure out how to connect to my SQLite database which is also stored in streamingAssets.
        public SqliteHelper(string databaseFileName) {
        if (Application.platform == RuntimePlatform.WebGLPlayer) {
            // ????????
        }
        else {
            tag = databaseFileName + ":\t";

            string dbPath = Path.Combine(Application.streamingAssetsPath, databaseFileName);
            if (System.IO.File.Exists(dbPath)) {
                dbConnectionString = "URI=file:" + dbPath;
            }
            else {
                Debug.Log ("ERROR: the file DB named " + databaseFileName + " doesn't exist anywhere");
            }
        }
    }

Now that I can't just open an SqliteConnection, I have no idea if there's a c# only solution, or if I have to learn php as suggested from tutorials such as this one. If someone could walk me through how to solve either of these problems I would greatly appreciate it.

sentences:
how to save Audio Volume to playerprefs to mute all scenes sounds Please Explain me how to Save or Set Audiolistner or scene Audio to playerprefs to control game all scene sound by a simple Button On and Off ..

Please Give Me C sharp Script as a Example To Mute and UnMute Full Game All Scenes Sound from Scene 1.

Thanks ..Waiting

sentences:
place sprites in grid pattern within an area I have been trying to do this for a few hours in unity now but cant get my head around it. basically i have 4 points(vector3) 1 each for the 4 corners topleft, topright, bottomleft, bottomright. now i have a sprite that i use as a block what i want to do is basically fit X number of blocks within the four points. see the image below. Icant think of a way to do this right now.
I would really appreciate any help in how to achieve this. thanks for helping.

sentences: How to reset a Script? Is there a way where I can make the script restore its condition to that before I hit play? Should I create a new copy of the original script every time instead?

sentences:
How can I spread my texture evenly across a cylinder in Unreal Engine 4? How can I spread my texture evenly across a cylinder in Unreal Engine 4?

Specifically, in the image below, I would like have texture on cylinder (on the left) match the one on the box (on the right). I need a many sides because I want the cylinder to be very smooth.

sentences:
Implement resolution scaling HTML5 canvas I'm building an hmtl5 real time game using socket.IO and node.js. If you've heard of the classic game "pong", I'm going for that. When you consider the gameplay for this game, it becomes apparent that resolution scaling is something I'll have to implement. I'm running one instance of the game on the server (no graphics rendering, only physics), and of course once for every client. Each client's canvas is the size of the browser window so could be any resolution.

What I'm wondering is how I should keep track of positions, velocities, etc. in the core game code. Should I use percentages and then multiply them by the respective screen sizes? Like x = 0.5 to store a position halfway across the screen? What's the best/standard way of doing this? Thanks so much.

sentences:
How can I avoid a delay with continues touch detection in swift? I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the direction in that I swiped. When I swipe into the opposite direction of my last swipe without leaving my finger from the touch ground, my character should move into this direction. When I release my finger from the touch screen, my character should stops instantly.

My problem is that there is often a small delay within the change of direction. And this delay makes it less precise.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    /* Called when a touch begins */
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        lastFingerPosition = location

    }
}

override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent){
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        if(location.x > lastFingerPosition?.x && lastMoveDirection != "right"){
            movePlayer("right")
        } else if(location.x < lastFingerPosition?.x && lastMoveDirection != "left"){
            movePlayer("left")
        }
    }
}

//@Todo: Wenn man touchMoved und nicht über dem Button hoch geht, wird die Action nicht aufgehoben
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        player?.removeAllActions()
        lastMoveDirection = ""
    }
}

func movePlayer(direction: String) {
    var player = self.childNodeWithName("man")

    if(lastMoveDirection != direction){
        player?.removeAllActions()
        lastMoveDirection = direction

        var duration:CGFloat? = 0
        var x = player?.position.x
        duration = x!

        if(direction == "left"){
            var xDestination:CGFloat = 10
            var run = SKAction.moveToX(10, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveLeft")
        } else if(direction == "right") {
            duration = self.frame.width - x!
            var xDestination = frame.size.width - 1
            var run = SKAction.moveToX(xDestination, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveRight")
        }
    }
}

sentences: Does PS3 have a program similar to the "Xbox 360 Creator Club"? Wondering if the PS3 has a way for game developers to make free / affordable games available to their consumer base?  Is the only way to get your game on the PS3 to go through an approval process which may cost money?

sentences:
Is Mogre (essentially Ogre, but C#) dead? If so what would be a viable alternative to it? I've been looking around for a 3D engine where I can use C# to replace Unity lately, but haven't really come up with much. Ogre looked promising, but it wasn't C# however Mogre is. Sadly looks like it hasn't been updated since Feb. 2014.

With the said are there any viable alternatives to it, or Unity? Or better yet is there a nightly I missed somewhere for Mogre?

sentences:
How to deal with procedural terrain, pre-load or real-time calculation? I have developed an algorithm that generates 2D terrain coordinates for my iOS 2D game. This may be a possible visual output:

The coordinates are stored in a 2D array.

mVertices[i][0] = ccp(sx, sy);
mVertices[i][1] = ccp(sx, 0);

E.g. sx is increased in steps of 30px while i is the number of steps. For each step a sy is generated. To get the line straight down I need a second point which is the second line of code.

Imagine in the game there will be a character on that terrain. The terrain scrolls to the left while you have to move your character. Now I want to figure out what would be the best way for me to draw the terrain.

One way is to pre-load the terrain. So I would generate the points for say 5000px along the x-axis when the user starts the game while a loading spash is displayed.

Another way is to generate the terrain in real-time. I think this is the best solution here. What do you think?

When I take the real-time way, how I do the array stuff? I mean the part that goes out of screen has to be removed from the array and there is a new step that is added.

Maybe a classic array is not good as data structure for that prupose. I introduced it in my project because I can pass it to the ccDrawPoly function that takes a CGPoint array.

Please share your ideas.

sentences: How do I store level-data in Android? I'm building a game where enemies come in waves. I want to create a file where I can define data about the waves (# of enemies, spawn times, speeds, etc.). I come from a background in iOS and would normally use something like a plist. What would be the best way to do something like this in Java and Android?

sentences:
Is there a legal option for writing Nintendo 64 games? Recently, I've been looking into developing games for Nintendo 64 emulators, and modding existing ROMs. I wanted to know if there is the possibility for any legitimate tools out there which can be used to write the code for the emulators or if all of that is off limits.

I heard that the Nintendo 64 SDK has always been sealed by an NDA limited to the game studios, years ago; however, I'm curious about where all the current ROMs that are available came from. Mainly because, unlike discs, cartridges are not typically supported by standard hardware.

sentences:
Fixed timestep without physics? I read Gaffer's Fix Your Timestep article many years ago, and have since had the impression that game code should have a fixed timestep, with only non-gameplay related tasks outside of that in the main loop.

However, I recently reread the article, along with several others, and realized the emphasis is on physics. Which makes sense, but now I'm wondering if it only applies to physics.

What about games which don't use a real physics simulation? People talk about 60fps games, doesn't that imply a fixed timestep? What about multiplayer where you have regular updates to and from the server?

The only alternative I know of is variable rate with time delta, but that sounds like it wouldn't be any better, and less exact. What method is typically used?

sentences:
smooth shading vs flat shading, what's the difference in the models? I'm loading the exact same model with Assimp, except one is exported from Blender, shaded smoothly, and the other was exported from Blender, shaded flatly. Here is my results from loading both into my game:

The Flat drawn model has 1968 vertices and the Smooth drawn model only has 671, why is this happening, I don't understand why there would be less vertices when it's shaded smoothly...?

sentences:
XNA - Non perspective projection? For a section of my game, instead of having a perspective projection, i would like to display an isometric view of an object.

So i don't want things to appear smaller if in a distance, etc.

Basically a proper isometric image.

Is there any way to do this in XNA?

sentences: Whats the point of all these Surface Formats I am relevantly new to Graphics Programming. I have written some basic games in xna in the past but I am trying to understand what the point of all these surface formats is. For instance Xna and DDS support the standard RGBA (8bpp). Why does one need 32 bpp or even stranger combinations of bits per channel like Rg32. Isn't it enough to have the standard DXn, RGBA, and HDR formats?

sentences:
How unity works on Web How Unity can work on Web if the code is written in C#? I understand that you can compile the C# code to a shared library and use it in Java (for Android) in ObjectiveC (for iOS) to enable Unity on multiple platforms, but you cant use shared library on JS. Does Unity do language to language translation from C# to JS to enable Unity on Web?

As I understand now starting from Unity 5.0 it even doesn't use Unity Web Player.

sentences:
Tools for creating 2d tile based maps What are some tools I can use to create 2d tile based maps?

Please provide the information below, and try to limit to one tool per answer.

Name
Link to website
General features
Export format
Anything else you deem noteworthy

sentences:
Convert "analog stick radians" into "normal radians / degrees" Sorry if the title isn't self explanatory. I've worked previously on the development of many small indie games for computers, but never really bothered on developing anything for a console, until recently when I got accepted for an indie development program for a well known game console. The games I'm working on (as most console games) will use the analog sticks for moving the character and rotating the camera, so far so good... except that the analog sticks don't work as I thought they would. When the analog stick is facing up, the "value" returned is pi / 2 (90°). When it's facing to the left the value is 0. When it's facing down, the value is (-pi / 2) (-90° ??) and when it's facing on the right the value is either -pi (-180° ??) or pi (180°). And obviously there are values in between all of those.

Small "ascii art" to demonstrate what I mean.

        ^   pi /2
+- pi <   > 0
        V   -pi /2

The values that I don't get are the negative ones, how can I convert those negative values to an actual circle, so that I get a value between 0° and 360° (0 and 2 pi)?

Sorry if the question might sound stupid, I'm really new to console development. At first I thought I would ask in the official developers forum for this game console, but I thought that a public resource like stack exchange might be better since, I'm most likely, not the only one that has to deal with this, and probably other consoles have the same mechanism too.

sentences:
OpenGL Core profile - Array of arrays in glBufferData for VBOs I want to send each face as VBO, and I structured the data as this

facevbo[0] =  x x x x x x   //x,y,z,r,g,b,s,t
facevbo[1] =  x x x x x
facevbo[2] =  x x x x x x x
facevbo[3] =  x x x x
.
.
.
facevbo[numfaces] = x x x x

Basicly I have dynamic 2d array with different column size:

GLfloat** faceVBO = new GLfloat*[m_numOfFaces];
faceVBO[dfaceIndex] = new GLfloat[pFace->numOfVerts*8];

When I print all the faces, everything is fine,
but when im trying to put them to use,
i have problem at this line:
(ideally I would iterate trough all the faces to bind each face, but lets take the first column)

glBufferData(GL_ARRAY_BUFFER, 4*oindices, faceVBO[0], GL_STATIC_DRAW);

the third parameter (faceVBO[0])
"argument of type GLfloat is incompatible with param. of type const void*"

but if i tead from array, like

GLfloat facevbo[] = {x,x,x,x...}

and

 glBufferData(GL_ARRAY_BUFFER, 4*oindices, faceVBO, GL_STATIC_DRAW);

it works OK.
How should i send the data in this case?

Thanks

sentences:
Why Minecraft has such a terrible backward compatibility? For every release of Minecraft, even a minor release, is almost guaranteed to break some plugins or mod.

Why is this so? I am asking this so that we could avoid the same architecture problem as Minecraft.

I mean, why can't the upgrades also support previous version of minecraft? Minecraft requires an EXACT version number match in order to connect. I am pretty sure the protocol can be designed so that clients should ignore unsupported commands.

For example, if there is new block introduced and the client doesn't understand it, they can just fall back to default/dummy block so that players can still play but start seeing dummy wireframe block or so.

Once they start seeing too much of wireframe blocks they know they should upgrade.

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

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

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

sentences: How to access the nth element in a 2d texture from a pixel shader in XNA How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d

sentences:
How can I retain the soundtrack state across levels to have continuous play? Suppose I have two levels. I want the same soundtrack to play on both of them.

At the moment I have an audio source in each level, playing the soundtrack. However, when you move from one level to the other, the soundtrack will of course restart over (because it's a different audio source).

How can I "resume" the soundtrack? Or rather, how can I retain the soundtrack state across levels to have continuous play?

sentences:
GraphView: Dragging a Blackboard causes it to get stuck offscreen I'm playing around with learning GraphView, and running into some strange problems with the Blackboard component. Here's a very simple repro:
using UnityEditor.Experimental.GraphView;
using UnityEngine.UIElements;

public class MyGraphView : GraphView
{
    public override Blackboard GetBlackboard()
    {
        var result = new Blackboard(this);
        /* COMMENTED OUT BLOCK #1
        var c = result.capabilities;
        result.capabilities = c & ~Capabilities.Movable;
        */
        /* COMMENTED OUT BLOCK #2
        result.RegisterCallback<MouseDownEvent>(OnMouseDown);
        result.RegisterCallback<MouseUpEvent>(OnMouseUp);
        result.RegisterCallback<MouseMoveEvent>(OnMouseMove);
        */
        return result;
    }

    public override void ReleaseBlackboard(Blackboard toRelease)
    {
        toRelease.RemoveFromHierarchy();
        /* COMMENTED OUT BLOCK #3
        toRelease.UnregisterCallback<MouseDownEvent>(OnMouseDown);
        toRelease.UnregisterCallback<MouseUpEvent>(OnMouseUp);
        toRelease.UnregisterCallback<MouseMoveEvent>(OnMouseMove);
        */
    }

    private static void OnMouseDown(MouseDownEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseUp(MouseUpEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseMove(MouseMoveEvent e)
    {
        e.StopImmediatePropagation();
    }
}

using System.Collections.Generic;
using System.Linq;
using UnityEditor;

public class MyGraphEditor : GraphViewEditorWindow
{
    protected MyGraphView _view;

    public override IEnumerable<GraphView> graphViews {
        get
        {
            yield return _view;
        }
    }

    private void OnEnable()
    {
        _view = new MyGraphView();
        this.rootVisualElement.Add(_view);
        _view.style.height = new StyleLength(new Length(100, LengthUnit.Percent));
    }

   [MenuItem("Tools/Graph Editor Test")]
   public static void ShowWindow()
    {
        var graphViewWindow = CreateInstance<MyGraphEditor>();
        var graphView = graphViewWindow.graphViews.FirstOrDefault();
        if (graphView != null)
        {
            var blackboard = graphView.GetBlackboard();
            graphView.AddElement(blackboard);
        }
        graphViewWindow.Show();
    }
}

Clicking the new menu item causes the window to open, just a blank editor window with a blank Blackboard. Clicking on the title bar of the Blackboard and attempting to drag it, though, causes it to immediately disappear. Checking in the UIElements Debugger shows that this is because it's somehow gotten its World Bound Y set to -79, so it's disappeared off the top of the window.
A bit of checking in the reference source suggests that if the Blackboard was not Movable, it couldn't be dragged around. Not ideal, but a temporary workaround at least. But if you uncomment the code that sets this up, (commented out block #1,) it breaks the editor entirely: clicking on the Blackboard causes Unity to stop responding to mouse clicks. Attempting to minimize the damage with the other two commented out blocks has no effect.
Anyone have any idea what's going wrong here and how to fix it? What do I need to do to have a Blackboard that can be dragged around properly?

sentences:
How can I build a data structure that will persist across saves/loads in GameMaker version 8.1 and earlier? I wish to build data structures such as trees, linked lists, graphs, stacks, queues, etc. in Game Maker. However, the concept of object in Game Maker Version 8.1 and older does not have a reliable concept of what a pointer is. They shift whenever something is deleted or instantiated, which is obviously bad if everything relies upon a construct of pointers. I think the motivation behind this is to avoid a dangling pointer error, but it makes objects practically useless.

The built in data structures found in the "ds_..." functions do not persist when saving and loading. They are simply unsaved altogether. This is also not very good in the long run as it could complex constructs to fall apart at random.

Therefore, this begs the question of how one can implement data structures in general that don't have this issue?

Due to recent updates in the engine's implementation of pointers in Game Maker Studio, the problem itself no longer exists as pointers do not need to shuffle to prevent dangling pointer exceptions (as was apparently the motivation behind that cough idiotic cough design choice). However, as objects in the language are somewhat bloated this question still serves as a way of asking for a memory-cheap solution to this problem.

Users of the original Game Maker software or people attempting to mod older games which feature code-based modding will still benefit from this post.

sentences:
Blend Modes in Cocos2D with glBlendFunc We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online.

For anyone interested, here they are:

  Multiply = GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA
  Screen = GL_MINUS_DST_COLOR, GL_ONE
  Linear Dodge = GL_ONE, GL_ONE

You can try these and other such modes in action online, at this very useful website: http://www.andersriggelsen.dk/glblendfunc.php

Now, we would appreciate it if anyone could provide us with additional blending modes that we can recreate inside Cocos2D, since our Open GL experience is really, really limited.

Thank you in advance!

Argiris

sentences:
How to change animation start/end proprieties via script? Is there a way of changing the start/end proprieties (Transform, Rect Transform, etc..) of an animation via script? Like, I have 5 objects that start at the same position but should end in different positions, so I would like to change the end positions of each one via script.

As I haven't found a way to do this, I created 5 animations for this, but I'd like to just have one animation and change its proprieties in runtime.

sentences:
Fix player movement? My character follows camera direction. my issue is when i look at sky and walk or run my character goes up ! the same thing happen when i look down and walk back.

    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    movs = new Vector3(moveHorizontal, 0.0f, moveVertical);
    movs = cam.TransformDirection(movs);

    rb.AddForce(movs * speed);

    float maxVelocity = 5f;
    rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxVelocity);

What I need is make it work normally. like GTA or GoW.

sentences:
How to do 2D Raycasting on a slope I have a 2d platformer game where my slope can be set at any angle, so I've setup a middle raycast that points to the ground onto the player to handle the collision. This works perfectly fine on a flat platform, but when I rotate it to a slope the player is offset increasingly more.

Player falls onto the platform with no rotation (works fine).

The player falls onto a platform at an angle with no rotation on the player.

Then when I rotate the player to the angle of the platform.

As you can see the player is offset wrong. Do I have to rotate the rays attached to the player and then push him out of the platform? Or is this overkill and I'm doing something wrong?

sentences:
Building different game objects (EG Spells, Items,) for an rpg game I believe the best way to manage item data would be to use xml?

For spells would the best option be to create a class (EG Fireball) and define all of the parameters inside of that class? Like Initilize Update and Draw? Then have a class called ParticleEngine and define Inside of fireball the type of particles to use?

Something like ParticleEngine Effects = new ParticleEngine(texture1,texture2,texture3,amountofparticles,offset,delay,life)

Or is there a better way to handle all of this?

What are some different stuctures and or what is the most efficient way of handling all of that data?

sentences:
How to request a specific OpenGL version? I'm working on an OpenGL project, coming from D3D. They're organised in very different ways, so it's tricky going :)

Is there any way for a Windows application to request a specific OpenGL context version, e.g. 2.1 or 3.x?

Also, I believe I need to use wglext.h from the OpenGL registry as the GL.h that ships with Windows is an earlier version, 1.1 or 1.4 - can anyone confirm?

sentences:
Why would some PNG files extracted from games display incorrectly? I've noticed extracting PNGs from some game files that the image becomes distorted part-way through. For example, here are a couple of PNGs extracted from the Textures file in Skyrim:

Is this some unusual variation on a PNG format? What modifications would I need to make to view such PNGs properly?

sentences:
XNA: SpriteFont question I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e:

<FontName>Kootenay</FontName>

or

<FontName>Arial</FontName>

No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA.
My problem is, I cant use them, I got this error:

  The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.

So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!

sentences:
Add force towards a point in Unity3d? I have a Vector2 and want to move an object towards it...
(this vector2 is the mouse position when clicked and I made sure I get only one position when its clicked)

My initial thought was to apply

  Rigidbody2D.Addforce(my vector2)

but it acting strangely...
How can I push anything towards a point?

N.B: I wanna use physics for it.... because I want to get the pushing feel!

sentences: In Unity, how do I make text/annotations appear when I mouse over GameObjects in playmode? How do I make text appear when I mouse over GameObjects in-game? What is the Unity jargon for this? I'm assuming it's 'annotations'.

sentences:
Render moveable entities into 3D isometric world? I have a separate list of moveable entities, and then the regular 3D map, represented by a 2D array of stacks of tiles. My problem is that right now, I'm rendering my moveable entities after the map, and so they end up in the right place, but rendering over everything. If I were to render my entity list at the right place, however, in the map rendering process, it would be very slow because I'd have to iterate over the moveable entity list to find one with the correct (x, y) coordinates each tile that's rendered. Here's what my world looks like:

Here is a screenshot of a particularly awkward example of this issue. The colonists are positioned (or seem to be) on the right tiles, but they draw in front of trees and hills they are actually behind.

Here's my current moveable entity drawing code:

Apologies for using a screenshot, but I can't paste into this text box for some reason. Anyway, my map drawing code is just a nested for loop over the map, pretty much. How do I merge these two? My drawing library doesn't have a Z-axis function.

sentences:
Game (X-Plane) boot/startup time / performance I use X-Plane for my question but it also concerns probably every other flight-simulator or simulation game in general. When developing a plugin what bothers me most is the startup-time of the application to test my plugin functionality so I was wondering how I can improve the startup speed of the simulator.

First I removed all additional scenery and reduced the loaded files to a minimum which gave me a startup time of 34 seconds which is quite fast already.
To improve the time even further I thought it would make sense to run the whole application from memory and I installed ubuntu 64-bit and created a 2GB tempfs filesystem in memory (ram-disk).

When starting x-plane from this memory file system it still takes 30 seconds. Can anyone explain what the application does during startup which needs so much processing time?

I assume that the graphic bitmaps for the object and the environment are compressed on disk and therefore they have to be decompressed in memory first before they can be used in opengl. This would explain the time spent on startup.

If it is true that the bitmaps need to be decompressed first would it be possible to improve the time by using multiple cores? If the application is multithreaded and there are four cores would the time be divided by four or does this processing happen on the GPU?

Any explanation which helps me to better understand the startup-process of a computer game is really appreciated because I'm interested in improving the overall performance of the system and therefore I need a better understanding of the bottlenecks (RAM, CPU, GPU, Disks (SSD/Raid), OS, libraries, ...).

sentences:
Trajectory of a spinning ball How do I would precalculate trajectory of a kicked ball, when it's spinning?

I'm applying spinning using simplified Magnus effect every frame like this and it works:

acceleration += swerve × velocity

My question is: do the equation below for calculating object trajectory can be extended to include the ball spinning?

position = start + 0.5*acceleration*time^2 + velocity*time;

I'm using Euler integration and ball moves fine. I just want to know how to predicts ball's movement path.

sentences: How to handle Animal AI biting and holding onto the character Example state of decay, zombie biting the player

sentences:
d3d11 renderqueue multi pass rendering design best practice The goal: issue least calls to d3d11 ImmediateContext and render advanced effects like toon / outline / anything that requires rendering the same vertex buffers with at least two different vertex shader and pixel shader programs efficiently by sorting opaque drawcalls front to back and transparent drawcalls back to front.

What I did: Abstract calls to d3d11 immediate context by a DrawCall struct that acts as a gpu command recorder. A call to DrawCall.SetIndexBuffer will create a c# Action that will issue a call on the ImmediateContext upon invoke call. The DrawCall internal gpu command list is sorted the following way: set shaders, set constantbuffers, set blendstate, set stencilstate, set vertexbuffers.... I am using sharpdx and c#.

My problem: I use a 64bit sortkey for my gpu commands. When rendering complex effects like outline or anything that requires state changes to outputmerger the whole idea with sorting doesn't seem right... example: I render opaque objects first and then transparent objects... I want to render an object opaque with a diffuse shader and it should have a red transparent outline. For this effect I have to modify stencil and blend states in between drawindexed calls. According to my sortkey those gpu commands are on different draw loops opaque<>transparent but the stencilstate requires both drawindexed calls to be one after another.

Should I implement a chained gpu command for multipass rendering or are there better ways to handle such effects?

sentences:
Backup virtual goods to survive game reinstalls I'm developing a game using Unity3D (for Android and iOS). I would like to save all user's virtual goods, so they are available even if the user remove and reinstall the app, or even if the user install it on a new device.

AFAIK an approach would be to authenticate the user, and save all the data on my backend server. But, to not reinvent the wheel, can you share your approach? i.e.: how do you authenticate users? are you using your own server, or any BaaS?

EDIT: After reading your answers, I think the best approach is to use "Google Play Game Services Saved Games" on Android, using the official plugin for Unity3D. For iOS, there is a similar feature for GameCenter, but I can't find any official plugin for Unity3D. But this plugin may work: https://www.assetstore.unity3d.com/en/#!/content/11626

Soomla plugin can be useful: https://www.assetstore.unity3d.com/en/#!/content/6103

Also, this plugin can be useful too: https://www.assetstore.unity3d.com/en/#!/content/20152

sentences:
what is the most popular mmorpg game that has an out-of-game api? World of Warcraft is off the table, because of the "WOW Glider Lawsuit" of 2008. Also see: Where is Blizzards official World of Warcraft API? Eve Online has an API

But, what is the MOST popular (in terms of usership) MMO Game that does allow programmers to develop out-of-game things (like an Android app).

sentences:
Geometry Shader crashing I keep getting some strange errors in my Geometry shader and when I search for the cause of the errors, it returns nothing substantial. Here is the code.

Shader

#version 450 core

layout(triangles) in;
layout(points, max_vertices = 3)out;

void main(void) {
    int i;
    for (i = 0; i < gl_in.length(); i++) {
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
}

Log.

0(4) : error C3008: unknown layout specifier 'max_vertices = 3'
0(4) : error C3008: unknown layout specifier 'points'
0(10) : error C3004: function "void EmitVertex();" not supported in this profile

I'm using OpenGL 4.5 (My pc supports it before anyone asks :p) and and glfw 3.2

EDIT:
Here is the steps I'm using to load up my shader.

Creating a shader instance:

shader = new StaticShader("VertexShader.shader", "TesselationControl.shader",
"TessilationEvaluation.shader", "Geometry.shader", "FragmentShader.shader");

StaticShader Constructor

ShaderProgram::ShaderProgram(const char * vertex_file_path, const char * tesselation_controll_shader_path,
    const char * tesselation_evaluation_shader_path, const char * geometry_shader_path, const char * fragment_file_path) {
    vertexShaderID = loadShader(vertex_file_path, GL_VERTEX_SHADER);
    tessControllShaderID = loadShader(tesselation_controll_shader_path, GL_TESS_CONTROL_SHADER);
    tessEvaluationShaderID = loadShader(tesselation_evaluation_shader_path, GL_TESS_EVALUATION_SHADER);
    geometryShaderID = loadShader(geometry_shader_path, GL_GEOMETRY_SHADER);
    fragmentShaderID = loadShader(fragment_file_path, GL_FRAGMENT_SHADER);
    Status("ShaderProgram", "Initilizing shader program");
    programID = glCreateProgram();
    glAttachShader(programID, vertexShaderID);
    glAttachShader(programID, tessControllShaderID);
    glAttachShader(programID, tessEvaluationShaderID);
    glAttachShader(programID, geometryShaderID);
    glAttachShader(programID, fragmentShaderID);
    bindAttributes();
    glLinkProgram(programID);

    GLint isLinked = 0;
    glGetProgramiv(programID, GL_LINK_STATUS, (int *)&isLinked);
    if (isLinked == GL_FALSE) {

        GLint maxLength = 0;
        glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &maxLength);

        if (maxLength > 1) {
            GLchar* infoLog = (GLchar*)malloc(maxLength);
            glGetProgramInfoLog(programID, maxLength, &maxLength, &infoLog[0]);
            std::cout << infoLog;
        }

        StatusError();
        exit(0);
    }
    StatusOkay();

    //Clean Up
    glDetachShader(programID, vertexShaderID);
    glDetachShader(programID, tessControllShaderID);
    glDetachShader(programID, tessEvaluationShaderID);
    glDetachShader(programID, geometryShaderID);
    glDetachShader(programID, fragmentShaderID);

    glDeleteShader(vertexShaderID);
    glDeleteShader(tessControllShaderID);
    glDeleteShader(tessEvaluationShaderID);
    glDeleteShader(geometryShaderID);
    glDeleteShader(fragmentShaderID);
}

Load shader function:

GLuint ShaderProgram::loadShader(const char * file_path, int type) {
    GLuint shaderID = glCreateShader(type);
    std::string shaderCode = FileManager::readFile(file_path);
    char const * sourcePointer = shaderCode.c_str();
    Status("ShaderObject", "Compiling Shader " + std::string(file_path));
    glShaderSource(shaderID, 1, &sourcePointer, NULL);
    glCompileShader(shaderID);
    GLint isCompiled = 0;
    glGetShaderiv(shaderID, GL_COMPILE_STATUS, &isCompiled);
    if (isCompiled == GL_FALSE){

        GLint maxLength = 0;
        glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &maxLength);

        if (maxLength > 1) {
            GLchar* infoLog = (GLchar*)malloc(maxLength);
            glGetShaderInfoLog(shaderID, maxLength, &maxLength, &infoLog[0]);
            std::cout << infoLog;
        }

        StatusError();
        exit(0);
    }
    StatusOkay();
    return shaderID;
}

sentences:
How is a DirectX Adapter Different from a Device? I'm relatively new to DirectX programming, and this is one of the more confusing issues I've encountered to date. According to the MSDN Documentation for DirectX 11:

  "A device is used to create resources and to enumerate the capabilities of a display adapter."

and from the MSDN Documentation for DirectX 9:

  "An adapter is a physical piece of hardware. Note that the graphics card might contain more than a single adapter, as is the case with a dual-headed display. "

From my neophyte perspective, these two concepts seem to overlap a fair amount. Am I correct in understanding that a device is an abstraction/encapsulation of a single adapter, which in turn is a software abstraction of a particular graphics card in the system?

sentences:
Confused about why my projection matrix works My projection matrix was  buggy, I'm not great at mathematics, but I checked it against the the songho tutorial, and the broken one seems correct to me but switching nearplane to farplane seems to have fixed it. What am I missing? My nearplane and farplane values are positive, nearplane is small about 0.01, 1.0f last time i ran against both; farplane is usually relatively large about 1000.0f, 500.0f the last time I ran it against both.

f32 l = left;
    f32 r = right;
    f32 t = top;
    f32 b = bottom;
    f32 n = nearplane;
    f32 f = farplane;

    m4x4 Result =  //TODO why did changing n to f in 0 and 5 fix it? and make sure it is fixed
    {
#if 0 // works
        2*f/(r-l), 0, (r+l)/(r-l), 0,
        0, 2*f/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), -2*f*n/(f-n),
        0, 0, -1, 0,
#else // doesn't
        (2*n)/(r-l), 0, (r+l)/(r-l), 0,
        0, (2*n)/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), (-2*f*n)/(f-n),
        0, 0, -1, 0,
    };
#endif

sentences:
Game not accepted in Google Play even though it's built in 64 bit (Unity) I tried building my game according to the google play rules, but I get the following error message:
"This release is not compliant with the Google Play 64-bit requirement

The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 1.

Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code that it needs. This avoids increasing the overall size of your app."

According to the documentation (https://developer.android.com/distribute/best-practices/develop/64-bit) for Unity I should get a working version when I do:

Set Scripting Backend to IL2CPP
Select the **Target Architecture > ARM64 checkbox
Build as normal

I've built the game both as APK and as AAB, but neither are accepted. I am using Unity 2018.3.14f1.

I have downloaded this NDK: https://dl.google.com/android/repository/android-ndk-r16b-windows-x86_64.zip and put the content to: C:\Users\MyName\AppData\Local\Android

sentences:
Detect mouse click on a bezier curve's neighborhood I'm developing a game in HTML5 and JavaScript using Canvas API for drawing graphics. I want to detect if the user has clicked on a bezier curve which has the line width of 20 pixels (something like this one on the picture). I need to validate if the user has clicked on the area drawn by the curve (red and black).

I implemented such an algorithm for lines, but could not adapt it to quadratic and cubic bezier curves. So I need an algorithm that will compare the position of a point relative to a bezier curve which has the form of

$$ B(t) = P_0 (1-t)^2 + P_1 (1-t)t + P_2t^2$$

for quadratic bezier curves or

$$ B(t) = P_0 (1-t)^3 + 3P_1 (1-t)t + 3P_2(1-t)t^2 + P_3t^3$$

for cubic bezier curves, and check if it is in the neighborhood of the bezier curve's path, I mean on the black drawn area.

[Red: Bezier curve's path; Black: Bezier curve's drawn area]

sentences:
Why is the Position Handle placed at certain distance away from vector3 unit in Unity? I have a vector3 value that I am setting in inspector and I am drawing a ray using OnDrawGizoms to draw that vector line.

However, the position handle I made using Handles API to set the vector3 value is placed certain distance away from the vector unit. It's not placed exactly at the end point of the vector line that is drawn and I am not sure why.

My goal is to just make a handle to position a vector3 value.

EDIT: For some reason, the handle is positioned correctly for y position alone but not for x and z positions.

Here is my code:

In this script, it is the localTargetPosition vector3 value that I want to make my handle for.

public class MovePlatform : MonoBehaviour
{
public Vector3 localTargetPosition = new Vector3(5, 0, 0);
public Vector3 m_initialPosition { get { return initialPosition; } set { initialPosition = value; } }
private Vector3 initialPosition, targetPosition, targetPosDebug;
public float speed = 3;
public bool loop;

void Start()
{
    initialPosition = transform.position;
    SetTargetPosition(localTargetPosition);
}

void Update()
{
    transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);

    if (transform.position == targetPosition)
    {
        if (loop)
        {
            SwitchDirection();
        }
    }
}

public void SwitchDirection()
{
    if (transform.position == initialPosition)
    {
        SetTargetPosition(localTargetPosition);
    }
    else
    {
        targetPosition = initialPosition;
    }
}

private void SetTargetPosition(Vector3 localPosition)
{
    targetPosition = initialPosition + transform.TransformDirection(localPosition);
    targetPosDebug = targetPosition;
}

void OnDrawGizmos()
{
    if (Application.isPlaying)
    {
        Debug.DrawLine(initialPosition, targetPosDebug, Color.red);
    }
    else
    {
        Debug.DrawRay(transform.position, transform.TransformDirection(localTargetPosition), Color.red);
    }
}
}

This is the script used for making handle:

[CustomEditor(typeof(MovePlatform)), CanEditMultipleObjects]
public class MovePlatformEditor : Editor
{
protected virtual void OnSceneGUI()
{
    MovePlatform movePlatform = (MovePlatform)target;

    Vector3 initialPosition = movePlatform.transform.TransformPoint(movePlatform.m_initialPosition);
    Vector3 targetPosition = movePlatform.transform.TransformPoint(movePlatform.localTargetPosition);

    EditorGUI.BeginChangeCheck();
    Handles.Label(targetPosition, "Target", "button");
    targetPosition = Handles.PositionHandle(targetPosition, movePlatform.transform.rotation);

    if (EditorGUI.EndChangeCheck())
    {
        Undo.RecordObject(movePlatform, "Move Handles");

        movePlatform.localTargetPosition = movePlatform.transform.InverseTransformPoint(targetPosition);
    }

    Handles.color = Color.yellow;
    //Handles.DrawLine(initialPosition, targetPosition);
}

}

sentences:
AI surrounding algorithm suggestions I am building up a simulation where predator groups (tribes) try to hunt other agents in the simulation (whom also are clustered in groups).

Now I got to a point where members of a group follow their leader and wait for any sort of commands (currently passed as strings and vector that they need to move towards).
Anyway the idea is to implement some interesting surrounding behaviour just like predators hunt in group they surround their prey.I shall attach a picture for better explanation:

The green circles are the agents that predators are hunting. The red circle is the leader of the predator group and the black dots are other predators. The sort of behaviours I am looking for should be similar to shown in the picture where on the right side of the picture the predators are surround the pack of green agents as instructed so by the leader of the predator pack.

What I was thinking initially was find the leftmost agent in the green pack and the right most in green agents pack and make members of the predator group move towards them.However at this point I shall mention that predators have a fixed field of view so it may not see all of the pack at first.

So I am wondering if anybody came across something like so or have any good ideas how to go about producing this sort of behaviour.

sentences:
Can you compare a parameter to another parameter using ChoiceFormat? I'm currently using the I18NBundle (wiki  | docs) package from LibGDX to do some internationalization for my game. the I18NBundle internally uses the java MessageFormat (docs) to format strings such as this:

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

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

It can also do conditionals like so:

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

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

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

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

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

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

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

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

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

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

sentences:
OpenGL web game: C++ with Java vs pure Java? I'm going to write browser online game, not MMO, but something like a lot of Flash game. But with OpenGL rendering, because Flash is using CPU for rendering.

What are advantages of pure Java or c++ with Java that only create window.

My requirements are:

good performance - low overhead when calling OpenGL functions
short code( if possible ) - so, Java is fully object oriented language, which can require usage of object for each called OpenGL function
basic portability - Linux, Mac, Windows - multiple builds for each platform aren't problem
little communication with server for saves, top score,... not multiplayer - may be slow
game should be downloadable

sentences:
Use spritesheet frames as particles? I want to use frames from a spritesheet as particles for my emitter.

I load my spritesheet with :

game.load.spritesheet('particles_sheet', 'http://stuff.lck.io/luckyslot/sprite_sheet.png', 50, 50, 6);

var emitter = game.add.emitter(game.world.centerX, canvas_height, 80);

And i need some code to load the right frame at random :

emitter.makeParticles('particles_sheet');

Any idea?

sentences:
Removing something on Collision? I have my collision detection code working so how would I tell my HealthPickup to disappear when my Player collides with it? I haven't played around with it yet but I think I may have to somehow remove the hitbox and stop calling the Draw() function (at least for my HealthPickup anyway)

Please note I am a novice and have not really dealt with XNA before.

sentences:
projected textures not appear on the "back" of the mesh as well? I want to create blood wounds on my character's bodies by using projected textures. I've watched some commentaries on games like Left 4 Dead and they say they use projected textures for the blood.
But the way projected textures work is that if you project a texture on a rigged character, say his chest, it will also appear on his back.
So what's the trick? How to get projected textures appear only on one "side" of the mesh?

I use the Panda3D game engine, if that will help.

sentences:
How do I store Items in MySQL? I'm working to my first game containing items (built a small one before, strategy type but not very complicated). I was thinking something like this for the db design since it will be almost the same items in each shop.  I'm thinking of connecting the shop to user items (not sure if you understand what i'm thinking of):

shopname
  shopNameId, shopName
shopCategory
 shopCategoryId, shopNameId shopCategoryName,
shopItems
 shopItemId, armourId, oneHandedWeaponId, twohandedWeapoinId,

this would be for the shop..now;

oneHandedWeapons
 oneHandedWeaponId, weaponName, weaponMinAtk, weaponMaxAtk, ...

otherAttributes,

oneHandedExtendedAttributes
 oneHandedExtendId, oneHandedWeaponId, ... otherAttritubes,

and again for other item types.
This npc's will be the only place from where they can buy items.

Now when a user bought a new item from one of the shops i should insert the id of that item in the inventory table no?
I was thinking on a structure like this for a stash based on 10 slots.

userStash
userStashId, userId, slot1, slot2, slot3, slot4, slot6, slot7, slot8, slot9, slot10

now on each on slot i can insert the id of that item.

Now my questions:

Is it ok how i did this?
Do you see any problems?
Do you have any advice?
Can you give me another ideea / another example how should I do this part?

sentences:
Restricting Maximum Velocity in Space I'm making a top-down 2D space ship game in which you rotate and thrust. I'd like to impose a maximum velocity for different engine types, meaning that a certain engine can only get you going up to a certain speed.

But I'd also like the ship to be able to travel faster than that maximum velocity, say if it were sent flying by a collision with a fast-moving asteroid.

I can't naively have the engines only apply impulse if the ship is moving at less than its maximum speed -- otherwise if an asteroid sent you flying to the right, you couldn't deliberately slow down because that would involve applying an impulse to the left.

But I'm not restricted to cardinal directions. If the ship is moving too fast to the right, I don't want it to accelerate to the right, but I would like it to be able to curve upward, which might involve applying some kind of impulse at say a 15 degree angle.

My other thought was to cap the maximum velocity of the ship at the maximum velocity of the engine, but then an asteroid collision could send you flying no faster than you engine's maximum speed, and that's undesirable as well.

How might I go about designing a system that allows one to reach velocities no higher than a set maximum from their own impulse, but still be able to steer their ship at higher velocities and still actually attain those higher velocities from external means?

Edit

Let's say my maximum velocity is 50 m/s. I'm traveling at 50 m/s at a 15 degree angle, which means my x velocity is 48.3 and my y velocity is 12.9. The ship is facing at a 30 degree angle (even though it's traveling along a 15 degree vector).

When I press the thrust button, I want the ship to trend toward that 30 degree angle of travel. Which means that its current angle of travel must be altered in some fashion. Right now I do so by applying impulses. But if I apply an impulse at a 30 degree angle, the ship's velocity will exceed is maximum (a good portion of that impulse is in the same direction as we're already going).

If I don't allow that impulse to be applied, the player can't adjust their course at all while they're moving too fast. And I'm not sure how to determine which components of an impulse would change a ship's velocity's angle without increasing its length.

sentences:
Amazon GameCircle Integration I'm trying to integrate Amazon GameCircle and I have been able to successfully initialize GameCircle in my app, but the problem is when I click on the button that displays achievements, the GameCircle achievement list comes up but it says "You have unlocked 0 of 0 achievements". Same happens with leaderboards i.e there are no leaderboards for this app. I have created a Leaderboard and a few achievements on the online developer portal for Amazon but they don't show for some reason. Can someone help me with this. Any links/resources that help with integrating GameCircle will be appreciated.

Thanks.

sentences:
How can I avoid tight script coupling in Unity? Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem?

For example:

I want to have health and death systems in separate scripts. I also want to have different interchangeable walking scripts that allow me to change the way the player character is moved (physics-based, inertial controls like in Mario versus tight, twitchy controls like in Super Meat Boy). The Health script needs to hold a reference to the Death script, so that it can trigger the Die() method when the players health reaches 0. The Death script should hold some reference to the walking script used, to disable walking on death (I'm tired of zombies).

I would normally create interfaces, like IWalking, IHealth and IDeath, so that I can change these elements at a whim  without breaking the rest of my code. I would have them set up by a separate script on the player object, say PlayerScriptDependancyInjector. Maybe that script would have public IWalking, IHealth and IDeath attributes, so that the dependencies can be set by the level designer from the inspector by dragging and dropping appropriate scripts.

That would allow me to simply add behaviors to game objects easily and not worry about hard-coded dependencies.

The problem in Unity

The problem is that in Unity I can't expose interfaces in the inspector, and if I write my own inspectors, the references wont get serialized, and it's a lot of unnecessary work. That's why I'm left with writing tightly-coupled code. My Death script exposes a reference to an InertiveWalking script. But if I decide I want the player character to control tightly, I cant just drag and drop the TightWalking script, I need to change the Death script. That sucks. I can deal with it, but my soul cries every time I do something like this.

Whats the preferred alternative to interfaces in Unity? How do I fix this problem? I found this, but it tells me what I already know, and it does not tell me how to do that in Unity! This too discusses what should be done, not how, it does not address the issue of tight coupling between scripts.

All in all I feel those are written for people who came to Unity with a game design background who just learn how to code, and there is very little resources on Unity for regular developers. Is there any standard way to structure your code in Unity, or do I have to figure out my own method?

sentences: Start Broadcast Unity Network Discovery I am using the unity NetworkDiscovery component, and I am wondering how I can auto-start broadcasting when the server starts, instead of the client having to click on the gui: Initialize Broadcast => Start Broadcasting. I would like to be able to put some C# in my start host function so that the user does not have to do anything.

sentences:
Primitives does not show on screen I'm trying to render terrain, everything compiles fine, but I can't see anything on screen. ( I'm moving camera around in case it was on the other side)

Can't figure out whats wrong.

public class Terrain
    {
        public VertexBuffer vertexBuffer;
        public IndexBuffer indexBuffer;
        public VertexPositionNormalTexture[] vertices;
        public int[] indices;
        //int gridSize;

        Camera camera;
        ContentManager Content;
        GraphicsDevice device;

        Texture2D heightmap;
        public Texture2D grass;

        Effect effect;

        public Terrain(ContentManager Content, GraphicsDevice device, Camera camera)
        {
            this.Content = Content;
            this.device = device;
            this.camera = camera;

            heightmap = Content.Load<Texture2D>("Gfx//heightmap");
            grass = Content.Load<Texture2D>("Gfx//grass");

            effect = Content.Load<Effect>("Effects//terrain");

            CreateVertices();
            CreateIndices();
        }

        public void Draw()
        {
            effect.CurrentTechnique = effect.Techniques["Texture1"];
            effect.Parameters["xWorldViewProjection"].SetValue(camera.worldMatrix * camera.viewMatrix * camera.projMatrix);
            effect.Parameters["xTexture"].SetValue(grass);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                device.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, indices.Length / 3);
            }
        }

        private void CreateVertices()
        {
            vertices = new VertexPositionNormalTexture[heightmap.Width * heightmap.Height];
            for (int x = 0; x < heightmap.Width; x++)
            {
                for (int y = 0; y < heightmap.Height; y++)
                {
                    vertices[y * heightmap.Width + x].Position = new Vector3(x, 0, y);
                    vertices[y * heightmap.Width + x].Normal = new Vector3(0, 1, 0);
                    vertices[y * heightmap.Width + x].TextureCoordinate = new Vector2(y, x);
                }
            }
            //device.SetVertexBuffer(vertexBuffer);
        }

        private void CreateIndices()
        {
            indices = new int[(heightmap.Width - 1) * (heightmap.Height - 1) * 6];
            int counter = 0;
            for (int x = 0; x < heightmap.Width - 1; x++)
            {
                for (int y = 0; y < heightmap.Height - 1; y++)
                {
                    int lowerLeft = x + y * heightmap.Width;
                    int lowerRight = (x + 1) + y * heightmap.Width;
                    int topLeft = x + (y + 1) * heightmap.Width;
                    int topRight = (x + 1) + (y + 1) * heightmap.Width;

                    indices[counter++] = topLeft;
                    indices[counter++] = lowerRight;
                    indices[counter++] = lowerLeft;

                    indices[counter++] = topLeft;
                    indices[counter++] = topRight;
                    indices[counter++] = lowerRight;
                }
            }
        }
    }

sentences:
I want to test the Animator component of a gameobject using nunit, but I am having issues I made a Blender 3D model with animations. Then I used the Animator Controller, and attached it to the model. The Animator Controller has a few Boolean parameter variables like isWaving, isDoing, and isIdle and more variables like that. If, say, a non-idle action is true, then the animation of my model transitions to the next one. I am into test-driven development, but I have never done it with Unity.

I tried writing the following code to test my project:

[SetUp]
public void SetUp()
{
    Crystal = GameObject.FindGameObjectWithTag("CrystalModel");
    CrystalScript = Crystal.GetComponent<CrystalChanPlayer>();
    CrystalAnimator = Crystal.GetComponent<Animator>(); // unity game animator
}

[Test]
public void ifSetAnimationIstodoThenToDoAnimationIsPlayed()
{
    CrystalScript.setAnimationStrategy("todo"); // set strategy
    CrystalScript.playAnimation(); // sets todo boolean to true and idle to false

    // first debug output
    Debug.LogError("todo is " + CrystalAnimator.GetBool("isDoing") +
        " idle is " + CrystalAnimator.GetBool("isIdle"));

    //second output
    Debug.LogError("current state is " +
        CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("idle"));

    Assert.True(CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("todoAnimation"));
}

I received the following output:

  "todo is true and idle is false"
  "true"

I think this is because Unity isn't really running, and my Animator doesn't get to update based on the variable changes. The first output assures me that todo is set to true and idle is false, hence the Animator should transition that animation to the todoAnimation. Yet, I can't seem to show that, in my tests.

Is there any way to test the Animator class? Are there any design patterns I can use?

sentences:
Slick2D: Animation not being parsed from spritesheet correctly I have a 960x960 spritesheet with each tile being 192x192.  I initialized my spritesheet and animation like so:

spritesheet = new SpriteSheet("resources/spritesheets/player.png", 192, 192);
walkingLeft = new Animation(spritesheet, 3, 0, 0, 1, true, 20, true);

When I attempt to render the animation, I get a java.lang.ArrayIndexOutOfBoundsException: -1 error.  This error doesn't occur when I'm creating an animation from images in the same row.  Therefore, I'm assuming that the error is being caused because of the way Slick is handling horizontal scanning (going to the next row after reaching the end).

sentences:
Using a object as origin for a Raycast using mouse position as direction Is there any way to cast a ray from an object using the mouse position as the direction for the ray?
I´ve been looking for a while but I can´t find something like that anywhere, so if anyone could help with this it would be great.

I´m using kind of a top view, you can see how here:

And what I want to do is set a empty game object on top of the character to act as the origin for the ray, then when I press a key the mouse is unlocked and an area appears, here´s how that looks:

And I want to use the position where the mouse clicks to be the direction of the ray.

sentences:
Snake4d - a 4 spatial dimensional game I wrote a little 4 spatial dimension game, it's a 4D snake. The rule are the same as the game for the old Nokia cell phone - eat the food, don't cross yourself, don't go out of the borders.

What do you think of the idea? How do I make a better graphic of the UI? Do you have any suggestion? Like this actually seem a DOS game ...

Here is a little explanatory video: http://www.youtube.com/watch?v=8IUnqm8j4BE

And here there is a new version I did with OpenGL and C++: http://www.youtube.com/watch?v=NaeqUp3jbls

Moreover I have a question, which from the two representation above you like more? Or better, do you have any idea how to represent the 4 dimension at the best?

Btw any comments, suggestions, and questions are appreciated about the UI, the game concept, etc.

sentences:
Shooting weapons Unity I'm trying to create a falling word game like z-type (code here). Once the game starts a few words are displayed on the screen. When the user types a letter and if that matches with the first letter of any of the words displayed, an "activeWord" tag is added to the word. I have also created a laser script that checks if the tag is active and when that happens, it shoots the laser. What's happening right now is that the laser is shot only once i.e when the first letter matches but doesn't shoot a laser when the remaining words are typed. Can someone please have a look at the code and tell me where I'm making a mistake.

this is the word display script where the active word is assigned:

public void RemoveLetter() // remove the first letter if its correct and so on for the remaining letters. change the color of the word to red and add the "activeddWord" tag.
 {
 text.text = text.text.Remove(0, 1);
 text.color = Color.red;
 text.gameObject.tag = "activeWord";
 }

public void RemoveWord()
{
    Destroy(gameObject); // removes the word from display
}

here is the input manager script:

public class WordInput : MonoBehaviour {

public WordManager wordManager;

void Update () {
    foreach (char letter in Input.inputString)
    {
        wordManager.TypeLetter(letter);
    }
}

EDIT

This is the player script where the laser is instantiated:

public class Player : MonoBehaviour {
public GameObject laserPrefab;
void Start () {
    transform.position = new Vector3(0.0f, -3.92f, 0); // player position
}

void Update () {
      Instantiate(laserPrefab, transform.position, Quaternion.identity);
        }
}

This is the updated laser script:

public class Laser : MonoBehaviour
{
public float speed = 10.0f;

private Vector3 laserTarget;

private void Start()
{

}

GameObject activeWord = GameObject.FindGameObjectWithTag("activeWord");

if (activeWord != null && activeWord.GetComponent<Text>().text.Length > 0){

  laserTarget = activeWord.transform.position; // find position of word
  transform.Translate(laserTarget * speed * Time.deltaTime);

  for (int i = 0; i < Input.inputString.Length; i++){

   Debug.Log("Character from input string: " + Input.inputString[i] + "\n" +
   "Character from word displayed: " + activeWord.GetComponent<Text>().text[0]);

   if (Input.inputString[i] == activeWord.GetComponent<Text>().text[0]){

     laserTarget = activeWord.transform.position; // find position of word
     transform.Translate(laserTarget * speed * Time.deltaTime); // shoot the laser
  }
 }
}

After I do this, there are two major errors that I get:

As soon as I hit play, the laser fires continuously without stopping.
The laser still shoots only once after the word is typed...This is the message I get in the console (screenshot attached). There is a difference of one word between the input string and whats displayed on the screen...Can someone please tell me how to rectify these.....

sentences:
How to convert a premade mesh into voxels so I can use algorithms such as marching cubes I have a mesh that was created in a 3D program which is the terrain the player will walk on.  I want to allow the terrain to be deformable by the player, but for it to be smooth (not like Minecraft).

From what I have read from existing questions similar to mine, I need to use an algorithm such as Marching Cubes (which I don't understand yet).  From what I understand, those types of algorithms are suited for procedural generation.

My question is;  How do I convert my mesh into voxels so that I can use algorithms such as Marching cubes?

Is it simply a matter of cutting up my mesh in chunks?

If it helps, I will be using C# and Unity 3D.

sentences:
LibGDX music doesn't play anymore after x times In my App I added two sounds, the first is played when the gamescreen start the second when the game is going to game Over screen.

Everything works fine but after about 12-13 games the second sound isn't played and until the player close completly the app and open it again every sound isn't played. How to solve?

Errors :

05-24 09:04:29.773    5571-5585/ E/AudioTrack﹕ AudioFlinger could not create track, status: -12
05-24 09:04:29.773    5571-5585/ E/SoundPool﹕ Error creating AudioTrack
05-24 09:04:32.421    5571-5585/ E/MediaPlayer﹕ error (-19, 0)
05-24 09:04:32.421    5571-5571/ E/MediaPlayer﹕ Error (-19,0)

sentences:
Lag in Destroy() method I have a script that destroys the player object when a collider with that script touches it. The thing is that, even if there is no time specified in the script, it takes couple seconds before it destroys the player. Why does this happen, and how do I get around it?

public class DestroyScript : MonoBehaviour
{
    public GameObject player;

    void OnTriggerEnter(Collision otherObj)
    {
        if (otherObj.gameObject.tag == "Player")
            Destroy(player);
    }
}

sentences:
What are the accessibility implications of requiring a button press or time-out on a game over screen? For simple games, is there a de-facto standard that game over screens time out after a few seconds before, or require some sort of input in order to, transition back to the main menu?

Time-out pros:

Accessibility. Mobility-impaired users may have difficulty pushing the buttons so the game should advance for them.

Time-out cons:

Accessibility. Vision-impaired users may have difficulty seeing any post-game information displayed within the allotted time.
Tweaking the time-out so it's not too long as to be annoying if the user happens to game over a lot. Also: "Don't make QA mad"

Input pros:

Accessibility. Vision-impaired users may take as long as needed to see any post-game information displayed on screen.
Makes time-outs skippable.

Input cons:

Accessibility. Motor-impaired users may have difficulty pushing buttons.

I remember reading a Microsoft article about certain best practice design decisions regarding accessibility a long time ago but can't recall the specifics.

sentences:
What is the difference between DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL? I have difficulty understanding the difference between those two values of the DXGI_SWAP_EFFECT enumeration. MSDN documentation states:

  DXGI_SWAP_EFFECT_DISCARD

  Use this flag to specify the bit-block
  transfer (bitblt) model and to specify that DXGI discard the contents
  of the back buffer after you call IDXGISwapChain1::Present1. This flag
  is valid for a swap chain with more than one back buffer, although,
  applications only have read and write access to buffer 0. Use this
  flag to enable the display driver to select the most efficient
  presentation technique for the swap chain.

  DXGI_SWAP_EFFECT_SEQUENTIAL

  Use this flag to specify the bitblt model and to specify that DXGI
  persist the contents of the back buffer after you call
  IDXGISwapChain1::Present1. Use this option to present the contents of
  the swap chain in order, from the first buffer (buffer 0) to the last
  buffer. This flag cannot be used with multisampling.

So, Sequential is for displaying the contents of the chain "in order", in other words, in the same order as you called Present(). If so, is Discard not in order? Obviously an older picture should never be shown before a newer one. What kind of "most efficient presentation technique" would this flag enable then?

What if your monitor's refresh rate is 60fps and your code is able to render at 90fps. In this case, every one out of two Presents, the queue will be full. What happens then? Does Present block until the next vsync, capping your rendering rate to 60fps and introducing input lag, or does it discard the oldest buffer in the queue with the new one and allows you to go on with your rendering code as fast as you can? Do these DXGI_SWAP_EFFECT flags have any bearing on the issue?

Thanks.

sentences:
Read from OpenGL texture to Bitmap in C# I want to read a texture pixels from texture id (associated with some FBO) to bitmap object in opengl (opentk) in c#
But it throws an exception says:

System.AccessViolationException occurred
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=OpenTK

The code:

public Bitmap GetTexture(int AttachmentIndex)
        {
            if (AttachmentIndex > fbo_colorBuffer.Count - 1)
                throw new IndexOutOfRangeException();

            Bitmap bitmap = new Bitmap(width, height);
            BitmapData bits = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            BindToRead(ReadBufferMode.ColorAttachment0 + AttachmentIndex);
            GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.Float, bits.Scan0);
            bitmap.UnlockBits(bits);

            return bitmap;
        }

public void BindToRead(ReadBufferMode Mode)
        {
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, fbo_id);
            GL.ReadBuffer(Mode);
        }

sentences:
Optimizing large number of ModelRenderable cubes with ARCore? I am creating an ARCore Android app that involves rendering up to thousands of cubes, of course using a Node and ModelRenderable object for each. Understandably, I'm unable to do that without running into memory issues, so I'm looking for ways to optimize. Ideas I've had so far are:

Removing all of the cubes that had no empty space around them since they would be invisible.
Investigating into some sort of culling (which I don't know much about) to not render the sides of the cubes that are invisible. I don't know if ARCore will already do this.
Hiding all of the cubes that are hidden behind other cubes. I don't yet understand the math behind this.
Grouping cubes of the same type into larger cubes. In one example, there might be 16x16x16 rendered on the screen. Each cube is an individual unit with its own type. So in relation to my grouping idea, I would take all the cubes that have the same type would be replaced with one larger cube or cuboid.

I've tried removing all of the cubes that have no empty space around them, as those will not be visible. Long term, however, this will be insufficient.

I don't have a lot of code to show that's related as this question is more looking for ideas to write code, but basically I'll be having a very large number of:

// Where position is a Vector3 and material is a Material object.
ModelRenderable cube = ShapeFactory.makeCube(new Vector3(CUBE_WIDTH, CUBE_WIDTH, CUBE_WIDTH), position, material);
Node node = new Node();
node.setRenderable(cube);

I'm not creating a new material every time, I generate those at startup.

I understand there are lots of questions already answered about this kind of optimization, but I haven't been able to find much about the implementation of things such as culling and hiding blocked cubes in the context of ARCore. Would I be better off using Unity?

If anyone has advice or ideas, I'd love to hear them.

sentences: SharpDX Texture to Image in C# I currently have an image processing application that outputs processed images post pixel shaders have been applied. However, using the examples I've found on the internet, the colors are flip to BGRA when RGBA is expected. I currently work around this with by post export processing to get the desired RGBA format. I was hoping someone else has dealt with this and has a solution that does not require post processing to correct the format.

sentences:
Geometry Shader input vertices order MSDN specifies (link) that when using triangleadj type of input to the GS, it should provide me with 6 vertices in specific order: 1st vertex of the triangle processed, vertex of an adjacent triangle, 2nd vertex of the triangle processed, another vertex of an adjacent triangle and so on... So if I wanted to create a pass-through shader (i.e. output the same triangle I got on input and nothing else) I should return vertices 0, 2 and 4. Is that correct?

Well, apparently it isn't because I did just that and when I ran my app the vertices were flickering (like changing positions/disappearing/showing again or sth like that). But when I instead output vertices 0, 1 and 2 the app rendered the mesh correctly.

I could provide some code but it seems like the problem is in the input vertices order, not the code itself.

So what order do input vertices to the GS come in?

sentences:
How can I draw multiple lines connected via "nodes" in libgdx Scene2D? I have two Vectors which indicate the ending points of each line. I am trying to draw similar lines to football formation lines like these:

My main problem using ShapeRenderer is:

ShapeRenderer coordinates are relative to screen coordinates and not Scene/Table/Stack. This creates varying coordinate points in different screen sizes. Although I can fix it, I still experience get varying line width in different screen sizes.
ShapeRenderer performance issues as it is mainly intended for debugging.
ShapeRenderer draws over all Actors.

I have tried drawing the lines as a Pixmap and adding them to the scene as an image. This is part of the constructor to my custom class which extends Group.

pixmap = new Pixmap( 16, 16, Pixmap.Format.RGBA8888 );

    pixmap.setColor(Color.RED);
    pixmap.drawLine(Ax, Ay, Bx, By);
    Texture pixmaptex = new Texture(pixmap, Pixmap.Format.RGB888, false);
    Image pixmapimg = new Image(pixmaptex);
    pixmapimg.setPosition(x, y);
    this.addActor(new Image(pixmaptex));
    pixmap.dispose();

I am trying to draw using this but it just draws a square with the pixmap width and height at (0,0) of the stack. Which is the best class to extend to draw this lines? I am expecting to write a custom class if this doesn't work.

sentences:
Kinect User Silhouette Shader I have this usermap from kinect's depth data (size is 320x280) and i want to display it on my game. The problem, of course it's ugly (first image) and i want to have beautiful effect like in the second image

The usermap is put on a bilboard as a texture2D and i've been thinking i should use fragment shader. I'm wondering what kind of shader techniques i should use so i can possibly make the same effect as shown on second image

Usermap: http://www.azerdev.com/darkmachine/usermap.png

Glowing man: http://www.azerdev.com/darkmachine/silhouette.jpg

sentences:
What is wrong with this character slope math? I'm making a sidescrolling platformer and have implemented some code that should convert the characters speed to an X speed and Y speed based on the angle of the surface they are on. This actual math for this was taken from a web page and I don't know if it's right or not.

// xSpeed and ySpeed are derived from speed, based on the angle
    xSpeed = speed * Mathf.Cos(angle);
    ySpeed = (speed * -Mathf.Sin (angle)) - gravity;

The angle is found with this code:

RaycastHit ground;
    Physics.Raycast (transform.position, Vector3.down, out ground, 1.5f);
    Debug.DrawRay (transform.position, Vector3.down.normalized, Color.green, 2, false);
    if (ground.collider != null)
    {
        angle = Vector3.Angle (ground.normal, Vector3.up);
    }
    else
    {
        angle = 0;
    }

This works fine when walking on a flat surface, but freaks out when walking on a slope. I believe the problem lies with the angle itself.

sentences: Tools for editing 2D sprite-based game levels What are good free and widely used tools for editing 2D sprite-based game levels? I'm looking for one that allows exporting data to a custom format. One that I know of is Blender — a 3D tool, primarily, but can be used for 2D art as well — which also supports Python scripts for exporting data.

sentences:
Multiple collisions within a single frame cycle? So say you want to simulate several objects in two dimensions, just bouncing around in a finite space. Using AABB and sweep tests, it shouldn't be that complicated to calculate single collisions between objects. But if you want to have an object bounce off another surface in the same frame (one collision), how do you account for any additional collisions after that first one? This might not make much sense, so I put a little graphic together to explain what I mean.

So say all this is happening in one frame cycle. The gray box moves up and bounces off the wall on the top; that's easy enough. That orange box is the problem, though. How do I calculate that collision as well (where the two translucent boxes are)? OR, if the frame rate is high enough, does it even matter? Thanks!

sentences:
Fast(er(est)) fullscreen/scene collision detection technique ("selection buffer") My vertex format has a float4 Flags element used to pass miscellaneous data to shaders.
Each mouse-collidable object that is rendered has a unique ObjectID that is written to an ObjectID-rendertarget which can be CPU-sampled to index the hovered object. The remaining render targets are geometry/lighting data.

I've found this has advantages:

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

I've found only one disadvantage:

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

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

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

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

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

sentences:
What is the term for the level progression paradigm in Bejeweled? Looking at the various level progression paradigms for my puzzle game, I decided to rule out the common ones such as 3-star per level, linear campaign-like story, etc. I like the idea of Bejeweled's classic mode where the player simply keeps on going.

What exactly is this paradigm called? I can't find any write-ups on it so I can't quite tell what its structure is like. Is it infinite? Does the difficultly increase with each level in some shape, way or form (more likely to get "No moves")?

sentences:
Pick which directional light shades which object Suppose you have two directional lights pointing at one sphere from different angles. You would expect the sphere to cast two shadows, but it turns out that this isn't the default behavior. The first light in the scene is the only one that casts a shadow. I want all my yellow spheres to take shadows from light A, but I want all my blue spheres to take shadows from light B instead of A. Is there a way to do this?

(It seems there's a fullforwardshadows pragma that could make the spheres cast both shadows. I'll try to figure that out if need be, but I really only need one shadow per sphere.)

sentences:
Fail to install ML-Agents (python packages) I have been trying for hours to install pytorch and mlagents with cmd, however I am getting pretty much the same error for each package I'm trying to install -

ERROR: Could not find a version that satisfies the requirement typing-extensions (from torch==1.7.0) (from versions: none)

ERROR: No matching distribution found for typing-extensions (from torch==1.7.0)

I'm using python version 3.7.9, attaching a screenshot of the cmd.
Also, as you can probably notice - I'm getting a repeating warning every time I'm using pip and I'm not sure of it's something to avoid -

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/torch/

sentences:
Should I scrap my own leader board and go for the Facebook built in one? Currently I'm rolling my own score and leader board functionality in my FB canvas game.
In my game, users can see what score they have, in addition I have a public leader board where everybody can see all scores from all other users.(I also have possibility for each user to set themselves as anonymous in the leader board, if desired)

But now I started thinking; why do I have my own leader board system?
Facebook has this scores API and I started play around with it.
It, of course, integrates well with Facebook, scores and achievement showing up in the ticker and what not.

But it seems that I can't let each user see a public leader board in much the same way I currently have it. But it do let the users see their friends score.
Let's face it, this is all what FB is all about, right? Friends.

So the question is; should i scrap my own leader board and go for the Facebook built in one (and skip the public part of it)?

My gut feeling says yes, but I wanted to hear what other thinks.

sentences:
2d block based game storing water simulation I am making a 2d block based sandbox game like terraria.

I'm trying to think where is the better place to store water in, data structure wise.

That is, to store it in the block world array, or to store it in its own sparse data structure. Does doing this have any benefits?

If I store it in the world array I have to store the fluid level (which would be like 16 levels possible). The other way I could simply have a fluid cell struct or something.

It might make things more clear separating it, but not sure if it would possibly affect performance either way.

In a game like this, the simulation is of course usually done via cellular automata (just in case that affects which data structuring I should use)

sentences:
How to design and implement turn-based system? Possible Duplicate:
  How to implement turn-based game engine?

I am considering making a game like Master of Orion but I don't know how to start with turn-based systems. If any of you played this game they know what I mean, same system is used in Civilization.
1. You give orders to your units and production queues
2. Click End Turn.
3. Everything moves, go to 1.

I know that some form of state machine is used, but maybe you could point me into some book or manual on the matter.

sentences:
How to pass arguments with BungeeCord/Bukkit plugin messaging I am trying to send a plugin message from Bukkit, to BungeeCord, but can not figure out how to send arguments.
Here is the code from the Bukkit plugin, which sends the message:

  ByteArrayDataOutput out = ByteStreams.newDataOutput();
  out.writeUTF("BungeeCord"); out.writeUTF("Argument");

  // If you don't care about the player // Player player =
  // Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
  // Else, specify them
  Player plr =  Bukkit.getPlayerExact("spacegeek224");

  plr.sendPluginMessage(p, "BungeeCord",
  out.toByteArray());

Here is the code in the main class of my BungeeCord plugin:

@Override
    public void onEnable() {
        this.getProxy();
        ProxyServer.getInstance().getPluginManager().registerListener(this, new ChannelListener());

        this.getProxy();
        ProxyServer.getInstance().registerChannel("Return");
    }

And finally, here is the code for the ChannelListener:

package net.spacegeek224.metro.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class ChannelListener implements Listener {

    @EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        if (e.getTag().equalsIgnoreCase("BungeeCord")) {
            DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
            try {
                String channel = in.readUTF(); // channel we delivered
                if(channel.equals("BungeeCord")){
                   ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()).create());

                } else {
                    ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()+":"+channel).create());

                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    }

    public void sendToBukkit(String channel, String message, ServerInfo server) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(stream);
        try {
            out.writeUTF(channel);
            out.writeUTF(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        server.sendData("Return", stream.toByteArray());

    }
}

I have tried many things, including Google, and looking at what other methods are available, but have come up with nothing.

sentences:
Using InputListener touchDown - Unable to jump while pressing direction button Using InputListener attached to images for touchscreen control I initially had the problem of the player being able to continuously jump and fix themselves to the top of the screen by simply holding the jump button.

This was resolved by adding a gdx.input.justTouched() check before calling the jump() method. However, this annoyingly then introduced a new issue of not being able to jump whilst holding a direction button. The direction button first has to be released before the jump will function.

if (player.presentState != Player.State.DEAD && player.presentState != Player.State.WIN) {
            if (controller.isRightPressed() && player.body.getLinearVelocity().x <= 1.75)
                player.body.applyLinearImpulse(new Vector2(0.1f, 0), player.body.getWorldCenter(), true);
            if (controller.isLeftPressed() && player.body.getLinearVelocity().x >= -1.75)
                player.body.applyLinearImpulse(new Vector2(-0.1f, 0), player.body.getWorldCenter(), true);
            if (controller.isUpPressed() && controller.isJumpPressed() && player.presentState != Player.State.FALLING)
                if (Gdx.input.justTouched()){
                    player.superJump();
                }
            if (controller.isDownPressed()){
                player.dive();
            }
            if (controller.isJumpPressed() && player.presentState != Player.State.JUMPING){
                if (Gdx.input.justTouched()) {
                    player.jump();
                }

The jump() method operates under two different state conditions.

If the player is state.ground or state.running, a positive y-impulse is applied.

If the player is state.falling a slight positive y-impulse is applied with linearDampening allowing the player to control the descent as to float/glide down.

This all works perfectly via my keyboard input implementation but not in my touchscreen one.

How to resolve this?

sentences:
Problem with preloading plist file in Cocos2d-x I am using Cocos2d-x engine with 3.2 version.

In my splash screen I am prefeching a plist by below line

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist");

Now inside game when I am creating a sprite I am getting an assert fail error

Sprite *ss = Sprite::createWithSpriteFrameName("pause.png");

  Assert failed: Invalid spriteFrameName: pause.png

Also when the splash screen is removed, I am getting the below line in console

  cocos2d: TextureCache: removing unused texture:
  D:/cocos2dx/projects/ABCD/Resources/mid/ui.png

Is there anything I need to add or something?
I was doing the same thing for 2.x and was working but not in 3.2

EDIT:
In 3.x if you are calling this line
Director::getInstance()->purgeCachedData();, remember that it will delete all textures from the cache memory. So handle all sprite-sheets manually.

sentences:
How to make the Steam overlay work with WPF? I have developed a game using C#+WPF and the game is currently on Steam (private branch until release). However Steam's overlay isn't working with WPF. Sometimes it tries to appear in the popups of comboboxs.

I've tried several options, the best so far was to render a black screen using SharpGL under my application :

<sharpGL:OpenGLControl
            Name="openGLControl"
            DrawFPS="False" RenderContextType="FBO" FrameRate="14"/>
<Grid Name="gridContainingMyApplication">

</Grid>

But as you can imagine this decreases the performance of the application and some effects can appear delayed (mouseover for example).

It was not a major concern until now but since we are planning on adding multiplayer we would like to find a way to make Steam's overlay work.

I know that WPF isn't the best option to create games but in our case we thought it would be. We've created a simulation game and since we have a lot of tables/stats/etc. we thought WPF was great, and excepting this overlay issue WPF seems perfect for us.

Is there a way to make Steam's overlay work with WPF ?

Thank you,

sentences:
Is SDL2 alone capable of dynamic (or deferred) lighting? I'm talking about JUST SDL2, not OpenGL or DirectX.
Would drawing deferred lighting bulk the CPU up and how would it be done?

sentences:
How to detect a body between two points on LibGDX I've two Vector2 (A and B), i draw a line between them.

Is there a way to check if the line intersect the Box2D CircleShape?
I need to a boolean output

sentences:
Strategy/City Builder browser game - technical details I actually have multiple questions into one. Hopefully someone can hit all of them.

I wanted to give a try at a massively multiplayer web based game. Basically, the game would have similarities to Evony, or Eve Online (a much scaled down version). The idea is it would be a mostly real time city builder (like Evony) that allows complex actions between players (like Eve Online but without the graphics and much scaled down). It would sort of be like a database game. I want it to be able to support around 500 people simultaneously online off one server.

However, I have multiple issues that I want to pin down before I actually start writing the code.

Continuous database updating

The database has to be continuously updated on a small time interval to reflect the passage of time in the game verse. Furthermore, the effects of all actions will have to be calculated as well. Right now I'm thinking about using mysql with events using the innoDB engine to do this. Is there a better/faster approach to this?

Continuous graphical updating

Certain details (such as "time till completion" etc when building something) need to be continuously updated on the user interface. I'm thinking about having each page in the user interface continuously make ajax calls for the information. Again, is there a better/faster way?

Thanks

sentences:
How to aim with a spaceship in 3D considering its angular momentum? So I have a spaceship and I have 6 degrees of freedom.

At a given moment the following vectors are known of the spaceship:

Local forward.
Local up.
Local sideways (may be implied from the previous two).
Angular momentum.

The spaceship has 3 torquers to add/subtract to the angular momentum the in main directions relative to it.

Each of them can add 0 to 1 units of angular momentum per second (so it's possible to run them less than full power when needed).

So from the given vectors, how can I compute which torquers to run to lock on the target vector as quickly as possible?

I think this is a basic problem in the field of attitude control. But I couldn't find good pointers yet (maybe I didn't use the right keywords in my search).

The tricky part is that I want to consider the instantaneous angular momentum. Otherwise I would just cross multiply the forward vector and the desired direction vector to have the desired axis of rotation, but that's not what I'm looking for...

My current idea is the following: use the roll torquers to eliminate the roll component the spaceship rotation if any, while using the pitch/yaw torquers to rotate it into the direction based on pitch/yaw angular differences of the forward and the desired direction and the pitch/yaw component of the spin. But I'm not sure it's the quickest, might not even be correct.

sentences:
What are the steps for creating level in Libgdx with Box2d? I have been trying to learn game programming for a week, although I have a good knowledge of programming.

I don't understand some steps of game design. I'm recently working to clone the iSlash game.I'm so confused about creating level like this one.

For example , this is a level of this game.

This crab or whatelse must be designed in tools like photoshop, am I right? There are objects which can move around, but inside this crab so I think, I can use Box2D.

Here is my temporary design this game..
I want to use a my own object and move balls inside this object,but the problem is here.I can't imagine that how I should do this? If I use mesh like below code,

mesh.setVertices(new float[] { -0.5f, -0.5f, 0,
                                        0.5f, -0.5f, 0,
                                        0, 0.5f, 0 });

I think , It's very very hard way to create a level and I don't know what my object's coordinate.It takes forever.

In brief, What should I do? What tools should I use? How do big games like Angry Bird or above game (iSlash) solve this? Can I use tiled map editor for this problem?

sentences:
Handling input through callbacks or through game loop? I've tried to figure out how to handle player input properly, but without luck so far.

As far as I have figured out, I can either:

  Call the respective methods directly through the callback fired when
  an input event is detected.

Or

  Save the input in an array and detect it through my main loop.

I would like some thoughts on this in terms of if there is any restrictions/benefits using one over the other.

sentences:
Is frustum culling necessary in a Flash/AS3 game? I'm making a 2D game where the map will be scrolled frequently, and only a small part of it will be visible at any time.

Which implementation would run faster?

The naive way: Make the map a single
huge MovieClip and move it around.
The elegant way: Split the map into
multiple chunks and use a frustum
culling algorithm to render only the
ones that are visible.

Now that I think of it, this question boils down to whether Flash does its own frustum culling on big MovieClips.

sentences:
How can I instantiate in the current rotation in Unity 2d? Backstory

I'm currently working on a 2D sidescroller/platform game as a hobby, and I just started recently. Followed a few tutorials and such I managed to wrote my own code for basic command like walk, jump, health and so on. However my basic code wasnt perforning as I would expect, I needed a more "Tight" feeling with the movements so I followed a suggestion to use a physics based controller (Prime31's PC2D, Acrocatic or even Corgi Engine...)

Well, now the movements are what I feel is good, So I kind of dived in the scripts to add/remove/customize some code.

Question

I'm stuck now on a simple issue, I added these lines

public Transform weaponMuzzle;
public GameObject projectile;
float fireRate = 0.5f;
float nextFire = 0;

then in my Update()

if (Input.GetButtonDown("Fire2"))
{
  animator.Play.Weapon();
  fireProjectile ();
}

and here is the problem I have

void fireProjectile ()
{
  if (Time.time > nextFire)
  {
    nextFire = Time.time + fireRate;

    if (_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0,0,180f)));
    }
    else if (!_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0, 0, 0)));
    }
  }
}

The prefabs are also physics based and they are fired with no problems, however they don't want to follow the current rotation of the player, they always go in the right X axis.

First of all, the facingLeft on my code is what I understand is the reference to the character controller motor, I tried with _motor.normalizedXMovement > 0 and _motor.normalizedXMovement < 0 (normalizedXMovement -1 is full left and 1 is full right) this just make it that you can only fire while moving, not stopped and the problem still persists.

I also tried with Quaternion.Identity instead of Euler and it's the same.

For a full source code : https://github.com/prime31/CharacterController2D

I'm kinda lost and it would means a lot if you can help me out on this issue.

Ps: I already searched here and other related forums but cannot find the answer, this is not a repost.

sentences:
Random numbers with a left or right biased skew Within Java I have a table of objects ranging from horrible (1%) to wonderful (100%) from which one is randomly selected. This is simple enough and appears on a bell curve with a normal distribution and the average at the 50% mark. But at various stages I wish for this distribution to shift left or right meaning that you are more likely to generate a less pleasant item or at other stages, generate a more pleasant one. The table ranges from 1 to 100.

How do I generate a random number that is biased to one end of the table and not the other, while still being able to, in this case in a bad situation, randomly come up with a 100%? I have looked at Random.nextGaussian(). But this doesn't seem to quite do it, if I am reading it correctly.

sentences:
Player animating the wrong direction once he is rotated I have used the scripting root motion move the player when using an 'inplace' animation.

All works correctly until the players rotation is off 0,0,0.
This is expected as the movement is along the transform.z axis but how can I account for the rotation in the script and apply it so the movement is correct in game?

The gorillacontroller script is the script we are trying to fix On playerGorilla. animator is on the playergorilla. The gorilla1 is the gameobject holding the mesh and the bones for the character.

I will also add the transforms are moving this was my silly mistake because I had tool handles in global instead of local.

This makes it even more confusing however because all tranform.z (blue axis) are facing the correct way for the animation to work but the animation is only ever playing in the original direction where the rotation is 0,0,0,0.

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class RootMotionScript : MonoBehaviour {

    void OnAnimatorMove()
    {
          Animator animator = GetComponent<Animator>();

          if (animator)
          {
               Vector3 newPosition = transform.position;
               newPosition.z += animator.GetFloat("Runspeed") * Time.deltaTime;
               transform.position = newPosition;
          }
    }
}

sentences:
How to make a sprite blink with Libgdx? I want to make a sprite blinking like this:

float alpha = .0f;

public void draw(SpriteBatch batch, float delta){
    alpha += delta;
    sprite.draw(batch, (float)Math.sin(alpha));
}

Well, it is blinking, but in a very irregular way. It should go from transparent to non-transparent to transparent and so on.
But with that code it is more like non-transparent to transparent - then it almost instantly skips back to non-transparent and goes back to non-transparent.

How can I optimize this?

sentences:
How does hardware tessellation work? I would just like someone to explain in relativly clear terms how hardware tessellation works considering it is the new buzzword with DX11.

Thanks.

sentences:
How to get samsung gear vr controller rotation & position in unity I am trying to get Samsung Gear VR(Oculus) rotation & position so when I turn the samsung controller left or right(like a magic wand)...it should give me rotation(Quaternion) & position(Vector3) readings?

How can I do that? I'm using Mobile version of Oculus Gear VR not the PC one. Also, GetLocalControllerRotation() returns void and doesn't return me a Quaternion

Does the controller come with a Gyroscope with the help of which I can the rotation or position readings?

sentences:
2D Outline shader in GLSL I have a simple prototype with 2D worms-like destructible terrain.
I use a trivial shader to discard pixels based on a mask.

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_mask;

void main()
{
    vec4 colour = texture2D(u_texture, v_texCoords);
    vec4 mask = texture2D(u_mask, v_texCoords);

    if (mask.a > 0)
        discard;
    else {
        gl_FragColor = colour;
    }
}

What would be a good and simple way to add few pixels thick black outlines to the terrain to make the carved parts look better?

I've researched something about edge detection algorithms, but my hunch says that such a fullblown thing would be kind of an overkill for this task?

I'm not after quality or high performance, but simplicity.

Thanks for any ideas.

sentences: How the game sends force feedback to the steering wheel How the game will be some of the information feedback to the steering wheel, such as bumps, bumps, vibration and so on. View MSDN, which are introduced from the steering wheel to get the relevant information and control the steering wheel of the force feedback, but how to get from the game inside the type of force feedback?

sentences:
Parameter 'Blend' doesnt exist I want to animate my character, but i got this error: Parameter 'Blend' doesnt exist.

if i use 1d Blend Type it works fine no bug nothing.

But if i change the Blend type

in the animation panel working fine the animation but if i run the game i get this error: Parameter 'Blend' doesnt exist and my character is freeze in one position what can cause this problem ?

parameters

sentences: Configurable Dice Cup Sound Effect for HTML5 Game I am developing an HTML5/javascript based game, where the players will have to roll virtual dice. I am working on a 3d model of a dice Cup and plan on having the users shake it and turn it upside down in order to roll the dice. I would like some realistic sound effects to go along with this interaction, but do not know how to achieve this. The problem is that the number of dice, the duration, intensity and speed of the dice cup shake will vary. Consequently, I don't think I will be able to create a convincing sound experience by using a prerecorded sound effect. How does one deal with making such sound effects configurable?Would I need to programmatically generate the sound using the web audio API? If so I would be grateful for any pointers as to how to do it.

sentences:
3D terrain generation with overhangs/caves 3D terrain with 2D noise function as heightmap is kind of 'easy'. Make a plane and adjust height based on the noise.

How would one start working on 3D terrain with overhangs/caves?

There are some older topics (for example related to Minecraft) on the thema, but non of them cover overhangs and in general techniques that can be applied to heightmap generated terrain.

sentences:
get position of GameObject on rendertexture from camera I'm rendering the camera output to an rendertexture on a plane.  This works fine. But I want to put GameObjects on the rendertexture on positions of world objects that are visible on the camera.

camera.WorldToViewportPoint(obj.transform.position)

shows the correct positions, but is not mapped to the rendertexture. How can I do this?

So it's GameObject in world > camera input >  plane with RenderTexture > world or local position of gameobject on top of rendertexture plane.

sentences:
How are Volumetric Effects made within games? (e.g. Smoke/Fire) For computer generated volumetric elements such as clouds, fire, and whitewater.

How are they made? Is it just a simple collection of particles [put to pixels] taken from Physics equations or are the like textures?

How are they applied? I would assume not from UV mapping

Derbis, smoke and fire come from the vehicle.

sentences:
Flatten transform hierarchy at build time Nested hierarchies cause a performance overhead when they include moving objects.

  Every time a GameObject moves, altering its transform, we need to let every game system that might care about this know. Rendering, physics, and every parent and child of the GameObject needs to be informed of this movement in order to match. As the scope of a game increases, and the number of game objects skyrockets, just the overhead of sending out all these messages can become a performance problem.

However, nested hierarchies are useful in organising a scene and keeping logical groups of gameobjects separate.

What options exist to save performance whilst keeping the hierarchy?  Is there any pre-existing solution to flatten a hierarchy when building only?

sentences: Using Gimp and clone tool. Source selection selects center of four pixels I am using gimp to make tilesets. When I use the clone tool and hold ctrl to select the source, the selection is in the center of four pixels instead of just one pixel.  I don't know if I am doing something wrong or if there is a setting to change this.  Any help would be greatly appreciated.  Here is a pic.

sentences:
How to structure tic tac toe game loop (or equivalent simple turn based game)? I'm developing the simple Tic Tac Toe game in Java and got stuck on the game loop architecture.

The game must support local, remote and automatic players.
The graphical interface is based on JavaFX.

How can I best structure the game loop so that the game logic is as separate as possible from the graphic interface?

I have thought of two approaches to solve this problem

Approach 1 - wait/notify

The simplest approach I thought of is to develop classes for each type of player (remote, interactive and automatic) and implement the necessary code within the mark (Board) method. The update method iterates the players and for each one executes the mark method.
In the case of the AI, no problem, but in the case of the interactive player I would find myself having to pause the current thread while waiting for input from the graphic interface thread. A solution that does not convince me.

public synchronized void mark(Board board) {
    nextMarkLocation = null;
    try {
        if(nextMarkLocation == null) {
            wait();
        }
    } catch (InterruptedException e) {
        // handling
    }

and

public synchronized void setNextMarkLocation(Location location) {
    nextMarkLocation = location;
    notify();
}

Approach 2 - expose methods

The second approach would be to implement the methods for setting the current player's action in the game class. In this case, at each execution of the update method the routine would be the following (pseudo code):

public void update() {
    var player = getCurrentPlayer();
    var location = player.getNextMarkLocation();
    var symbol = player.getSymbol();
    board.markCell(location, symbol);
    updateCurrentPlayer();
}

The GUI will take care of updating itself according to the update of the match and setting the action for the current player. Here a check should be placed on the GUI owner. If the current player is not the same as the GUI owner, the game must ignore the action.

But the problem would be the reverse: And the automatic players?

Do you have any suggestions? Thanks

sentences:
Smooth vector based jump I started working on Wolfire's mathematics tutorials. I got the jumping working well using a step by step system, where you press a button and the cube moves to the next point on the jumping curve.

Then I tried making the jumping happen during a set time period e.g the jump starts and lands within 1.5 seconds. I tried the same system I used for the step by step implementation, but it happens instantly. After some googling I found that Time.deltatime should be used, but I could not figure how. Below is my current jumping code, which makes the jump happen instantly.

 while (transform.position.y > 0)
 {
   modifiedJumperVelocity -= jumperDrag;
   transform.position += new Vector3(modifiedJumperVelocity.x, modifiedJumperVelocity.y, 0);
 }

Where modifiedJumperVelocity is starting vector minus the jumper drag. JumperDrag is the value that is substracted from the modifiedJumperVelocity during each step of the jump. Below is an image of the jumping curve:

sentences:
Design patterns in Game Physics In the frames of a number crunching compatible programming language (say.. C++), what would be an elegant solution for adding self collision, external collision and integration step (Euler, etc.) updates to an object? (say the already abused mass spring system).

Say the object class is this one:

class DeformableObject
{
    public:
    DeformableObject();
    virtual ~DeformableObject();
    protected:
    vector <vec3<Real> > pos;
    vec3<real> fEval(int idx); // - the internal force due to ellasticity at the idx-th node
    friend class Integrator;
}

For example, in case of the integration method, I was thinking of having an abstract Integrator class and derive from it to add specific methods (Euler, Verlet, Midpoint, you name it).:

class Integrator
{
    public:
    Integrator();
    virtual ~Integrator();
    vec3<Real> Step(Real DTime, DeformableObject * dObject, int idx);
}

Now, since I'd like to switch or perhaps let different instances of the same deformable object use  integration method A and the other use integration method B (for "benchmarking" purposes), is it safe to "think inside the box" and refer to either the Bridge or Strategy pattern? Which is more suitable and less ambiguous, especially performance-wise?

What about a self collision controller approach? Should I just add a self collision method to the DeformableObject class or "befriend" it with a Collider class? And what about external collisions, with different objects - how should that aspect be approached, at least at the conceptual level: considering the naive, brute pair-to-pair collision queries, if two objects collide, their points must be updated in the sense that velocities and forces are added to the points' own dynamic quantities (e.g. restitution forces, penalty forces, friction forces, reflected velocities, impulse conservation velocity changes, etc.).
I know this is a broad topic, but I don't know which book does tackle these natural problems for a novice programmer. Thanks for your patience in reading this question!

sentences:
Converting Unity .fbx model to .stl using the exporter? We bought this script asset from the Unity store. We need to run it to convert some .fbx files to .stl.
Is there any simple guide on how to run a script from the asset store?

sentences:
resolving per pixel collision issue In space invader, I'm doing bullet to barrier intersection using rect to rect, then I'm testing the first bullet's impact pixel, if it's green I blast a circle, if it's black, it continues travelling. now there is a situation that there is part of the barrier that won't be checked for intersection, as shown in the image, the first intersection test will fail, because the first pixel is black...

How would I resolve that issue ?

sentences:
Problem with default 3rd person controller in Unity 4 I am new to Unity. Whenever I am importing the default 3rd person controller (construction worker) in my scene and clicking the play button, the model seems to be in the running pose.

The control keys are working properly, and I am also being able to make the character stand, walk, run and jump properly.
Only problem is that it is always in the running pose - which looks very odd.
I did not make any change to anything. I just imported the controller as is.

Can someone please tell me how to correct this issue?

P.S. I hope my question was clear.

sentences:
How to find 1/3 and 2/3 of the distance between two given points? I know how to find the middle of two given points:

var midpoint = (pointA + pointB)/2;

where pointA and pointB are Vector2

I thought that

var thirdBtnPoints = (pointA + pointB)/3;
var twoThirdBtnPoints = 2*(pointA + pointB)/3;

should give me 1/3 and 2/3 between the two points but it doesn't. I guess this might be more of a math question though, but how can I find 1/3 and 2/3 of the distance between two given points?

sentences: Collisions between players at spawnpoints I am working on a FPS/MMORPG and ran into a problem at spawnpoints, when I enabled collision detection between players. Neither player would be able to move if both spawned at the same time, because both players would essentially be "trapped" within each other's meshes. What is the best way to resolve this problem?

sentences:
Slick2D and Nifty GUI I am currently trying to combine both slick2d and nifty to work together. I've had some amount of success - I can now actually run my test and it won't crash. As far as I can tell, it will also receive input properly.

First, I'm having doubts I'm doing it right. I extend NiftyStateBasedGame in my outer game and then I extend two NiftyOverlayGameState to create the two states. However, I am getting an error that doesn't crash my application saying:

WARNING: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
    at org.bushe.swing.event.EventServiceLocator.setEventService(EventServiceLocator.java:123)

I could ignore it, since the application is running well enough (I think?) but I'm concerened that once I figure out how to actually implement some parts of the GUI they might not work.

Which leads me to my next question. I was trying to create a simple button on screen and I could not for the life of me figure out how to go about it. I have my nifty instance... But what do I do with it? Any pointers in the right direction would be greatly appriciated!

My three classes:

The outer class, TheGame (This is the StateBasedGame)

public class TheGame extends NiftyStateBasedGame
{

    Menu menu;
    Nifty nifty;
    GameOver go;

    public TheGame(String name)
    {
        super(name);
        menu = new Menu();
        go = new GameOver();

    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException
    {
        this.addState(menu);
        this.addState(go);

    }

    public static void main(String[] args) throws Exception
    {
        AppGameContainer game = new AppGameContainer(new TheGame("OMG, Super test!"));

        game.setDisplayMode(800, 600, false);
        game.setAlwaysRender(true);

        game.start();

    }

And the two dummy classes the are the states:

public class Menu extends NiftyOverlayGameState
{
    @Override

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("Does it work?", 100, 100);

    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
            sbg.enterState(1);
    }

    public int getID()
    {
        return 0;
    }

public class GameOver extends NiftyOverlayGameState
{

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("WORKS, OOOH-YEA!", 100, 100);
    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON))
            sbg.enterState(0);
    }

    public int getID()
    {
        return 1;
    }

Again, if compiled, this gets me the two screens I want with the warning/exception I mentioned above. What am I doing wrong? And how would I start actually adding GUI elements to this?

sentences:
Why does the D3DXCOLOR structure not work as I expect? I looked up some R G B values for certain colours, such as "Indian red" for example, which has the RGB values (238, 64, 4).

If I use those values into a D3DXCOLOR structure like this: D3DXCOLOR(238, 64, 4, 255), the colours display oddly - as white! This displays as yellow: D3DXCOLOR(238, 64, 0, 255). Why is this?

sentences: Help generating clues in a treasure finding game I am a high school student creating a small game in unity for fun and would greatly appreciate your opinions on this game mechanic. I have a treasure finding game that takes place in a randomly generated forest with randomly placed treasure. There are also randomly placed landmarks such as large rocks, lamp posts, picnic tables, etc. The treasure spawns within a certain radius of a landmark as to provide a reference point for clues to the position of said treasure. I am having some difficulty however, deciding what sort of clues i could generate. I thought of a few ideas such as generating clues referencing a landmark the treasure is near, clues referencing cardinal directions, and clues which are an image of the treasure's surrounding environment. I would love some feedback on the clues i have thought of so far, and new suggestions for clues. Thanks in advance!

sentences:
Representing a world in memory I'm attempting to write a chunk based map system for a game, where as the player moves around chunks are loaded/unloaded, so that the program doesn't run out of memory by having the whole map in memory.

I have this part mostly working, however I've hit a wall regarding how to represent the contents of each chunk in memory because of my so far limited understanding of OOP languages.

The design I have currently has a ChunkManager class that uses a .NET List type to store instances of Chunk classes. The "chunks" consist of "blocks". It's similar to a Minecraft style game.

Inside the Chunk classes, I have some information such as the chunk's X/Y coordinate etc, and I also have a three dimensional array of Block objects. (Three dimensional because I need XYZ values)

Here's the problem:

The Block class has some basic properties, and I had planned on making different types of blocks inherit from this "base" class. So for example, I would have "StoneBlock", "WaterBlock" etc.

So because I have blocks of many different types, I don't know how I would create an array with different object types in each cell.

This is how I currently have the three dimensional array declared in my Chunk class:

private Block[][][] ArrayOfBlocks;

But obviously this will only accept Block objects, not any of the other classes that inherit from Block.

How would I go about creating this? Or am I doing it completely wrong and there's a better way?

sentences:
How can I make a look around effect of the player some kind of cutscene? I want that at some point in the game the player will be looking over the view out of the window.
So I added a new Camera and positioned the camera close to the window.
Then using a small script I'm turning the Camera on.

But after turning the camera on I wan to make that the camera will rotate around the window area so it will give a natural feeling that the player is looking over the view outside.

And the script that is attached to another GameObject that activating the Camera:

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

public class ItemAction : MonoBehaviour
{
    public Camera viewCamera;

    private void Update()
    {

    }

    public void ViewCamera()
    {
        viewCamera.enabled = true;
    }
}

The part I'm using is the ViewCamera method.
But I messed it up.
But the idea is after turning on the Camera to make it feel like looking around the view outside.

How can I make the camera move first to one direction and then mirrored to the other direction ?

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

public class ItemAction : MonoBehaviour
{
    public Camera viewCamera;
    public float Speed;

    public void ViewCamera()
    {
        viewCamera.enabled = true;
        StartCoroutine(animate());
    }

    IEnumerator animate()
    {
        while (transform.localEulerAngles.y > -45)
        {
            transform.Rotate(0, -Time.deltaTime * Speed, 0);
            yield return null;
        }
        //and then possibly the same but mirrored to look in the other direction
        while (transform.localEulerAngles.y < 45)
        {
            transform.Rotate(0, Time.deltaTime * Speed, 0);
            yield return null;
        }
    }
}

The way it is now it's just keep rotating to the same direction nonstop.

sentences:
How to resolve collision when both of the intersecting bodies were moving? Suppose there are two quadrilaterals A and B.  A is stationary but B is moving. They collided. Now B is inside A.

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

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

sentences:
How do I draw a zoomable image in OpenGL? Up to now I have used glDrawPixels but since my image is a large geotiff one, I'm getting some horrible results for example:
this is the code used for zoom extent:

void COpenGLControl::ZoomFullExtent()
{
    GLint iViewport[4];
    glGetIntegerv(GL_VIEWPORT, iViewport);
    glPixelZoom((GLfloat) iViewport[2] / (GLfloat)width,
                (GLfloat) iViewport[3] / (GLfloat)height);
}

Since the image is a square one, it's not a good result.

This is the code used for zoom in:

void COpenGLControl::FixedZoomIn()
{
    glPixelZoom(2.0f, 2.0f);
}

but it does zoom in operation just one time and when I again click on the button the zoom in is not done I think it is because that when I call COpenGLControl::FixedZoomIn for an instance of the class COpenGLControl infact the openGL window is zoommed not the contents in it.

I have heard about texture mapping and how to zoom by changing z of the camera point.

How would I customize the class COpenGLControl for my purpose?

sentences:
Why does Farseer 2.x store temporaries as members and not on the stack? (.NET) UPDATE: This question refers to Farseer 2.x. The newer 3.x doesn't seem to do this.

I'm using Farseer Physics Engine quite extensively at the moment, and I've noticed that it seems to store a lot of temporary value types as members of the class, and not on the stack as one might expect.

Here is an example from the Body class:

private Vector2 _worldPositionTemp = Vector2.Zero;

private Matrix _bodyMatrixTemp = Matrix.Identity;
private Matrix _rotationMatrixTemp = Matrix.Identity;
private Matrix _translationMatrixTemp = Matrix.Identity;

public void GetBodyMatrix(out Matrix bodyMatrix)
{
    Matrix.CreateTranslation(position.X, position.Y, 0, out _translationMatrixTemp);
    Matrix.CreateRotationZ(rotation, out _rotationMatrixTemp);
    Matrix.Multiply(ref _rotationMatrixTemp, ref _translationMatrixTemp, out bodyMatrix);
}

public Vector2 GetWorldPosition(Vector2 localPosition)
{
    GetBodyMatrix(out _bodyMatrixTemp);
    Vector2.Transform(ref localPosition, ref _bodyMatrixTemp, out _worldPositionTemp);
    return _worldPositionTemp;
}

It looks like its a by-hand performance optimisation. But I don't see how this could possibly help performance? (If anything I think it would hurt by making objects much larger).

sentences:
Getting any type in Unity Inspector I am developing a SaveManager system for my games. Basicly what it should do is;

1) Gets the "ANY" user created Serializable class by Drag&Drop to inspector. (save data).

2) Writes that class to a file using either BinaryFormatter or XMLSerializer.

I want to be able to use it in my future games. So it should be save data class(type) independant (like serializers). I will use it like an asset, import the SaveManager, give serialized class as parameter, and let it do the rest. But as i said, it should be able to use any user created serialized class.

So the problem is, since that "serialized class" will be written by the user in the "game project" (not in the SaveManager project), and i don't have that "serialized" class type in my SaveManager project, i don't know how to make the SaveManager, reference the class from inspector.

So lets say i create this class in the game project (not in the SaveManager project)

[System.Serializable]
public class SaveData
{
    public string Name = "Name";
    public int Number = 5;
}

Now when i import the SaveManager project (asset) into my "game" project, i should be able to drag and drop the script to the SaveManager inspector and let it do the rest. Since BinaryFormatter works for every Serializable type, the name of the type is actually doesn't matter. I mean BinaryFormatter is type free as long as the type is serializable. I want to use that feature, and make the SaveManager type free too.

So in future if i want to use, say "MyNewSaveData" serialized class, "in an another game", i want to be able to drag and drop this to SaveManager inspector and let it do the rest.

Now the thing is, if i use

public object _SaveData;

in SaveManager script, unity inspector doesn't show it.

if i use

public Object _SaveData

it casts the user created type to an Object, and i lose the type i need.

I tried to use System.Type, but unity doesn't show it too.

Basicly what i want to do is, get "any" serialized class as reference. Like

public SerializedClass _SaveData;

or something like

public Script _SaveData;

That reference should accept "any" serialized class. Gets it's type, then casts it to that type.

When i use

public Object _SaveData

if i use _SaveData.GetType(), i get the type the "user created".
I have the type, in my hands, but i can't cast Object to that type. I don't know how to use that type for casting.

What ever i do, it either doesn't show up in inspector, or it casted to another type and i lose the data.

What should i do?

sentences:
How to add font assets to a Unity based Android app on runtime? I am working on an android app that contains a Unity scene. The unity scene has some TextMeshPro text fields where user can enter information. Users also have the option to select fonts for these text fields.

I want to support a lot of fonts. Right now I add all the font assets in Unity. But these font assets add up to increase the app size a lot.

I am trying to find out if there is a way to download these fonts at runtime as per the user's choice so that the initial app size is small? Is this possible?

I would appreciate any links, tutorials, or help. I've not been able to find any information regarding this so far. Thanks!

sentences: Flickering water effect I have downloaded completely different samples with water effects (in XNA) and I've noticed that they all exhibit a common problem: when the camera direction (only the direction, not the position)  moves, a noticable and annoying flicker occurs where the water meets terrain. I'm curios to find out more about this. Why does it happen? Does it have a name? And what can I do about it?

sentences:
How to get rid of an image upon collision detection in SDL? I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars he can collect and get points.

I have set up my point system so now when he hits a good star, he should get a point. However, when he hits a star, he actually gets lots of points, as long as he is touching the star, which I don't want. I think that what's happening is because the stars are moving and he rubs up against the stars; each pixel he moves counts as a new collision so he gets a point per collision. Ideally, he should only get one point per star.

So I have two problems: 1) I need to figure out how to make it so that he can only get one point when he hits a star. 2) Since he is supposed to be 'collecting' the stars, I want to make the star disappear when he collects it.

So it's similar to most of these types of games, whereby, the player collects something, it disappears and they get a point.

EDIT:

This is struct I've made:

typedef struct {
    int x, y, w, h, baseX, baseY, mode;
    float phase;
} Goodstar;

I've then referenced it in another struct like so:

Goodstar goodStars[GOOD_STARS];
SDL_Texture *goodStar;

[GOOD_STARS] is equal to 100.

And then here's my collision detection code:

// Check for collision with good stars
for (int i = 0; i < GOOD_STARS; i++) {
    if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
        if (!game->man.isDead) {
            game->man.points++;
        }
        break;
    }
}

So right now it only checks for a collision and then adds a point.

EDIT 2:

This is the code you suggested and it works:

for (int i = 0; i < GOOD_STARS; i++) {
    if (!game->goodStars[i].awarded) {
        if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
            if (!game->man.isDead) {
                game->man.points++;
                game->goodStars[i].awarded = 1;
            }
            break;
        }
    }
}

And this is my initialisation code:

  // Initialise stars
  for (int i = 0; i < GOOD_STARS; i++) {
    game->goodStars[i].baseX = 320 + random() % 38400;
    game->goodStars[i].baseY = random() % 480;
    game->goodStars[i].mode = random() % 2;
    game->goodStars[i].phase = 2 * 3.14 * (random() % 360) / 360.0f;
        game->goodStars[i].awarded = 0;
  }

sentences:
Continuous running vs timed tasks? I've started making a browser-based game, as a hobby, where users log in via a website and can manage a soccer team. I need to have some sort of process running to handle player development, running matches, age players, generally progressing time..

I've never done anything like this before and therefore I'm putting this out there to get some feedback from other people.

So, my idea was that I could have a continuously running application which can handle all the "off-line" processing. But, that got me thinking that another approach could be to have, f.ex. a "PlayerTrainingTask" running daily, a "RunMatchesTask", running on a fixture-based schedule, et.c.

Which approach is most appropriate? or is there another option I haven't thought of?

What are your thoughts?

sentences:
Weird white outline around model I'm working on a game in XNA 4 and I recently switched to a deferred shading implementation following this guide.  A strange white outline is showing up on my models now and I'm not sure whats causing this.  I thought maybe it was a lack of precision on the normal render target or the depth render target but increasing them to 64 bits (Rgba64) instead of 32 (Color) didn't help.  I also thought it might be some problem with the specular calculation so I tried setting the specular to 0 but that didn't help either.  Debugging the pixel in PIX shows the diffuse value is being calculated as nearly white for that pixel.  Any ideas?  I included a picture of the problem below, it's easier to see it at full size.

Pixel Shader:

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;

    float2 texCoord = 0.5f * (float2(input.ScreenPosition.x, -input.ScreenPosition.y) + 1) - halfPixel;

    float4 normalData = tex2D(normalSampler, texCoord);

    //Transform normal back into [-1, 1] range
    float3 normal = normalize(2.0f * normalData.xyz - 1.0f);

    float specularPower = normalData.a;
    float specularHardness = tex2D(colorSampler, texCoord).a * 255;
    float depthVal = tex2D(depthSampler, texCoord).r;

    //Compute screen-space position
    float4 position = float4(input.ScreenPosition.xy, depthVal, 1.0f);

    //Transform to world space
    position = mul(position, InvertViewProjection);
    position /= position.w;

    //Surface-to-light vector
    float3 lightVector = lightPosition - position;

    float3 projectedTexCoords = position - lightPosition;
    projectedTexCoords = mul(projectedTexCoords, float3x3(
                            float3(-1, 0, 0),
                            float3(0, 1, 0),
                            float3(0, 0, 1)));

    float distanceToLight = length(lightVector) / lightRadius;
    float shadow = ShadowContribution(projectedTexCoords, distanceToLight);

    float attenuation = saturate(1.0f - distanceToLight);

    lightVector = normalize(lightVector);

    //Compute diffuse light
    float normalDotLight = max(0, dot(normal, lightVector));
    float3 diffuseLight = normalDotLight * Color.rgb;

    float3 reflectionVector = normalize(reflect(-lightVector, normal));
    float3 directionToCamera = normalize(cameraPosition - position);
    float specularLight = specularPower * pow(saturate(dot(reflectionVector, directionToCamera)), specularHardness);

    return shadow * attenuation * lightIntensity * float4(diffuseLight.rgb, specularLight);
}

Edit: Sorry about the JPG, stackexchange's uploader did that on its own.  Roy T:  I did actually reference your XNA4 conversion of the tutorial for the parts that changed from XNA3.  Since I didn't make any big changes to the code I thought maybe this bug existed in the original but was just impossible to see with so many lights all moving around, so I removed all but one light and the bug showed up again (look near the lizard's elbow)

Here are the GBuffer contents for my scene:

Color Buffer:

Depth Buffer:

Normal Buffer:

Final Render:

Edit2:

I'm starting to suspect the problem is CombineFinal.fx when it samples the color map.  This is the computation for a properly colored pixel right next to a white pixel:

diffuseColor        : (0.435, 0.447, 0.412)
diffuseLight        : (1.000, 1.000, 0.902)
light               : (1.000, 1.000, 0.902, 0.000)
PixelShaderFunction : (0.435, 0.447, 0.371, 1.000)
specularLight       : 0.000

And this is the output from an improperly colored white pixel directly next to it:

diffuseColor        : (0.824, 0.792, 0.741)
diffuseLight        : (1.000, 1.000, 0.902)
light               : (1.000, 1.000, 0.902, 0.000)
PixelShaderFunction : (0.824, 0.792, 0.669, 1.000)
specularLight       : 0.000

The diffuseColor is the only difference, and this color is taken directly from the color map.  Perhaps there is a slight error in the computation of the texture coordinate to sample from?

Lighting Pass:

sentences:
Export "Lite" and "Full" versions with different package names for Google Play Console On the Google Play Console, you can't have two games with the same package name.
Is there a way to have two of the same game with different package names, exported from the same Unity project? For example, a "lite version" with ads and a "full version" without ads.

sentences:
Safe to advertise without a trademark? Alright, I'm currently thinking about registering my game with Steam's new Greenlight program. Only problem is I don't have a trademarked title yet and I read the government's registration process can take a little while. (and $$ I don't have at the moment) So naturally, this got me wondering if it is a sound idea to proceed without one.

So my question is are there any serious pitfalls I should worry about if I start advertising without a trademarked title? (Assuming it doesn't infringe upon anyone else's property of course)

sentences:
How change LOD in geometry? I'm looking for a simple algorithm for LOD, for changing geometry vertexes and decreasing frame time. I've created an octree, but now I want model or terrain vertex modify algorithm, not for increase (looking on tessellation later) but for decrease.

I want something like this:

Questions:

Can the same algorithm apply to both model and terrain correctly?
Do indexes need to be modified?
Must I use octree or simple check distance between camera and object for desired effect?
Is a new value of indexcount for the DrawIndexed function needed?

Code:

     //m_LOD == 10 in the beginning
     //m_RawVerts - array of 3d Vector filled with values from vertex buffer.

     void DecreaseLOD()
     {
         m_LOD--;
         if(m_LOD<1)m_LOD=1;
         RebuildGeometry();
     }

     void IncreaseLOD()
     {
         m_LOD++;
         if(m_LOD>10)m_LOD=10;
         RebuildGeometry();
     }

     void RebuildGeometry()
     {
         void* vertexRawData = new byte[m_VertexBufferSize];
         void* indexRawData = new DWORD[m_IndexCount];
         auto context = mp_D3D->mp_Context;

         D3D11_MAPPED_SUBRESOURCE data;
         ZeroMemory(&data,sizeof(D3D11_MAPPED_SUBRESOURCE));

         context->Map(mp_VertexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(vertexRawData,data.pData,m_VertexBufferSize);
         context->Unmap(mp_VertexBuffer->mp_buffer,0);

         context->Map(mp_IndexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(indexRawData,data.pData,m_IndexBufferSize);
         context->Unmap(mp_IndexBuffer->mp_buffer,0);

         DWORD* dwI = (DWORD*)indexRawData;

         int sz = (m_VertexStride/sizeof(float));//size of vertex element

         //algorithm must be here.
         std::vector<Vector3d> vertices;
         int i = 0;
         for(int j = 0; j < m_VertexCount; j++)
         {
             float x1 = (((float*)vertexRawData)[0+i]);
             float y1 = (((float*)vertexRawData)[1+i]);
             float z1 = (((float*)vertexRawData)[2+i]);
             Vector3d lv = Vector3d(x1,y1,z1);

             //my useless attempts
             if(j+m_LOD+1<m_RawVerts.size())
             {
                 float v1 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD]]);
                 float v2 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD+1]]);

                 if(v1>v2)
                     lv = m_RawVerts[dwI[j+1]];
                 else
                     if(v2<v1)
                         lv = m_RawVerts[dwI[j+2]];
             }

             (((float*)vertexRawData)[0+i]) = lv.x;
             (((float*)vertexRawData)[1+i]) = lv.y;
             (((float*)vertexRawData)[2+i]) = lv.z;

             i+=sz;//pass others vertex format values without change
         }

         for(int j = 0; j < m_IndexCount; j++)
         {
             //indices ?
         }

         //set vertexes to device
         UpdateVertexes(vertexRawData,mp_VertexBuffer->getSize());

         delete[] vertexRawData;
         delete[] indexRawData;
     }

sentences: Python interpreter as in-game console Say I have a game which has lots objects (NPCs, monsters, etc.), I want a console so I can change the variables of the objects (like changing HP for example), how could I embed python into my program, so that I can change these variables and classes with a few keystrokes in the console? An example of a command would be: /monster 1 1 HP 100 (monster is the object name, 1 1 is the coordinates, and HP 100 is the variable to change, and to what amount)

sentences:
How to recycle unity scroll list of game objects? In my game, I have a scrollrect which its content have a VerticalLayout component. When I fill that with so many count of GameObjects, the game will fall in problem!

I know that I have to recycle my objects, but I don't know how!

sentences:
Unity: I need to edit my prefab but I can't move anything inside it! I imported a character into Unity and turned him into a prefab. I couldn't get my custom "Look-At" script to work for the eyes, which are children of the prefab I imported. So I opened the prefab and discovered (to my HORROR) that I am unable to transform his eyes AT ALL, even in the prefab-view. It's like his body parts are made of stone, or something! I checked his eyes in the Blender scene and don't see any animation data attached to them. So how could this happen? How can I fix it?

The eyes ARE children of a bone called "root", which I don't think has any keyframes in any animation. Further, all my bones imported as empties.

sentences:
Simple (and fast) dices physics I'm programming a throw of 5 dices in Actionscript 3 + AwayPhysics (BulletPhysics port).

I had a lot of fun tweaking frictions, masses etc. and in the end I found best results with more physics ticks per frame. Currently I use 10 ticks per frame (1/60 s) and it's OK, though I see a difference in plus for 20 ticks.

Even though it's only 5 cubes (dices) in a box (or a floor with 3 walls really) I can't simulate 20 ticks in a frame and keep FPS at 60 on a medium-aged PC. That's why I decided to precompute frames for animation, finishing it in around 1700 ticks in 2 seconds. The flash player is freezed for these 2 seconds, and I'm afraid that this result will be more of a 5 seconds or even more, if I'll simulate multi-threading and compute frames in background of some other heavy processes and CPU drawing (dices is only a part of this game).

Because I want both players to see dices roll in same way, I can't compute physics when having free resources, and build a buffer for at least one throw of each type (where type is number of dices thrown). I'm afraid players will see a "preparing dices........." message too often and for too long.

I think the only solution to this problem is replacing PhysicsEngine with something simpler, or creating own physicsEngine. Do You have any formulas for cube-cube and cube-wall collision detection, and for calculating how their angular and linear velocities should change after a collision occurs?

Edit: I'm assuming the only way to solve my problem is to make a cube-cube and cube-wall collision engine, however maybe there's another solution for my problem.

As Arthur pointer out, there can be one animation - for me this is just a shortcut, I could as well show the final result without any dices rolling.
However, I thought about making 100 precomputed dice throws, though a user won't avoid repetition here as well. Sometimes a dice sits on it's edge (or corner) for a while, and that gives player some excitement (will it fall on 5 and give me a full house?), but with limited number of animations a player would already know how the animation will end.
Buffering solution would work, if players would see dices roll in different way (results would still be the same) - I'm considering this solution, however I'm still going to try to create a simple physics engine and see how it works.
less ticks is a solution I don't consider, because at as few ticks to be able to simulate physics in real-time, the dices behave not better than if I treated them as balls in my physics engine...

sentences:
Navigate multiple Units on a grid through a tight space with different directions I just started learning about pathfinding algorithms.
Assume we have this scenario:

Blue and Green can move only on those tiles. They can also talk to each other.
Blue wants to go through the tunnel and green wants to go too, however both need to pass each other somehow. In case of a "basic" A* pathfinding algorithm they will both get stuck in the tunnel.

To prevent this issue i had some Ideas:
- Blue can tell green that he should move back first (give blue priority) when they both step next to each other (problems arise when there are more than 2)
- A better algorithm, that calculates this like an automatic traffic regulator (one will wait till the other frees the path) --> seems complicated

Now I am wondering if there are more efficient methods, how its done in general, if you have better ideas, if you can point me to some algorithms or some papers that adress this issue.

sentences:
Outsourcing mobile app development, but royalty-based? Terribly sorry if this is in the wrong StackExchange site, but it looked closest to my question.

I have an idea or two floating around in my programmer's brain for mobile apps on Android or iOS. Thing is, I can't spend months programming it after my day job just to see someone else go to market first. In the same vein, I don't want to dump tens of thousands of dollars to pay someone to do it outright. I know that in other industries, you can often get paid by offering up the idea as intellectual property, allowing another company to do the work while you collect royalty checks for coming up with the idea in the first place, assuming the developing company went ahead with it and it became successful.

Does such a thing exist in the mobile application development world? If so, any recommendations for trustworthy companies? Let's assume that it actually IS a decent idea, is well vetted out and planned, and does not exist in the marketplace yet.

sentences:
Limits of FixedJoint in Unity I've built towers of cubes where each cube is connected to the one before with a FixedJoint. At 30 high they flop about as expected, but at a certain point (demonstrated at 100 high) they explode and do something crazy, moving around at light speed.
Video: https://www.loom.com/share/8807d99f157c45a1899138b469b4dec3?from_recorder=1
Is there a limit to the amount of force/torque a FixedJoint can simulate properly? The forces are set to break at infinity.

sentences:
How to update vertex buffer in DirectX 12 I would like to create cloth simulation. Which type of buffer should i use for vertices. I will need to update them on every frame. And how updates need to be done. I'm new to graphics programming, but still i'm mostly interesting in high level overview. If there is open-source project implementing it, reference to it would be of help.

For now i have only rigid body geometries. For this i create a resource with

    THROW_IF_FAILED(g_device->CreateCommittedResource(
        &CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
        D3D12_HEAP_FLAG_NONE,
        &CD3DX12_RESOURCE_DESC::Buffer(byteSize),
        D3D12_RESOURCE_STATE_COPY_DEST,
        nullptr,
        IID_PPV_ARGS(buffer_.GetAddressOf())));

Then i update it with initial data using another upload buffer to initialize first buffer. Lastly i transition first buffer into D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER state.

Well, i got some comments directing me toward DirectX11, but for my purposes i will better use DirectX12, and again, i'm pretty matured programmer and just need a highlevel overview of what need to be done.

For example,

  create default buffer with geometry, then create upload heap, and when
  needed create placed resource buffer to upload data into your default
  buffer.

But here a lot of questions arise. For now i use frame resources e.g. for transforms to update them on each frame and do not stall CPU. But if i will copy once a frame to the same default buffer will my it cause stalling? And should i use different queue for copying, and how then do resource state transitioning?

From what i understood for now, i need to implement this, but how to implement CopyResource functionality?

sentences:
Best strategy to track object hierarchy using groups and obj files I am making a 3D game in OpenGL from scratch. In this game I have a ship with stuff inside it. How can I attach the stuff to the ship in the CAD program and maintain that hierarchy in my own game?

For example say I have a fire extinguisher in my ship that mounts on the wall.  There are two approaches both with problems.

Solution 1: Save fire extinguisher and ship as separate obj files.

Problem: How can I place the fire extinguisher in the proper place inside my ship in my game?  With hundreds of objects manually placing them is completely infeasible. I want to arrange stuff in my CAD and load it into the game and be done.

Solution 2: Save fire extinguisher as its own group inside the ship obj file.

Problem: Now I can't reuse the fire extinguisher in other ships. The obj files for game assets will balloon out of control in size with new instances of reused sub-objects.

Is there some way I can specify the position of an external object? A 3d point in my ship obj file representing the origin of another obj model?

sentences:
How do I follow this glsl1.2 + lights + shadows tutorial? I am following this great tutorial but I have many questions.

Let's see if I understand the basic idea.

1. I must create the same number of FBOs that lights (maximum 8).
2. I must create the same number of depth textures (shadow maps) that FBOs.
3. For every FBO I must perform offscreen render (render to texture, drawing the scene from the point of view of each of the lights, maximum 8 times).

Is this correct or can I use just a texture with multiple FBOs, or fbo with various textures or how?

Assuming you use the idea above, how should the final render of the scene?

glUseProgram(programa);
  glUniformli(shadowM0,4);
  glActivateTexture(GL_TEXTURE4);
  glBindTexture(GL_TEXTURE_2D,depthT0);
  //Draw Escene?

  glUniformli(shadowM1,5);
  glActivateTexture(GL_TEXTURE5);
  glBindTexture(GL_TEXTURE_2D,depthT1);
  //Draw Escene?

  glUniformli(shadowM2,6);
  glActivateTexture(GL_TEXTURE6);
  glBindTexture(GL_TEXTURE_2D,depthT2);
  //Draw Escene?

  ...
glUseProgram(0);

Is this okay? I think not, because it uses a lot of resources and the scene would have to be drawn up to 7 times. (One per light source and shadow mapping).

Well but then how should the render scene with multiple light sources and shadows?

sentences:
Artillery Simulation I need some help on a simulation of an Artillery like this one

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

I cant figure out how to make the "tomato" to get to the selected spot.

Where can I get solutions for this kind of questions in the future? Physics programming books? I am using LibGDX (Java).

sentences:
Deferred shading - how to combine multiple lights? I'm starting out with GLSL and I've implemented simple deferred shading that outputs G-buffer with positions, normals and albedo.

I've also written a simple point light shader.

Now I draw a sphere for the point light and output goes into a lighting buffer.

The problem is, how do I combine the results of lighting buffer when drawing multiple lights?

E.g. when I'm drawing the second light to the lightbuffer using the point light shader, how do I add first light to the second light in the lighting buffer. I mean, you can't read from and write to the same output buffer?

sentences:
What kind of hardware would be required to render an Earth sized minecraft like map? I have been thinking about this problem. Is it possible with current technology to create a 1:1 replica of the earth in voxel based game? What's the best data structure to store this giant map? Which algorithm should be used to render this data structure in real-time?

These questions make these assumptions:

Each voxel has a resolution of 1 cubic meter.
For simplicity sake,
each voxel requires only 1 byte of metadata information. This information
will be used to store the identify the "type" of the voxel (earth,
water, rock, etc).
The earth volume is 1 * 10ˆ21 cubic meters.
By "current technology" I include anything that is commercially available, but not super computers.
Only the Earth topography and bathymetry will be used to generate the map. Human building, plants or caves are excluded. The underground blocks will be chosen based on geological studies e.g.:  if depth is greater than 3000km render a 'magma' voxel.
Just like in Minecraft, the map is not static, it can be modified in-game.
A 'infinite' draw distance is a big plus, what's the point of having the whole earth in a map if you can't fly up and watch the whole planet?

The first conclusion that I came when I thought about this problem is that storing the Earth data in a linear way is infeasible, assuming that each voxel occupies only 1 byte of memory this would still require 1 zettabyte to store the map. So some kind of compression is required.

I think that a voxel octree could compress the map, but I am not sure by how much. The entropy of this voxel map is probably very low, so I guess that a very high level of compression can be achieved.

Disclaimer

This is a theoretical question, I have no intentions of writing a voxel earth

EDIT

The ESA GOCE has already mapped the Earth geoid with a 1cm-2cm precision. I believe that this information could be used to generate a very precise heightmap of the Earth. This would exclude the need to use an algorithm to fill gaps in the Earth topography.

sentences:
Quaternion.slerps resets camera rotation to (0,0,0) when i go to play mode help! i am building a camera rotation script like in fps. Everything is setup and working except that camera rotation resets to zero at the start of game which i dont want.
This is the camera rotation i have set:

This is rotation of character my script is attached to:

And after hitting play it resets camera rotation to (0,0,0). i want it to remain how i have set it in inspector. i am using quaternion.slerp to rotate camera around to rotations on the basis of touch inputs. After reset to (0,0,0) everything works fine.please help, i have always had a hard time understanding quaternions.

this is the script:

    public class ScreenCharacterController : MonoBehaviour {

     private Camera mainCamera;
     private CharacterController character;
     private int leftFingerID = -1;
     private int rightFingerID = -1;
     private Vector2 leftFingerInput;
     private Vector2 rightFingerInput;
     private float xAxisRotation;
     private float yAxisRotation;
     [SerializeField] private float minXRotation;
     [SerializeField] private float maxXRotation;
     [SerializeField] private float minYRotation = -25f;
     [SerializeField] private float maxYRotation = 25f;
     [SerializeField] private float cameraRotationSpeed = 20f;

     void Start()
     {
         mainCamera = Camera.main;
     }

     void Update()
     {
        //for touch
         TouchInput();

        //for calculating rotation vaues
         CalculateAndClampRotation();

         RotateCamera();
     }

     void TouchInput()
     {
         foreach (Touch touch in Input.touches)
         {
             if (touch.phase == TouchPhase.Began)
             {
                 //Left Touch
                 if (touch.position.x < Screen.width / 2)
                 {
                     leftFingerID = touch.fingerId;

                 }
                 //Right touch
                 else
                 {
                     rightFingerID = touch.fingerId;

                 }
             }
             else if (touch.phase == TouchPhase.Moved)
             {
                 //Left Touch
                 if (touch.position.x < Screen.width / 2)
                 {
                     if (leftFingerID == touch.fingerId)
                     {

                     }

                 }
                 //Right touch
                 else
                 {
                     if (rightFingerID == touch.fingerId)
                     {
                         rightFingerInput = touch.deltaPosition * Time.smoothDeltaTime;

                     }

                 }
             }
             else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
             {
                 if (touch.fingerId == leftFingerID)
                 {
                     leftFingerID = -1;

                 }
                 else if (touch.fingerId == rightFingerID)
                 {
                     rightFingerID = -1;
                     rightFingerInput = new Vector2(0, 0);
                 }

             }
         }
     }

 void RotateCamera()
     {
         Quaternion currentRotation = mainCamera.transform.localRotation;
         Quaternion targetRotation = Quaternion.identity;

         targetRotation = Quaternion.Euler((mainCamera.transform.localRotation.x - yAxisRotation),
         -(mainCamera.transform.localRotation.y - xAxisRotation), 0f);

         mainCamera.transform.localRotation = Quaternion.Slerp(currentRotation, targetRotation, 0.5f);

     }

     void CalculateAndClampRotation()
     {
         xAxisRotation += rightFingerInput.x * cameraRotationSpeed;
         yAxisRotation += rightFingerInput.y * cameraRotationSpeed;
         xAxisRotation = Mathf.Clamp(xAxisRotation, minXRotation, maxXRotation);
         yAxisRotation = Mathf.Clamp(yAxisRotation, minYRotation, maxYRotation);
     }

 }

sentences: Can running unity of a system with nvidia graphics card speed up the simulation? I have a nvidia GTX 1080 graphics card in my computer, I don't know if unity by default makes use of GPU. Does having a GPU helps to speed up unity simulations.

sentences:
Creating a simple countdown timer in unity Hello's I was looking for a way to do a countdown timer in unity and stumbled across this solution :
public float timeRemaining = 10;

private void Update()
{
    if (timeRemaining > 0)
    {
        timeRemaining -= Time.deltaTime;
    }
    else
    {
        WinGame();
    }
}

Which at first seemed pretty elegant and easy to use, however, I was thinking about it, and wouldn't this be inconsistent for players with different FPS?
For example, if the player has 60 FPS vs 30 fps it would take longer for the player having 60 FPS to reach 0 on time remaining.

sentences:
Unity Debug - UnityGfxDeviceWorker (34): EXC_RESOURCE RESOURCE_TYPE_MEMORY Unity - How does one debug this Xcode error on an iOS device?
Debug - UnityGfxDeviceWorker (34): EXC_RESOURCE RESOURCE_TYPE_MEMORY

sentences:
How can I add 3D animation to my Pygame window? I've developed a quiz game using Pygame but now I'm being asked to implement a 3D animation element (a game show host) to the game.

I used Pygame as I was told it would be an easy enough language to learn and make something simple, however I see now that it seems very limited in terms of 3D animation.

I've seen OpenGL being used with Pygame and what I need is for my game to run exactly as it is, but with the 3D element (game show host) added on the corner of the window for example.

How can I use OpenGL in Pygame in order to do this?

sentences: Tools for non-programmers to add new tasks to games Since graphic designers/end users are not programmers, what are the technique to allow them to add new tasks or change application logic in a game? what are the end user tools? I want some popular examples.

sentences:
Can’t Load .fbx from blender to Monogame correctly I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is this one of the correct ways to convert it properly ?).

After watching this video https://www.youtube.com/watch?v=u7tLYMPC828 I saw that you have to convert the .fbx file that you create using blender, to a new .fbx file, using a tool called fbx converter 2013, and then use that file in the pipeline.exe tool, to produce the final .xnb file. Without doing that, I can't even see my model when drawn on the screen.

With the steps I described above, I managed to see the .xnb file on my screen but it was not exactly the original model I had made. For example:

As you can see the real model I got (after the convertion with the fbx converter 2013)  is much longer, whereas the one on the left (the one I draw in my game), is like packed in a small square.

If you are using blender, please let me know how do you import the .fbx to your Monogame project. (Or you can suggest to me another software you are using to make models and tell me your method of importing models to Monogame)

This is how I am drawing my model:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);

    Vector3 modelPosition = new Vector3(-25, 0, 0);
    float modelRotation = 0;
    float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in Brick.Meshes)
    {
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 50.0f);
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = Matrix.CreateRotationZ(modelRotation)*
                Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition,
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Edit: I also tried exporting to .X from blender and when i converted to .xnb, loaded the model and drew it, nothing shows up.

sentences:
Z rotation matrix inverting object I'm currently creating a 3d game where I need to rotate shapes. To do se, I created a rotation matrix for each axis, X, Y and Z. X and Y are giving me expected results, but not Z who kind of "inverts the shape". I need it to rotate like it would rotate a 2d shape.

Here is the Z matrix :

zRotation.matrix[0][0] = cosf(rotationAngles.z);
zRotation.matrix[1][0] = -sinf(rotationAngles.z);
zRotation.matrix[0][1] = sinf(rotationAngles.z);
zRotation.matrix[1][1] = cosf(rotationAngles.z);
zRotation.matrix[2][2] = 1;

Here is what it looks like : https://imgur.com/a/3YR4Nlc

PS : The game have an isometric perspective.

EDIT : Here is how I do matrix * vector

vec3 operator *(vec3 operand){
    //multiply vector by matrix

    vec3 result = vec3((operand.x * matrix[0][0]) + (operand.x * matrix[1][0]) + (operand.x * matrix[2][0]) + (operand.x * matrix[3][0]), (operand.y * matrix[0][1]) + (operand.y * matrix[1][1]) + (operand.y * matrix[2][1]) + (operand.y * matrix[3][1]), (operand.z * matrix[0][2]) + (operand.z * matrix[1][2]) + (operand.z * matrix[2][2]) + (operand.z * matrix[3][2]));
    return result;
}

(Fourth element is always 0)

sentences:
What do you need to know in C++ before starting to program with DirectX I was wondering what do you need to know in C++ before starting to program with DirectX?

I have only been programming in C++ (more for 2D games using SDL and learning the basics) for just over a year, I was wondering what kind of concepts and methods should someone be knowledgeable with or at least have seen before, before attempting to learn how to use Direct X?

sentences:
How would I go about using FXAA in XNA? This isn't so much a "give me teh codez" as it is a request for the "right" steps to go through.

I want to implement FXAA in XNA, but I'm a relative newb to the graphics side of game dev, so I'm not sure what the most efficient way to do this would be.

My first hunch is to render the scene into a texture, and then render that texture on a rectangle, with the FXAA code in a pixel shader.

However, I would actually be surprised if there was no more efficient way to do it.

sentences:
LibGDX: TextureRegion renders correctly, but .getTexture() doesn't I have a TextureRegion that I get from an atlas map (which in turn I get from the Asset Manager), eg

AssetManager am = myGame.getAssetManager();
TextureAtlas atlas = am.get("my.atlas", TextureAtlas.class);
TextureRegion object = atlas.findRegion("myobject");

Now when I draw the object with

batch.draw(object, ...);

the object is drawn correctly, but if I do

batch.draw(object.getTexture(), ...);

it is drawn as garbage. Is this expected? I thought it should work the same.

sentences:
How to do Chromatic Aberration on a transparent background? I have a problem with a chromatic aberration shader effect...

If I produce the effect on a white background I get exactly what I want:

But if I do the same effect on a transparent background I get this:

In my code I use the following shader to produce the chromatic aberration effect:

// Chromatic Aberration

float DisplacementX = 5;
float DisplacementY = 5;

sampler TextureSampler : register(s0);

float4 main(float4 position : SV_POSITION, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{

// Offset the main texture coordinates.
float2 texCoord2 = float2(texCoord.x + DisplacementX, texCoord.y + DisplacementY);

float2 texCoord3 = float2(texCoord.x - DisplacementX, texCoord.y - DisplacementY);

float4 color1 = tex2D(TextureSampler, texCoord);
float4 color2 = tex2D(TextureSampler, texCoord2);
float4 color3 = tex2D(TextureSampler, texCoord3);

float alpha = color1.a + color2.a + color3.a;

// Look up into the main texture.
return float4 (color1.r, color2.g, color3.b, alpha);

}

technique RGBSplit
{

pass Pass0
{

PixelShader = compile ps_2_0 main();

}
}

This works great when I set the whole screen to a render target and apply the effect but I want to be able to apply this effect only to the foreground so I can choose which sprites it effects and then draw the background behind the transparent space.

My thinking so far is that I could create a white layer of the foreground image and blend it with the chromatic layer to produce the correct effect like this:

return float4(1, 1, 1, alpha); // Produces white version of layer

But I've unsuccessfully managed to blend it and I always end up with the same result as the second image.

I know this is possible because Teleglitch uses the same effect on bullets etc without effecting the background.

Perhaps someone with better blending knowledge than myself can help point me in the right direction?

sentences:
Image drawing tools (that aren't Photoshop) that work in the sRGB colorspace I'm looking for a way to create sRGB raster images. Now, I could use Inkscape and just have it render to a raster format, but are there any image drawing tools other than Photoshop that work in sRGB?

Here's what I want to be able to do more specifically. Let's say the image is all one color. I want to be able to pick color 0x808080, which is in the sRGB colorspace. I want the file to write an image where every pixel is 0x808080. And then, when I read it, I can tell OpenGL that it's sRGB color data, so it will treat the 0x808080 color has being from the sRGB colorspace.

The important part is that, when I'm selecting colors in the tool, the colors I'm selecting are from the sRGB colorspace.

sentences:
Help Reading this Data in XML as a List (ContentReader) Edit:

So i'm going to rephrase the question a bit, seeing as now i think know how i'm going to read this data. Looking at this example as my guide:
http://forums.create.msdn.com/forums/p/53404/323877.aspx

This is pretty much what i'm currently doing, and to be clear and show you guys:
http://pastebin.com/GxqQcBDg, that's how i'm loading my data.

So looking at that guys example from his post, he has a similar layout, his "Enemies" can equal my element "Animated_Tiles" and then his "Items" could be equal to my "Tile" objects, at least if you compare my data to his they look extremely similar, and yes i did update the Data as Richard Marskell - Drackir suggested,
But i'm wondering if i can have "Type" definitions like the guy has in his example, to show what i mean:

  <Animated_Tiles Type="System.Collections.Generic.List[Namespace.Class]">

Can that be done? Or is it only the "Asset" element that can have the Type definition?
Currently this is what my new data layout looks like:
http://pastebin.com/i42166ZQ

But currently, it seems to start reading it but i get this error by the first "Tile" Element. So the only difference i see between his & my layouts are that he has the Asset containing the List definition whereas i have "Animated_Tiles". So i'm unsure can any element can have the "Type=Blah" definition?

sentences:
How do I make educational games engaging not boring? We make educational games for school students, age 7-18; we can't have any violence or blood in them.

I have scoured Google Play and YouTube for good examples of educational games.

So far I found this math game. The cannon fires at number-enemies, to score, the player should bring their values to exactly zero.
As levels advance, the bigger numbers occur - 10, 20, 30, etc.

Why is it hard to make educational games that are not boring? It seems violence is what attracts most young people nowadays!
One big exception could be puzzles.

sentences:
Determining whether an object is in field of view considering obstacles I'm thinking of stealth games where an object has a certain field of view that you want to avoid otherwise game over.

The field of view may be linear or circular or any arbitrary group of pixels/tiles.

If I don't consider obstacles (for example, if you're standing behind a wall, they can still see you), I can determine whether the player is within an object's field of view using simple geometric properties using the two object's positions and range. This can be done efficiently, though it kind of assumes the objects are points.

However, to make it realistic, you should be able to hide behind a wall or a tree without being seen.

How is this problem usually solved?
What are some articles that I can read to understand more about this problem?

sentences:
How to generate AABB, OBB & Sphere from polygon soup How can I generate AABB, OOBB and Sphere from a polygon soup, where the bounding volumes are defined as follows:

AABB should be specified by min(x,y,z) max(x,y,z)
OOBB should be specified by min(x,y,z) max(x,y,z) and a quaternion for rotation
Sphere is specified as position(x,y,z) and radius

sentences:
database design help for game / user levels / progress Sorry this got long and all prose-y. I'm creating my first truly gamified web app and could use some help thinking about how to structure the data.

The Set-up

Users need to accomplish tasks in each of several categories before they can move up a level. I've got my Users, Tasks, and Categories tables, and a UserTasks table which joins the three. ("User 3 has added Task 42 in Category 8. Now they've completed it.") That's all fine and working wonderfully.

The Challenge

I'm not sure of the best way to track the progress in the individual categories toward each level. The "business" rules are:

You have to achieve a certain number of points in each category to move up.
If you get the number of points needed in Cat 8, but still have other work to do to complete the level, any new Cat 8 points count toward your overall score, but don't "roll over" into the next level.
The number of Categories is small (five currently) and unlikely to change often, but by no means absolutely fixed.
The number of points needed to level-up will vary per level, probably by a formula, or perhaps a lookup table.

So the challenge is to track each user's progress toward the next level in each category. I've thought of a few potential approaches:

Possible Solutions

Add a column to the users table for each category and reset them all to zero each time a user levels-up.
Have a separate UserProgress table with a row for each category for each user and the number of points they have. (Basically a Many-to-Many version of #1.)
Add a userLevel column to the UserTasks table and use that to derive their progress with some kind of SUM statement.

Their current level will be a simple int in the User table.

Pros & Cons

(1) seems like by far the most straightforward, but it's also the least flexible. Perhaps I could use a naming convention based on the category ids to help overcome some of that. (With code like "select cats; for each cat, get the value from Users.progress_{cat.id}.") It's also the one where I lose the most data -- I won't know which points counted toward leveling up. I don't have a need in mind for that, so maybe I don't care about that.

(2) seems complicated: every time I add or subtract a user or a category, I have to maintain the other table. I foresee synchronization challenges.

(3) Is somewhere in between -- cleaner than #2, but less intuitive than #1. In order to find out where a user is, I'd have mildly complex SQL like:

SELECT categoryId, SUM(points) from UserTasks WHERE userId={user.id} & countsTowardLevel={user.level} groupBy categoryId

Hmm... that doesn't seem so bad. I think I'm talking myself into #3 here, but would love any input, advice or other ideas.

P.S. Sorry for the cross-post. I wrote this up on SO and then remembered that there was a game dev-focused one. Curious to see if I get different answers one place than the other....

sentences:
Ball bouncing infinitely and constantly Alright, so I've got hold of some simple physics mechanics, and am currently trying to implement bouncing. Based on the first answer of this question, I've developed the following algorithm:

    Vector2 velocity;

    float gravity;
    float elasticity;

    Hitbox dummy;

    // ---

    void bounce() {
        dummy.MoveY(velocity.Y);
        velocity.Y += gravity;

        if (dummy.ThereWasContact.South) velocity.Y *= -elasticity;
    }

Gravity can be any value, and Elasticity is always between 0.0f and 1.0f. Velocity.Y's initial value can also be anything.

Weight factors aside, which would determine a minimal rebound force for the object to be able to leave the ground again and (probably) aren't related to the problem, this is apparently fallacious.

What happens here is somewhat like this:

If I drop an object from a height of 128 units, for example, 0u marking ground height, with a gravity of 1u and elasticity of 0.9, the object would bounce once, reach a maximum height of ~126u from the rebound, and from then on keep alternating on maximum heights between this and ~122u.

This example is based on one of my own experiments, in which I drop an object from a height of 64 pixels and there is a floor at 192 pixels. The maximum height will keep going from ~66 pixels to ~70.

What am I missing? Does weight after all do more than I think? If I need to explain something better or details appear to be missing, let me know.

sentences: Material colours in unity not displaying correctly? Even though I've picked blue the color is displayed as something pinkish. All colors are like this

sentences:
How much to pay for artwork in an indie game? I am an indie developer and I need some detailed artwork. How much is reasonable to pay an artist for say 20 character designs? I know it depends on the artist's skills, etc, but I am wondering what to expect so that I can budget it.

Edit:

Let's say cartoon-ish art (Example - not necessarily in that level of detail but that kind of cartoony-art style). No 3-d modelling - The art will be used as still images in game and for promotional reasons. I'd provide a base sprite design for them to expand on and detail.

Also, some numbers would be nice - I like numbers. Even a range is helpful.

Like: expect to spend $x2 ~ $x1 for top-notch and $y2 ~ $y1 for decent quality.

I understand I can ask at some indie-help site but, if an artist says something like $1000 for 20 designs, I wouldn't have any idea if it's reasonable / good deal / bad idea etc.

sentences:
Merging tesselated terrain with manually modelled In my flighsim visual system I am rendering large scale terrain using fixed grid mesh which is tesselated and displaced using height map. But for some relative small area (usually airports) we have much more detailed models including terrain, runways and so on. And here is a problem how can I merge tesselated terrain with modelled one?

On the picture bellow grey is a tesselated terrain, and blue is modelled with 3dsmax.

sentences:
Unity Mirror can't reflect another mirror across from it I created a mirror in Unity using the FX/MirrorReflection and the script that comes with it.
http://wiki.unity3d.com/index.php/MirrorReflection4

One mirror at a time works perfectly fine, but as soon as I add another mirror in front of the other mirror it starts bugging out.

See image below for the result I'm getting.

Does anyone know how to fix this so that both mirrors can reflect off each other?

sentences:
Rendering performance for Flash games I was reading on SO about native flash rendering vs building a custom BitmapData frame buffer and some of the answers were a bit conflicting, so I was wondering:

Is it generally best practice to go the custom Bitmap buffer route or is it best to leave rendering to the flash engine?
If you're using vector animations (MovieClips) as opposed to sprites, does that change the answer to the above?
If so is it best practice to use sprite based animations?

(I'm targeting Flash 10 if that makes any difference)

sentences:
Using XNA to create an isometric tileset? In XNA, how can I take any given texture, then render it so that it fits completely into a 64x31 (or 32x15) isometric tile such that it tessellates perfectly? My goal is to give various textures to my game, then have it generate an isometric tileset from the given textures, thus requiring pixel-perfect accuracy.

I have tried to use an orthogonal projection, which has good (but imperfect) results, but always ends up making odd-width textures instead, such as 61x29; no amount of adjusting the camera position or target or orthagonal settings seems to correct this, textures always end up with 1, 3, or 5 pixels on the top or bottom of the tile:

How can I correct this behavior, or is there a better way I can create multiple isometric tiles easily?

Edit: Before anyone asks, I'm not trying to clip or mask anything when I render it. I'm trying to preserve as much of the texture as possible and push it cleanly into a specific space.

sentences:
Should I use tiles in a snake game? I'm building a simple snake game, which is my first game ever. I'm using LibGDX, which is Java-based.

I've looked at the Tiled Map Editor, but I don't know if it is necessary in a simple game like snake. Is it?

I don't know how to make grid however, and I think that the map editor could make a grid easier than by code? I don't know.

sentences:
Game server for an android/iOS turn-based board-game I am currently programming an iPhone game and I would like to create an online multiplayer mode. In the future, this app will be port to Android devices, so I was wondering how to create the game-server?

First at all, which language should I choose? How to make a server able to communicate both with programs written in objective-c and Java?

Then, how to effectively do it? Is it good if I open a socket by client (there'll be 2)? What kind of information should I send to the server? to the clients?

sentences:
Unity order issue with TilemapRenderer.Render I'm using unity, with 2D Tilemaps (I'm doing something like an RPG)

I want to have a Tile which should be rendered with a random sprite.

When I use a tile like a tree that is bigger than the tile size and RandomTile, the draw order seems to get confused. Even if the sort order on the Tilemap Renderer is set appropriately, some of the tiles are drawing on top of the other tiles with no consistent pattern.

After stepping through with the Frame Debugger, it looks like all tiles with the same sprite are drawn at the same Draw Dynamic event under TilemapRenderer.Render.

I'm using the following script:

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

#if UNITY_EDITOR
using UnityEditor;
#endif

using UnityEngine;

namespace UnityEngine.Tilemaps
{
    [Serializable]
    public class RandomTile : Tile
    {
        [SerializeField]
        public Sprite[] m_Sprites;

        public override void GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData)
        {
            base.GetTileData(location, tileMap, ref tileData);
            if ((m_Sprites != null) && (m_Sprites.Length > 0))
            {
                long hash = location.x;
                hash = (hash + 0xabcd1234) + (hash << 15);
                hash = (hash + 0x0987efab) ^ (hash >> 11);
                hash ^= location.y;
                hash = (hash + 0x46ac12fd) + (hash << 7);
                hash = (hash + 0xbe9730af) ^ (hash << 11);
                Random.InitState((int)hash);
                tileData.sprite = m_Sprites[(int) (m_Sprites.Length * Random.value)];
            }
        }

#if UNITY_EDITOR
        [MenuItem("Assets/Create/Random Tile")]
        public static void CreateRandomTile()
        {
            string path = EditorUtility.SaveFilePanelInProject("Save Random Tile", "New Random Tile", "asset", "Save Random Tile", "Assets");

            if (path == "")
                return;

            AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<RandomTile>(), path);
        }
#endif
    }

#if UNITY_EDITOR
    [CustomEditor(typeof(RandomTile))]
    public class RandomTileEditor : Editor
    {
        private RandomTile tile { get { return (target as RandomTile); } }

        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            int count = EditorGUILayout.DelayedIntField("Number of Sprites", tile.m_Sprites != null ? tile.m_Sprites.Length : 0);
            if (count < 0)
                count = 0;
            if (tile.m_Sprites == null || tile.m_Sprites.Length != count)
            {
                Array.Resize<Sprite>(ref tile.m_Sprites, count);
            }

            if (count == 0)
                return;

            EditorGUILayout.LabelField("Place random sprites.");
            EditorGUILayout.Space();

            for (int i = 0; i < count; i++)
            {
                tile.m_Sprites[i] = (Sprite) EditorGUILayout.ObjectField("Sprite " + (i+1), tile.m_Sprites[i], typeof(Sprite), false, null);
            }
            if (EditorGUI.EndChangeCheck())
                EditorUtility.SetDirty(tile);
        }
    }
#endif
}

Is there any way to fix it?

sentences:
How can I get post-processing effects with pygame? I'd like to be able to make the screen like blurry and wavy, like when a player enters a portal in Minecraft.

How would I make this with pygame?

sentences:
What does Steam require from a Greenlight submission? I'm an indie developer getting ready to submit my game to Steam Greenlight, but have hit a road block. I don't know what to submit.

I've been searching and I haven't found anything detailing whether I should submit the game's files and let Steam do the rest or an installer to install the resource files and the executable in a certain spot?

Do I need to make any Steam-specific optimizations/additions to my game before it can be submitted?

sentences:
SDL2 - Ignoring repeated key input until key is released I'm currently using SDL_GetKeyboardState to capture key states once per frame. This works great for input that I want to handle for as long as a key is pressed (i.e character movement) but creates a real problem when I want to respond to a key press only once while the key is held down. Currently, even a rapid key press+release occurs over 2-3 frames, meaning the input is handled that many times instead of just once.

In short, is there a simple way to handle input once when a key is pressed, and then ignore that key until it's released and pressed again?

Just to mention, I've already looked at using event.key.repeat to see if a key has been repeated, but this only seems to work when the key has been pressed for a certain period of time (in my case 10+ frames)

Thanks in advance

sentences:
How do I remove the background from pixel art sprites in Gimp? I drew a pixel art tree using GIMP. My problem is, how can I cut out the white background, because if I want to build a tile map with it, in my case with tiled, it always has the white background with it.

I know you can cut it manually, but I want to know whether there is an easier way.

sentences:
OpenGL - have object follow mouse I want to have an object follow around my mouse on the screen in OpenGL. (I am also using GLEW, GLFW, and GLM). The best idea I've come up with is:

Get the coordinates within the window with glfwGetCursorPos.

The window was created with

window = glfwCreateWindow( 1024, 768, "Test", NULL, NULL);

and the code to get coordinates is

double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos);

Next, I use GLM unproject, to get the coordinates in "object space"

glm::vec4 viewport = glm::vec4(0.0f, 0.0f, 1024.0f, 768.0f);
glm::vec3 pos = glm::vec3(xpos, ypos, 0.0f);
glm::vec3 un = glm::unProject(pos, View*Model, Projection, viewport);

There are two potential problems I can already see. The viewport is fine, as the initial x,y, coordinates of the lower left are indeed 0,0, and it's indeed a 1024*768 window. However, the position vector I create doesn't seem right. The Z coordinate should probably not be zero. However, glfwGetCursorPos returns 2D coordinates, and I don't know how to go from there to the 3D window coordinates, especially since I am not sure what the 3rd dimension of the window coordinates even means (since computer screens are 2D). Then, I am not sure if I am using unproject correctly. Assume the View, Model, Projection matrices are all OK. If I passed in the correct position vector in Window coordinates, does the unproject call give me the coordinates in Object coordinates? I think it does, but the documentation is not clear.

Finally, to each vertex of the object I want to follow the mouse around, I just increment the x coordinate by un[0], the y coordinate by -un[1], and the z coordinate by un[2]. However, since my position vector that is being unprojected is likely wrong, this is not giving good results; the object does move as my mouse moves, but it is offset quite a bit (i.e. moving the mouse a lot doesn't move the object that much, and the z coordinate is very large). I actually found that the z coordinate un[2] is always the same value no matter where my mouse is, probably because the position vector I pass into unproject always has a value of 0.0 for z.

Edit: The (incorrectly) unprojected x-values range from about -0.552 to 0.552, and the y-values from about -0.411 to 0.411.

sentences:
Why do I get this error with FB.LogInWithPublishPermissions? I don't know what's wrong. I know that FB.Login is already deprecated. I don't know what syntax to use.

public class FBholder : MonoBehaviour {
    void Awake(){
        FB.Init (SetInit, OnHideUnity);
    }

    private void SetInit()
    {
        Debug.Log ("FB Init Done");

        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in");
        } else {
            FBlogin ();
        }
    }

    private void OnHideUnity(bool isGameShown)
    {
        if (!isGameShown) {
            Time.timeScale = 0;
        } else {
            Time.timeScale = 1;
        }
    }

    void FBlogin()
    {
        FB.LogInWithPublishPermissions ("user_about_me, user_birthday", AuthCallback);
    }

    void AuthCallback(ILoginResult result)
    {
        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in worked");
        } else {
            Debug.Log ("FB Logged in failed");
        }
    }
}

and I'm getting this error

  Assets/FBholder.cs(40,6): error CS1502: The best overloaded method match for `Facebook.Unity.FB.LogInWithPublishPermissions(System.Collections.Generic.IEnumerable, Facebook.Unity.FacebookDelegate)' has some invalid arguments

and this

  Assets/FBholder.cs(40,35): error CS1503: Argument #1' cannot convertstring' expression to type `System.Collections.Generic.IEnumerable'

sentences:
My GML object doesn't want to inherit variables here's the error that I can't seem to get rid of.

FATAL ERROR in
action number 1
of  Step Event0
for object side2_obj3:
Variable side2_obj3.sidePick2(100004, -2147483648) not set before reading it.
at gml_Object_side2_obj3_StepNormalEvent_1 (line 1) - if (sidePick2 == 1)

this object is inheriting from an object that holds the variables sidePick1 and sidePick2. I stripped the level down to just the object to see if this was being caused by a code collision and the issue seems to be persisting.
EDIT
I gave tried calling the following function
Event_inherited ()

And it didn't work

sentences:
How can I rotate a camera on the X and lookat target and once looking at the target to stop slowly the rotation? This is a screenshot showing the camera position.
I want it to rotate slowly smooth to the left and once looking at the soldier to stop rotating.

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;

    // Use this for initialization
    void Start ()
    {

    }

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

    }
}

The script is attached to a empty gameobject.
What I want to do is once the camera stopped rotating and looking at the soldier to make the soldier start moving to the right and camera should follow the soldier rotating and keep follow the soldier moving.

The main idea is to create a cut scene. The camera is position at this point just to display the cut scene.

To make the first rotation to the target I tried this:

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

But the camera is not rotating at all.

This is screenshot of the Hierarchy and Inspector:

The script is attached to GameObject: SoldierNaviFight
The camera that I want to move is the child of SoldierNaviFight: SoldierNaviFightCamera

UPDATE:

This will rotate the camera but it's rotating it to the right instead to the left to the soldier. Not sure why:

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        fightCam.transform.rotation = Quaternion.RotateTowards(fightCam.transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

sentences:
How can I mod Crusader Kings 2 to prevent vassals from declaring Holy Wars? I would like to have a playthrough where my vassals cannot declare wars.

I have set "vassal_wars_law_2" to all my subordinate kingdoms, and yet, this regularly happens:

I think that to prevent this I have to modify something in the

# Regular Holy War CB
religious = {
    name = CB_NAME_RELIGIOUS
    war_name = WAR_NAME_RELIGIOUS

declaration in the 00_cb_types.txt file.

Unfortunately I am quickly out of my depth and I don't know exactly what to change to disable that Casus Belli type for everyone in my empire except me, the emperor.

Can someone please help me in understanding the necessary steps?

sentences:
How to constrain axis-angle rotation? I have a problem where I'm performing an axis-angle rotation and am trying to constrain my rotations.  Specifically I have a skeleton (model/mesh with rig, transforms are hierarchy parented to pelvis which move the triangles of the mesh) and I am constraining the motions to prevent bad joint rotations (e.g. knees bending sideways or backwards).  The rotations in this case can pretty much be constrained by saying "do not rotate about X/Y/Z."

I'm using the Unity3D RotateAround function which rotates about a specified axis at a point by an arbitrary angle.  Given control over this point, axis, and angle how can I constrain this rotation to prevent "bad" rotations?

sentences:
Making knockback in c++ I want to implement a "knockback" in my 2D game, but I have no idea how to do it. I've found some tutorials on google but nothing help. (My knowledge about math is a little limited when we're talking about Cartesian plane)

Well let's just figure out, I have the player and the monster on my map (2 vectors) and when I touch the monster, BOOOM, I get "knockbacked" at the OPPOSITE direction (not left, right, top or bottom) that I touch him.

I have the following code on my project:

CollisionManager.cpp

CollisionManager::CollisionManager()
{
}

CollisionManager::~CollisionManager()
{
}

bool CollisionManager::checkCollisionWithWall(SDL_Rect box, std::vector<Tile*> tiles)
{
    return touchesWall(box, tiles);
}

void CollisionManager::checkCollisionEnemy(Player * player, GameObject * enemy)
{
    if (enemy->type() == std::string("Enemy"))
    {
        return;
    }
    if (SDL_HasIntersection(&player->getCollisionBox(), &enemy->getCollisionBox()))
    {
        player->collision(enemy);
    }
}

The player's collision function (almost nothing here):

void Player::collision(GameObject* collisionObject)
{
    isKnockbacking = true;
    hp -= 2;

}

Ahh and my moving function is inherited from my Entity class:

void Entity::checkTileCollision(std::vector<Tile*> tiles)
{
    if (isKnockbacking == false) {
        //Move the dot left or right
        v2DPosition.m_x += v2DVelocity.m_x;
        collisionBox.x = v2DPosition.m_x;

        //If the dot collided or went too far to the left or right
        if ((v2DPosition.m_x < 0) ||
        (v2DPosition.m_x + 18 > Game::Instance()->getScreenWidth()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_x -= v2DVelocity.m_x;
            collisionBox.x = v2DPosition.m_x;
        }

        //Move the dot up or down
        v2DPosition.m_y += v2DVelocity.m_y;
        collisionBox.y = v2DPosition.m_y;

        //If the dot collided or went too far up or down
        if ((v2DPosition.m_y < 0) ||
        (v2DPosition.m_y + 18 > Game::Instance()->getScreenHeight()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_y -= v2DVelocity.m_y;
            collisionBox.y = v2DPosition.m_y;
        }
    }
}

I've followed LazyFoo, SDL Game Development book and some other tutorials on YouTube to make it.

If I need to be more specific, just tell me.

sentences:
How can I boost cache performance when storing objects in a scene with managed languages? So, for reasons that I won't go into (has to do with my team more so than a good objective reason, unfortunately), I'm building a soft game engine in C# on top of SharpDX. C++ wasn't an option. I can't store objects contiguously in C# when it comes to reference types like classes, so I'm thinking about taking a data-oriented-design approach to storing objects in my scene. Thus, my scene looks a bit like this right now (all of the fields are structs because I can store them by value type, and thus contiguously):

public delegate void UpdateMethod (ref ModelData md, ref Transform t, ...)

class Scene
{
    ModelData[] models;
    Transform[] transforms;
    //...some other fields here
    UpdateMethod[] updateMethods; //delegate array

    void UpdateAll()
    {
         for (int i = 0; i < NUM_GAME_OBJECTS; i++)
        {
            if (updateMethods[i]!= null)
            {
                updateMethods[i](ref models[i], ref transforms[i], ...);
            }
        }
    }
}

The idea being that I can now store the objects contiguously as opposed to just an array of contiguous references to the data if I made each component a class.

Is this even a viable technique, or am I abusing the DOD paradigm? I'm storing all of my objects like this, not just my dynamic ones. Perhaps I could split it up into two sets of arrays for dynamic and non-dynamic, so I'm not tempting branch-predictor slow-downs on the if statement for UpdateAll()?

Will an approach like this create more issues than it attempts to solve? I will note that, while updating occurs here, I outsource the actual carrying out of the component functionality to other systems. For example, an input subsystem determines keys pressed, so an object could check in its unique update method denoted by the delegate; the update doesn't do everything, just behavior specific to that bundle of game object data.

This seems analogous to operating over columns in a row-major language, in that I'm killing performance gain of data locality; am I correct in concluding it would it be beneficial to wrap all of these fields into some GameObjectData wrapper struct, and just store those in an array?

sentences:
applyForce as long as display is pressed In my project I have my main character body. I want it to move down on the y-axis as long as the screen is pressed. I tried it with

public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        jetski.applyForce(new Vector2(0,-1000), jetski.getWorldCenter(), true);
        return true;
    }

but that does it only once.

sentences:
How can a game handle all characters at once? This question is just to gain knowledge about how a game can handle so many characters at once. I am new to gaming so I beg your pardon in advance.

Example

I am creating a tower defense game in which there are 15 tower slots where towers are built and each tower ejects projectile at a certain rate; lets say that every second, 2 projectiles are created by each of the towers and there are enemies marching on the battlefield, lets say 70 (each with 10 types of attributes like HP, mana, etc., which will change as they move around the battlefield).

Summary

Tower Count = 15
Projectiles Created By Each Tower Per Second = 2
Total Number of Projectiles Created Per Second = 30
Units in Battlefield Count = 70

Now, does the game handle those 30 projectiles and 70 units by handling them on 100 different threads (which is too much for a PC) or 1 thread that moves all of them, reduces their value, etc. (which will be kind of slow, I think)?

I do not have a clue about this so can anyone guide me on how this will work out?

sentences:
Why is my player not giving a knock back when it stays at the right side of the enemy? So, I have this problem I am facing, for some reason my player does not get a knockback when it stays at the right side of the enemy but when it stays at the left side it gives a knockback. What's the problem?

PLAYER MOVEMENT

void Movement()
    {

        //THIS IS FOR WALKING
        if (isControlesEnabled)
        {
            moveInput = Input.GetAxisRaw("Horizontal") * runSpeed;
            myBody.velocity = new Vector2(moveInput, myBody.velocity.y);
        }

PLAYER KNOCKBACK

private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Enemy"))
        {
            health -= 0;

            if (health <= 0)
            {
                gameObject.SetActive(false);
            }
            else
            {
                ContactPoint2D contactPoint = collision.GetContact(0);
                Vector2 playerPosition = transform.position;
                Vector2 dir = contactPoint.point - playerPosition;

                dir = -dir.normalized;

                myBody.velocity = new Vector2(0, 0);
                myBody.inertia = 0;

                isControlesEnabled = false;
                Invoke("EnablePlayerControles", controlesDisablePeriod);

                myBody.AddForce(dir * knockBackForce, knockBackForceMode);
            }
        }
    }

    private void EnablePlayerControles()
    {
       isControlesEnabled = true;
    }

sentences:
Remove previous scenes from memory in Unity 3d I'm making a game in unity3d which I optimized as much as I can.

I've made different levels in each scene.

After a few scenes the game starts to lag on mobile devices. And works smoothly if application is restarted and game is continued from last scene .

How can I clear previously loaded scene in Unity3d or overcome the problem I mentioned above ?

sentences:
Background color gradient with SDL I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window will be, using an image is no option).

Please note: I need to achieve this using only the C standard library and the SDL, no other library and no C++.

sentences:
What can I use to generate 2d vector graphics as a list of coordinates? I am working on a game that uses simple 2d vector graphics. I want a tool that will let me visually draw things like arbitrary polygons by placing points.

A perfect tool would present a grid that I could scale larger or smaller (ie: the window is 10 units across or the window is 20 units across). It would let me draw a polygon on this grid, and will tell me, simply, the coordinates of each point.

It would be great if this tool could then export a file format that was something like

0, 5
3, -2
0, 0
-3, -2

For bonus points, it would be great to be able to assign other attributes to each point. In the end, this will get passed to OpenGL, so things like color and opacity could possibly be used.

sentences:
Authoritative Server Movement and Collision I am attempting to write a proof of concept in preparation to do my first networked game. I have decided to do an authoritative server with client side prediction.

I am trying to implement my architecture like this diagram from an excellent article on the subject

In the article, the data that is synchronized is the player's position. This works great for turn based games, but what about real time games?

In my game, each entity has a position and a velocity vector. It is the server's job to detect collisions. I have attempted to send the server velocity changes, but I am having an issue where the server's position and the client's position begins to diverge because their clocks are not perfectly synchronized.

So my question is, is it standard practice to send positions as the synchronized state between a client and server instead of a velocity vector? Will changing to synchronizing positions instead of velocities open my game up to cheating? Is there a better way to synchronize the players' states with the server?

Also, if I use positions, doesn't that mean that the other players are going to be seen in a past state? Will that mean that the server might send a player killed message before the collision is visible to the player in the present?

sentences:
How can I rotate pixel art sprites without the aesthetics getting ruined? I'm right now in front of a huge "Game Design" question.
I'm making a pixel-art-ish game and using bilinear interpolation could solve lots of animation-issues. On the other hand, its not a "pixel-game" anymore.

If I use Bilinear Interpolation the animation works but it looks "hybrid-ish" and the artstyle gets lost. Either I mess up my animations or I mess up the artstyle. I cant have both it seems.

Is there any other way to solve this?

sentences:
Angle object only in the X axis I'm trying to code a turret to angle towards a target, where I have one part of the turret only rotating on the left/right, and I want to animate another part to only angle up/down. I've got the left/right (RotateTowardsTarget) working, but I can't get the up/down (AngleTowardsTarget) to work, it seems to also rotate the object as well as angle it.

turretXRotation is a child of turretYRotation. These objects form the top of a gun turret, so the base will rotate, and the gun barrel will angle towards the target

/// <summary>
/// Orient the turret weapon towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void OrientWeaponsTowards(Vector3 lookPosition)
{
    RotateTowardsTarget(lookPosition);
    AngleTowardsTarget(lookPosition);
}

/// <summary>
/// Rotate towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void RotateTowardsTarget(Vector3 lookPosition)
{
    // Determine which direction to rotate towards
    Vector3 targetDirection = lookPosition - transform.position;

    // The step size is equal to speed times frame time.
    float singleStep = weaponRotationSpeed * Time.deltaTime;

    // Rotate the forward vector towards the target direction by one step
    Vector3 newDirection = Vector3.RotateTowards(
        turretYRotation.transform.forward,
        targetDirection,
        singleStep,
        0.0f
    );

    // Draw a ray pointing at our target in
    //Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);

    newDirection.y = 0;
    // Calculate a rotation a step closer to the target and applies rotation to this object
    turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);
}

/// <summary>
/// Angle towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void AngleTowardsTarget(Vector3 lookPosition)
{
    // Determine which direction to rotate towards
    Vector3 targetDirection = lookPosition - turretXRotation.transform.position;

    // The step size is equal to speed times frame time.
    float singleStep = weaponRotationSpeed * Time.deltaTime;

    // Rotate the forward vector towards the target direction by one step
    Vector3 newDirection = Vector3.RotateTowards(
        turretXRotation.transform.forward,
        targetDirection,
        singleStep,
        0.0f
    );

    // Draw a ray pointing at our target in
    //Debug.DrawRay(turretXRotation.transform.position, newDirection, Color.red, 3);

    // Calculate a rotation a step closer to the target and applies rotation to this object
    turretXRotation.transform.rotation = Quaternion.LookRotation(newDirection);
}

Does anyone know how I can just make the `turretXRotation` only change it's X value to aim towards the target? I've tried similar stuff to the rotating, by zeroing out some of the x/y/z coords, but I can't seem to crack it.

sentences: Clipping Effect in Toon Boom Harmony 15.0 I want to do similar effect like this tutorial Masking Effect. The tutorial using Toon Boom Studio 8, I'm using Toon Boom Harmony 15 and can't seem to find the Cliiping Effect they use in tutorial. Not even from Node View. Any advice to do the same effect ??

sentences:
How to detect and prevent abuse (botting) of online game API? I have been ocassionally working on a game idea in my free time. The gameplay and content renders it to be implemented as a online multiplayer game built with well established web technologies. You should know that it falls into the strategy and simulation genre. That means: No running around with characters or similar but only atomic actions (regarding client-server communication) like "build thing A on location X".

At one point I realized there is a huge problem: having a browser based front end relying on a REST API back end makes it a more than excellent target for bots. While automation is desireable for business it is poison to a game which is about fun. I experienced it first hand in a browser game in the past were the most successful players were bots which subdued everybody.

From my current point of view I do not see any possibility to protect against bots when building a multiplayer online game based on  a REST API. Exception: Making it open source so everybody can host his own instance for private groups or even just oneself (to not get annoyed by jerks with bots).

Is there any way to differenciate between an honest player who just set an alarm for the next possible action and a bot automatically taking every chance on appearance of it? Besides such show stoppers like captchas. If not, I would think about another technology stack which makes it at least much harder to mess with client-server communication (proprietary encrypted binary protocol in a native code client).

Edit: Thank you, your answers are inspiring but also made me realize that specific countermeasures cannot be made by going further into details of the game. However, that would be too much for a question on Stack Exchange. So I just want to point out the most important points:

Players are exploring, developing and managing whenever they want to. Their businesses still run fine when they are offline (it is a peaceful game, no weapons involved). Only expansion and progress need the players action. Those actions are limited by:
time is one of the key resources (like in EVE Online skill training). All processes in game require it. There is no point in being online 24/7. The average player should be successful already with spending not more than an hour every day in one or two sessions (roughly, the concept is still in development).

sentences:
Trouble With Quaternions and orbital camera: UPDATED:
I have been trying to implement a Orbital Camera of sorts in a engine I am currently doing in Unity3D, the issue being I can't seem to do the correct rotation no matter what.

This is what it is needed:

Rotate on Y and X axis via the mouse, but the Y and X axis are not Vector.up or Vector.right
they are given by the current Slope of  the Target I am orbiting around.

I don't get how I can make it idependent of the character rotation, but at the same time dependent

This sorta works, but some loops have issues,  check the video below for a taste of whats wrong

var forward = Vector3.forward; //Vector3.Cross(ViewTarget.transform.up, transform.right);
        //Apply the rotation
        var rot = Quaternion.AngleAxis(CurrentHorizontalLook, ViewTarget.transform.up);
        var rot2 = Quaternion.AngleAxis(CurrentVerticalLook, transform.right) ;
        Debug.DrawRay(ViewTarget.transform.position, Vector3.right * 5, Color.yellow, 0, false);
        Debug.DrawRay(ViewTarget.transform.position, ViewTarget.transform.up * 5, Color.blue, 0, false);
        var offset = forward * 5;
        transform.rotation =  rot * rot2;
        transform.position = ViewTarget.transform.position + EyeHeight + transform.rotation*-offset;
        transform.LookAt(ViewTarget.transform.position, ViewTarget.transform.up);

EDIT : Maybe this image will help.

Black is the Up Vector, Red is the rotation on X Axis, Green is rotation on Y Axis.
The trick here is it being idependent of the right and forward of the Target object , only the Up vector used to align the camera.

Edit: I have "something" that is somewhat related to what I want, but still missing one thing.

I got the camera to rotate correctly on the target Y axis, but it doesn't align to the ground plane at all.

Convention :
Y = UP
Z =  Forward
X = Right

var rot = Quaternion.AngleAxis(CurrentHorizontalLook, ViewTarget.transform.up);
        transform.rotation = rot ;
        var rot2 = Quaternion.AngleAxis(CurrentVerticalLook, transform.right) ;

  transform.rotation =  rot * rot2;

    var offset = forward * 5;

This is what I have , the issue now being that if the character is on a 90 degree wall the camera should be moving around the character on the same plane as the wall, but in my case it looks in a top down manner. If instead of WorldForward I used TargetForward it moves in the correct plane, but then when the character changes direction  the camera shifts too.

I think a better explanation of what I want is this : I want the camera to rotate on the X,Z Plane of the character, and I want to be able to tilt it up or down in the Y,Z Plane.
If you check the video I posted when Sonic goes in loop I want the camera to do sorta the same thing.

Youtube Showing current Camera issue

sentences:
Why does my simple OpenGL shadow map fail? I want to render a simple shadow map for grass, where closer looks brighter and further looks darker, from the view of the light point. I can't get it to work.

Here is the relevant code:

//setting up buffers
gl.glGenFramebuffers(1, framebuff);
gl.glBindFramebuffer(GL4.GL_FRAMEBUFFER, framebuff.get(0));

gl.glGenTextures(2, textureBuff);
gl.glBindTexture(GL4.GL_TEXTURE_2D, textureBuff.get(0));
gl.glTexStorage2D(GL4.GL_TEXTURE_2D, 1, GL4.GL_R32F, displayWidth, displayHeight);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MAG_FILTER, GL4.GL_LINEAR);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MIN_FILTER, GL4.GL_LINEAR_MIPMAP_LINEAR);
gl.glFramebufferTexture(GL4.GL_FRAMEBUFFER, GL4.GL_COLOR_ATTACHMENT0, textureBuff.get(0), 0);

gl.glBindTexture(GL4.GL_TEXTURE_2D, textureBuff.get(1));
gl.glTexStorage2D(GL4.GL_TEXTURE_2D, 1, GL4.GL_DEPTH_COMPONENT32F, displayWidth, displayHeight);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MAG_FILTER, GL4.GL_LINEAR);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MIN_FILTER, GL4.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_COMPARE_MODE, GL4.GL_COMPARE_REF_TO_TEXTURE);
gl.glTexParameteri(GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_COMPARE_FUNC, GL4.GL_LEQUAL);
gl.glFramebufferTexture(GL4.GL_FRAMEBUFFER, GL4.GL_DEPTH_ATTACHMENT, textureBuff.get(1), 0);
gl.glDrawBuffer(GL4.GL_NONE);

if(gl.glCheckFramebufferStatus(GL4.GL_FRAMEBUFFER) != GL4.GL_FRAMEBUFFER_COMPLETE)
         System.out.println(gl.glCheckFramebufferStatus(GL4.GL_FRAMEBUFFER));

Drawing command (unsure if it's correct):

//gl.glBindFramebuffer(GL4.GL_FRAMEBUFFER, framebuff.get(0));
gl.glViewport(0, 0, displayWidth, displayWidth);
gl.glEnable(GL4.GL_POLYGON_OFFSET_FILL);
gl.glPolygonOffset(2.0f, 4.0f);

/*
gl.glClearBufferfv(GL4.GL_COLOR, 0, new float[] {0, 0, 0}, 0);
gl.glClearDepth(1.0f);
gl.glClear(GL4.GL_DEPTH_BUFFER_BIT);*/

setupMVPMatrix();
gl.glBindVertexArray(vaoBuff.get(0));

gl.glUseProgram(shaderProgram);
gl.glDrawArraysInstanced(GL4.GL_TRIANGLE_STRIP, 0, 5, 512 * 512);

gl.glDisable(GL4.GL_POLYGON_OFFSET_FILL);
//gl.glBindFramebuffer(GL4.GL_FRAMEBUFFER, 0);

When I comment the glBindFramebuffer(), the grass appears correctly with the white color (from the light point of view, which shows the matrix should be correct):

But if I call glBindFramebuffer() with the depth test enabled, everything just disappears. I have also checked the framebuffer status, yet it seems there is no error.

What might cause this?

sentences:
Custom Camera View Fustrum in Unity Is it possible in Unity to make some sort of bounding box (with a running application) within the current viewpoint of the actual screen?

Let me explain:

I'm working on a project which uses a projection for visual output, the screen I am projecting on is smaller than the actual projectors resolution. This means that the unused spaces around the actual working application, are black and visually hidden.

Made an image for exra explanation:

As i'm new to Unity and still learning, I'm not sure if this is even possible because of the use of camera's and environment. I happen to know that it's possible in three.js. But if anyone could point me in the right direction or explain that it's impossible would be much appreciated because I'm not sure where to look anymore!

sentences: Open GL ES 2.0 Android Texture,Shader, etc... loading I have gotten texture's to load along with shader's however it seems that I can only create shaders and textures in onSurfaceCreated in my implementation of the render interface. Is this truly the only place one can create shaders, textures, ...?

sentences:
How collisions should be handled in terms of design I'm not sure how should I design the collision part in order to respond the all the game requests.

First that comes in mind is
1. Update the game objects positions
2. Check the collision
3. Update the positions based on collision data

Now the problem is what if an object needs to know when it did collide in order to perform some actions.
Lets say a player picks a chests, so he must not be bounced by the chest and also all the player, chest and cut scene sequence need to be triggered.

So if I do everything in collision routine (without triggers) then all the game logic is biased toward one game and is not flexible, its need to be adapted/rewritten for each game.

If I use triggers and call every object collision function what if player needs to move backward and collisions needs to be rechecked, do I need to make a flag to recalculate and collisions for objects that has this flag set until collisions are done?

Or do I check for chest collision in player update method (before the global collision routine) and do all the calculations there... but what if I don't want the player to react to collision if chest is closed and react if its opened (not just a player-chest collision pair setting)?

What is the best way to implement this kind of system that will be flexible for future games and in the same time respond to all requests of game design (in this case the example I wrote above, player-chest)

sentences:
is GameObject.Find() a bad idea even for one frame? as I searched GameObject.Find and GameObject.FindwithTag are heavy to work with and for reall projects its better to find repalcements.

for a NPC that get instantiated in game it first needs to find player character. for this issue I only can use GameObject.find() .

for a scene with lots of objects maybe its heavy for even one frame if there is lots of objects in the scene. is there any way to set the researching object in head of hierarchi and the NPC to only get that?

sentences: Where could I look online to learn about being a game designer? I'm interested in being a video game designer but I know next to nothing about how to do what ever it is I will be doing as a game designer. Could you offer any advice of a good online area where I could learn about the basics of game designing and later on the more complicated information.

sentences:
How to pass one float as four unsigned chars to shader by glVertexPointAttrib? For each vertex I use two floats as position and four unsigned bytes as color.
I want to store all of them in one table, so I tried casting those four unsigned bytes to one float, but I am unable to do that correctly...

All in all, my tests came to one point:

    GLfloat vertices[] = { 1.0f, 0.5f, 0, 1.0f, 0, 0 };
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float),
        vertices);

// VER1 - draws red triangle
//  unsigned char colors[] = { 0xff, 0, 0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0, 0,
//          0xff };
//  glEnableVertexAttribArray(1);
//  glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, 4 * sizeof(GLubyte),
//          colors);

// VER2 - draws greenish triangle (not "pure" green)
//  float f = 255 << 24 | 255; //Hex:0xff0000ff
//  float colors2[] = { f, f, f };
//  glEnableVertexAttribArray(1);
//  glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, 4 * sizeof(GLubyte),
//          colors2);

// VER3 - draws red triangle
int i = 255 << 24 | 255; //Hex:0xff0000ff
int colors3[] = { i, i, i };
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, 4 * sizeof(GLubyte),
        colors3);

glDrawArrays(GL_TRIANGLES, 0, 3);

Above code is used to draw one simple red triangle. My question is - why do versions 1 and 3 work correctly, while version 2 draws some greenish triangle?
Hex values are one I read by marking variable during debug. They are equal for version 2 and 3 - so what causes the difference?

Edit:
Question is already answered, I just want to add some more information, to clarify my motives for eventual future readers.

I am aware, that when copied to graphics memory, all values will be eventually stored as floats (even 4 unsigned bytes).
"Packing" 4 colors into one float is used by me just to decrease memory usage by color values in my VertexBufferObject class, where all vertex values are stored in one float array. Thanks to this approach, color information for each vertex (RGBA) is stored into single float value, instead of four. Memory usage is significantly lower, at small cost of one additional reinterpret_cast at color creation/change

sentences:
Unity C#: Game Object Movement Issue I'm trying to move a game object within a set x and y range. I thought the code below would work, but it does nothing. The idea is the player controls the platform and tries to move under the ball. Any suggestions would be appreciated.

using UnityEngine;
using System.Collections;

[System.Serializable]
public class Boundary{
    public float xMin, xMax, yMin, yMax;
}

public class PlatformController : MonoBehaviour {

    public float speed = 10f;
    public Boundary boundary;
    public Rigidbody platformRB;

    void Start(){
        platformRB = GetComponent<Rigidbody> ();
    }

    void FixedUpdate(){

        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        Vector3 movement = new Vector3 (moveHorizontal, moveVertical, 0f);
        platformRB.velocity = movement * speed;

        platformRB.position = new Vector3 (
            Mathf.Clamp (platformRB.position.x, boundary.xMin, boundary.xMax),
            Mathf.Clamp (platformRB.position.y, boundary.yMin, boundary.yMax),
            0f
        );
    }
}

Here's how the rolling ball works (as is intended)

using UnityEngine;
using System.Collections;

public class BallMovement : MonoBehaviour {

    public Rigidbody ballRB;
    public float thrust;

    // Use this for initialization
    void Start () {
        ballRB = GetComponent<Rigidbody> ();
    }

    // Update is called once per frame
    void FixedUpdate(){
        ballRB.AddForce (Vector3.right * thrust);
    }
}

sentences:
How do i find the circumsphere of a tetrahedron? I'm looking for the most minimized equation to find the center coordinates and the radius of a tetrahedron circumsphere given four 3D points.

What I found on the internet mainly deal with the circum sphere of a flat 3D triangle, or some rough mathematical definitions, or some very single case such as regular tetrahedrons. Anyway I managed to find the equation below but I missed something :

    ->  ->      ->
let d1, d2, and d3 three vectors of any face of the triangle :

    | d1x  d1y  d1z |   | x |   | d1^2 |
2 * | d2x  d2y  d2z | * | y | = | d2^2 |
    | d3x  d3y  d3z |   | z |   | d3^2 |

My knowledge in this field has its limits but I think I can handle matrices and vector operations. But is the right part of the equation the square of the norm of each vectors ? (which are into a vector). Is the equation valid ? Is it just the writer who lazely forgot to write |d1|^2 ? Or Is it a common way to define some mathematical property.

PS : It's for a Delaunay Triangulation implementation. The equation (number 9) is in the following link : https://www2.mps.mpg.de/homes/daly/CSDS/t4h/tetra.htm

sentences:
ScaleX and Y for stretching MovieClip I'm developing a game, and the game has a shop.  In that shop there is an option for a house expansion.  This is a movieclip that I want the user to be able to spend their coins to increase their house in the following ways:

-> stretch house to right <- stretch house to left ^ stretch house upward v stretch house downward.

The thing is, I've been thinking of using ScaleX and ScaleY to accomplish this.  The only problem:  It stretches the left and right, I can't make it do one.  I'm sure there is a way to do this, but I haven't yet figured it out.  Any ideas?

sentences: How to implement Long Polling with PHP and flash? I'm trying to make a multiplayer game but am a newbie to server side programming except that I know a little PHP. I learnt about this technique called long polling where the server can wait for fresh data to be available and then send it. How does one do long polling using PHP? Are there any libraries available. I'm already using ZendAMF, so how do I make zendamf and long-polling to co-exist?

sentences:
How to handle input in Monogame I've just switched over to MonoGame from XNA. Since MonoGame is supposed to have the same API (implying that any copied code should work as usual), I've run into a strange issue- input doesn't seem to be handled through MonoGame.

When I tried to fix any missing "using" directives in that class, it automatically added using Microsoft.Xna.Framework.Input which implies that there's no MonoGame equivalent.

Googling the issue had no success- all the tutorials I found for MonoGame said to use XNA's input.

Is there a MonoGame equivalent for handling input, or do I just need to use XNA for that?

sentences:
Time loop/ticking architecture Say I build a snooker game, where balls need to jitter around.

Balls belong to a class (ball class), where all the ball functions are defined.

In the animation, time evolves by a clock ticking within a time loop.

I wonder if the clock function/time loop should be optimally defined in the main program or the class file?

If defined in the class, the advantage is that all functions regarding ball movements, collisions etc, which take time to happen, can be put in the class, without worrying about the time loop; the disadvantage is that time will tick for every ball separately, which obviously looks bad.

sentences:
How to dynamically construct a reference to a game object by name I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should increment the currentIndex var, and switch the reference to a new game object, whose text color will be changed.

This is what I'm trying as a test:

GameObject testText = GameObject.Find("MenuOption" + 4);
TextMeshProUGUI thisTextMesh = testText.GetComponent<TextMeshProUGUI>();
thisTextMesh.color = colorWhite;

How do I dynamically construct a reference to MenuOption1,2,3,4,etc? Or is there a better way to handle this without writing a big long conditional?

sentences:
Mouse state not acting as I intend it to I am creating an inventory system.  I have it working well, but for some reason when I pick up an item from a slot(lets say slot 2 of 20) and drop it into that same slot(slot 2) the mouse state fails to update correctly, resulting in the item being dropped and picked back up in the same cycle.  I feel like I am missing something here, but would appreciate any help.  Below is my code.

The method that controls the Item being Dropped into the inventory:

    public void ItemDropped(Vector2 pos, Item item)
    {
        for (int intlc = 0; intlc < InvBoxes.Count; intlc++)
        {
            if (InvBoxes[intlc].Intersects(new Rectangle((int)pos.X, (int)pos.Y, 1, 1)))
            {
                if (Items[intlc] != null)
                {
                    ClampedItem = Items[intlc];
                }
                else
                {
                    //Set bln in Game to stop drawing item at cursor
                    ClampedItem = null;
                    GlobalVariables.TheGame.blnClamp = false;
                }
                Items[intlc] = item;
                break;
            }
        }
    }

Logic in my Inventory Class' Update method to Update the mouse state, after setting the old mouse state.  Then it check for hovering over an item, and sets all old hovers to false.  It then looks for if I am clicking on the item hovered over, and therein lies the problem :

        oms = ms;
        ms = Mouse.GetState();

        //set hover
        for (int intlc = 0; intlc < Items.Count; intlc++)
        {
            if (Items[intlc] != null)
            {
                if ((ms.X - Items[intlc].location.X) < 50 && (ms.X - Items[intlc].location.X) > 0 && (ms.Y - Items[intlc].location.Y) < 30 && (ms.Y - Items[intlc].location.Y) > 0)
                {
                    Items[intlc].invhover = true;
                }
                else
                {
                    Items[intlc].invhover = false;
                }
            }
        }

            for (int intlc = 0; intlc < Items.Count; intlc++)
            {
                if (Items[intlc] != null)
                {
                    if (Items[intlc].invhover)
                    {

                        if (ms.LeftButton == ButtonState.Pressed && oms.LeftButton == ButtonState.Released)
                        {
                            ClampedItem = Items[intlc];
                            Items[intlc] = null;
                            GlobalVariables.TheGame.blnClamp = true;
                        }
                    }
                }
            }

In my game Class at the end of the the Update I have a few calls that pertain to this issue :

        Rectangle rect = new Rectangle(mouseState.X, mouseState.Y, 1, 1);

        if (blnClamp)
        {
            if (rect.Intersects(inventory.Bounds) && mouseState.LeftButton == ButtonState.Pressed && MoldState.LeftButton == ButtonState.Released)
            {
                inventory.ItemDropped(new Vector2(mouseState.X, mouseState.Y), inventory.ClampedItem);
            }
        }

        inventory.Update(InvPos);

If you look at the conditional in my game's inventory's Update method's check for mouse state's current and old button state being pressed and released, when I grab an item from slot 1 and drop it into slot 2, the mouse state conditional validate as intended.  But when trying to grab the item at slot 1 and drop it back into slot one, the item drops, and is immediately clamped again because old mouse state is up and new mouse state is down.  Both instances will hit the conditional that is inside the hover conditional.

Additional Note : When I put a breakpoint on the ItemDropped Method inside my inventory class, the debugger causes the mouse state to update as intended, and the item that I picked up out of slot 2 is placed into slot 2 without fail.  There is a flaw programatically to how I have my updates set up somehow.

sentences:
Is wireframe effect possible without geometry shader? I am trying to write a shader that highlight the edge between each pair of vertices, much like the UCLA Wireframe Shader.

All implementations I came across require geometry shader support. I am wondering if this is possible with just vertex and fragment shaders?

(Of course, I can use texture to workaround it; but I am trying to avoid create custom textures for each model that I need this effect. On the other hand, I could just use geometry shader but it presents quite a problem when porting to iOS, which lacks support.)

sentences:
Perlin Noise unwanted artifacts I am trying to write a perlin noise class with c++ and sfml, but I am experiencing unwanted visual artifacts in the output. In the image, there are obvious lines being drawn between the points of the lattice:

The class template representing the noise is a specialization of lattice noise for vectors. The important function, GetValue() expects values between 0.0-1.0, representing the coordinates at which to get the value of the noise, which should also return a value between 0.0-1.0. Calling the function at (0, 0) should return the value at the top left corner. NormX and normY are the distance between lattice points x0-x1 and y0-y1, again in the range 0.0-1.0.

Before calculating the dot product, the distance vector from each corner lattice point is calculated instead of only using the distance from the top left corner. Because the final value at any point may be negative (-1.0 - 1.0), it is mapped to the range 0.0-1.0 by adding 1 and dividing by two before being returned.

template<>
inline float LatticeNoise2D<sf::Vector2f>::GetValue(float u, float v)
{
    float normX = u * resX_;
    int x0 = normX;
    int x1 = x0 + 1;
    normX -= x0;

    float normY = v * resY_;
    int y0 = normY;
    int y1 = y0 + 1;
    normY -= y0;

    float fadeX = Fade(normX);
    float fadeY = Fade(normY);

    sf::Vector2f dist(normX, normY);
    float dot0 = Dot(At(x0, y0), dist);
    dist = sf::Vector2f(1 - normX, normY);
    float dot1 = Dot(At(x1, y0), dist);
    float lerp0 = Lerp(dot0, dot1, fadeX);

    dist = sf::Vector2f(normX, 1 - normY);
    dot0 = Dot(At(x0, y1), dist);
    dist = sf::Vector2f(1 - normX, 1 - normY);
    dot1 = Dot(At(x1, y1), dist);
    float lerp1 = Lerp(dot0, dot1, fadeX);

    float value = Lerp(lerp0, lerp1, fadeY);
    return (value + 1) / 2;
}

The At(x, y) function returns the pre-generated vector on the lattice (a 2d std::vector) at the given index. The dimensions of the lattice in each dimension are resX_ and resY_, respectivley.

template<typename value_type>
inline value_type LatticeNoise2D<value_type>::At(int x, int y)
{
    return lattice_[x % resX_][y % resY_];
}

The vectors at each point on the lattice are generated on the unit circle by randomly choosing an angle in radians (0-2pi) and then calculating the x & Y components given that the length of their hypotenuse is 1.0.

template<>
inline sf::Vector2f LatticeNoise2D<sf::Vector2f>::Random()
{
    float pi = 4 * atan(1);
    float theta = static_cast<float>(rand()) / RAND_MAX * 2 * pi;
    return sf::Vector2f(cos(theta), sin(theta));
}

The Lerp() function performs linear interpolation, and the Dot() function calculates the dot product of two vectors. The Fade(t) function maps a value from 0.0-0.1 to an S Curve to be used in the Lerp function instead of just the linear distance between lattice points.

Why am I getting these lines between the points of the lattice, and how can I fix them? My goal is to make noise like this example:

sentences:
Unreal installation and storage space requirement I am a new user of Unreal. I installed the program on Windows 7, and after using it for awhile I noticed that the C:/ partition was filling up very fast as I worked on my projects. I store my projects on a storage device different than the one with Windows- does Unreal nevertheless write files related to a project to C:/ and if it does, can such a setting be changed?

I am upgrading to Windows 10. Is there any difference in the behavior explained above between the two Windows versions? Is there any rule of thumb about how much there should be free space on the C:/ partition for Unreal to work with, regardless of where projects are stored?

sentences:
Objects' coordinates and scale adjustment according to different devices resolution and aspect ration in Unity E.g I have a bunch of objects which are generated in specific coordinates. Let's say in a range of - 5 to + 5 on X axis. I came app with these numbers because of camera size I have in Unity editor.

What if I run my game on few random devices with different aspect ratios and resolutions? Will unity adjust my game automatically so everything fit perfectly or should I do it manually somehow? And how if I should?

sentences:
Distance travelled by gameObject and behavior depend on device's performance? The distance travelled by my gameObject and behavior depend on my device's performance. If the device is slow for example, it takes longer to accomplish a specific task, thus travels at a smaller speed, smaller distance etc. and doesn't end up where it's supposed to. How can I fix this?

Here's the code:

variable1 -= variable2 * Time.deltaTime;
transform.position += new Vector3 (13, variable1 * Time.deltaTime, 0);

sentences:
Multiple render targets: Output target format performance questions This is probably API independent (more dependent on hardware implementation), but just in case, I'm using OpenGL.

The question is restricted to PC hardware.

I have a couple of questions concerning the output textures that are being rendered to (e.g. in gbuffer geometry pass)

Is there a (noticeable, measurable) performance penalty of using different formats for the
different output textures? e.g. RGB8 (unsigned byte) (8 bits for each component) for diffuse color, RGBA8 (unsigned byte) for specular color + roughness, RGB16F for normals?
Is it worth it to pack smaller component data into larger types just so I can have equal render targets (and fewer of them in number)? E.g. just having two RGBA16F render targets, packing diffuse + specular + roughness into the first, and normals and other stuff into the second render target using bitmasking?
Are there output texture data types/formats that I should avoid entirely?

sentences:
Approaches on detecting if a car should steer left or right considering a next direction I'm developing the A.I. of my racing game, and I'm having an unforeseen problem. I manage to get the bot to drive by itself by accelerating in the direction of an angle that is returned using the atan2 trig function considering the position of previously-defined waypoints on the track data structure. Here's the code for ai.py:

import math
import pygame

class Bot:

    def __init__(self, player, track):
        self.player = player
        self.track = track
        self.current_waypoint = 1
        self.player.states[0] = True
        self.track.choose_waypoint_path()
        self.number_of_waypoints = len(self.track.waypoint_positions.keys())
        self.get_waypoint_angle()

    def get_waypoint_angle(self):
        self.dx = self.track.waypoint_positions[self.current_waypoint][0] - self.player.car.pos[0]
        self.dy = self.track.waypoint_positions[self.current_waypoint][1] - self.player.car.pos[1]
        self.ratio = math.atan2(self.dy, self.dx)
        self.angle = -self.ratio * (180/math.pi)

    def think(self):
        if pygame.Rect(self.player.car.pos, self.player.car.dimensions).collidepoint(
            self.track.waypoint_positions[self.current_waypoint][0],
            self.track.waypoint_positions[self.current_waypoint][1]
        ):
            self.track.choose_waypoint_path()
            self.number_of_waypoints = len(self.track.waypoint_positions.keys())
            if self.current_waypoint == self.number_of_waypoints:
                self.current_waypoint = 0
            self.current_waypoint += 1
        self.get_waypoint_angle()
        self.player.car.angle = self.angle
        self.player.car.rotate()
        self.player.move()

The thing is, when I set the car angle based on the return of the atan2 function, self.player.car.angle = self.angle, the car rotates/turns in an extremely unrealistic fashion. It works, but it means that I have to gradually steer the car, and then I face this problem. I don't know when to steer left or right, because the angle can be negative. If I do this, for example:

        if self.player.car.angle > self.new_angle:
            self.player.car.angle -= self.player.car.steering_speed
        else:
            self.player.car.angle += self.player.car.steering_speed

The bot drives to the next waypoint destination by weirdly driving in circles.

So, I know the direction in which the bot should drive, but based on its previous angle, I don't know whether it should steer left or right to reach that direction.

sentences:
using rperp or perp to find perpendicular of a vector i have code local coordinate

Vec2 velo = Vec2(100,0);
Vec2 Heading = velo.getNormalized();
Vec2 side = Heading.perp();
Vec2 trans = Vec2(12,12);

then i can generate toWorldCoordinate for trans vector:

word.x = heading.x* trans.x + heading.y * trans.y + pos.x;
word.y = side.x* trans.x + side.y * trans.y + pos.y;

im trying to apply example from book: game ai by example, using cocos2dx.
in cocos2dx we have rperp and perp for aplying perpendicular.
and in my POV,  cocos y is pointing up then we should use (-y,x) that is perp function.

but its seem the actor movement y is reversed then.
im realy confused with concept right hand / left hand. using rperp is fix the issue. but im still not understand why rperp should be used? afaik to make y pointing up we should use perp (-y,x) which is (1,0).perp = (0,1);// the destination is upward

sentences:
How can I deactivate and activate a button? I have a code that keeps a gameObject between scenes, the theme is that this gameObjecte has as a child a button, which I can change the linerenderer color, besides changing the image of the button according to the selected color and thus keep the data between scenes. then when I change to the next scene I deactivate the button with the meteodo "dehabilitar()"  and in the others it is not necessary, then when I change to the next scene I deactivate the button and it is not shown, but when I go back to the next scene and call the function " habilitar() "the button is not displayed. If someone can help me in what I have bad in the code or what I lack?

PS: I did different methods to activate and deactivate the button but the same thing always happens and I leave it like that for a while.

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

namesp

ace DigitalRubyShared
    {
        public class CambioColor : MonoBehaviour
        {

            public Button mybutton;
            public LineRenderer p1;
            public LineRenderer p2;
            public Sprite colorRojo;
            Color Rojo = new Color(1, 0, 0, 1);
            public Sprite colorAzul;
            Color Azul = new Color(0, 0, 1, 1);
            public static int counter = 0;

            public static bool estado = false;

            public static CambioColor estadoCambioColor;

            void Awake()
            {
                if (estadoCambioColor == null)
                {
                    estadoCambioColor = this;
                    DontDestroyOnLoad(gameObject);
                }
                else if (estadoCambioColor != this)
                {
                    Destroy(gameObject);
                }

            }

            void Start()
            {
                mybutton = GetComponent<Button>();
                p1 = GetComponent<LineRenderer>();
                p2 = GetComponent<LineRenderer>();

                counter = 2;
            }

            public void changeColor()
            {

                counter++;

                if (counter == 1)
                {
                    mybutton.image.overrideSprite = colorAzul;
                    //mybutton.image.sprite = colorAzul;
                    p1.startColor = Azul;
                    p1.endColor = Azul;
                    p2.startColor = Azul;
                    p2.endColor = Azul;

                }
                if (counter == 2)
                {
                    mybutton.image.overrideSprite = colorRojo;
                    //mybutton.image.sprite = colorRojo;
                    p1.startColor = Rojo;
                    p1.endColor = Rojo;
                    p2.startColor = Rojo;
                    p2.endColor = Rojo;

                    counter = 0;
                }

            }

            public void dehabilitar()
            {
                if (estado == false)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
estado = true;
                }
            }

            public void habilitar()
            {
                if(estado == true)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
                    estado = false;
                }

            }

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

            }
        }

    }

sentences:
Unity - how to put a target under a character's feet that follows ground model contours? In my current projects, one of the power-ups needs to place a target marker centered on the position of the player triggering it - the actual design for this is TBC, but will be a circle with a radius of 10 units.

The ground for the playing arena is a model, and not flat. Assuming that I use a texture to show this target area, how can I have this texture render following the contours of the ground?

Alternatively, any other approach to solving this would be appreciated.

Thank!

sentences:
Should I use attack effect collision to detect when damage is dealt? I am wondering what a common way for actually dealing damage to different units is. Imagine a game like starcraft for example, should damage be done like this:

  1) zealot attacks zergling, deal damage to zergling

or

  2) zealot attacks zergling, create an attack effect on zergling. When
  this effect collides with the zergling deal damage to said zergling.

The advantage of 2 is for projectiles (like a dragoon attack) will deal damage when the attack collides with the target unit.

What are your thoughts about this in general? Are there other ways of doing this?

sentences:
Is it possible to export animations from Blender to Unity prefab without re-exporting entire character? I have a fully rigged and animated character that I recently exported from Blender as an FBX to Unity. I need to make more animations for the character now but I am very tired of exporting the entire character every time I make a change. I do not need to update texture coordinates or vertex weights (probably). Is there a way to record a new animation in Blender and attach it to the existing Unity character?

Or alternatively, is there now a viable way to produce quality animations for characters inside of Unity? My character needs to move fingers and toes but does not have facial animations.

sentences:
MonoGame not all letters being drawn with DrawString I'm currently making a dynamic user interface for my game and are setting up having text on my buttons. I'm having an odd issue where, when i use a specific piece of code to determine the text position, it will not render all of the text passed to DrawString. Even weirder, is if i insert another DrawString after this, drawing more text at a different place, different parts of the text will be drawn.

The code for drawing my button with the text attached is:

public override void Draw(SpriteBatch sb, GameTime gt)
{
    sb.Draw(currentImage, GetRelativeRectangle(), Color.White);
    sb.DrawString(font, text,
        new Vector2(this.GetRelativeDrawOffset().X + this.Width / 2 - font.MeasureString(text).X / 2,
            this.GetRelativeDrawOffset().Y + this.Height / 2 - font.MeasureString(text).Y / 2), textColor);
}

The methods in the creation of the Vector2 simply get the draw position of the button. I'm then doing some calculation to center the text.

This produces this when the text is set to 'Test':

And when i enter this piece of code below the first DrawString:

sb.DrawString(font, "test", new Vector2(500, 50), Color.Pink);

I should mention that that grey square is being drawn in the same spritebatch, before the button and the text.

Any ideas as to what could be causing this? I have a feeling it may be due to draw order, but i have no idea how to control that.

sentences:
Lightmapped prefabs for procedural content I'm doing a game with procedural content from handmade prefabs, but I ran into a problem as Unity bakes the scene instead of objects when lightmapping with Beast. So when the prefabs are instanced they are without lightmaps.

Is there a way to get lightmaps for dynamically created prefabs with Unity's built-in lightmapper?

sentences:
libgdx: 2nd var of myClass()'s values saving to/overriding 1st var of myClass() I'm using libgdx with Eclipse.

PROBLEM:

In the class inputHandler I have a list of buttons, menuButtons, composed of 2 buttons: playButton and retryButton.
They both belong to the class simpleButton:

public static simpleButton playButton, retryButton;

I declared them as:

retryButton = new simpleButton(100, 100, 40, 10, retryRegion, retryRegion);
playButton = new simpleButton(80, 80, 20, 20, assetLoader.playButtonUp, assetLoader.playButtonDown);

(see note at end of question)

But when I run the game only the 2nd button runs (in the above case, playButton).

So I went to the class
gameRenderer
and used shapeRenderer to clearly see what was going on.

shapeRenderer.rect(inputHandler.retryButton.bounds.x, inputHandler.retryButton.bounds.y,
    inputHandler.retryButton.bounds.width, inputHandler.retryButton.bounds.height);

shapeRenderer.rect(inputHandler.playButton.bounds.x, inputHandler.playButton.bounds.y,
        inputHandler.playButton.bounds.width, inputHandler.playButton.bounds.height);

Although only the 2nd button was displaying, the 2nd button now adopted the code for both the buttons.
i.e. the 2nd button was now both the play and retry (replay) buttons and worked perfectly.

note from before:
These aren't their actual sizes (the actual sizes are equal to the sizes of the texture regions of their art graphics) but for the sake of simplicity and legibility I changed them to simpler values.

Pictures:

playButton on bottom (playButton working):

retryButton on bottom (retryButton working):

The simpleButton class:

public class simpleButton {

    private float x, y, width, height;

    private TextureRegion buttonUp;
    private TextureRegion buttonDown;

    public static Rectangle bounds;

    public static boolean isPressed;

    public simpleButton(float x, float y, float width, float height,
            TextureRegion buttonUp, TextureRegion buttonDown) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.buttonUp = buttonUp;
        this.buttonDown = buttonDown;

        bounds = new Rectangle(x, y, width, height);
    }

sentences:
Is it possible to render to multiple devices / monitors in XNA? As the title.

If so, how?

As well as wiring it up correctly, how should I manage syncing GPU resources and update/draw steps?

sentences:
AS3 - Increase tint as health decreases I'm working on a game where enemies continually spawn with more and more health based on how long you've been playing. As the enemies take damage, I'd like their sprite to get darker and darker, until they die.

Here's what I've got so far:

    enemy_array[i].health -= damage;
    healthcolor.setTint(0x000000, enemy_array[i].health*0.1);
    enemy_array[i].transform.colorTransform = healthcolor;

Predictably, this is making enemies get less black as they take damage. What I need is to convert the decreasing enemies' health into an increasing number between 0 and 1.

I have absolutely no idea where to begin. It's entirely possible I have tunnel vision, but I'm hoping someone here might have an idea for how to accomplish this.

Thanks for your time.

sentences:
lag compensation for slow bullets (opposing players perspective) I have figured out how the server is suppose to "rewind" for bullet collisions so that when you hit a player on your screen, the server will also say you hit them. However, when you press a key to shoot on your computer, it will take x ms until the opponent sees that you shot. by then, the moving opponent will be past the position that you fired while the sever says that they were still hit anyway.

What you will see: You aim and shoot at them, the bullet hits them and they take damage (this works out perfectly so far)

What they will see: They are moving and you shoot at them. the bullet trails behind them and misses, flying off into the distance. Yet they still take damage.
How can this be fixed?

sentences:
Get the up vector of the camera in ARKit I'm trying to get the four vectors that make up the boundaries of the frustum in ARKit, and the solution I came up with is as follows:

Find the field of view angles of the camera
Then find the direction and up vectors of the camera
Using these information, find the four vectors using cross products and rotations

This may be a sloppy way of doing it, however it is the best one I got so far.

I am able to get the FOV angles and the direction vector from the ARCamera.intrinsics and ARCamera.transform properties. However, I don't know how to get the up vector of the camera at this point.

Below is the piece of code I use to find the FOV angles and the direction vector:

func session(_ session: ARSession, didUpdate frame: ARFrame) {
  if xFovDegrees == nil || yFovDegrees == nil {
    let imageResolution = frame.camera.imageResolution
    let intrinsics = frame.camera.intrinsics
    xFovDegrees = 2 * atan(Float(imageResolution.width) / (2 * intrinsics[0,0])) * 180 / Float.pi
    yFovDegrees = 2 * atan(Float(imageResolution.height) / (2 * intrinsics[1,1])) * 180 / Float.pi
  }

  let cameraTransform = SCNMatrix4(frame.camera.transform)
  let cameraDirection = SCNVector3(-1 * cameraTransform.m31,
                                   -1 * cameraTransform.m32,
                                   -1 * cameraTransform.m33)
}

I am also open to suggestions for ways to find the the four vectors I'm trying to get.

sentences:
Webgl page heap size increasing in each page load then crash I am getting aw snap or sometime not enough memory problem when I reload my webgl page. I have a webgl project which is empty (just a camera + light), developed in unity3d. I am reloading it, and profile its memory.

As you can see that its load 1.2MB in the first load than 1281 MB in second then 1574 then 2160 and then get crash. I am amazed that why it is happening?

  Another source of memory-related problems is the IndexedDB filesystem
  used by Unity. Any time you cache an asset bundle or use any
  filesystem-related methods, they are stored in a virtual filesystem
  backed by IndexedDB.

  What you might not realize is that this virtual filesystem is loaded
  into and persisted in memory as soon as your Unity application starts.
  This means that if you are using the default Unity caching mechanism
  for Asset Bundles, you are adding the size of all of those bundles to
  the memory requirements for your game, even if they are not being
  loaded.

but the problem is I didn't load anything from this build yet.

Even when I try to refresh my empty project several time in chrome I get this error:

For Mozilla, there is an error log which states failed to asynchronously prepare wasm: out of memory

sentences:
Can I make a flash file I developed to run on Androis / IOS? I've created a simple game using ActionScript 3.0 and Adobe Flash CS5.
Is there any way to run this creation on Android / Apple IOS ?
(Even if so, I still have no Idea how to work with "touch" interfaces, just want to know if such thing is possible first.)

sentences:
Broadcasting state changes to clients I'm wondering what's the most efficient way to broadcast state changes of entities on a 2d map, to other entities. In particular, I have X players connected to a server on a 2d map and each of them has a sight radius, which defines which other players (or any abstract entities in general) can be seen. Each entity may change its state at any point in time, which needs to be broadcast to everyone who can see it. At the moment, I use a very simple approach:

Use a quadtree to subdivide the world and assign entities to nodes.
At each update 'tick', flag entities which has their visible state changed, and recompute their quadtree nodes.
For each player, determine which changed entities can be seen, and send all their state. This implies any previous entity which the player doesn't see anymore is not sent, and the client can remove it from its view.

This works, but it seems a lot of computing which might be avoided somehow (the visibility determination at each tick seems awful). Does anyone have any ideas?

sentences:
How to: Duplicating and updating component data in systems I am new to game development. Coming across the ECS (entity-component system) pattern I generally quite liked the idea. I have implemented the current version of my engine using the OOP style approach. In other words, Components are objects that have both state and behaviour and methods that can be polymorphic. My entity manager also means that when a SpriteRenderComponent has been added to an entity, entity.GetComponent<RenderComponent>() will return a reference to the SpriteRenderComponent. Of course, the problem with this is that components have to communicate with each other. E.g. the draw method will access the TransformComponent's transform data.
Now I have dug a bit deeper and found that most sources recommend the pure ECS approach where the entities are an id or a list of components, components are just structs with public data and the systems are where all the magic happens ie where all the functions are. Of course, components don't depend on each other and the same is ideally true for systems as well.
So now when I want to draw a sprite I create a SpriteRenderSystem which knows how to draw a sprite. The problem is that drawing concerns all kinds of drawable things e.g. to sort them depending on a zOrder and layer. This is what lead me to the idea of nodes as objects that are local to the system. So now the SpriteRenderSystem would add a 'SpriteRenderNode' to the RenderManager. The SpriteRenderNode could inherit from an abstract RenderNode and implement the virtual draw method. The SpriteComponent would only hold the data specific to the sprite such as colour. The vertex array and all the other stuff that is purely related to rendering is kept encapsulated in the derived RenderNodes.
Problem #1
In order to be drawn by the RenderManager, the SpriteRenderNode would need to know and therefore store its transform data. The only way to keep this data up to date would be to copy the entity's transform component's transform data to the SpriteRenderNode every frame. I am not so much concerned about performance here but about the practice of duplicating the data in the systems. It feels like this is a violation of general good programming practices though I can't see any immediate reasons why it may prove harmful.
Problem #2
Taking the data out of the components.
From what I understand, the data should live in the components. However, taking the above-presented idea a step further, there may be cases where storing data in components isn't necessary at all. Such an example may be an animation system which may simply store and update animation nodes for each entity and then change their components such as texture, position... The problem with this is that it would take away the ability to save the game by simply serialising all the components.
As you see I am quite confused about how a good pure ECS should look like. Any help would be much appreciated.

sentences:
D3D9 Alpha Blending on the surfaces I have a surface (OffScreenPlain or RenderTarget with D3DFMT_A8R8G8B8) which I copy pixels (ARGB) to, from a third party function. Before pixel copying, Bits are accessed by LockRect.

This surface is then StretchRect to the Backbuffer which is (D3DFMT_A8R8G8B8). Surface and Backbuffer are different dimensions. Filtering is set to D3DTEXF_NONE.

Just after creating the d3d device I've set following RenderState settings

D3DRS_ALPHABLENDENABLE -> TRUE
D3DRS_BLENDOP          -> D3DBLENDOP_ADD
D3DRS_SRCBLEND         -> D3DBLEND_SRCALPHA
D3DRS_DESTBLEND        -> D3DBLEND_INVSRCALPHA

But I see no alpha blending happening. I've verified that alpha is specified in pixels.

I've done a simple test by creating a vertex buffer and drawing a triangle (DrawPrimitive) which displays with alpha blending.

In this test surface was StretchRect first and then DrawPrimitive, and the surface content displays without alpha blending and the triangle displays with alpha blending.

What am I missing here? Thanks

EDIT: I must add this is on x64 Win7

sentences:
Is having a master builder object a bad idea? I have wondered about using the following approach to creating Entity objects in a personal project. What I want is to be able to keep track of all Entity objects that get created, so whenever an instance is created, it should automatically get added to a bookkeeping list.

The approach I thought of using is to create a class that can hand out new Entity objects, rather than allowing them to be created directly. This class is called EntityFactory. It's not the factory pattern though. Basically, I define my Entity base class with a private constructor and made EntityFactory a friend class so that it could instantiate Entity objects and hand them out.

The only downside I can see is that I would have to pass around the EntityFactory object.

Will there be other problems? Is this a bad idea? If so, what alternatives are there to have automatic tracking of all Entity objects that get instantiated.

sentences:
Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll) So, turned on my pc today thinking I we're gonna continue making my game but got denied by this error.

Have no idea how to fix it and why it's there at all, I haven't touched my project properties in days.

I start my game, he console pops up and just when I can see my games window blink it crashes and gives me this error :

  Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll) in SFML_Game.exe: 0xC0000005: Access violation reading location 0xCCCCCCD8.

It crahes at the 2nd line of SFML code it goes trough, which is :

sf::RenderWindow window(sf::VideoMode(1200, 840), "SFML - Box2D Engine 1.0");

And the first line being this :

sf::Clock deltaClock;

sentences:
Confused why draw code is clearing, pico-8 api demo In the API demo when they do the example of how to draw a colour pallette at the top of the screen:
I notice the commands don't work when used inside the draw function. When used inside of draw they showup for a second and disappear. removing the cls() allows them to stay, but I need cls included. What do i need to be doing to get the pallette to stay while using the following within the draw function?

function _draw()
       cls()
       rectfill(1,1,7,7,5)
       for i=0,10 do
          print(i,x,2,i)
          x = x + 6
       end
end

sentences:
How can I make my player move in the direction the camera faces? I have a 3rd person camera which can rotate around the player.
My problem is that wherever camera is facing, players forward is always the same direction.

For example when camera is facing the right side of the player, when I press button to move forward, I want player to turn to the left and make that the "new forward".

My camera script so far:

using UnityEngine;
using System.Collections;

public class PlayerScript : MonoBehaviour
{
    public float RotateSpeed = 150,
    MoveSpeed = 50;
    float DeltaTime;

    void Update()
    {
        DeltaTime = Time.deltaTime;
        transform.Rotate(0, Input.GetAxis("LeftX") * RotateSpeed * DeltaTime, 0);
        transform.Translate(0, 0, -Input.GetAxis("LeftY") * MoveSpeed * DeltaTime);
    }
}

public class CameraScript : MonoBehaviour
{
    public GameObject Target;
    public float RotateSpeed = 170,
    FollowDistance = 20,
    FollowHeight = 10;
    float RotateSpeedPerTime,
    DesiredRotationAngle,
    DesiredHeight,
    CurrentRotationAngle,
    CurrentHeight,
    Yaw,
    Pitch;
    Quaternion CurrentRotation;

    void LateUpdate()
    {
        RotateSpeedPerTime = RotateSpeed * Time.deltaTime;

        DesiredRotationAngle = Target.transform.eulerAngles.y;
        DesiredHeight = Target.transform.position.y + FollowHeight;
        CurrentRotationAngle = transform.eulerAngles.y;
        CurrentHeight = transform.position.y;

        CurrentRotationAngle = Mathf.LerpAngle(CurrentRotationAngle, DesiredRotationAngle, 0);
        CurrentHeight = Mathf.Lerp(CurrentHeight, DesiredHeight, 0);

        CurrentRotation = Quaternion.Euler(0, CurrentRotationAngle, 0);
        transform.position = Target.transform.position;
        transform.position -= CurrentRotation * Vector3.forward * FollowDistance;
        transform.position = new Vector3(transform.position.x, CurrentHeight, transform.position.z);

        Yaw = Input.GetAxis("Right Horizontal") * RotateSpeedPerTime;
        Pitch = Input.GetAxis("Right Vertical") * RotateSpeedPerTime;
        transform.Translate(new Vector3(Yaw, -Pitch, 0));
        transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        transform.LookAt(Target.transform);
    }
}

sentences:
How can I make alternate fragments drop (or make them black) based on a checkerboard texture? How can I make alternate fragments drop(or make them black) based on a checkerboard texture in a Unity fragment shader?

I am using forward path rendering in my shader passes for lighting and shadows for every object in the scene.

Now,I need a shader (or something) that drops alternate pixels from the overall screen space after everything is rendered. How can I achieve this effect?

sentences:
Storing transformations in game objects. (GLM, C++) I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently in hierarchical structure.

Should I keep each transformation separate or keep them bundled in a transformation matrix? I have a feeling a single matrix would be way more efficient than calculating model transformation matrix each frame for each object in component tree. On the other side, I'd like to access position, rotation and scale individually as I plan on using them later for some other optimizations.

I'm aware of glm::decompose but I'm not sure if it's a good idea to call it every frame.

Should I keep both the matrix and the components, decompose the matrix every frame or calculate it every frame?

sentences:
Free camera rotation in 3D space I'm using a view matrix to do camera movement and rotation.

viewMatrix = new Matrix4f();
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), viewMatrix, viewMatrix);
Matrix4f.translate(new Vector3f(x * (-1), y * (-1), z * (-1)), viewMatrix, viewMatrix);

I'm manipulating the rotation values around each axis here:

//left and right
public void rotateY(float amount)
{
    ry += amount;
}

//Up and down
public void rotateUp(float amount)
{
    rx += amount;
    if(rx < -90)
        rx = -90;
    if(rx > 90)
        rx = 90;
}

This all works fine. Now i'm trying to create a more "free" camera so that i always turn left an right and don't simply rotate around the Y-Axis.

For the rotation up you simply remove the if-cause. But for the rotation sidewards you need to calculate the parts for the x- and the z-axis using sin and cos. That's where i get confused. How can i rotate sidewards correctly?

sentences:
Does allocating and freeing a huge chunk of memory at startup "clean up memory?" The book Game Coding Complete, Fourth Edition, chapter 5 (Game Initialization and Shutdown), section Checking Memory contains this interesting code sample:

bool CheckMemory(const DWORDLONG physicalRAMNeeded, const DWORDLONG virtualRAMNeeded)
{
    MEMORYSTATUSEX status;
    GlobalMemoryStatusEx(&status);
    if (status.ullTotalPhys < physicalRAMNeeded)
    {
        // you don’t have enough physical memory. Tell the player to go get a
        // real computer and give this one to his mother.
        GCC_ERROR("CheckMemory Failure: Not enough physical memory.");
        return false;
    }
    // Check for enough free memory.
    if (status.ullAvailVirtual < virtualRAMNeeded)
    {
        // you don’t have enough virtual memory available.
        // Tell the player to shut down the copy of Visual Studio running in the
        // background, or whatever seems to be sucking the memory dry.
        GCC_ERROR("CheckMemory Failure: Not enough virtual memory.");
        return false;
    }

    char *buff = GCC_NEW char[virtualRAMNeeded];
    if (buff)
    {
        delete[] buff;
    }
    else
    {
        // even though there is enough memory, it isn't available in one
        // block, which can be critical for games that manage their own memory
        GCC_ERROR("CheckMemory Failure: Not enough contiguous memory.");
        return false;
    }
}

This raises some questions.

The first part just asks the OS (Windows) how much physical RAM is available.
The curious part is the second one, which allocates a huge chunk of memory and frees it right away:

char *buff = GCC_NEW char[virtualRAMNeeded];
if (buff)
{
    delete[] buff;
}

The author goes on to explain:

  ... this function allocates and immediately releases a huge block of memory.
  This has the effect of making Windows clean up any garbage that has accumulated in the memory manager
  and double-checks that you can allocate a contiguous block as large as you need. If the call succeeds,
  you've essentially run the equivalent of a Zamboni machine through your system's memory,
  getting it ready for your game to hit the ice...

But I have my reservations on that.

"Cleaning garbage that has accumulated in the memory manager?" Really? If the game has just started, shouldn't there be no garbage?

"Making sure you can allocate a contiguous block?" In the very specific case where you are going to manage memory yourself, this would them make some sense, but still, if you do allocate a lot of memory right of the bat, you pretty much make it impossible for any other application to run in the system while yours is on.

Also, isn't this likely to force the OS to commit all that memory, and as consequence evict a lot of memory to the swap disk space, slowing your app startup a lot?

Is this really a good practice?

sentences:
Is the June 2010 DX SDK really the latest? I have not been involved in game development, using the DirectX SDK, since around 2008. From the looks of it, the June 2010 release, of the DirectX SDK, is still the latest release. This release is more than two years ago, based on the name. Is this still the latest release, or has there been a naming convention change and I am missing something newer? I've seen mention of it being rolled into a Windows SDK, so I am confused and figured I would come here to ask.

Thanks

sentences:
How do I hide all the geometry in a scene that is contained in a box object? I have a nature scene that "stands" on z = 0 level, basically on the grey grid. I want to hide all the geometry bellow z = 0, which would be under a plane, or inside a very large box.

I don't want to use Boolean because it requires me to update group all my assets and insert them into operand B. But I have moving parts like water and stuff :|

now I KNOW its possible, I have done it like 2-3 years ago but I don't have access to the 3ds file anymore nor could I find the source website :(

sentences:
How to automatically select a graphical quality level? I'm making a game that lets the users choose their graphical settings, with the usual categories: low, medium, high.
I want to implement an "auto" category, and decide what the appropriate values are on startup. But I'm not sure how to do that.
For example in OpenGL, you could check the OpenGL version or query the memory through extensions (if provided) to guess at it, but that seems fickle since it may be the case that a low end graphics card has a high OpenGL version but bad hardware. Checking memory might be a bit better, but I assume it still is not the most accurate way of checking things.
A more robust approach would be to render in the background and check the FPS, but that could require setting up a whole scene, rendering it, etc. Most games seem to do this very quickly, so I don't know how they could set up a whole scene and do a bunch of quick tests.
Is there a fast way to do this?

sentences:
How to decompose a 4x4 TRS transformation matrix with negative scale? As the title says I need to decompose 4x4 TRS transformation matrices and extract the proper scale vectors and the proper rotation vectors (or rotation quaternions).
I know how to extract those information when the upper 3x3 matrix determinant is not negative. The problem is that those matrices can have that negative determinant and as far as I could understand, this negative determinant indicates a flip or mirrored transformation.
What do I have to do to extract the proper values for scale and rotation in those cases?

sentences:
Unity CaptureScreenshot captures and editor as well I'm trying to create some screenshots but ScreenCapture.CaptureScreenshot actually captures the entire editor and not just the Game view.

I'm using this few lines of code here:

public class ScreenShotTaker : MonoBehaviour
{
    public KeyCode takeScreenshotKey = KeyCode.S;
    public int screenshotCount = 0;
    private void Update()
    {
        if (Input.GetKeyDown(takeScreenshotKey))
        {
            ScreenCapture.CaptureScreenshot("Screenshots/"
                 + "_" + screenshotCount + "_"+ Screen.width + "X" + Screen.height + "" + ".png");
            Debug.Log("Screenshot taken.");
        }
    }
}

What could be the issue?

sentences:
How are physics or graphics components typically built in a component-oriented system? I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to start creating the actual components I am a bit confused. When I think of them in terms of HealthComponent or something that would basically just be a property, it makes perfect sense. When it is something more general as a Physics/Graphics component, I get a bit confused.

My Object class looks like this so far (If you notice any changes I should make please let me know, still new to this)...

typedef unsigned int ID;

class GameObject
{
public:

    GameObject(ID id, Ogre::String name = "");
    ~GameObject();

    ID &getID();
    Ogre::String &getName();

    virtual void update() = 0;

    // Component Functions
    void addComponent(Component *component);
    void removeComponent(Ogre::String familyName);

    template<typename T>
    T* getComponent(Ogre::String familyName)
    {
        return dynamic_cast<T*>(m_components[familyName]);
    }

protected:

    // Properties
    ID m_ID;
    Ogre::String m_Name;
    float m_flVelocity;
    Ogre::Vector3 m_vecPosition;

    // Components
    std::map<std::string,Component*> m_components;
    std::map<std::string,Component*>::iterator m_componentItr;
};

Now the problem I am running into is what would the general population put into Components such as Physics/Graphics? For Ogre (my rendering engine) the visible Objects will consist of multiple Ogre::SceneNode (possibly multiple) to attach it to the scene, Ogre::Entity (possibly multiple) to show the visible meshes, and so on. Would it be best to just add multiple GraphicComponent's to the Object and let each GraphicComponent handle one SceneNode/Entity or is the idea to have one of each Component needed?

For Physics I am even more confused. I suppose maybe creating a RigidBody and keeping track of mass/interia/etc. would make sense. But I am having trouble thinking of how to actually putting specifics into a Component.

Once I get a couple of these "Required" components done, I think it will make a lot more sense. As of right now though I am still a bit stumped.

sentences: Irregular Shaped Colliders For Unity Is it possible to create an irregular-shaped collider?  If so, how?  Would I need to create a couple objects and group them up into one Game Object?

sentences:
What are the implications of releasing without a trademark? I've been working on a video game for almost a year now and with release looming I'm starting to panic cause I don't have a trademark (but I do have a company).

I really don't want to have to push release back a year to wait for the trademark process... Can I get around this and just release (safely) somehow?

sentences:
Bullet Physics: Applying a force at the point of collision Suppose I want to simulate some kind of gripper with two "fingers" (such as pair of pliers, or two-fingered robot hand), picking up an object from the ground. Both the gripper and the object are dynamic rigid bodies.

I want to start with the object roughly in the centre of the gripper, and then move the two fingers towards the object, to determine the point at which they make contact with the object's surface. Then, I want to apply a certain force from the fingers onto the object, before finally lifting the fingers (and hence the object) upwards.

Is there any simple way to achieve this just by treating the two fingers as two individual rigid bodies? I want to just move the fingers towards the object to find the point of collision -- so can I treat them as kinematic objects (with zero mass so they don't fall under gravity, which is what I want), and move them manually by slowly changing the pose of each finger over time? But how will I know at what point the fingers and object collide, so that I should stop moving the fingers and start applying a force?

Thank you!

sentences:
Use client as server in client/server architecture Let me clarify what i mean by that.

Let's say i want to create a multiplayer game which uses physics (box2d).
If I would let the server handle all the physics I would end up with a very overwhelmed server with clients that only control one entity on the server.

Question:

What if i only use the server as a 'router' to control the traffic between clients and use one of the clients to handle the physics and do some checking to stop cheating?  Is this a bad idea? ( But this may increase latency, since clients can't send data directly to each other.)

Keep in mind that a game is between 2 players, that means the client which would handle the physics wouldn't have all clients body handled by it's pc.

sentences:
2D game physics, doing it right I have a ball that you can make jump,

I have a sneaking suspicion I'm doing this wrong. It works now, to the extend that gravity pulls the object down toward the ground, but I'm having trouble manipulating the speed of the object.

What this is, is a ball jumping and falling towards the ground.

I have another function called "jump" that just adds a value to it's yVel

I can increase gravity, and it falls faster.

I can increase the jSpeed speed, and it'll rise up longer, but not faster

But I can't get it to do everything faster. It just looks painfully slow, which may or may not be because of my emulator running at 11 fps, on average.

Is it just my emulator, or is it something on my end?

float time = elapsedTime/1000F;
 if (speed < maxSpeed){
            speed = speed + accel;
            }
            if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
            mVelY += (speed);
            }

            if (!(mY + height >= Panel.mHeight)){
            mVelY = mVelY  + gravity ;}

            mX  =  (float) (mX +(mVelX * time));
            mY =  (float) (mY + (mVelY * time));

sentences:
Learning Web Development and Game Development at the same time? I'm a junior-level developer, currently working full time and trying to get experience with working with ASP.NET MVC. I love web development, and want to continue to pursue it as my career, but I also love gaming and have done a few game tutorials with Monogame/XNA, and love that as well.

For anyone that has been in this situation, Can you tell me, from experience, if you noticed any form of degenerative results when trying to split focus between a full-time career in another field and beginning game development? I am looking for concrete examples of people who managed to split their time, and what their experience was like. I'm concerned that if I focus on game development on my spare time, then my growth in web development might suffer. I hope to use your input to determine for myself, how I should split up my free time, and manage my "Extracurricular" web projects, AND game development projects, so that I don't end up as a jack of all trades, master of none. I don't know why this is such a hard decision for me. :(

sentences:
Fixed physics time step and input lag Everywhere I read says I should fix the time step of my physics simulation, and interpolate the result to the actual frame rate of my graphics. This helps with simplicity, networking, reproducibility, numerical stability, etc.
But as I understand it, fixed time step guarantees between 1 and 2 Δt of input lag, because you have to calculate one step ahead in order to interpolate. If I use 90 Hz physics, it gives me an input lag of about 17 ms, on average.
Since I often see gaming enthusiasts talking about 1 ms input lag, 1 ms delay, and how that makes a difference, I wonder how fast-action games does it, and how they reduce the input lag using fixed time step.
Or they don't, and 1 ms delay is just marketing mumbo jumbo?

sentences:
check if there are planets in the vicinity I'm trying to make a random galaxy map in gamemaker, with several planets at random places. The problem I have run into is that some planets will be too close together. I need a way to put a minimum distance between them, but I can't figure out how to do it, or where I'm going wrong in the code.

I use the following script to make the map (argument0=amount of planets of this type to create and argument1=the object under which this type is located):

var i;
var MinDistance
var ToCloseFlag
var planetx, planety

for (i=0;i!=argument0;i+=1)
{
do
{
    do
    {
        do{
        planetx=random(room_width);
        }
        until(planetx<room_width-64 && planetx>64);
        do {
        planety=random(room_height);
        }
        until(planety<room_height-64 && planety>64);
    }
    until(place_empty(planetx,planety))
    MinDistance=400;
    ToCloseFlag = 0;

    with(argument1){
        if (point_distance(planetx,planety,other.x,other.y)<MinDistance)
            {
                ToCloseFlag=1;
            }
    }
 }
 until (ToCloseFlag=0);

    if place_empty(planetx,planety)
    {
        instance_create(planetx,planety,argument1);
    }

}

Any help would be greatly appreciated.

sentences:
What are the benefits of using a 2D game engine on Android? I have thought about just coding a 2D game on Android using just pure Java and the Android SDK, no engines like libdgx, cocoa-2dx attached. I don't know if I really need to use a game engine or not. Doesn't Java already come with basic libraries and APIs for most things already?

I'm not interested in the cross-platform aspect of game engines. The game is 2D, so there's no complex issues with 3D, importers, or what not. I also don't like to have to code around level editors or pre-built constructs like a character or tile class.

Given this, are there any other benefits for me using a game engine to code my Android 2D game? For example, I'm clueless with OpenGL so if I'm doing it w/o an engine I would be using pure Java, would that be significantly slower than using an engine like libgdx?

sentences:
Why do games ask for screen resolution instead of automatically fitting the window size? It seems to me that it would be more logical, reusable and user-friendly to implement flexible, responsive UI layout over a 3d or 2d screen, which can then be run on any screen resolution.

Some modern games auto-detect screen resolution and adjust the game to that, but the option to change the resolution still remains in the settings.

Why is this option there?

My guess is that this is one way to provide older machines with a way to improve performance by rendering less graphics and just stretching them across the screen, but surely there are better ways of improving performance (choosing different texture and model qualities, for example).

sentences:
Software and Hardware Rendering From what I understand, the main difference between software rendering and hardware rendering is that in software rendering you use the CPU to determine what to color each pixel, and in hardware rendering you let the GPU take care of calculations and determine how to draw each pixel.

However, in the end, isn't an API such as OpenGL still required to do the actual drawing no matter which method you pick? I saw a basic software rendering engine that someone built, and the person said he still used OpenGL to do the actual drawing after using the CPU to do the rendering. So is an API like OpenGL or DirectX still required in the end? And if so, is it true that a computer must at least have an integrated GPU or dedicated GPU to display anything at all?

sentences:
How are the following 3D effects mocked in Myst 4? (link) Superficially, I thought 'all' that would be required to make a myst style game would be to place the camera inside a 3D sphere, with the sphere's inner surface textured with an appropriately-distorted (to account for the concave nature of the sphere), 2D rendering of a 3D world.

The only thing that I can't really work out is how are some elements of the game alive and moving?

In this video, the sea waves are moving:
http://www.youtube.com/watch?v=ju0lACSm7Us

In this one we have some pretty cool particle effects involving clouds, as well as lighting, thought I think the lightning is pre-rendered:
http://www.youtube.com/watch?v=_CidCIDHFL4

I doubt these effects are actually 3D; I think they are 2D looping movie files. However I could be wrong.

To clarify, how do you think they've achieved such gorgeous 3D effects regarding the water, clouds and lightning?

Are they looping movies? How are these movies presented to the user and integrated so well?

sentences:
How to keep the object rotation while using RotateAround in Unity? I've got an object that has a comet-like sprite rotating around it. I'm using this code in LateUpdate() to make it rotate and keep the comet's tail at the right position:

transform.position = player.transform.GetChild(0).transform.position + (transform.position - player.transform.GetChild(0).transform.position).normalized * 2f;
transform.RotateAround(player.transform.GetChild(0).transform.position, Vector3.forward, 100f * Time.deltaTime);

It works fine until the object moves. After moving, the comet follows the object and goes back to the orbit, but its rotation gets messed.

I've got an image describing this problem:

The image on the left shows how the comet behaves at the beginning. On the right there's a sample of how the comet's position can possibly look after moving around. I want it to always look like on the left image.

Is there any way to stick the comet to the object's orbit? It can move as fast as the object, I don't need tealistic calculations of the position changing for the comet.

sentences:
Self occluding object and alpha blending Look at the object I've rendered with my app:

It's the same screen twice, above the original and below I've drawn (by hand :P) the shape of the mesh of one of plant's leaves. You can clearly see where the problem is.

From what I understand, this leave is drawn before the other leaves, writing a higher value to the depth buffer but not changing the pixel color (as it's transparent in that particular place). When the other leaves are drawn then their pixels in that place in the buffer are discarded since they're failing the depth test (they're farther away from the camera).

Now while I understand what the problem is I don't know how to solve it. This whole plant is one object so I can't sort by depth. What should I do?

sentences:
Unused methods after component inheritance in component based architecture? I have a GameObject class, which contains Components, like:

Renderer
Camera
Behaviour
Rigidbody

First I inherited all of them from Component which has an Update() method, and it is called every frame on every game objects' every component.

But then I noticed, that** Renderer and Camera's Update method is unused**. (There are classes like RenderData & CameraData which are isolated and made from primitives, and upon creation of these Components, these Data's pointer is sent to the GraphicsEngine which will process them every frame.)

So having an unused method is bad. So I created a DynamicComponent class, which inherits from Component, and Behaviour & Rigidbody classes are inherited from it.

I moved the Update() from Component to DynamicComponent, and I have now 2 containers at gameobjects:

Components (for components which are inherited directly from Component)
Dynamic Components (for components which are inherited from D.Comp.)

And every frame I only call DynamicComponents' Update().

Now I'm having another issue. There is the Behaviour class, where should be a Start() method, which is called on every Behaviour when the scene is fully initalized.

That means that I should have a Components, D.Components and also a Behaviours container at game objects.

This looks very bad to me.

Having a Component class, with Start(), Update(), etc is very simple and makes a very clean code, but this means that only a few derived classes implement its virtual methods.

What should I do?

sentences:
How to put the “camera” inside a cube in OpenGL I'm really new to OpenGL and can't seem to figure out how to put the "camera" inside the cube I've created so that I can move in an FPS-like style.  I tried to use gluLookAt and gluPerspective but I'm clearly missing some steps. What should I do before gluLookAt? Here's the code written so far:

    int rotate_Y; //used to rotate the cube about the Y-axis
    int rotate_X; //used to rotate the cube about the X-axis

//the display function draws the scene and redraws it
void display(){

    //clear the screen and the z-buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity(); //resets the transformations

    glRotatef(rotate_X, 1.0, 0.0, 0.0);
    glRotatef(rotate_Y, 0.0, 1.0, 0.0);

    //Front Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.0, 1.0, 0.0);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    //Back Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 0.0);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glEnd();

    //Right Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 1.0);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    //Left Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.7, 0.7, 0.0);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glEnd();

    //Upper Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.7, 0.7, 0.3);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glEnd();

    //Bottom Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.2, 0.2, 0.8);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    glFlush();
    glutSwapBuffers(); //send image to the screen
}

int main(int argc, char*argv[]){

    //initialize GLUT
    glutInit(&argc, argv);

    //request double buffering, RGB colors window and a z-buffer
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

    //create a window
    glutInitWindowSize(600, 600);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Space");

    //enable depth
    glEnable(GL_DEPTH_TEST);

    //callback functions
    glutDisplayFunc(display); //display - redraws the scene
    glutSpecialFunc(specialKeys); //special - allows interaction with specialkeys

    //pass control to GLUT for events
    glutMainLoop();

    return 0; //this line is never reached
}

Feel free to ask more about what I'm trying to achieve if I wasn't clear enough. Thanks for your help.

sentences:
Bouncy Ball stops without enough force I am building a 3D Pong clone and want to implement a frictionless bouncing ball.

These are the steps i took:

Create a box in which the ball can bounce, consisting of standard cubic objects.
Create a ball using a spherical object
Add a Rigidbody to said ball (Mass: 1, Drag: 0, A.Drag: 0, no Gravity)
Add a bouncy Physics Material to the balls Sphere Collider (D.Friction: 0, S.Friction: 0, Bounciness: 1, Fraction Combine: min, Bounce Combine: max)
Add a script to the ball that adds force to the ball on start:

Script Snippet:

void Start() {
    this.getComponent<RigidBody>().addForce(0, 0, 100);
}

When i play the scene, the ball will fly towards the wall and then stop. If i change the added force to (0,0,101) it works as intended. If i lower the mass of the ball and use the old force (0,0,100) it also works. But it will always stop at the wall, if the added force is <= mass*100.

What am i missing?

sentences: How can I create a pixellated, limited-palette appearance in modern OpenGL? I wanna get some old art style (256 color, dithering, etc) in modern OpenGL in an effective way. Maybe using a low resolution (320x240) rendered at a bigger space so that the pixels looks "bigger?" I'd just like to fake this old style on modern GPUs.

sentences:
Deploying MonoGame on Android I've developed a game using MonoGame for Android (with Xamarin). When deploying to my Android device (via the Xamarin Studio IDE) it installs 3 apps - Monogame-Android-8-support, Monogame-Shared-Runtime and the actual game.

Now I'd like to know how you can package all those into one APK in order to publish the app.

sentences:
Which server platform to choose I'm going to write a server for an online multiplayer with these requirements:

Pretty simple turn based game (think a card game) that is played entirely on the server (security reasons)
Must be able to run multiple games (tables) with 4 players per table, but no lobby system required (another server takes care of that)
Can support as many players at once as possible; Might need multiple servers
Chat between players
Socket connection to a Flash/AIR client
Must be able to communicate with other servers (for player accounts and such)

Now, I'm considering two options:

Smartfox (or equivalent)
A custom Java solution in something like Tomcat

Why Smartfox?

It handles multiple rooms and chat natively
It presumably has solutions for well-known multiplayer gaming issues

Why custom?

Smartfox has many unneeded functions, bad for performance
Smartfox communicates with an XML-based format, I could use a more efficient binary one.
Don't know if running the entire game model on the server is convenient with Smartfox' extension mechanism
Multiple rooms and chat are easy to reimplement
Tomcat or a lightweight container is easier to deploy than Smartfox
Better IDE support for developing on Tomcat (automatic deploy, etc)

What do you think? Are my assumptions correct? Do you have anything to add? What option should I choose (or maybe a different one entirely)?

sentences:
How to find collision detection side between two objects? I am using box2D and I have two objects, one is bouncy ball and the other one is block. I'd like to find which side of the block is collided with, so I can only make the ball bounce when it hits the top.

I tried to implement many things like fixture data and by detecting position, using manifold but not get the accurate result. I also tried to calculate distance between two object but all went wrong.

sentences: How do I extract and publish my game made in Code::Blocks? So I made a 2D adventure game using c++ and SFML with the Code::Blocks IDE and the GNU GCC compiler. I have been working on it for several months and been doing bug fixes and everything. I want to publish my game to steam, or maybe a website for people to download for free and enjoy my game. However I do not know how to take my code on Code::Blocks and put it into a single application that when double-clicked it can be opened and ran as a game. Please help, it would be greatly appreciated.

sentences:
How to get a smooth path for a vehicle in a 2D top down map? I am making a 2D tile based game which involves having AI that needs to traverse the map avoiding obstacles in a natural and smooth path (NOT NECESSARY THE SHORTEST)

The orientation of the vehicle is also important in the example above the initial orientation of the vehicle is to NORTH but the orientation of the vehicle at the destination doesn't matter.

All I could do now is to compute the path using A* or a BFS fill through the center of the tiles.

This is an example of a desired path:

sentences:
Settlers-like terrain representation Remember this beauty? I'm playing it now on my old Amiga 1200.

My question is: How do you think they represented the terrain, data structure wise? Obviously it's some kind of points, with a height. Or hexagons. And how did they decide which dots were buildable?

EDIT: I could rephrase the question to say "how do I achieve this kind of terrain", but I would still only be interested in how to do it on a machine with 1 MB of RAM and a 7 Mhz processor, because this is the machine i currently developing games for. If that seems like a vague or meaningless question to you, that's alright, but I'm still curious if someone has any knowledge about this.

sentences: What is a collision shape? I am a business developer who is new to game programming. In learning Stencyl, I see that there are things called collision shapes associated with tiles. This seems to be a standard term in game programming. What is a collision shape?

sentences: Is the Windows 10 Game Bar extensible? Does the Windows 10 Game Bar have an an API that I, as a developer, can hook into and as such make a product that starts alongside all games that support the game bar (say, a parental control interface)?

sentences:
XNA- Transforming children So, I have a Model stored in MyModel, that is made from three meshes. If you loop thrue MyModel.Meshes the first two are children of the third one. And was just wondering, if anyone could tell me where is the problem with my code.

This method is called whenever I want to programmaticly change the position of a whole model:

public void ChangePosition(Vector3 newPos)
{
    Position = newPos;

    MyModel.Root.Transform = Matrix.CreateScale(VectorMathHelper.VectorMath(CurrentSize, DefaultSize, '/')) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Up, MathHelper.ToRadians(Rotation.Y)) *
        Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Right, MathHelper.ToRadians(Rotation.X)) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Forward, MathHelper.ToRadians(Rotation.Z)) *
        Matrix.CreateTranslation(Position);

    Matrix[] transforms = new Matrix[MyModel.Bones.Count];
    MyModel.CopyAbsoluteBoneTransformsTo(transforms);

    int count = transforms.Length - 1;
    foreach (ModelMesh mesh in MyModel.Meshes)
    {
        mesh.ParentBone.Transform = transforms[count];
        count--;
    }
}

This is the draw method:

foreach (ModelMesh mesh in MyModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.View = camera.view;
        effect.Projection = camera.projection;
        effect.World = mesh.ParentBone.Transform;
        effect.EnableDefaultLighting();
    }
    mesh.Draw();
}

The thing is when I call ChangePosition() the first time everything works perfectlly, but as soon as I call it again and again. The first two meshes(children meshes) start to move away from the parent mesh.

Another thing I wanted to ask, if I change the scale/rotation/position of a children mesh, and then do CopyAbsoluteBoneTransforms() will children meshes be positioned properlly(at the proper distance) or would achieving that require more math/methods?

Thanks in advance

sentences:
LibGDX: How can i remove inner actors? How can I remove these(on the picture) actors if I only have access to root's Window methods getChildren() and getCells() ?
I've tried somthing like this:
removeActor(getCells().get(1).getTable().getCells().get(0).getTable()...getTable());

But it always return the root Table.

UPDATE

I've came to this:

Cell<FileChooser> cell = getCells().get(1);
removeActor(cell.getActor().getCells().get(0).getActor());

But now it throws nonsense Exception:

Exception in thread "LWJGL Application" java.lang.ClassCastException: com.kotcrab.vis.ui.widget.file.FileChooser$11 cannot be cast to com.kotcrab.vis.ui.widget.file.FileChooser

How class cannot be cast to its own type?

sentences:
Box collider/rigid body eventually moves through static collider I found this question, but I'm not sure if it applies to my problem.

I'm hacking together a Pong-style game, and my problem is with the walls (box collider, no rigid body) not completely stopping movement of the player paddle (box collider, yes rigid body.) Sufficiently fast mouse movement eventually moves the paddle through the wall. There is initial resistance, but I would expect Player Paddle to stop moving abruptly at the wall. How can I make this happen? I'm new to Unity/colliders/game dev.

My player paddle simply moves up and down (Z-axis) with up/down mouse movement:

public class MouseMovement : MonoBehaviour {
    public float speed = 10f;
    // Update is called once per frame
    void Update () {
        var translation = Input.GetAxis("Mouse Y") * speed;
        translation *= Time.deltaTime;
        transform.Translate(0, 0, translation);
    }
}

I exported an asset package that reproduces the problem. My problem objects are Player Paddle, Upper, and Lower https://www.dropbox.com/s/yx9svb51nywdvgg/pong-export.unitypackage?dl=0

sentences:
Construct flow field cost map from polygon geometry I'm looking into implementing flow fields for pathing large numbers of units across a map. From what I can find, flow fields are always constructed as a grid, and require building a cost map of obstacles and terrain levels.
Edit: Pathing cost will ultimately come from a variety of sources, not only the map geometry. However, map geometry was the only piece that comes from existing geometry, as opposed to being calculated on the fly. Other sources include:

Walkable areas of the map (including slopes but excluding cliffs and canyons)
Player-constructed buildings (which must be pathed around)
Range limits (remote-control units can not stray outside the range of the nearest control tower)
Enemy attack range (resource gathering units may want to try to steer clear of the attack range of enemy towers, if possible)
Player-created waypoints (influencing the route units will take to get to a particular destination, to avoid enemy defenses or perform patrolling)

Assuming I start with map geometry (not a grid), this would seem to mean that I would need some way of rasterizing my map polygons into the cost map.
But is rasterization the best way to accomplish this? I'm assuming this is a solved problem, but have been unsuccessful in finding other options.

sentences: To what platforms can the blender game engine build to? I used to use the BGE until I found that unity can build to lots of different platforms. What platforms does the BGE support?

sentences:
Available Small Open Source Game Engines for tutorial I'm learning to create a game engine from scratch in XNA. I'm seeking examples of very small game engines, specifically the architecture and structure of source files, etc. It should include a scripting engine. Articles are also appreciated.

More specifically, I have a problem knowing how to connect the scripting engine to the rest of the game engine, like loading a models from the script.

sentences:
What's the point of [HiddenInInspector] (as opposite to [NonSerialized])? I understand the difference between [HiddenInInspector] and [NonSerialized], what I'm missing is the use case for [HiddenInInspector]: so far every time I've encountered it, it was used by developers who weren't aware of [NonSerialized], that would actually have meant to use that. The result is that they risked to get unexpected values when the variable in question was deserialized.

So, in which case it turns out to be useful to hide something from the inspector but to serialize it? If there is such case, are there any known precautions to take in order to prevent unexpected behaviour?

sentences:
How do game devs optimize their games for new CPUs/architectures? I've learned that DirectX helps devs to program games on a variety of hardware. However, that's the visual/graphics side of things.

How do game devs deal with new CPUs or CPU architectures? Is there another API for that? Do they use DirectX for this too? Or do they need to learn the ins and outs of the architecture and program accordingly?

Thanks.

sentences:
gravity simulation implementation this.attract = function () {
        for (let i = 0; i < numofplanets; i) {
            var r = Math.sqrt(Math.pow(blackhole.x - planet[i].x, 2) + Math.pow(blackhole.y - planet[i].y, 2));
            planet[i].acclx = (blackhole.mass(blackhole.x - planet[i].x)) / Math.pow(r, 3);
            planet[i].accly = (blackhole.mass - (blackhole.y - planet[i].y)) / Math.pow(r, 3);
            // planet[i].acclx=(blackhole.x-planet[i].x)/60000; without force implementation in which planets get sucked inside the blackhole
            // planet[i].accly=(blackhole.y-planet[i].y)/60000; without force implementation in which planets get sucked inside the blackhole)
            planet[i].speedy += planet[i].accly;
            planet[i].x += planet[i].speedx;
            planet[i].y += planet[i].speedy;
        }
    }

i am trying to create gravity simulation model for a game in JavaScript.i need planets to move around a black hole in elliptical orbits.
first i calculate acceleration and then add it to velocity and according to that i calculate the next position of planet. i first tried with just calculating distance vector between planets and black hole but in that scenario planets directly gets sucked inside the black hole and i need them to move in elliptical orbits. i tried calculating acceleration due to gravity but i think formula is wrong so can you correct it or provide some other implementation.

sentences:
Transition between two Views i want to animation the transition between game screens , in my game loop i have a function called getCurrentScreen() which returns a Screen object this Screen Class
has a function called present() this function draw on the framebuffer , when i want to change to another screen i call setCurrentScreen(Screen) , so it will draw the screen i set ,  What i want is to animation the transition between these screens  any suggestion , is the a book or an article that discusses this

sentences:
In a multiplayer game, should I store the list of character names on the Player class? I am writing a multiplayer game that has account system and character creation system like standart MMORPGs. I have a question about name creating issue. I think that I can create a static variable on Player class that keeps created player names but it confused me. It will tell me name is valid or unvalid depends on the other players has this name.

Questions;

Does implementation does make sense ?
If i have 1000 players, is it means it consumes 1000 times of memory of this list? Or it just consume as like there is one?
What is your suggestion for place that I can keep player name list? A new class?

sentences:
Unable to draw single particle effect at two places I am using Libgdx ParticleEffect to draw a fire particle effect .

The issue I have is that when I try to render a ParticleEffect at two different locations within single game loop, only the last draw call has the effect drawn on screen. I update the Particle effect only once per game loop but set its position to two distinct locations and draw it. Is this a trivial problem with Libgdx ParticleEffect:

ParticleEffect effect = new PartcleEffect();
effect.load(gdx.files.internal("data/effect.particle"),atlas,"");
effect.start();

In render :

effect.update(deltaTime);

effect.setPosition(x1,y1);
effect.draw(batch);

effect.setPosition(x2,y2);
effect.draw(batch);

Can someone tell me why it isn't working?

sentences:
Level loading philosophy in MMO games I've been working on project for quite a while, and I've returned to dilemma about level loading.
The problem is i trust the client with it's local level loading, when it's done loading it tells the server to join it to server room data stream and server start to send data.

My current setup

Client logs in, on login server sends the characters.
Client chooses the character and start to load level locally.
When client scene done loading, it request to add to room.
Client receives the data he needs.

I fear that user could hack the client and actually load other scene, that would result in players and characters going through props and models, it could also be an exploit to see hidden data and items.

Instead, after server sends the chosen character it could "wait" for user to send response that level has finished loading. After that, server joins the character to room and send data to the user. That way client doesn't know anything about rooms or it's names.

Any suggestions?

sentences:
Depth write and depth test in Unity Scenario: several objects (o1, o2,.., on) have to be rendered with the z test disable, but the z values must be written to the depth buffer. In another pass, some other objects (t1, t2,..., tm) need to be rendered considering with the z test enabled, and considering the prior values from the previous pass.

Is it possible to achieve this with Unity's material script? The goal is to support a custom order for the rendering of transparent objects (the o1,..,on in the scenario description) alongside with matte objects (t1,..., tm). I tried using the features mentioned here, but the results were incorrect, i.e. as if the z values were completely discarded inbetween passes. Can anyone, perhaps, share a code stub for this scenario?

sentences: Make an animation repeat X times I am using Unity Mecanim and I would like an animation ( walking animation about 2 seconds longs ) to repeat X times before moving to the next animation. How can I achieve this?

sentences:
glfwCreateWindow function returning NULL I am working on creating a game engine using GLFW. To begin, I set up a window class in C++ to test how making a window works. For some reason, when I call the glfwCreateWindow function, it returns NULL instead of GLFWwindow*. Here is my code (I have a header file that defines the class and then the c++ file that defines the class):

Here is the window.h header file:

#pragma once

#include <iostream>
#include <GLFW/glfw3.h>

namespace harmony { namespace graphics {

    class Window
    {
    private:
        const char* m_Title;
        int m_Width, m_Height;
        GLFWwindow* m_Window;
        bool m_Closed;
    public:
        Window(const char* name, int width, int height);
        ~Window();
        bool closed() const;
        void update() const;
    private:
        bool init();
    };

} }

And here is the c++ window.cpp file:

#include "window.h"

namespace harmony { namespace graphics {

    Window::Window(const char* title, int width, int height)
    {
        m_Title = title;
        m_Width = width;
        m_Height = height;
        if (!init())
            glfwTerminate();
    }

    Window::~Window()
    {
        glfwTerminate();
    }

    bool Window::init()
    {
        if (!glfwInit)
        {
            std::cout << "Failed to initialized" << std::endl;
            return false;
        }

        m_Window = glfwCreateWindow(m_Width, m_Height, m_Title, NULL, NULL);
        if (!m_Window)
        {
            std::cout << "Failed to create window!" << std::endl;
            return false;
        }
        glfwMakeContextCurrent(m_Window);

        return true;
    }

    bool Window::closed() const
    {
        return glfwWindowShouldClose(m_Window);
    }

    void Window::update() const
    {
        glfwPollEvents();
        glfwSwapBuffers(m_Window);
    }

} }

And lastly here's my main.cpp:

#include "window.h"

int main()
{
    using namespace harmony;
    using namespace graphics;

    Window window("Yay it works!", 800, 600);

    while (!window.closed()) {
        window.update();
    }
    return 0;
}

I looked it up and there are only a couple cases (in the source code of glfwCreateWindow) where it returns NULL, but I haven't found a good way to troubleshoot which one.

sentences:
My orbit code produces the wrong results I have a GameObject called "Sun" in the sky. A game object called "GameManager" keeps track of time in the game, it is responsible for updating the hours and days.

For my sun I do something like this to get a percentage to use for the position of the sun on the orbit circle:

 float percentage = (((float)theGameManager.GetHourOfDay() / (float)GameManager.numberOfHoursInADay) * 360.0f);

I have a piece of code that can return the point in a circle if given a radius, an angle and an origin point.

public static Vector3 GetPointInCircle(float radius, float angleInDegrees, Vector3 origin)
{
    Vector3 resultingPoint = new Vector3(0.0f, 0.0f);
    resultingPoint.x = origin.x + radius * Mathf.Cos(angleInDegrees);
    resultingPoint.y = origin.y + radius * Mathf.Sin(angleInDegrees);

    return resultingPoint;
}

I use this function to determine the suns position each frame, as the angle i am passing is just the percentage of the circle, i expect the percentage variable to give increasingly bigger angles that make up 360 degrees. It does.

However when I set the suns new position using:

Vector3 newPos = new Vector3(MathsHelper.GetPointInCircle(sunOrbitRadius, percentage, new Vector3(50.0f, 0.0f, 50.0f)).x,
MathsHelper.GetPointInCircle(sunOrbitRadius, percentage, new Vector3(0.0f, 0.0f, 0.0f)).y, transform.position.z);

transform.position = newPos;

and the resulting behavior is the sun jumping to totally random positions around the circle, often picking ones that are near the start and end of the circle (by hour 4 the y value is already negative, which shouldn't be the case).

I notice if I swap out the percentage variable for Time.time it works perfectly, however this does not give me control over the sun in accordance to GameManagers day tracking and I feel like I am missing something obvious as to me it looks as though the math should work.

Additionally, I am using C# in Unity.

sentences:
How can I create a "night sky" effect in OpenGL? I am creating a game using OpenGL and I want to render the effect of a night sky with a few stars in it.

I want to have a shiny black effect in the sky so that it looks good. Could some one help in how to proceed through it or give a link to a good tutorial?

sentences:
Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in position and size.

So, for example:

My first thought was:

Generate list of possible points
From this list remove all points in the fixed size rect
From this list remove all points that can't possibly meet the other requirements (e.g. points close to the image edges that wouldn't meet the required bounded min / max rect size)
Then randomly pick a point, generate a random bounded width / height, see if this intersects any current rect, until we find one that doesn't
Record rect, remove all points in rect from list
Repeat

However this seems slow, overly-complex and still results in holes because sometimes there's no more room for the minimum size of rect to fill the last bit of space.

I've looked into algorithms involving squaring the square, packing routines and such like, but nothing I've found helps with the additional constraint that one rectangle is predefined and the rest can be random.

Not looking necessarily for a full algorithm, but hints at an approach would be appreciated.

sentences:
Authenticating users without a username or password I'm curious about what the process is for anonymously authenticating users when it comes to mobile games. There are quite a few examples out there, but the ones that immediately come to mind are Lords Mobile, Family Guy: Quest for Stuff, and Clash of Clans. When you first open the game, you're assigned an account id and that id is tied to your device until you choose to register an account with a password or sign in through some SSO service.

In that initial step where you're not creating a password or using SSO, how are these games making sure the requests are from both the user/device that they come from? Or is it that they actually don't?

I can imagine a simple setup where you're providing a key that needs to be refreshed every now and then just like you would with something like OAuth, but other than that you don't care that the user is who they say they are. After all, you're dealing with a request that already has to be validated for legality within the game rules.

sentences: Is there any way to move the sprites inside the sprite editor? I have imported a .png file of a stickman in which I had placed his head, body, two legs, and two hands a bit far apart from each other so that Unity will automatically convert the picture into sprites. Indeed, Unity did convert those body parts into sprites easily but now I have a problem. I made a bone going through the body and another bone going from the body to the head through the transparent area in between the sprites. Also, I have created one bone for each hand and leg and parented them to the bone in the body. The problem is that when I automatically generate geometry then the mesh rendering works completely fine within the body of the stickman, but it doesn't work anywhere else, be it the hands, or the head, or the legs. I can see the mesh only in the body of the stickman and nowhere else. Does this problem arise because the sprites are not connected, or is there any other reason? I am very new to game development, therefore please try to explain it in simple words. Thank You.

sentences:
Ipad - actionsheet not showing all buttons in landscape mode when keyboard is present I am developing an Ipad application. It supports both landscape and portrait mode. The app has keyboard.It also shows an action sheet with 4 buttons when required. In portrait mode it works perfectly. But in landscape mode action sheet only show 2 buttons when keyboard is there .Without keyboard it show all 4 buttons.
Any solution?

sentences:
Finding inspiration / help for making up (weapon) names I'm really bad with words, especially with English words. Currently I'm struggling to make a good weapon names for my game, it needs to display the weapon functionality (weak/strong/fast/ballistic etc) correctly as well. For example the best weapon in a (futuristic) game cannot be called just with the name "Laser", it's just too boring, right?

Are there any tools, websites or anything that helps me finding good names for weapons? (or anything else similar).

I was thinking to use scientific names, but noticed that they are really hard to write, and they get very long, and I also lack information about science, I only know I could use the atomic sub-particles names in the weapons for example.

How do I get started with becoming good with making up names? (this could apply in generally to any naming problems).

sentences:
About Alpha blending sprites in Direct3D9 I have a Direct3D9 application that is rendering ID3DXSprites. The problem I am experiencing is best described in this situation:

I have a texture that is totally opaque.
On top of it I draw a rectangle filled with solid color and alpha of 128.
On top of the rectangle I have a text that is totally opaque.
I draw all of this and get the resulting image through GetRenderTarget call.
The problem is that on the resulting image, on the area where the transparent rectangle is, I have semi transparent pixels. It is not a problem that the rectangle is transparent, the problem is that the resulting image is.

The question is how to setup the blending so in this situation I don't get the transparent pixels in the resulting image?

I use the sprite with D3DXSPRITE_ALPHABLEND which sets the device state to D3DBLEND_SRCALPHA and D3DBLEND_INVSRCALPHA. I tried couple of combinations of SetRenderState, like D3DBLEND_SRCALPHA, D3DBLEND_DESTALPHA etc., but couldn't make it work.

Thanks.

sentences:
Should I use different input layout for meshes (vertices) with and without normal maps? I'm writing an DirectX11 game.

About 60% of my game models (or "of my vertices") have:

Position
Texture coordinate

Some of them use:

Position
Texture coordinate
Normals

And few of them:

Position
Texture coordinate
Normals
Tangents
BiTangents

And I have about 10 shaders:

3 of them assume that vertices have just position and texture coordinates
5 that they also have normals
2 make use of tangent/bi-tangent info

The question is: should I create 3 vertex structures and 3 D3D11_INPUT_ELEMENT_DESC arrays for them (option 1)? Or create only one, universal vertex structure (the last one, 5 members) and 1 D3D11_INPUT_ELEMENT_DESC for it (option 2)?

What I see:

Option 1:

No unused data will be transfered to shader - e.g. 60% of models will be rendered with simple shader that don't calculate normal maps and we will send to him just position/texture coordinate.

Option 2:

Only one input structure, no need to switch vertices types - simpler code, maybe faster (no switching)?, no need to bother if new shader needs 1st, second or third structure (we can just pass everything to it and it will decide which members to use).

sentences:
How to expose game data in the game without a singelton? I'm quite new to cocos2d and games programming, and am currently I am writing a game that is currently in Prototype stage. Everything is going okay, but I've realized a potentially big problem and I am not sure how to solve it.

I am using a singelton to store a bunch of arrays for everything, a global list of planets, a global list of troops, a global list of products, etc.  And only now I'm realizing that all of this will be in memory and this is the wrong way to do it.

I am not storing files or anything on the disk just yet, with exception to a save/load state, which is a capture of everything.

My game makes use of a map which allows you to select a planet, then it will give you a breakdown of that planets troops and resources,

Lets use this scenario:

My game has 20 planets. On which you can have 20 troops.

Straight away that's an array of 400!

This does not add the NPC, which is another 10.

So, 20x10 = 200

So, now we have 600 all in arrays inside a Singelton.

This is obviously very bad, and very wrong.  Especially as the game scales in the amount of data.

But I need to expose pretty much everything, especially on the map page, and I am not sure how else to do it.

I've been told that I can use a controller for the map page which has the information I need for each planet, and other controllers for other items I require global display for.

I've also thought about storing each planet's data in a save file, using initWithCoder however there could be a boatload of files on the user's device?

I really don't want to use a database, mainly because I would need to translate NSObjects and non-NSObjects like CGRects and CGPoints and Colors into/from SQL.

I am open to other ideas on how to store and read game data to prevent using a singelton to store everything, everywhere.

Thanks for your time.

sentences:
Multi-level 3D grid based pathfinding in Unity I'm trying to come up with a way to pathfind on multiple levels. See image:

The orange walls would be considered a ladder, connecting you to the upper levels.

At first I thought of looking at it as though it were top down 2d, but I also need to be able to go under things at some point. How can I compute these paths?

sentences:
Rendering to specific face of a cubemap I have working omnidirectional shadow maps for point lights. Rendering a shadow map for one point light consists of rendering the scene to 6 separate rendertargets, then send those render target textures (shaderresourceviews) to a pixel shader which will shadow the scene by projective texturing. Switching rendertargets 6 times for each point light however is quite costly, and so does sampling from those in the pixel shader later.
My question is how would I access a face of the cubemap to render to? Now I am doing Id3d11devicecontext::omsetrendertargets(1,NULL,&depthtarget) . My depthtarget is a texture2d which is bound to a depthstencil view and a shaderresource which is set up to be a cubemap. Can I even set an individual face to render to or is the process completely different?

sentences:
Alternatives to Component Based Architecture? Usually when I develop a game I will use an architecture like what you see below. What other architectures are popular for simple game development? I'm concerned about having a narrow view of what exists out there for architectures beyond this. Is this an example of component-based architecture? Or is this something else? What would that look like? What alternatives exist?

public abstract class ComponentBase {

    protected final Collection<ComponentBase> subComponents = new LinkedList<ComponentBase>();

    private boolean enableInput;
    private boolean isVisible;

    protected ComponentBase(boolean enableInput, boolean isVisible) {
        this.enableInput = enableInput;
        this.isVisible = isVisible;
    }

   public void render(Graphics2D graphics) {
        for(ComponentBase gameComponent : this.subComponents) {
            if(gameComponent.isVisible()) {
                gameComponent.render(graphics);
            }
        }
    }

    public void input(InputData input) {
        for(ComponentBase gameComponent : this.subComponents) {
            if(gameComponent.inputIsEnabled()) {
                gameComponent.input(input);
            }
        }
    }

    ... getters/setters ...

    public void update(long elapsedTimeMillis) {
        for(ComponentBase gameComponent : this.subComponents) {
            gameComponent.update(elapsedTimeMillis);
        }
    }

}

sentences:
PVRCT Texture Format with glTexStorage2D on Open GL 3.0 ES How? I've looked everywhere and I can't seem to find the answer.

How can I use glTexStorage2D with PVRCT textures? I've done this:

#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02

glTexStorage2D(GL_TEXTURE_2D, 1, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, m_uPixelsWide, m_uPixelsHigh );

Where the GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG internal format works for glTexImage2D, but when I run that Tex Storage command, my pvr textures come out black. There are no errors posted, and when I query glGetTexParameteriv, my texture is indeed set to Immutable.

Does PVRCT not work for opengl 3.0?

sentences:
ID3D11DeviceContext Map/Unmap bottleneck I maintain a small rendering engine that displays models in Direct3D 9. I'm currently migrating this to Direct3D 11, and I've hit a snag in how I display points on the model. Using a sphere mesh, I translate to each point in the local coordinates, and draw the mesh. In Direct3D 9, I was using the fixed function pipeline for the drawing of the mesh. So, I would just change the world matrix for each point and draw the mesh. Obviously in Direct3D 11, I need to use shaders and update constant buffers.

The problem I've run into is the high volume of Map/Unmap calls I need to make so that I can set the constant buffers with the updated world matrix. This is creating a bottleneck and the framerate is slower than the Direct3D 9 implementation. If I remove the Map/Unmap calls, performance is much better, but obviously the meshes are in the wrong spot when I do this.

Am I missing something? Is there a better way to be doing this? It seems strange to me that I can't mirror the same performance I got from Direct3D 9. One thing I should note is that this is done in C++/CLI, so there is some marshaling going on, but from what I can tell via benchmarking, that doesn't have anything to do with the slow down.

Here is my code:

D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT result;

result = device->UnmanagedContextPointer->Map(d3dBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
Marshal::StructureToPtr(data, IntPtr(mappedResource.pData), false);
device->UnmanagedContextPointer->Unmap(d3dBuffer, 0);

Any insight would be greatly appreciated, thanks!

sentences:
XNA 4: GetData from Texture2D and Set it into Texture3D with specific order I am trying to convert my color grading 2d lookup texture into 3d LUT. When I simply use:

ColorAtlas.GetData(data);
ColorAtlas3D.SetData(data);

I get this:

I tried building my 2d atlass horizontally but it did not helped - the data was messed up in a different way.

So my question is how can I influence the order of the data I get from the 2d atlas and how can I properly pass it into my 3d atlas?

Update: I know that I can GetData from a specific Rectangular area and put it into several arrays, but the result is still the same. This is what I tried:

        Color[] data2D = new Color[0];

        for (int i = 0; i < 32; i++)
        {
            Color[] data = new Color[32 * 32];
            GraphicsDevice.SetRenderTarget(null);

            ColorAtlas.GetData(0, new Rectangle(0, i*32, 32, 32), data, 0, data.Length);

            int oldLength = data2D.Length;

            Array.Resize<Color>(ref data2D, oldLength + data.Length);
            Array.Copy(data, 0, data2D, oldLength, data.Length);
        }
        ColorAtlas3D.SetData(data2D);

sentences:
Not able to change the background of the scene in cocos2dx android I have started Game Development using Cocos2d-x. And started with HelloWorld sample game. I am able to run this sample game. But when I try to change the Background Color, I am getting error in

 HelloWorldScene.h
    The type 'HelloWorld' must implement the inherited pure virtual method 'cocos2d::CCRGBAProtocol::setOpacity'

Changes:
class HelloWorld : public cocos2d::CCLayerColor

and also in

 **HelloWorldScene.cpp**

    Invalid arguments '
    Candidates are:
    bool initWithColor(const cocos2d::_ccColor4B &, ?, ?)
    bool initWithColor(const cocos2d::_ccColor4B &)
    '
   **Changes:**
   CC_BREAK_IF(!CCLayerColor::initWithColor(ccc4(255,255,255,255)));

I am new for Cocos2d-x and also for C++. Is there any thing left to include or what?

sentences:
Making Bigger Touch Space in Node Using SpriteKit And Objective-C I am trying to make simple game, but I have a problem. The node is too small. On iPhones with smaller screen size, the finger can't move it. On iPad and on simulator, however, the node can be moved due to larger sizes of the screens. Due to that, I know it's not the code that causes the issue.

Due to the fact that I am using this paddle image on many levels, I create it as separate file so I can implement it anywhere I want within the app.

Here is what I got:

PaddleNode.m

- (id)init
{
    return [self initWithName:@"paddle"];
}

- (id)initWithName:(NSString *)name
{
    self = [super init];
    if (self) {

        self = [PaddleNode spriteNodeWithImageNamed: @"board.png"];
        self.userInteractionEnabled = YES;
        self.name = name;
        self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];
        self.physicsBody.dynamic = NO;
        self.physicsBody.usesPreciseCollisionDetection = YES;
        self.physicsBody.categoryBitMask = paddleCategory;
        self.physicsBody.collisionBitMask = emptyCategory;
        self.currentTouchValue = nil;
    }

    return self;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.previousTouchesTimestamp = event.timestamp;
    for (UITouch *touch in touches) {
        self.currentTouchValue = [NSValue valueWithNonretainedObject:touch];
    }
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.currentTouchValue = nil;
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch *touch in touches) {
        NSValue *key = [NSValue valueWithNonretainedObject:touch];
        if ([key isEqualToValue:self.currentTouchValue]) {
           CGPoint touchPoint = [touch locationInNode:self.scene];
           CGPoint movePoint = CGPointMake(self.position.x, touchPoint.y);

           if ([self withinParentFrame:movePoint])
               self.position = movePoint;
       }
    }
 }

 - (BOOL)withinParentFrame:(CGPoint)point
 {
    CGFloat offset = self.size.height / 2;
    if (point.y >= offset && point.y <= self.scene.frame.size.height - offset)
        return YES;
    else
        return NO;
 }

P.S. I am learning Objective-C by myself and English is not my first language. So, if it's OK, explain me like you would to little child.

sentences:
How should I share variables between instances/classes? I'm making a game using LOVE, so everything is programmed in Lua. I've been experimenting with using classes and object orientation recently. I've found out that a nice system to use is having most of the game's code in different classes, and having a table of instances with all of the instances of any class in it. This way, I can go through every instance of every class and update and draw it by calling the same function.

There is a problem, though. Let's say I have an instance of a player with variables for health and recharge time of a weapon. I also have a master instance which is responsible for drawing the HUD. How can I tell the master instance what the player's health is? Bad solutions:

Assuming that the player instance will always have the same position in the table - that can be easily changed.
Using global variables. Global variables are evil.
Have the master instance outside of the instances table, and have the player set variables inside the master instance, which it then uses for HUD drawing. This is really bad because now I have to make a duplicate of every variable the master instance needs.

What is the proper, standard way of sharing variables between instances? Do I need to change the way I keep track of instances?

Edit: the hump library for LOVE has a signal/slot system. Would that be a reasonable way to share variables between instances?

sentences:
Calculate the direction, From Outer Polygon Point to Inner Polygon inside Point I was able to find the co-ordinates of inner Polygon using this trick.

Need the co-ordinates of innerPolygon

But, I have some problem in getting the direction from Outer Polygon Point to Inner Polygon inside Point? See this image, I need to make sure that the direction should be from inner to outer.

sentences:
Unity Mirror Network Transform not working I am having an issue with Mirror's network transform component in unity. Players cannot see each other move, and in the inspector window only the host's player moves (this is not updated to the connected player though). In the inspector window you see a sphere moving and facing in the direction of the connected player (I did not program this so it must be Unity trying to tell me something) as per the picture below.

Any help is much appreciated as there doesn't seem to be anybody that I can find online with a similar problem.

Thank you!

sentences:
Volume that encompasses the whole scene? I'm thinking that the straight-forward way would be to just iterate through the objects and just find the maximum and minimum coordinates on each axis, but this seems a little bit unoptimal.

Is there a faster, more efficient way of doing this?

sentences:
CreateRenderTarget returns 0x80070057 in big surface resolution I have created the SLI merged desktop of three 1920x1680 monitors, so the desktop resolution is 5760x1080.

There is a 0x80070057 error, while calling CreateRenderTarget to create the RT_Surface:

IDirect3DSurface9* _render_surface;
HRESULT hr = _device->CreateRenderTarget(
        _desktop_width * 2,
        _desktop_height + 1,
        D3DFMT_A8R8G8B8,
        D3DMULTISAMPLE_NONE,
        0,
        TRUE,
        &_render_surface, NULL);

It works OK with desktop resolution 1024x768, and the total resolution is 3072x768.

In http://msdn.microsoft.com/en-us/library/windows/desktop/bb174361(v=vs.85).aspx, it says

  If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_NOTAVAILABLE, D3DERR_INVALIDCALL, D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY.

and no description about 0x80070057.

  HRESULT: 0x80070057 (2147942487)
  Name: E_INVALIDARG
  Description: An invalid parameter was passed to the returning function

Somebody please help me.

I tried to check MaxTextureWidth and MaxTextureHeigh in D3DCAPS9 structure as @mh01 indicated, and got the value 8192 both. And what I trying to create is 11520x1080.
So, my question is what effects the value of MaxTextureWidth and MaxTextureHeigh? VideoCard model or some setting in the BIOS?

I got the below information as @RayDey said, while turn on the debug level:

  Direct3D9: (INFO) :======================= Hal HWVP device selected
  Direct3D9: (INFO) :HalDevice Driver Style b
  Direct3D9: :Subclassing window 000d0612
  Direct3D9: :StartExclusiveMode
  Direct3D9: (INFO) :Using FF to VS converter
  Direct3D9: (INFO) :Using FF to PS converter
  Direct3D9: (INFO) :Enabling multi-processor optimizations
  Direct3D9: (INFO) :DDI threading started
  D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 9.2074e-316f.  This is ok.
  Direct3D9: :WM_ACTIVATEAPP: BEGIN Deactivating app pid=00000c9c, tid=00000728
  Direct3D9: :DoneExclusiveMode
  Direct3D9: :INACTIVE: 00000c9c: Restoring original mode (1680x1050x22x120) at adapter index 0
  Direct3D9: :* Active state changing
  Direct3D9: :WM_ACTIVATEAPP: DONE Deactivating app pid=00000c9c, tid=00000728
  Direct3D9: (ERROR) :Failed to create driver surface
  Direct3D9: (ERROR) :Error during initialization of surface. CreateRenderTarget/CreateDepthStencil failed
  Direct3D9: (ERROR) :Failure trying to create render-target
  D3D9 Helper: IDirect3DDevice9::CreateRenderTarget failed: E_INVALIDARG

sentences: Unity animator causing lights to turn on sluggishly? I've got lights on a vehicle that I am controlling using several animations. I have an animator with multiple layers and everything works properly. However, I am having an issue where the lights take roughly half a second to reach full brightness. In the inspector, it does not show the intensity rising from 0-3, it just shows them already set to 3. If I preview the animation without the controller, the lights are on instantly. But for whatever reason, when running through the controller, they "come on slowly", not like when you flip a switch and lights are instantly "on", these turn on and take time to reach full brightness. I have ensured I do not have an exit time, and do not have fixed duration checked, and transition duration is set to 0. I have also tried to speed up the animation "Speed" property just to see if it would change anything but had no effect. Does any one have any idea why this is happening? thank you!

sentences:
DirectX 11 Mouse Picking Problem I'm trying to do mouse picking and actually it works but when I scale the object and click that point on the image it picks wrong one, this happens only after scaling an object and I'm sure matrices are correct, any idea?

    DirectX::XMFLOAT4X4 projection;
    DirectX::XMStoreFloat4x4(&projection, Graphics::projectionMatrix);

    float viewX = ((2.0f * Input::GetMouseX()) / MainWindow::GetDisplayResolution().width - 1.0f) / projection(0,0);
    float viewY = (1.0f - (2.0f * Input::GetMouseY()) / MainWindow::GetDisplayResolution().height) / projection(1,1);

    DirectX::XMMATRIX inverseMV = DirectX::XMMatrixInverse(nullptr,DirectX::XMMatrixTranspose(entity->Renderer_->MV_Matrix)); //MV is column order

    DirectX::XMVECTOR rayOrigin = DirectX::XMVector3TransformCoord(DirectX::XMVectorSet(0.0f,0.0f,0.0f,1.0f), inverseMV);
    DirectX::XMVECTOR rayDirection = DirectX::XMVector3Normalize(DirectX::XMVector3TransformNormal(DirectX::XMVectorSet(viewX, viewY, 1.0f, 0.0f), inverseMV));

    for (const auto& subMesh : entity->Renderer_->mesh->GetSubMeshes())
    {
        float distance = 0.0f;
        if (subMesh.AABB.Intersects(rayOrigin, rayDirection, distance))
        {
            for (unsigned int i = 0; i < subMesh.GetIndexCount(); i += 3)
            {
                DirectX::XMVECTOR p1 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i]]);
                DirectX::XMVECTOR p2 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 1]]);
                DirectX::XMVECTOR p3 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 2]]);

                if (DirectX::TriangleTests::Intersects(rayOrigin, rayDirection, p1, p2, p3, distance) && distance < minDistance)
                {
                    minDistance = distance;
                    *pickedEntity = entity;
                }
            }
        }
    }

sentences:
Best source for sound effects? What is a good source for sound effects for use in an indie game production (C#, XNA)?

The sounds do not need to be free.
They, however, should have a clear licence for commercial use.
The website should allow for searching, browsing and preview (or better: pre-listening).

I already had a look at http://www.1soundfx.com but their collection is not too large. I am specifically looking for sound effects. No music and no ways to make my own sounds.

All help is greatly appreciated!

sentences:
Generating Weapon Damage Based on Item Level I bring with me a question on loot generation from ARPGs.  In Diablo 3, items are generated for each level range, with damage range being defined manually.

I need help with an equation that generates weapons with damage scaling up based on level.

Level 1 - LowD - Lowest Damage

Level 80 - CapD - Cap Damage

I would like to generate weapons that scale linearly in damage based on item level. So item level is an important variable.

There are two additional factors: min damage and max damage.

Damage Range Example
Level X Sword: MinDmg - MaxDmg

MinDmg is a random number rolled by dice based on the linear scale with level.
MaxDmg likewise, is a random number rolled by dice based on the linear scale with level.

Level 1 Sword: 1-3

Level 10 Sword: 10-15

Level 10 Sword: 9-14

Level 80 Sword: 250-300

CapD is there to set the ceiling that the maximum range can reach up to.
Example is the max damage a level 80 sword can deal.

sentences: Are there any benefits for using the CPU instead of the GPU? I've been researching processors and graphics cards, and I discovered that GPUs are way faster than CPUs. I read in this one article, a 2-year-old Nvidia GPU outperformed a 3.2GHz Core I7 Intel processor by 14 times in certain circumstances. If GPUs are that fast, why don't developers use them for every function in a game? Is it possible for GPUs to do anything other than graphics?

sentences:
Bukkit shoot tnt & help with vectors I want to shoot a piece of tnt from the players face and then let it explode when it hits the target block.

        if (cmd.getName().equalsIgnoreCase("cannon")) {
        if(!perrmissionCheck(sender, "Needs.cannon", "cannon")){
            return true;
        }
        if (!(sender instanceof Player)){
            sender.sendMessage(nameC+"You must be a player to preform this command.");
            return true;
        }
        Block block = ((Player) sender).getTargetBlock(null, 50);
        Location location = ((Player) sender).getLocation();
        //float power = 4;
        //if (args.length == 1){
            //power = Float.parseFloat(args[0]);
        //}
        sender.sendMessage(name+"BOOM!");
        double x = block.getX();
        double y = block.getY();
        double z = block.getZ();
        TNTPrimed tnt = (TNTPrimed) ((Player)sender).getWorld().spawn(location, TNTPrimed.class);
        Vector v = new Vector(x, y, z);
        tnt.setVelocity(v);
        //block.getWorld().createExplosion(location, power);
        //block.getWorld().spawn(tntLoc, TNTPrimed.class);
        return true;
    }

This kinda just ramdomly throws the tnt and then exploads i want to get where the player is looking and then shoot it that way if someone could also describe how the args work for new Vector(arg0, arg1, arg2) i would appreciate it...

Thanks any help is great

EDIT
I relize this is really old but i wanted to share how I did it,

    int v = 2;

    if (args.length > 1){
        v = Integer.parseInt(args[0]);
    }

    final Vector direction = user.getEyeLocation().getDirection().multiply(v);

    TNTPrimed tnt = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), TNTPrimed.class);

    tnt.setVelocity(direction);

    user.sendMessage(name + "Boom!");
    plugin.inGameMsg.msgAdmins(plugin.chatDark_AQUA + user.getName() + plugin.chatGray + " used cannon command!");
    return true;

this sends the tnt right where the player is looking

sentences:
Help Improving Map Generation I've recently attempt for the first time to implement a map generation system and while it does work, it doesn't work exactly the same I want but I'm not really sure on what changes I can make it to make it generate the type of map I want.

This is my map generation code

///<summary>Generates a Room at a Start Position</summary>
    void GenerateMap(Vector2 roomStartPos)
    {
        Vector2 startPos = roomStartPos;

        int roomTileNum = random.Next(minRoomTiles, maxRoomTiles);
        for (int i = 0; i < roomTileNum; i++)
        {
            if (CheckTilePosValid(startPos)) //Checks if a position is taken by a tile already
            {
                Tile newTile = CreateTile(startPos); //Creates a Tile at a passed in Position
                startPos = GetRandomEdgeDirection(newTile.SpritePosition); //Gets a Random position next to the passed in Position

            }
            else
            {
                startPos = GetRandomEdgeDirection(startPos);
                i--;
            }
        }
    }

It's likely a really bad way of generating a map. It basically gets a random number of tiles to generate, it will then place a Tile at the start position and select a new position in a random direction (Up, Down, Left, Right). It'll then place a new tile at that new position specified, it will then simply loop through that till it's placed every tile.
The "CheckTilePosValid()" function is used to determine if the random position that is gathered has already been taken by a tile. If the position isn't taken then it will create the tile and continue through the loop, while if the position is taken then it will get a new position and basically keeping doing that till it gets a position that hasn't been taken already.

This generates maps like this:

The issue is mainly with the first image since as you can see, the map is very stretched out which isn't what I want. I'd more want a map similar to the second image, tiles much closer together and not so stretched out but is still random enough.

I'm just not sure how exactly I can achieve this so I was wondering if anyone would be able to help me? Would I need to completely rework my generation system or can I just make simple changes to fix this?
I'd very much appreciate the help :)

sentences:
How do you de/serialize a monobehaviour class? It seems JsonUtility.FromJson does not work for MonoBehaviour classes (and I can't get Newtonsoft to parse strings to Vector3s)
Suppose you have a MonoBehaviour class like this (so that the values can be easily specified in inspector in editor)

public class PropertyClass:MonoBehaviour{
  public Vector3 location;

  public string name;
}

Suppose you have json data downloaded as a string called text, that you try to convert to PropertyClass[] format via using an JSONHelper around JSONUtility.FromJson(text);
How do you have it autopopulate?
If you specify a FromJsonOverwrite solution - how do you have that work with JSONHelper?
using System;
using UnityEngine;
using System.Collections;

public static class JSONHelper
{
    public static T[] FromJson<T>(string json)
    {
        Wrapper<T> wrapper = UnityEngine.JsonUtility.FromJson<Wrapper<T>>(json);
        return wrapper.Items;
    }

    public static string ToJson<T>(T[] array)
    {
        Wrapper<T> wrapper = new Wrapper<T>();
        wrapper.Items = array;
        return UnityEngine.JsonUtility.ToJson(wrapper);
    }

    [Serializable]
    private class Wrapper<T>
    {
        public T[] Items;
    }
}
```

sentences: Count Unity terrain size In blender? My unity terrain size is 150*150, and I want to create a plane in blender have the same size. How to figure the correct size ?

sentences:
How to restrict the players movement win relation to screen bounds in Unity? (Without colliders) I am really enjoying making the switch to Unity. But here I have found one of those rare moments where it appears to make things more difficult (at least it is for me as I am crap at understanding the actual manual)

Basically my 'player' is a space ship. It starts life at 0,0,0 world coordinates and I have been doing all the movement based off of that. (ie. Add force X to move left or right, and there is a constant Z speed which is done via rb.transform.Translate().)

I want to restrict the movement on the X Axis, so in Libgdx id use something like:

if (player.position.x <= 0){ player.position.x = 0;}
if (player.position.x >= viewport.getX()){ player.position.x = viewport.getX();}

The thing is that wont work for me in Unity for several reasons (1. I dont know much about the viewport as I didnt create it. 2. the player.position is being affected by the rigidbody forces. AND i am working in world coordinates with the players position).

As I said, the player is constantly moving forward on Z axis, so making colliders doesnt seem like the right choice for me.

I'm pretty sure Unity devs would of put this in Unity v0.001 but I just cannot for the life of me find how to actually do it. (Any info I can find seems from like 2011 and also is pretty badly written code making this simple matter takes dozens of lines of code and some methods - I'm hoping there is  a Unity method already made, like player.transform.ScreenPosition or something but yeah I cannot find it!?

Any help would be massively appreciated as always.

sentences:
IConvertGameObjectToEntity interface on Unity ECS Was working on ECS and following the tutorials by Mike Geig in Unite Copenhagen on YouTube(https://youtu.be/BNMrevfB6Q0), and understood that unity automatically converts transforms, mesh renderers and things like that to ECS, the IConvertGameObjectToEntity interface converts entities that I want specifically for my game. But, while following his tutorial exactly as he did it, the entities that I have on my game do not have colliders in them, but is seen in his demo, how do I resolve that?

EDIT: I've Instantiated an entity, and it works fine, but then implementing the
void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem); from the IConvertGameObjectToEntity interface,  I just have an entity, and only the mesh is visible, and an empty Component data that I've assigned on the Convert() method is available, I don't have a collider as it is on the prefab.

Here is my Spawn Entity Code:

void Start (){
        manager = World.Active.EntityManager;
        ObjectEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(ObjectPrefab, World.Active);

        for (int i = 0; i < 100; i++)
            SpawnTheObject();

}

private void SpawnTheObject()
{
    Entity object = manager.Instantiate(ObjectEntityPrefab);

    manager.SetComponentData(object, new Translation { Value = transform.position });
    manager.SetComponentData(object, new Rotation { Value = Quaternion.identity });

}

Here is The code attached to The Object:

public class AsteroidLifeECS : MonoBehaviour, IConvertGameObjectToEntity {
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
    MoveSpeed moveSpeed = new MoveSpeed { Value = MovementSpeed }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, moveSpeed);

    RotateSpeed rotateSpeed = new RotateSpeed { Value = RotationSpeed }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, rotateSpeed);

    Health health = new Health { Value = Health }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, health);
}

}

sentences:
Keep 3d model facing the camera at all angles I'm trying to keep a 3d plane facing the camera at all angles but while i have some success with this:

Vector3 gunToCam = cam.cameraPosition - getWorld.Translation;
Vector3 beamRight = Vector3.Cross(torpDirection, gunToCam);
beamRight.Normalize();
Vector3 beamUp = Vector3.Cross(beamRight, torpDirection);
shipeffect.beamWorld = Matrix.Identity;
shipeffect.beamWorld.Forward = (torpDirection) * 1f;
shipeffect.beamWorld.Right = beamRight;
shipeffect.beamWorld.Up = beamUp;
shipeffect.beamWorld.Translation = shipeffect.beamPosition;

*Note: Logic not wrote by me i just found this rather useful

It seems to only face the camera at certain angles. For example if i place the camera behind the plane you can see it that only Roll's around the axis like this:

http://i.imgur.com/FOKLx.png (imagine if you are looking from behind where you have fired from.

Any idea what to what the problem is (angles are not my specialty)

shipeffect is an object that holds this class variables:
public Texture2D altBeam;
public Model beam;
public Matrix beamWorld;
public Matrix[] gunTransforms;
public Vector3 beamPosition;

sentences: How would I write a shader that supports 2 different texture coordinates? Hi I am not very good with writing shaders. How would I make a shader that simply supports 2 texture coordinates so I can load up 2 different textures to be used at the same time but on different parts of my world? Right now I have 1 texturecoord variable setup and I load a texture through it using GraphicsDevice->SetTexture(0, &Texture); and making sure my VertexDeclaration and FVF both support that, but how can I add a second texture to this? Would I make it so that I make separate coordinates and link the coordinates to a texture? How would I write that?

sentences:
Directly pass from transform feedback buffer to fragment shader I am building terrain using a lod algorithm and deferred cascaded shadowmaps. The tessellated terrain is about 6,000,000 triangles. I tried this using 2 methods.

1st method: Both the deferred shadow program and the drawing program use tessellation shaders to tessellate the terrain. The tessellation stage for each program is exactly the same.

2nd method: I have 3 programs. The first program tessellates the terrain and stores it on the GPU using transform feedback. The second program uses the transform feedback buffer to render to shadow depth buffer. The third program uses the transform feedback buffer to draws the scene. This way I avoid tessellating the terrain twice.

To my surprise, the 2nd method was actually much slower until I started using the separation of the tessellation phase to tessellate the terrain less frequently. Now the methods are about the same fps, but in the 2nd method the terrain mesh is being updated less frequently.

Shouldnt the 2nd method be faster even if I tessellate every frame like the first method? The only thing I can think of is that the passthrough vertex shaders for the shadow and main program both have to copy 6,000,000*3 vertices even though they are just passthrough shaders. In the first method, the data would be passed right from tessellation shader to the fragment shader. So...

Does a passthrough vertex shader use the transform feedback buffer data directly, or does it copy every single vertice (even though it's the same), and use the copied data?

...
{
    out_position = in_position;
    out_normal = in_normal;
    out_uv = in_uv;
}

Is there any way I can speed this up?

Thanks in advance :)

Edit:

I should note that the example is for the shadow  program, the geometry shader applies different mvp matrices, culls, and asigns layers.

In the main program, I use
    gl_Position=mvp*in_position;
to allow gl to cull back facing triangles, but the normals and uvs are still passthrough.

sentences: Game-App deep linking is working in all android phone, but it is not working in tablets . Do i need to add any manifest code to work it in Android? This is my manifest, which is used for App indexing auto complete and deep linking.

sentences:
C++: Checking if an object faces a point (within a certain range) I have been working on a shooter game in C++, and am trying to add a feature whereby missiles shot must be within 90 degrees (PI/2 radians) of the direction the ship is facing. The missiles will be shot towards the mouse. My idea is that the ship's angle of rotation is compared with the angle between the ship and the mouse (std::atan2(mouseY - shipY, mouseX - shipX)), and if the difference is less than PI/4 (45 degrees) then the missile can be fired. However, I can't seem to get this to work.
The ship's angle of rotation is increased and decreased with the A and D keys, so it is possible that it isn't between 0 and 2*PI, hence the use of fmod() below.

Code:

float userRotation = std::fmod(user->Angle(), 6.28318f);
if (std::abs(userRotation - missileAngle) > 0.78f) return;

Any help would be appreciated. Thanks!

sentences:
How can I change the background color of the image? I'm trying to change my background image color, but somehow it doesn't work.
I have provided my code below and hope you will be able to tell me how I should do this, and why my code didn't work.
import pygame

class Wooden_Boy:

    def __init__(self, win_game):

        self.screen = win_game.screen
        self.screen_rect = win_game.screen.get_rect()

        self.image = pygame.image.load("alien_invasion/images/wooden_boy.png").convert()
        self.image.set_colorkey((0, 0, 255))
        self.rect = self.image.get_rect()

        self.rect.center = self.screen_rect.center

    def blitme(self):
        self.screen.blit(self.image, self.rect)

This is my second code which is connected with wooden boy:
import sys
import pygame
from wooden_boy import Wooden_Boy

class Window:

    def __init__(self):

        pygame.init()

        self.screen = pygame.display.set_mode((1200, 800))
        pygame.display.set_caption("Pygame Window")

        self.boy = Wooden_Boy(self)

        self.bg_color = (0, 0, 255)

    def run_window(self):
        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    sys.exit()

            self.screen.fill(self.bg_color)
            self.boy.blitme()

            pygame.display.flip()

if __name__ == "__main__":
    win = Window()
    win.run_window()

sentences:
Detecting wins in peer to peer RTS games like Starcraft A typical RTS game is implemented with the standard networking model: peer to peer lockstep.

Consider Starcraft 2, given that Battle.net presumably doesn't know anything about the state of game given that there is only communication between the two players in a peer to peer model, how does Battle.net know who was the winner in the end. Relying on the two peers to not try to cheat and report accurate results is naive.

sentences:
Is it normal in skeletal animation to NOT consider the translation component in bone transform matrices? I'm using assimp to load a model, and DirectX11 and DirectX ToolKit to render it.

In the document of DirectXTK's IEffectSkinning, it says:

  As an optimization, SkinnedEffect and DGSLEffect assume that all the
  matrices are affine transformations, and that the final column is (0 0
  0 1). This means that the value of the last column is effectively
  ignored when set into the constant buffer containing the bone
  transformations (i.e. the shaders use float4x3)

Is this the convention when implementing skeletal animation ?

Does it have negative repercussions ? If it does, what are they ?
Do some animated models require the translation components to be considered?

sentences:
Animating a rigged 3D model in untiy I made this 3D model of sonic in Blender complete with its own rig for animating. I would like to use this for testing 3D movement in unity along with the animator tool. However, when I export the fbx file to my unity project it shows up as intended with the armature and the mesh, however, moving the individual components of the rig have no effect on the mesh? I'm not sure why this isn't working like blender, any help  in regards to reading material or any options I have left unchecked that prevent this from working would be greatly appreciated!
I know I havent given much information here, but I havent been able to find a good tutorial on any of this that doesnt involve importing animations from another program, I just want to be able to rig and animate a model I made in blender using Unitys animator tool.

sentences: LWJGL Rendering a 2D Object at a Certain Position On-Screen Okay, so in LWJGL, how can I render a 2D object (maybe for like a menu, or meter that shows up on screen during the game), and have control over size and position on screen? So I can tell it what position relative to the screen. It is a 3d game using gluPerspective (as opposed to glOrtho).

sentences:
Create a instance of a C++ class within a blueprint I'd like to create an instance of a C++ class in a blueprint.
That's my current approach, but the instance is None. Why?

sentences: GLSL Shader Solution for Ambient Occlusion? For the iOS app I am writing I want to incorporate some aspects of ambient occlusion for photo manipulation. Can someone suggest a GLSL approach that will work. Realtime performance is not super critical. Under a second compute time is fine.

sentences:
How to make a cylindrical collider for a cylindrical mesh in UE4 When I am importing Axis Alligend cylindrical mesh in UE4 here is what I get as an automatically generated collider:

But if I rotate the mesh in Maya and again exprot FBX to improt in UE4 here is what I get:

As you can see the object is the same but the collider is much worse. How can I make the same callider in spite of the orientation of the cylinderical mesh?

BTW if I remove collider and do auto convex collider:

I get this:

Which is very good but the problem is that I want it to be generate from the beginning and not later when I edit the mesh collider. How can I achieve that?

sentences:
Finding the point of collision I'm writing a 2D rigid body simulator. The objects being simulated are convex polygons. My question involves how to decide on the "point" of collision, so that when I apply a response force, I can also calculate torque.

In 2D, the popular method of narrowphase collision detection seems to be the Separating Axis Theorem. However, while this gives you the "are they colliding?" as well as "by how much?", it does NOT give you a reference point (that I'm aware of) at which to apply the response force (and thus calculate torque)*.

The other method (which also interests me more, because it's what's used in 3D, which would be the logical next step) is to calculate the Minkowski difference of the two polygons, and decide that they're colliding if (0,0) is contained in the resulting polygon. But, how do you use this to decide the relative point at which to apply the response force? My hypothesis is that, since each face of this difference effectively corresponds to a face of one of the polygons, the separation distance is the shortest distance from (0,0) to the MD, and you apply this to the corresponding face on the polygon.

As a bonus, how does one do this in 3D?

*As I'm writing this, I just realized that, when using SAT, I could just keep track of which points are overlapping, and apply the force at the "average" of those points. But I would have to decide on which of the several non-separating axes to perform this little trick...

sentences:
Unity UI circular clickable area I'm building some somewhat involved UI stuff using the Shapes vector package.
I need to be able to detect clicks on a circle, but also need to be able to click on things right next to that circle in all directions (it's a large circle).
I can limit the detected clicks to within the circle by simply using a square and checking distance of click from center of circle. But this still obscures clickable things behind the square but outside of the circle (in the corners of the square).
How can I detect those?
Thanks!

sentences:
remove sudden upward & downward jerk from camera I have a scene with low poly assets & NavMesh enabled for character navigation. When player climbs the bridge there's a sudden upward jerk in camera. Also, when the player comes down, there's a downward jerk in Camera.

I want the camera movement to be smooth so it appears as if the y-axis of the camera is floating like a drone. Below is my script that I'm using

public class FollowCamera : MonoBehaviour {

float MIN_X = -26.72f;
float MAX_X = 34f;
float MIN_Z = -6.22f;
float MAX_Z = 47.6f;
float MAX_Y = 15f;
float MIN_Y = 0.6f;

public float startYPositionOfCamera;

// The target we are following
public Transform target;
// The distance in the x-z plane to the target
public float distance = 10.0f;
// the height we want the camera to be above the target
public float height = 5.0f;
// How much we
public float heightDamping = 2f;
public float rotationDamping = 3.0f;

[AddComponentMenu("Camera-Control/Smooth Follow")]

void Start()
{
    startYPositionOfCamera = transform.position.y;
}

void LateUpdate()
{
    // Early out if we don't have a target
    if (!target) return;

    // Calculate the current rotation angles
    float wantedRotationAngle = target.eulerAngles.y;
    float wantedHeight = target.position.y + height;

    float currentRotationAngle = transform.eulerAngles.y;
    float currentHeight = transform.position.y;

    // Damp the rotation around the y-axis
    currentRotationAngle = Mathf.LerpAngle(currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);

    // Damp the height
    currentHeight = Mathf.Lerp(currentHeight, wantedHeight, heightDamping * Time.deltaTime);

    // Convert the angle into a rotation
    var currentRotation = Quaternion.Euler(0, currentRotationAngle, 0);

    // Set the position of the camera on the x-z plane to:
    // distance meters behind the target
    transform.position = target.position;
    transform.position -= currentRotation * Vector3.forward * distance;

    // Set the height of the camera
    transform.position = new Vector3(transform.position.x, currentHeight, transform.position.z);

    // Always look at the target
    transform.LookAt(target);

    // Clamp the position of camera so it doesn't go back of mountains
    transform.position = new Vector3(
            Mathf.Clamp(transform.position.x, MIN_X, MAX_X),
            Mathf.Clamp(transform.position.y, MIN_Y, MAX_Y),
            Mathf.Clamp(transform.position.z, MIN_Z, MAX_Z)
        );
}

}

sentences:
Sprite Animation using cocos2dx 2.0.2 I am trying to implement sprite animation using coco2dx. I have tried several demos, but all of them are same. While I tried, getting violation error in my code.

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("AnimBear.plist");
    CCSpriteBatchNode *spreetsheet = CCSpriteBatchNode::create("AnimBear.png");
    this->addChild(spreetsheet);

CCArray *bearArray = new CCArray();
     for(int i = 1; i <= 8; i++)
{
        char name[32] = {0};
         sprintf(name, "bear%d.png",i);
        bearArray->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name));
}
    CCAnimation *walkAnim = CCAnimation::animationWithSpriteFrames(bearArray, 0.1f);
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    CCSprite *bear = CCSprite::spriteWithSpriteFrameName("bear1.png");
    bear->setPosition(ccp(size.width/2, size.height/2));
    CCAction *walkAction = CCRepeatForever::actionWithAction(CCAnimate::actionWithAnimation(walkAnim));
    bear->runAction(walkAction);
spreetsheet->addChild(bear);

Error is coming in first line while we passing plist refrence. I am using Visual Basic 2010 and put both files in Resource folder (png and plist).

sentences:
What are the other three "game dynamics"? Seth Priebatsch recently gave a tedtalk entitled “Building the game layer on top of the world.” In it, Seth described four “game dynamics,” techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were:

Appointment dynamic-a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example: happy hour)
Influence and status-the ability of one player to modify the behavior of another's actions through social pressure. (Example: different color credit cards as a reflection of status)
Progression dynamic-a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example: linkedin profile progress bar)
Communal discovery-a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example: finding interesting content on Digg.com)

Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?

sentences:
Implementation of finding an index in a 1D array for a triangular grid Am using a while loop to find an index within a 1D array, is there an easier, less-time-consuming and/or mathmatical way to find the index?

Consider the next grid:

 4   o
     |\
     | \
     |  \
 3   o---o
     |\  |\
     | \ | \
     |  \|  \
 2   o---o---o
     |\  |\  |\
     | \ | \ | \
     |  \|  \|  \
 1   o---o---o---o
     |\  |\  |\  |\
     | \ | \ | \ | \
     |  \|  \|  \|  \
 0   o---o---o---o---o

     0   1   2   3   4

To find an index in the triangular grid within a 1D array I have the next function:

//int size = 5;
int getindex( int x, int y )
{

    int columnCount = size;
    while( y-- > 0 ) x += columnCount--;

    return x;

}

The array (The numbers within the parenthesis are the coordinates and to simplify your view, in reality the (x,y) is in its whole the data):

pointdata data[ 15 ] = {
    (0,0), (1,0), (2,0), (3,0), (4,0),
    (0,1), (1,1), (2,1), (3,1),
    (0,2), (1,2), (2,2),
    (0,3), (1,3),
    (0,4),
};

sentences:
Working Qt controls in a 3d environment I need some advice from a Qt expert.

The background:
I have a 3D engine (ogre3d) working in concert with Qt. The 3D Content is displayed in a widget (using a custom OS window in the client area). I'm able to overlay arbitrary Qt widgets onto the 3d world using the widget render() method and a shared bitmap. This makes a great "heads up display". I can use the standard Qt style sheets and animation using this technique.

My goal
I'd like to go a step further and allow the user to move these rendered widgets using the mouse. I'd like some advice on the best way to implement this.

Possible solutions:

The widgets in the HUD are not part of the inheritance chain. I render them manually. They don't get events though. I could add them to the inheritance chain so they get events in the usual way. Then I would need to change them to render to my shared bitmap instead of to the operating system. I looked at this once but couldn't find enough information to implement it.
Capture mouse events in the 3D display widget and EMIT them to child controls. I basically create my own event handling chain.

Any suggestions on how to implement this?

I'm also considering switching to Qt5. I'm not sure how that might affect this decision.

sentences:
Long distance walking and fast travel I'm developing a sort of ’social mmmo’ where people build an avatar and chat with people around them, carryout tasks together, and play team games.

At the moment I have a product I want to release to beta testers but I only have 2 locations ready and they are quite far apart.

I have a fast travel system in place where people can pay to ride the bus making any journey take a short period of time.

If people run out of money they either have to earn more or make the walk themselves.

In the beta would it be better to make the bus free, or have people walk the empty land to get to the other town if they run out of money?

At the moment the land is just plain grass, hills, a river, and the odd tree with nothing of interest.

The journey currently takes around 10-15 minutes to walk if you know the way.

sentences:
Unity: Is there a way to edit a Skin file? My project has multiple skins and sometimes we have to deal with skins with many custom styles. Editing them in the editor is difficult, for instance, I cannot delete one style that is not the last one without deleting the ones after it.

Would there be a way to edit a file that represents this skin?

Could I edit a skin file if I use Text in the Asset Serialization Mode (Unity Pro)?

If not, is there something in the Unity Store to help me better edit skins?

sentences:
Rotating projectile in direction it is moving I am using a parabola curve to launch my arrows:

public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
    Func<float, float> f = x => -4 * height * x * x + 4 * height * x;

    var mid = Vector3.Lerp(start, end, t);

    return new Vector3(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t), mid.z);
}

I have a projectile that is a simple capsule scaled down to be long and thin like an arrow. I've tried every way to rotate it I could find online, but there is always something off. In order to follow the curve I need the direction between the last position and the new position, so I have been trying things like:

void ParabolaMovement() //Called in Update()
{
    parabolaAnim += Time.deltaTime;

    parabolaAnim = parabolaAnim % 5;

    Vector3 newPos = MathParabola.Parabola(start, target, 5f, parabolaAnim / 5);
    Vector3 dir = newPos - transform.position;
    transform.LookAt(dir);

    transform.position = newPos;
}

As for what is going wrong, it does not point AT the target, which I udnerstand it can't because nowhere do I specify target pos, which I should, but don't know where. I cannot simply tell it to lookat target, since I want it to lookat the direction it is currently going in the curve, but it also needs to face the target.

sentences:
How to translate vertex buffer coordinates in 2D I am trying to (using a 2D Directx9 engine library) rotate/translate a set of points in a vertex buffer.

I understand how this would be done in a 3D system - i.e using the vertex shader stage of the rendering pipeline with transformation matricies...

But Im not sure that applies in 2D? (or am I wrong).  I don't know where any of the vertex shader stage happens in 2D? or whether it happens at all.

Basically I can create a transformation matrix using some thing like D3DXMatrixTransformation2D()
and I know how to apply that to an LPD3DXSPRITE object (using Sprite->SetTransform()),  but how can I apply that transformation matrix to a set of 10+ coordinates stored in a vertex Buffer instead of a sprite.

Any help or suggestions would be greatly appreciated.
Thanks

sentences:
Season Change Reveal Effect I was watching the teaser trailer for Seasons After Fall, and I was struck by the effect they use to transition between seasons (around 21-24 seconds):

The level art, including the background and the foreground platforms, change from a sepia-coloured autumn to a lavender winter, with the effect spreading outward from the player character a bit like water soaking through paper.

It looks like more than just a palette change, as details in the leaf and bark patterns change in the transition.

How could I achieve an effect similar to this in a 2D Unity game?

sentences:
Rotate arrow on canvas I need to draw a flow dynamically based on some user choices. In that flow I want to draw the choices (blue circles with number) and the directions of that choices (line and arrow). For example: node 1 to node 2.

JSFiddle Example

To draw the direction I draw a arrow in the end of the line but I can't make the arrow rotate around itself.

JS code

$(document).ready(function () {
    drawOnCanvas();
});

function drawOnCanvas() {
    var canvas = document.getElementById('myCanvas');

    if (canvas.getContext) {
        var ctx = canvas.getContext("2d");

        var circle1 = {
            x: 75,
            y: 75,
            r: 15
        };

        var circle2 = {
            x: 225,
            y: 50,
            r: 15
        };

        var arrow =
            {
                h: 5,
                w: 10
            };

        drawCircle(ctx, circle1, "1");
        drawCircle(ctx, circle2, "2");

        var ptCircle1 = getPointOnCircle(circle1.r, circle1, circle2);
        var ptCircle2 = getPointOnCircle(circle2.r, circle2, circle1);
        var ptArrow = getPointOnCircle(circle2.r + arrow.w, circle2, circle1);

        drawLine(ctx, ptCircle1, ptCircle2);
        drawArrow(ctx, arrow, ptArrow, ptCircle2);
    }
}

function drawArrow(canvasContext, arrow, ptArrow, endPt) {

    var angleInDegrees = getAngleBetweenPoints(ptArrow, endPt);

    canvasContext.beginPath();
    // first save the untranslated/unrotated context
    canvasContext.save();

    // move the rotation point to the center of the rect
    canvasContext.translate(ptArrow.x, ptArrow.y);
    // rotate the rect
    canvasContext.rotate(angleInDegrees);

    canvasContext.moveTo(endPt.x, endPt.y);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y + arrow.h);
    canvasContext.lineTo(endPt.x - arrow.w, endPt.y - arrow.h);
    canvasContext.closePath();
    canvasContext.fillStyle = "rgb(72,72,72)";
    canvasContext.stroke();
    canvasContext.fill();

    // restore the context to its untranslated/unrotated state
    canvasContext.restore();
}

function drawCircle(canvasContext, circle, text) {
    canvasContext.beginPath(); //começa ou reinicia o desenho de algo
    canvasContext.fillStyle = "rgb(43,166,203)";
    canvasContext.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI, false); //cria arcos
    canvasContext.fill(); //atribui estilos

    drawText(canvasContext, circle, text);
}

function drawText(canvasContext, circle, text) {
    canvasContext.font = '8pt Calibri';
    canvasContext.fillStyle = 'white';
    canvasContext.textAlign = 'center';
    canvasContext.fillText(text, circle.x, circle.y + 3);
}

function drawLine(canvasContext, startPt, endPt) {
    canvasContext.moveTo(startPt.x, startPt.y);
    canvasContext.lineTo(endPt.x, endPt.y);
    canvasContext.stroke();
}

function getPointOnCircle(radius, originPt, endPt) {
    var angleInDegrees = getAngleBetweenPoints(originPt, endPt);

    // Convert from degrees to radians via multiplication by PI/180
    var x = radius * Math.cos(angleInDegrees * Math.PI / 180) + originPt.x;
    var y = radius * Math.sin(angleInDegrees * Math.PI / 180) + originPt.y;

    return { x: x, y: y };
}

function getAngleBetweenPoints(originPt, endPt) {
    var interPt = { x: endPt.x - originPt.x,
        y: endPt.y - originPt.y
    };

    return Math.atan2(interPt.y, interPt.x) * 180 / Math.PI;
}

I think the problem is in drawArrow() method in the lines

canvasContext.translate(ptArrow.x, ptArrow.y);

canvasContext.rotate(angleInDegrees);

I already tried every possible values for the rotation and the translation but arrow still don't rotate properly around itself. Can anyone help me?

sentences: Create a filled pixmap for box2d fixture I'm trying to make a pixmap that fills in a Box2D fixture. It would be kind of like a fill bucket. I've done this before, but I want it to work on rectangles and other polygons. Is there an algorithm to do is, or will I need to write on myself? Thanks.

sentences:
Block player movement What do i need to keep my player model from going through environment objects like walls, trees etc?

Im trying to figure out if should use rigid bodies and the built in physics but i feel that its too difficult to predict what will happen then.

Is there an alternative that still will prevent the player from going through environment objects?

At the moment my player is a 3d model compsosed of some primitive shapes and a capsule collider.

sentences:
Nuget in Unity with Mac OS I have moved over to Mac for Unity development, and am aware you can still use Windows .dll files in your project. I use NuGet as a secure method of getting specific dlls, and have usually done this on Windows by manually downloading the .nukpg and extracting the .dlls using WinRAR, then putting the dlls in Unity. So far, I have thought of two ways to do this on Mac:

1.) Doing the same thing, but with a WinRAR alternative that can open .nukpg

2.) Using Visual Studio for Mac that has a NuGet interface built in with Unity

Has anyone done this, or found a solution for getting package from NuGet in Unity for Mac?

sentences:
UDK, can you add your own effects? I'm new to game development and am curious to know if you can add your own cg effects? Like if I wanted to add fog to my game and UDK didn't support that, is that possible?

What kind of coding does one do, in a engine like UDK?

sentences:
How to store Unity Component after destroying a GameObject I have a collectible item, which I can put into the inventory. Its GameObject has a InventoryItem script attached in which I want to set all parameters needed for correct display in the inventory. Here is the C# code:

InventoryItem.cs

public class InventoryItem : MonoBehaviour {
    public bool collectible = true;
    public string name;
    public Sprite sprite;
}

Part of ItemCollectingController.cs responsible of passing data to InventoryController

if (Input.GetButtonDown("Use")) {
    InventoryController inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<InventoryController>();
    inventory.AddItem(target.GetComponent<InventoryItem>());
    Destroy(target);
    Debug.Log("Added to inventory");
}

And the important part of InventoryController.cs

public List<InventoryItem> items;
public void AddItem(InventoryItem item) {
    items.Add(item);
}

When collecting the item, the GameObject is destroyed and so is the reference in the InventoryController. The items List keeps a missing component. What can I do about that?

sentences:
When to unload graphics object from main memory? I writing my resource mangaer, and I consider about how it can work for graphics objects (like textures, meshes). I think about this :
I want to load texture (in pseudocode):

Texture t = resMgr.GetTex("image.png");

and GetTex make something like this:

load texture from disk to main memory
create texture object (load it to gpu memory)
unload texture from main memory

I consider about 3 step, does game engines that you know unload meshes/textures after load them into gpu memory ?

sentences:
How to use an overlapping shader so that it uses layers sort from sprite renderer and its transparent Im using the shader from
question
, but once I put it in the game, and my character gets close to it, it will be hidden by the shadow of the tree, which is transparent.
Any way to make the shader transparent and/or maybe use the sprite renderer sort layer system
I have been trying to use stencil configurable shader with no luck
Thank you for your help
Not sure what combination of these should work:

The character is using a normal sprite renderer.

sentences: I.T. degree for game programming? I am a 19 year old who has always been interested in video & computer games. I developed the interested for game programming about three months ago and started researching on the profession. The only degrees always suggested on the internet and in books are those of computer science, physics, mathematics, & game development. BSc Information Technology has been my major for the past two years; and even though my university teaches we the I.T. students computer programming (in c++, c#, java) and offers us the opportunity to undertake some computer science courses of our choice in addition to the regular I.T. courses, I am feeling insecure about my prospects in getting into the profession. My question is: Will a game development company hire me if I exhibit good math, physics and game programming skills with an I.T. degree? If NO, will I have to obtain an MSc in a much more related course.

sentences:
Parallax Scrolling Road-2D I'm working on a racing game which will have a top view from the back camera. The image below displays a similar example. I am confused about how to achieve the movement of the road if parallax scrolling is used. The road gets narrow as we move forward whereas it is broader closer to the camera. Should I focus on parallax scrolling to achieve this or is there some other technique to work with such games?

p.s. I'm using cocos2d-x as the gaming engine.

sentences:
Setting SteamVR Camera Target Eye before SteamVR installed in Unity I'm writing a plugin that can be used in both VR and non-VR projects. I have a Camera that is used to display UI containing some game info on a secondary monitor. My problem is that when the end-user adds my plugin and then imports steam vr, this UI camera's Target Eye is set to "Both" by default.

I can't have any SteamVR code in my plugin. But I can't adjust Target eye property of the camera without it. I just want it so that the camera doesn't change when a user imports SteamVR. I want it to always render to the main display (target eye = none)

So just to clarify,

I have my plugin, written in a non-vr project with a standard Unity camera. There is no Target Eye setting for this standard camera.
User wants to use it in VR project, imports plugin into SteamVR Project
Camera used to render UI gets automatically converted (wrongly) into SteamVR camera
Defaults to Target Eye = Both
Need it to be Target Eye = None

At the moment to avoid users submitting countless bug reports, I have to provide warnings in like 6 places telling users to dig way into my built-in prefabs to adjust this setting manually if they use SteamVR. It's not easy for new Unity users, and I want to make adoption as easy as possible.

sentences:
How to smooth jagged pixel edges in Unity? So I am reading an image from a png file into a 2D sprite. This sprite serves as a "province" in my game. Currently, I am getting this:

If you look closely, you will notice that you are seeing the square corners of each pixel, because I am mapping the image on a 1:1 ratio of pixels:world coordinates.

What I want is a slightly rounded corner in these places. Look at the 2-dimensional provinces in this example:

I have been googling around for algorithms, but most answers simply say "use a shader" and don't describe the techniques used to do this (until now I have not done much with shaders). If you would like to see my working code for the province system, it is posted on my answer to my own question here.

sentences:
How do I handle window resizing in SlimDX? I'm considering the use of SlimDX in a managed Windows Forms Application. Available with DirectX is DXUT. I use DXUT to handle events such as window resizing and 'lost devices.'

How well does SlimDX account for these occurrences? If I were to use SlimDX, how would I account for the functionality of DXUT in managed code?

sentences:
Adding multiple materials to a single mesh in three.js I've been doing some reading and can't seem to figure out a good way to do this..

I have a simple globe with a material on it like so:

const earthGeomerty = new THREE.SphereGeometry( 4, 48, 48 );
const earthDiffuse = loader.load('assets/drought_earth_texture.png');
const earthSpec = loader.load('assets/drought_earth_texture_bump.png');

const material = new THREE.MeshPhongMaterial( {
    specular: 0xffffff,
    map: earthDiffuse,
    specularMap: earthSpec,
    normalScale: new THREE.Vector2( 1, 1 ),
    shininess: 5,
    transparent: true,
    depthTest: true,
    depthWrite: false,
    polygonOffset: true,
    polygonOffsetFactor: - 4,
    wireframe: false
} );

and I apply this material to my earthGeometry like so:

const sphere = new THREE.Mesh( earthGeomerty, material );

but now I want to add an atmospheric glow, which I found a nice extension for and created like so:

const atmosphereMaterial = THREEx.createAtmosphereMaterial();

but after doing a ton of reading I'm unsure of how to use both material and atmosphereMaterial to my single sphere mesh.

Any help? Thanks!

sentences:
How to move/rotate different parts of an entity indepently from each other? Background: I am playing around with a simple isomorphic 3D shooter where a player controls a character which can shoot other players. Here's an example scene where you can also see the hierarchy for the game objects and the controlling script:

As you can see, I have created a simple turret which consists of three parts:

Guns
Torso
Bottom

Just to be more clear, here's a screenshot of the turret close up with its armature:

In Unity, I have already created a simple PlayerController.cs script (see beloc) which allows a player to move the entire game object around using W, A, S, D and look using the mouse.

However, I want to rotate the Bottom independently. So if the Player moves left, the bottom should rotate towards that direction but the torso should still focus on the mouse position.

Now the first question is how I can do that. I don't know how to get access to the game objects and rotate them independently. The second question is how I can or should design the player game object s.t. I can exchange models more easily. What I mean by that is: Imagine the player switches the weapon. Obviously, only the guns should change but e.g. not the entire character. Only the mesh etc. should change dynamically.

I am sure this isn't that hard to accomplish but I couldn't find a simple example that kind of explains how to do it.

PlayerController.cs

public class PlayerController : MonoBehaviour
{

    [SerializeField]
    public float moveSpeed = 1f;
    private Vector3 _forward;
    private Vector3 _right;
    public LayerMask layerMask;

    // Start is called before the first frame update
    void Start()
    {
        this._forward = Camera.main.transform.forward;
        this._forward.y = 0;
        this._forward = Vector3.Normalize(this._forward);
        this._right = Quaternion.Euler(new Vector3(0, 90, 0)) * this._forward;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.anyKey)
        {
            this.Move();
        }

        this.MouseLook();
    }

    public void Move()
    {
        var rightMovement = this._right * Input.GetAxis("HorizontalKey");
        var upMovement = this._forward * Input.GetAxis("VerticalKey");
        transform.position += (Time.deltaTime * this.moveSpeed * Vector3.Normalize(rightMovement + upMovement));

        var heading = Vector3.Normalize(rightMovement + upMovement);
        if (Vector3.Magnitude(heading) > 0.0)
        {
            transform.forward = heading;
        }
    }

    void MouseLook()
    {
        Ray castPoint = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(castPoint, out hit, float.MaxValue, layerMask))
        {
            Vector3 direction = hit.point - transform.position;
            direction.y = 0.0f;
            transform.forward = Vector3.Normalize(direction);
        }
    }
}

sentences:
How to find the closest point on a plane So I have this terrain with a perpendicular plane setup, now I want to move the vertices of the plane to their closest resp. vertices on the terrain.
I made a drawing to illustrate my thoughts.
Final result being the terrain will look like it has some thickness.

i also need the projection of the point on the terrain

I found this code on a previous thread :

    float distance = PointToPlaneDistance(smallObj.transform.position, wall.transform.position, wallNormal);

    private float PointToPlaneDistance(Vector3 pointPosition, Vector3 planePosition, Vector3 planeNormal)
    {
        float sb, sn, sd;

        sn = -Vector3.Dot(planeNormal, (pointPosition - planePosition));
        sd = Vector3.Dot(planeNormal, planeNormal);
        sb = sn / sd;

        Vector3 result = pointPosition + sb * planeNormal;
        return Vector3.Distance(pointPosition, result);
    }

The result vector here is the closest point

But what is the plane normal?
Unity has a built in mesh.normals which gives all the surface normals for the terrain. Which one should I use here?

sentences:
Blender FBX exports to Unity3D have incomplete animation sequences Using Blender, I have rigged and animated this model with this attack action.

I exported this model to an FBX format and imported the said FBX file into my Unity3D project. However, when I imported it, I noticed that the animation sequence is incomplete:

As you can see, the sword does not animate correctly and remains unmoved in its original position.

In Blender, the sword and scabbard are animated in Pose mode with IK and other constraints. However, as I understand it, FBX bakes these constraints into the animation, so I'm not sure if that causes the issue.

Why is the sword not animating correctly? How do I fix this so that the Unity animation is 100% faithful to the Blender animation?

sentences: Trouble programming JInput for game controller Due to lack of reasonable documentation, I have not been able to program inputs for using a game controller. The most I have ever found was how to detect if a controller is found and what it's name is. Does anyone know of a reliable tutorial on how to program controller buttons to perform any actions?

sentences:
Displaying whole screen image on multiple devices without stretching In my(Android) game, all of my sprites are scaled against to a particular ratio (this 'guide' ratio stays the same regardless of the actual ratio of the screen on which they are to be displayed) - these sprites are then displayed on screens of different ratios.

This way, the game can run full screen on any device, it simply means that more/less of the game is visible on some devices than it is on others.

However, I can't work out how to diaplay a large (full-screen) image on different devices.

The only thing I can think of is to simply create the original image for the larger display and the crop it down to fit other ratios.  Something like this:

So here, the image on the right is how the picture will show on the original device (full-screen with no cropping), the device on the left has a smaller width.  But what if this runs on a device with a larger screen?

In this case is it simply a case of (uniformly) stretching the image until it fills the screen?

Would be grateful for some guidance.

sentences:
Objective-C Moving UIView along a curved path I'm not sure if I am approaching this the correct way. In my app, when a user touches the screen I capture the point and create an arc from a fixed point to that touch point. I then want to move a UIView along that arc.

Here's my code:

ViewController.m

//method to "shoot" object - KIP_Projectile creates the arc, KIP_Character creates the object I want to move along the arc

...

//get arc for trajectory
    KIP_Projectile* vThisProjectile = [[KIP_Projectile alloc] initWithFrame:CGRectMake(51.0, fatElvisCenterPoint-30.0, touchPoint.x, 60.0)];
    vThisProjectile.backgroundColor = [UIColor clearColor];
    [self.view addSubview:vThisProjectile];

...

 KIP_Character* thisChar = [[KIP_Character alloc] initWithFrame:CGRectMake(51, objCenterPoint-5, imgThisChar.size.width, imgThisChar.size.height)];
    thisChar.backgroundColor = [UIColor clearColor];
    thisChar.charID = charID;
    thisChar.charType = 2;
    thisChar.strCharType = @"Projectile";
    thisChar.imgMyImage = imgThisChar;
    thisChar.myArc = vThisProjectile;
    [thisChar buildImage];
    [thisChar traceArc];

in KIP_Projectile I build the arc using this code:

- (CGMutablePathRef) createArcPathFromBottomOfRect : (CGRect) rect : (CGFloat) arcHeight {

    CGRect arcRect = CGRectMake(rect.origin.x, rect.origin.y + rect.size.height - arcHeight, rect.size.width, arcHeight);

    CGFloat arcRadius = (arcRect.size.height/2) + (pow(arcRect.size.width, 2) / (8*arcRect.size.height));
    CGPoint arcCenter = CGPointMake(arcRect.origin.x + arcRect.size.width/2, arcRect.origin.y + arcRadius);

    CGFloat angle = acos(arcRect.size.width / (2*arcRadius));
    CGFloat startAngle = radians(180) + angle;
    CGFloat endAngle = radians(360) - angle;

    CGMutablePathRef path = CGPathCreateMutable();
    CGPathAddArc(path, NULL, arcCenter.x, arcCenter.y, arcRadius, startAngle, endAngle, 0);

    return path;

}

- (void)drawRect:(CGRect)rect {

    CGContextRef currentContext = UIGraphicsGetCurrentContext();

    _myArcPath = [self createArcPathFromBottomOfRect:self.bounds:30.0];

    CGContextSetLineWidth(currentContext, 1);
    CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
    CGContextSetStrokeColor(currentContext, red);
    CGContextAddPath(currentContext, _myArcPath);
    CGContextStrokePath(currentContext);

}

Works fine. The arc is displayed with a red stroke on the screen.

In KIP_Character, which has been passed it's relevant arc, I am using this code but getting no results.

- (void) traceArc {

    CGMutablePathRef myArc = _myArc.myArcPath;

    // Set up path movement
    CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    pathAnimation.calculationMode = kCAAnimationPaced;
    pathAnimation.fillMode = kCAFillModeForwards;
    pathAnimation.removedOnCompletion = NO;
    pathAnimation.path = myArc;
    CGPathRelease(myArc);

    [self.layer addAnimation:pathAnimation forKey:@"savingAnimation"];

}

Any help here would be appreciated.

sentences:
In a visual novel game with optional sidequests, how to encourage the sidequests without requiring them? Context
I'm working on a small visual novel-style game, telling the story of a defense attorney and investigator. The story is split into chapters, with each chapter being a new case, and there are also recurring characters who develop throughout the story. It's a mini Phoenix Wright-style experience, with some point-and-click detective work mixed in.
As part of the game, you can embark on optional character-based sidequests, each of which focus on a different character and showcase some development between them and the protagonist. A few of these sidequests unlock after completing each case, and are usually related to the case that just happened. For example, after finishing a case involving a video game convention, you unlock an optional sidequest where you can take one of the supporting characters (the "tough guy who's secretly a dork on the inside", of course) to the convention before it leaves town.
I want to make these sidequests optional, and not force the player to do all of them or make them feel like they have to say "yes" to all of them - that is, I want to establish that they're free to decline an invitation if they don't like a particular character as much as the others and would rather not take them out for ice cream. However, I still want to make sure the player does some of them, because I feel many of them, if missed, would cause the player to miss out on really neat parts of the game. (If it helps, the game doesn't have a "completion percentage" or anything, just small achievements for doing certain things.)
My question
Given this design, I have a conundrum. I want the player to do at least some of the optional sidequests, but I don't want to force it or make them feel like it's necessary to see every single one of them. I don't want to place an arbitrary "you must do 3 sidequests to proceed" roadblock, but I also don't want the player to skip all of them and do the entire story without developing any of the characters. That obviously defeats the point of a heavily character-based visual novel! So, this is my dilemma:
What game mechanics in a visual novel are best to encourage optional sidequesting, but not require it for story progression or completion?
I have a couple ideas for this, since a lot of games have offered solid solutions for this problem already:

Making the sidequests optional, but having rewards for doing them. This is the approach that most games take nowadays. You don't have to do the sidequests, but maybe if you do one, it unlocks a palette swap, an item, or a hint coin.
Affinity mechanics. Maybe if you do enough sidequests for your prosecutor buddy, he gets closer to you and gives important hints in a later cases. This would work similarly to "friendship" in other games, where there's a number that keeps track of how good your relationships with different characters are and doing quests increases that number. At the same time, I think this encourages too much of a "metagame" approach, where players will just do every sidequest for a character all at once to unlock their bonus. It also makes the difficulty curve of the game wonky, since I want the cases to start easy and get progressively harder, and giving substantial bonuses in the late game might mess with that design.
Requiring the player to do at least X of them. This is the roadblock approach - blocking the progression of the story until the player does at least 1, 2, or 3 of the available sidequests. I dislike this because it feels like I'm being arbitrary and might frustrate the player if they don't like the current sidequest options and really want to do the next case.

Ideas and other suggestions are welcome!

sentences:
Unity:How to realize a modal message box? I'm developing a simple "modal" MessageBox.

This is the code inside Message Box panel:

public void Show(string _title , string _message, bool _showYesButton, bool _showNoButton, bool _showCancelButton) {
    this.gameObject.SetActive (true);
    Title.text = _title;
    Message.text = _message;
    btnYes.SetActive (_showYesButton);
    btnNo.SetActive (_showNoButton);
    btnCancel.SetActive (_showCancelButton);

}

And here how I call it outside:

MyMessageBoxScript _script = MyMsgBoxGameObject.GetComponent<MyMessageBoxScript >();
_script.Show("Hey..","Are you sure you want to overwrite this save ?",true,true,false);

Ok.. the problem is that I can't do a "modal" window, like in .NET version, returning what user pressed.

Something like:

buttonPressed = _script.Show("Hey.:", "Are you sure...");

So, searching with Google someone use this Way :

_script.Show(CallBackFunction; "Hey..","Are you sure you want to overwrite this save ?",true,true,false);

and

void CallBackFunction () {
...
}

But I can't understand how it works: How to pass CallBackFunction as parameter and how to execute (after clicking: yes,no or cancel) ?

Thanks

sentences:
Soft Body rendering from OBJ model As part of my master thesis I have to do an softbody simulation.

I 'm using Bullet Physics engine.

I'm trying to render softbody, create from Meshes, with Shaders in OpenGL but the object doesnt seem to be rendered (it doesnt appear in the window).

I'm not sure if the problem is because of the way I created the sobtbody or the way I render it.
Thank you in advance.

I'm using this function for creating a softBody from my OBJ Liver model :

        btScalar* verti = new btScalar[3 * (Liver.getMeshes()[0].vertices.size())];
        for (int i = 0; i < Liver.getMeshes()[0].vertices.size(); i++)
        {
            verti[3 * i] = Liver.getMeshes()[0].vertices[i].Position.x;
            verti[3 * i + 1] = Liver.getMeshes()[0].vertices[i].Position.y;
            verti[3 * i + 2] = Liver.getMeshes()[0].vertices[i].Position.z;
        }

        int* indi = new int[Liver.getMeshes()[0].indices.size()];
        for (int i = 0; i < Liver.getMeshes()[0].indices.size(); i++)
        {
            indi[i] = Liver.getMeshes()[0].indices[i];
        }

        btSoftBody* LiverSBody = btSoftBodyHelpers::CreateFromTriMesh(softBodyWorldInfo, verti,
            &indi[0],
            int(Liver.getMeshes()[0].indices.size()) / 3);

        LiverSBody->m_cfg.kVC = 0.5;
        btSoftBody::Material* pSpMat = LiverSBody->appendMaterial();
        //LiverSBody->m_materials[0]->m_kLST = 0.5;
        pSpMat->m_kLST = 1.0;
        LiverSBody->setPose(false, true);

        btTransform trans;
        trans.setIdentity();
        trans.setOrigin(btVector3(0,0,0));
        LiverSBody->transform(trans);

        LiverSBody->generateBendingConstraints(2, pSpMat);
        LiverSBody->m_cfg.piterations = 2;
        LiverSBody->m_cfg.kDF = 1.0;
        LiverSBody->m_cfg.kSRHR_CL = 1;
        LiverSBody->m_cfg.kSR_SPLT_CL = 0;

        LiverSBody->setTotalMass(10, true);
        LiverSBody->scale(btVector3(0.02, 0.02, 0.02));
        LiverSBody->getCollisionShape()->setMargin(0.1);

        float Friction = 0.9;
        float Restitution = 0.5;

        LiverSBody->setFriction(Friction);
        LiverSBody->setRestitution(Restitution);

        m_pSoftBodyWorld->addSoftBody(LiverSBody);

I'm using this class for loading and visualizing model https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/model.h
I need to extract from the softBody some data (Position, normal, texCoords, tangent and bitangent) to fill the vertex buffer objects but i don't know where to find most of it... I know that the position and the normals are in the softbody nodes but i can't find the other information needed (texCoords, ..).

//btSoftbody.h
struct Node : Feature
    {
        btVector3 m_x;       // Position
        btVector3 m_q;       // Previous step position
        btVector3 m_v;       // Velocity
        btVector3 m_f;       // Force accumulator
        btVector3 m_n;       // Normal
        btScalar m_im;       // 1/mass
        btScalar m_area;     // Area
        btDbvtNode* m_leaf;  // Leaf data
        int m_battach : 1;   // Attached
    };

sentences:
What's the purpose of OpenGL's Vertex Array Objects? I've just started out with OpenGL I still haven't really understood what Vertex Array Objects are and how they can be employed.

If Vertex Buffer Object are used to store vertex data (such as their positions and texture coordinates) and the VAOs only contain status flags, where can they be used? What's their purpose?

As far as I understood from the (very incomplete and unclear) GL Wiki, VAOs are used to set the flags/statūs for every vertex, following the order described in the Element Array Buffer, but the wiki was really ambiguous about it and I'm not really sure about what VAOs really do and how I could employ them.

sentences:
Project 2D texture onto a cubemap 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.

sentences:
Data Structures for Logic Games / Deduction Rules / Sufficient Set of Clues? I've been cogitating about developing a logic game similar to Einstein's Puzzle , which would have different sets of clues for every new game replay.

What data structures would you use to handle the different entities (pets, colors of houses, nationalities, etc.), deduction rules, etc. to guarantee that the clues you provide  point to a unique solution?

I'm having a hard time thinking about how to get the deduction rules to play along with the possible clues; any insight would be appreciated.

sentences:
Better way to do AI Behavior in AS3/Flixel I'm making a game in Flixel and I need to program an NPC. It's rapidly turning more complex than I expected. I was wondering if there are any best practices, tutorials or examples that you can refer me to, to see how this is done.

I can probably hack it together, which is what I always do, but it would be nice if I can make it maintanable and can add stuff later on.

Here's screenshot to give you an idea: The butler will be an NPC that will follow you, or guide you, and talk to you the whole time.

EDIT:
More specifically: What I have now is a long list of IF statements in the update loop of the butler (about 8 different cases), and all I have covered is his walking behavior. I want him to comment on things and sometimes switch his main behavior to be more aggresive or distant,... Is there any way to keep track of this, or is complex code with many many nested if statements the way to go?

sentences:
libGDX new TextureAtlas(filename) and new Texture(filename) drawing stale image data I'm trying to draw an image using libgdx but no matter what I do, libgdx seems to insist on drawing a portion of an image I had loaded and used in an earlier game screen.

In my current game screen (class implements Screen), I have tried loading the image using both an atlas and loading it via the Texture class.  However, when I draw the image in my render method, portions of an image that I had loaded previously are being displayed instead.  Not the image that I am passing to the draw method!

I have tried both loading the image using a Texture Atlas and directly:

private TextureAtlas deckAtlas;
private TextureRegion aceHearts;
// In class constructor
deckAtlas = new TextureAtlas("deck.atlas");
aceHearts = deckAtlas.findRegion("ace-heart");

and:

Texture texture = new Texture("deck.png");
sprite = new Sprite(texture, 72, 0, 72, 100);

Depending on the method used above, I try to display by either:

game.batch.begin();
game.batch.draw(aceHearts, 100, 100);
game.batch.end();

Or:

game.batch.begin();
sprite.draw(game.batch);
game.batch.end();

where game is an instance of a class that extends Game and batch was initialized in that class's create method.

To start from the beginning, in my class that extends Game I call

setScreen(new MainMenu(this));

In Main Menu Screen, I load a skin using

skin = new Skin(Gdx.files.internal("uiskin.json"));

and create a bunch of Scene.2d UI widgets with that skin (the packed image that's loaded by the skin is contributing the image that is being drawn on my next screen when I don't want it to).  Finally, I create the Screen in which I am having the above problems using

game.setScreen(new TableGame(game));

So to summarize, I am loading an image in a class that implements Screen, but that image never gets drawn to the screen.  Instead, an image that I had used in the previous screen is being displayed instead.  Any ideas why?

Thanks for any help.

I am using libGDX 1.3.1 (I think).

sentences:
Odd offset bug in Farseer/XNA/C# So I'm using Farseer to create an immovable object:

[...]
private Body body;
public Immovable(World world, ContentManager c, String s, int posx, int posy, int w, int h, String user_data)
{
    texture = c.Load<Texture2D>(s);
    float converted_width = ConvertUnits.ToSimUnits(w);
    float converted_height = ConvertUnits.ToSimUnits(h);
    float converted_posx = ConvertUnits.ToSimUnits(posx);
    float converted_posy = ConvertUnits.ToSimUnits(posy);
    body = BodyFactory.CreateRectangle(world, converted_width, converted_height, 1.0f, new Vector2(converted_posx, converted_posy), user_data);
    body.BodyType = BodyType.Static;
    width = w;
    height = h;
    x = posx;
    y = posy;
}

What I'm trying to do is keep separate my values for screen units (here, width, height, x, and y) and my values for simulated units (here, stored in body). This way, later, when I draw the object to the screen, I can:

public virtual void Draw(SpriteBatch sb)
{
    sb.Draw(texture, new Rectangle(x, y, width, height), Color.White);
}

This way, when I instantiate things, I can visualize them as screen coordinates, which should hopefully keep me sane during all this! Theoretically (especially as these objects don't move), these two coordinate pairs should be in the same spot (or off by a maximum of one pixel if I'm truncating floats to an int somewhere).

However, for some reason, my rectangles are being offset by ~25 pixels up and to the left. Here's a screenshot:

You can see that he has "landed" just above where the rectangle is being drawn. I can float around the box to explore where the physics engine believes it is, and I find that it's up and left about 25 pixels.

Any ideas on what could be causing this?

sentences:
Testing HTML5 canvas games on low resource computers I've made a game in HTML5 & JS and want to test it on varying types of user setups as I've heard it doesn't perform too well on older MacBooks.

How can I accomplish this? I'm thinking of something like browserstack.com but for GPU, CPU and memory testing.

sentences: Unity, Which side of Collider2D was hit by raycast? I've got a player firing out 2d raycasts. If one of them hits a boxcollider2d I would like to know if it hit the top side, bottom side, left side, or right side. How would I go about doing this? I've tried using Bounds but that didn't work out very well.

sentences:
Unity3d app immediately goes to background after starting up on iOS So the iOS build of my game started doing this today and I have no idea why. The only think I can think of is that I added this line :

Application.runInBackground = true;

but this should not force it to go to the background on startup. Other games run just fine on the phone. It's very unlikely that the game itself is using too much resources. It does not crash it just goes into the background and when you select it from there it stays on for like a second and then goes back. Has anyone experienced this before ?

sentences:
Is it possible to use absolute input device like a pointer or VR headset for peeking(looking) in non VR FPS or 3rd person games? Assume I have a VR headset, which has absolute orientation as output and this orientation is input to a game.
In VR Games, your character looks wherever you look by using your headset's absolute orientation(right?) Everything is OK for VR games
Coming to the point for non VR games;
Normally, when you tilt a joystick to a direction and hold it at that position, your character always turns relative to the direction until you released your finger. For example if you tilt the joystick to rightest and hold it at there, your character starts rotationg around itself to the right until you release joystick.
Can I do the VR rotating thing with a standart game controller joystick? Do games (or game engines) allow this type of control? I mean when I tilt my stick to rightest position, my character peeks to rightest, but when I release the stick, character peeks to default(front).  If it is possible, could you give name of games that suppport this control type? What is the technical name for this control type and maybe some resources or keywords for my research?

sentences:
Horizontal scrollview only I am using unity's scrollview.
I want to disable the vertical scrollbar and i want the viewport to resize vertically depending on the content.
Too confusing to explain with word so i have created the example picture below :

How do i achieve this properly ?

sentences:
Using deltaTime and Frame Rate Independence I'm working on one of my first games and I've read that linking your game logic to FPS is bad because it will run differently at different FPS (obviously).
I have already made some of the basic game dependent on frame rate and now that I know this, I would like to unlink the logic and render. I've learned that LibGdx has deltaTime in its render method for this, however I believe I'm misunderstanding how I am to use it.

For example, my movement currently looks something like this:

if (rightKeyisPressed)
    setVelocityX(movementSpeeD)
playerPos.add(getVelocity)

In my case, I would like the player to move 6 units per second. Since I built this on 60 fps, that means that movementSpeed is 0.1. Now the way I have seen deltaTime used is by scaling the movementSpeed based on the time like this:

setVelocityX(movementSpeed * deltaTime)

However, now I move very slow because delteTime is a very small number. How can I make movement still the same speed without depending on the fps?
Sorry if I'm missing something obvious, I just can't seem to wrap my head around this.

sentences:
Require maths help calculating deflection angles of quadrants For each quadrant, I need to find a neat way of calculating the deflection angle for a small circular object striking a circle, as shown in the diagram.

Angles a and b are already known.
Angle a is always relative to 0 degrees position.
Angle b is relative to the quadrant.
The initial angle can also be greater than 180, when coming from the
other direction, as shown in the diagram the right.

For quadrant 2, in the following snippet from my code, dy and dx represent the x and y coordinates of a point on the circle:

intersectAngle = atan(dy/dx);

Initial angle is calculated from velocity vectors:

pAngle = PI - (atan2(pVel.x, pVel.y));

For quadrant 0, I came up with this for the rebound angle:

pAngle = pAngle - 2 *(pAngle - tangentAngle);

Where tangentAngel is just the intersect angle with half PI added. Thsi worked for a ball from any direction.

Moving onto quadrant 1, this works for pAngles of less than 90 deg, but not for pAngles from the other direction:

pAngle = pAngle + 0.5 * PI - intersectAngle;

Feels like I shouldn't be writing all this code and that there is a more efficient way. I realise this is an elementary question but I'm studying this so it's all new to me. Please be gentle.

sentences: Handling bad network clients using socket.io Currently I'm working on a MMO game which players can join and exit game whenever they want. I have a connection manager server (CMS) written in golang using socket io library. World connects to CMS and clients connect to CMS and talk to world and world update clients with snapshots of game state. For testing I wrote a client that connects to CMS and act as a player for testing how many clients can my CMS handle. I reach around 80 clients per one core vcpu and 1 gig ram and that's acceptable for my game and resources. I released the game but in real life when there is around 5 or 6 real players and one player with bad network connection joins game it massively take effect the another players game experience. Packets don't receive to another clients or delayed heavily! I believe it's because socket io uses tcp and when a bad network client joins it should send messages many times for client received it completely. How should I overcome this? I know I should used udp for my game but it's too late and I released my game in play store and it got around 700 installs. Is there anyway I can put a time to live like attribute to messages that if client don't received them at a certain time dropped them? Any idea whould be helpful.

sentences:
I want to make a pause button on the scene I want to make a pause button on the scene. If I press the button it will show the guiTexture with a variety of buttons with each different script. So what steps should I take?
1. How do make it so if I press the pause button on a scene it will show guiTexture?

sentences:
Creating a Melee Weapon in Box2D (libGDX) I am struggling with how to implement a melee weapon that can swing when a key is pressed.

I am imagining two different attacks (stab and swing)

I have tried creating two fixtures (character + weapon), two different bodies, two different bodies + revolute joint, but I can not code it to behave the way I imagine it to look like.

STAB:

So with the press of a button, a body/fixture (sensor) would come out for ~1 second and then disappear (alternatively, the body/fixture could always be on the hero and just rotate 90 degrees around the vertices when pressed, and then rotate back to normal)

SWING:

Same thing, but now the weapon will start from the top and swing downwards. Weapon will also be a sensor.

What I have tried:

I created two dynamic bodies.

The weapon has to follow the hero, so I used a revolute joint to hold them together. When a key is pressed, I set the angular velocity of the weapon to a number. However, the weapon will continue to spin after I let go of the key. I tried implementing an if check (if angle is greater than ___, set angular velocity to zero). However, that just means the weapon will stop spinning when I press the key a second time.

sentences:
How do I correctly set up a Unity animation to move? I downloaded a custom .fbx model from the asset store, imported it to my project and placed it in my scene. I then created an animator controller and added it to the object.

To get the animations (that came with the model) into the animator tab, I dragged them onto the model in the hierarchy. I then set the one animation to default and pressed play, but in the game window, the model didn't move.

What might be going on?

The only time it did something was when I set it to "play from start" but that made it go through all the animations.

I'm quite new to Unity 4. If you need any extra information, please ask.

sentences:
Spawn scene object not found for 1 I'm getting this error with the new Unity Networking (5.1):

Spawn scene object not found for 1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

This happens in the client, when it connects to the server: the server is file, while the client fails to load the scene. I guess this error means "I failed to load the (online) scene" (which in fact it is the scene number 1), but I've no clue why it does fail.

The server has a custom player spawning function:

public class NetworkDirector : NetworkManager
{
    public override void OnServerConnect (NetworkConnection conn)
    {
        base.OnServerConnect(conn);

        Transform spawnPoint = FindObjectOfType<SpawnPoints>().getNextSpawnLocation();
        GameObject spawned = FindObjectOfType<InstancedElements>().SpawnObjectFree(playerPrefab,spawnPoint);

        FindObjectOfType<CameraFollow>().SetTarget(spawned);
        NetworkServer.AddPlayerForConnection(conn,spawned,0);
    }
}

sentences:
Möbius effect in Unity This morning I've seen the following animation on Twitter. It is a kind of Möbius strip effect.

It's cool! Isn't it? So I've decided to build something similar using Unity, just for fun. I want to build the effect using just the cameras, as this way we can use it for any rotating scene. The first step has been to create a circle scene and make it rotate:

Note that the camera uses an ortographic projection so perspective does not deform it. This is important so we can merge different views later.

Then I've replaced the main camera by two different ones, located in opposite positions (horizontal and vertical) and rendering to textures. A simple Canvas with two panels (divided vertically) shows the partial result (one camera texture per panel):

I know this is cool, but not perfect yet, as the center of the rendered output shows clearly where a panel finishes and the other one starts. Look at the center of the rendered output above.

The original inspiration video shows no perspective in the center, and I think that is the trick, but I cannot achieve that with an orthographic camera (or I don't know how).

Do you know any approach to distort the camera or something similar, so the cameras are perpendicular in the middle of the scene (and only in the middle)? Are you able to think a solution to dissimulate the joint of both camera views?

As a first approach (dismissed for the moment) I've tried to add another camera, perpendicular to the scene so there is no perspective in that point. Then I render its output in the UI in another panel on top of the previous ones. And it is not too bad, but again the joint is too obvious and now I have two joints instead of one:

sentences:
Why do my Box2D bodies occasionally get stuck and separate forcibly? I'm making a space game with LibGDX and Box2D. I made a video here to illustrate the issue.

Verbal description: When objects collide, they sometimes get stuck together and are then suddenly separated by a strong force.

Both objects have identical body definitions and fixtures:

bod = new BodyDef();
bod.type       = type;
bod.allowSleep = false;

shape = new CircleShape();
shape.setRadius(values[0]);

fix = new FixtureDef();
fix.restitution = 0f;
fix.friction    = 1f;
fix.shape       = shape;
fix.density     = 1f;

worldBod = world.createBody(bod);
worldBod.setTransform(position.x, position.y, 0);
worldBod.createFixture(fix);

Why might this be happening? How can I fix it?

Update: Here is some more info.

The Player class contains a function update(float deltaTime) with the rest listed below

force.x += (directionVector.x * SPEED)*deltaTime;
force.y += (directionVector.y * SPEED)*deltaTime;

//This helps keep the object in control from preventing forces greater then 3
if(force.x >= 3){
    force.x = 3;
}if(force.x <= -3){
    force.x = -3;
}if(force.y >= 3){
    force.y = 3;
}if(force.y <= -3){
    force.y = -3;
}
//This quickly reduces the force back down to 0
force.x *= 0.5;
force.y *= 0.5;

this.getBody().applyForceToCenter(force, true);

In the render part of the main game class I step the world with

gameWorld.step(Gdx.graphics.getDeltaTime(), 6, 6);
//although increasing or decreasing the itterations seems not to help

and Finally the hexagon's are created using the ShapeRenderer pulling the position and

sr.setProjectionMatrix(camera.combined);
sr.begin(ShapeType.Line);
sr.circle(p1.getBody().getPosition().x, p1.getBody().getPosition().y, 1);
sr.circle(barrierPole.getBody().getPosition().x, barrierPole.getBody().getPosition().y, 1);
sr.end();

sentences:
What are the disadvantages of R-Trees in collision detection? I was poking around in SQLite and discovered R-trees. A little digging revealed that R-trees are really just fancy AABB-trees.

Then I realize that the state of the art in collision detection (often a perf-limiting sub-system for physics simulation) is dynamic trees (simple AABB trees).

So this is indicating to me that we can produce more efficient physics with this as a drop-in replacement.

Here is a pretty convincing argument for R-trees from half a decade ago. To really distill it to the core, R-trees were developed for databases to optimize disk access where getting the right data into RAM is the happy place, and now we can recycle the technique to optimize memory access where keeping the right data in cache is the happy place.

Sadly it seems that this has not caught on. I wonder what the reasons are?

I also found no reference to this BVH method in my Real-Time Collision Detection (Ericson) text (though, that book is a bit older than 2010).

sentences:
What coordinates are we passing to pixel shader from vertex shader? I have read articles about shader programing and understood the very basic knowledge of shader programing. One thing I always get confused is about the texture mapping. What I pass(output) from VS to PS is the vertex position and Texture Coordinates. I understood that in VS we can simply choose to pass the vertex position as it is or manipulate vertex position here (and may be something more). So what we ultimately pass is the position of the vetex.  But... it is still not clear to me that we are passing which we are calling as texture coordinates or UV?

If I understood correctly, if my model is a simple triangle consist of 3 vertices, VS will be run three times for each of the vertix and I am passing the position of the vertex. Its straight forward. But what is with the texture? Say, I am using 50x50 jpg image as texture. How are the 3 vertices are mapped to this 50x50 pixel texture?

From the book I have started reading couple of days ago explained that the rasterizer is the one which groups the vertices to form triangle and calculates the number of pixel in the triangle. But again its not clear to me that what we are passing as texture coordinates to VS?

sentences:
In GM Studio, how do I prompt the player for a password? I could make strings in earlier Game maker versions, but it doesn't work in the Studio version when I try.  The code I used:

When Left Mouse Clicked on Password Bar:

var str;
str=get_string("Crack the code!","");
if str!="pswrd" && str!="PSWRD"
{
    check_answer=false;
    room_restart()
}
else
{
    check_answer=true;
    room_goto_next()
}

I want a box to pop up saying "Enter Password".  Then to enter the password, and if correct, go to a room, for example.  I am using physics in Gamemaker Studio 1.4.

sentences: Can I release Kinect based games? I've been reading up some hacks on Kinect development to work around the fact that there is no official SDK from Microsoft. Even if we do manage to create a game, can we distribute it through the XBox marketplace? Or will it cause any issues?

sentences:
Can I use flat shading on a generated mesh? I tried to generate a mesh from code in Unity. The problem is, that the edges are automatically smoothed. When I import a model into Unity, I can set the smoothing angle of the edges, but is something like this possible with a generated mesh?

I would like to have no smoothing at all.

sentences:
Creating Complex Collision Shapes in GMS2 I'm pretty new to Game Maker Studio 2 and I've hit a wall in programming with their built-in physics engine. I created a irregularly shaped object and I want to modify the collision shape so that it fits the shape of the sprite. In the built in collision shape editor it only allows you to create a convex shape with a max of 8 points. Is there another way to do this without having to plot out points individually in code?

Thanks!

sentences: Voxel sparse octrees for indirect illumination I don't understand the use of voxel sparse octrees for indirect illumination calculations. First of all, what exactly is happing? We're rendering the scene as usual with diffuse lighting. In the meantime, we're maintaining the octree of our scene. But when do we use it and for what exactly?

sentences:
Straightforward guidelines for converting OpenGL to OpenGL ES? Is there a straightforward list of finite steps that I need to follow to convert an OpenGL program into an OpenGL ES that's used on the iPhone and iPad? I'd be using GLKit.

I've seen some similar API functions but I gather that triangles have to be presented differently.

sentences:
Why can't my .exe find my .fx file? I'm having a problem with my .fx file in my D3D 11 application.

I can run the application just fine from Visual Studio, but when I run the .exe it fails when trying to load the .fx file.

I've checked the file name in the code and tried all sorts of paths but I can't figure this out, why is this happening?

sentences:
Tutorial or Example of creating custom sprite tool/map editor for XNA? I want to create various sprite tool and map editor using XNA. Now, the problem is I do not know how would I implement the window forms and components (such as button, check box, sprite list, etc.) into my program and allow it to completely control my XNA environment. If there is any tutorials or examples that show how to make editor for XNA, then I would be very pleasing.

Thanks

sentences:
Draw depth works on WP7 emulator but not device I am making a game on a WP7 device using C# and XNA. I have a system where I always want the object the user is touching to be brought to the top, so every time it is touched I add float.Epsilon to its draw depth (I have it set so that 0 is the back and 1 is the front).

On the Emulator that all works fine, but when I run it on my device the draw depths seem to be completely random.

I am hoping that anybody knows a way to fix this. I have tried doing a Clean & Rebuild and uninstalling from the device but that is no luck. My call to spritebatch.Begin is:

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

and to draw I use

spriteBatch.Draw(Texture, new Rectangle((int)X, (int)Y, (int)Width, (int)Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, mDrawDepth);

Where mDrawDepth is a float value of the draw depth (likely to be a very small number; a small multiple of float.Epsilon.

Any help much appreciated, thanks!

sentences:
Size of .skp gets doubled after importing to Unity I have created a 3D model in SketchUp, and it is about 1.6Mb in size. After importing it to Unity, the size more than doubled to 4Mb.

Why is that?

sentences:
Creating dependent values in the Unity inspector I want to create a few values which will be dependent on each other. Specifically, I want total sum of few values always be 100 In unity inspector no matter how I tweak them.

E.G.:

int total = 100;

int one = 20;
int two = 30;
int three = 45;
int four = 5;

How can I make other values adjust automatically if I tweak one of them in Unity Inspector?

sentences:
Does use of simple shaders improve performace/battery life? I'm making OpenGL game for Android. Till now i've used only fixed function pipeline, but i'm rendering simple things.

Fixed function pipeline includes a lot of stuff i don't need. So i'm thinking about implementing shaders in my game to simplify OpenGL pipeline if it can make better performance.

Better performance = better battery life, unless fps is limited by software limit, not hardware power.

sentences:
Commonizing cycle time across different browsers for HTML5 Is there a good (accepted) method for "fixing" the cycle time within an HTML5 canvas game implementation?

The game that I have been working on runs far quicker in Google Chrome than in other browsers such as Firefox, Opera, or IE9.  To be honest, it kind of reminds me of running a game from the early 90's on a brand new machine.

sentences:
Dynamic length increment of of an object-LibGdx I want to implement something in my LibGdx game, where a small stick is positioned vertically.On tap,I have to increase the length of the stick with tap frequency.Later I want to rotate,perform collision and do all those things that a sprite can do.It is an advanced form of fly Swatter game.
I am wondering how can I do it.I found some ways.But I am not sure it will work nicely.

1.Creating an array of small sticks and adding it to the base stick to increase the length.(Rotating array of object at a time is difficult,I know.)

2.Scale the image to increase the size of the stick.

Important thing is that this stick and rotation is an super important event in my game.

I only have experience of a simple running in LibGdx.
It would be very helpful if experienced persons give some ideas to implement this game in LibGdx.

sentences: OpenGL 2.0 Android Scrolling Horizontally and Vertically I am new to OpenGL2.0 in Android. How can I scroll the GLSurfaceView both horizontally and vertically?

sentences:
Voxel terrain generation performance problems I am trying to create a minecraft clone to practice some stuff in Unity including Raycasting, terrain generation and player controlls.
Terrain is generating without any problem with a perlinNoise.
My problem is the then following performance problems.
The terrain is only 1 block high with no underlying blocks. Each block constist out of 6 quads with a 64x64 texture. I generate terrain at 200 x 200 size.
I can't imagine why 4000 voxels with such simple textures can lag out whilst my pc runs objects with 50k tris and complex textures without any problem.
My code:
[...]

public int xVoxels = 200;
public int zVoxels = 200;

[...]

for (int x = 0; x < xVoxels; x++){
    for (int z = 0; z < zVoxels; z++){

        // voxel = script parameter
        GameObject newVoxel = GameObject.Instantiate(voxel);
        Vector3 position = new Vector3();

        position.x = xVoxels/2 + x;
        position.z = zVoxels/2 + z;
        // PerlinNoise stripped out for testing
        position.y = 0f;

        newVoxel.transform.position = position;
    }
}

Solutions I tried:
Combining meshes
Combining all meshes to a single one per material worked wonderfully... until I wanted to interact with each voxel determined by Raycasting from the Camera, I had a raycast hit to the combined mesh and not to my determined voxel
Generating the planes myself
Instead of using the unity plane object I generated all vertecies myself, same performance problems

sentences:
How can I efficiently render a tile-based map with many Z-levels, where the levels act like hollowed out voxels? My map setup is a little different to what you normally have with tilemaps. The map itself is a rectangular prism, with a width, height, and depth being variable. In my case, width is the x-axis horizontally across the screen, height is the y-axis vertically across the screen; and depth is the z-level, or how "deep" the map goes into/out of the screen.
In my map; you could consider the rectangular prism as "solid". Many/most of these voxels could be considered as occluders to the voxels below them. Some voxels are hollowed out to make rooms and corridors.
The map is viewed at a specific z-level, from 0, the "bottom" of the rectangular prism, to n, the top.
A "hollowed out" voxel, if viewed from it's level, would result in me rendering a floor texture in that tile. If there were 4 voxels above it hollowed out, then that floor texture would be rendered when the map is viewed from each of these z-levels, but each z-level above the "floor" would have a semi-transparent black rect rendered on top of the tile (so it gets successively darker the further "up" you are).
This occurs until you're on a z-level above the tallest voxel that is hollowed out to make the room; at which point you can't see it any longer, because this non-hollowed out voxel blocks your view to the room below.
The problem I have is that there are many z-levels to render; and most of the hollowed out sections criss-cross around in the different layers to make a very complex network of little rooms and tunnels. This results in me naively rendering a floor texture, followed by several layers of semi-transparent black rects, followed by a fully-opaque black rect; and potentially repeated for any additional overlapping rooms; for every x,y tile on the screen.
I'm trying to wrap my head around a way to render this more efficiently but I'm having trouble. Currently, for every render loop, I'm attempting to step through the z-layers, from the current viewed z-level down to 0, and finding the z-level that is occluded first (or all the way to the 0 level), so that when rendering, I can skip z-layers for that tile that are below this value.
This isn't really giving me much of a performance increase.
I'm looking for ideas on how to better perform these series of draw calls. I'm using OpenGL3.3 directly, so I'm not restricted by any library or engine constraints. Currently, I'm rendering each "tile" on each layer seperately and would prefer to keep it that way for simplicity.

sentences: Blender->Unity materials problem I have a pproblem with materials and their texture. I have a model with 1 material called 'Car_Jack', after i put my .blend file into unity, unity adds 'Car_Jack__Car_Jack_UV', which is white material without textures. I have the only one UV map, called 'Car_Jack_UV'. What is wrong with Unity/Blender?

sentences:
ETC1 texture opacity I'm using the cocos2d-x engine and want to support etc1 on android devices for my game.
For ETC1 i'm using the mali compression tool, and GLSL.

Everything is working, but I can't change the opacity of my sprites anymore.

my alpha blending is GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA .
can anyone help?

Here are one of my Textures with rgb tex + alpha tex

Vertex Shader:

attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D tex1;

void main()
{
    gl_Position = CC_PMatrix * a_position; //CC_PMatrix comes from engine
    v_fragmentColor = a_color;
    v_texCoord = a_texCoord;
    v_texCoord2 = v_texCoord;
}

Fragment Shader:

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D u_texture1; //alpha texture

void main()
{
    //CC_Texture0 comes from cocos2d-x engine and represents the rgb
    vec3 tex = texture2D(CC_Texture0, v_texCoord).rgb;
    float alpha = texture2D(u_texture1, v_texCoord).r;

    gl_FragColor = vec4(tex,alpha);
}

sentences:
DX11: Drawing with index buffer not working? For our student project I've been tinkering with an OBJ-loader in order to import models into our application.
It loads without issues, and drawing it kind of works without index (the model is obviously not represented correctly because I'm not using an index buffer)
However, drawing with DeviceContext->DrawIndexed shows nothing on screen.

Without indexed drawing

With indexed drawing

Buffer creation method:

void ObjectLoader::CreateBuffers()
{
    //Index buffer
    D3D11_BUFFER_DESC iBufferDesc;
    memset(&iBufferDesc, 0, sizeof(iBufferDesc));
    iBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    iBufferDesc.Usage = D3D11_USAGE_DEFAULT;
    iBufferDesc.ByteWidth = sizeof(DWORD);

    D3D11_SUBRESOURCE_DATA indexData;
    indexData.pSysMem = &ind;
    pDevice->CreateBuffer(&iBufferDesc, &indexData, &pIndexBuffer);

    //Vertex buffer
    D3D11_BUFFER_DESC bufferDesc;
    memset(&bufferDesc, 0, sizeof(bufferDesc));
    bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    bufferDesc.Usage = D3D11_USAGE_DEFAULT;
    bufferDesc.ByteWidth = sizeof(TriangleVertex) * this->NumberOfVerts();

    D3D11_SUBRESOURCE_DATA data;
    data.pSysMem = tva;
    pDevice->CreateBuffer(&bufferDesc, &data, &pVertexBuffer);
}

Draw method:

void ObjectLoader::Draw()
{
    if (pDevice == nullptr)
        return;

    UINT32 vertexSize = sizeof(float) * 5;
    UINT32 offset = 0;

    pDeviceContext->IASetVertexBuffers(0, 1, &pVertexBuffer, &vertexSize, &offset);
    pDeviceContext->IASetIndexBuffer(this->pIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
    pDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    pDeviceContext->DrawIndexed(vIndex.size(),0 , 0);

    //pDeviceContext->Draw(this->NumberOfVerts(), 0);

}

Index data is initially stored in an unsigned integer array before being passed to D3DD11_SUBRESOURCE_DATA

//index array
UINT* ind;

What the hell am I missing? I've looked at several books on indexed drawing and it seems pretty straight-forward. At first I thought the winding order was reversed but I checked this by simply reversing the index array; same result.

If you need more code let me know, but I feel this should suffice.

Thanks in advance!

sentences:
How complex should enemy AI be in a dnd-alike? I'm writing a text-mode (python + ncurses), turn-based rpg based loosely on 3rd edition D&D and Neverwinter Nights (the PC game) rules. It's not going to be a full implementation, but 'in the spirit' of them. I already have quite a bit of the basics in place; movement, a few base classes and races, rule-based encounters (shop/npc/monster X shows up when condition Y is true), dynamic generation of monsters, player and enemy stats and random, levelled equipment etc. It's enough to start moving around a basic world, talking to people, examining objects and location and now I'm moving on to (melee) combat.

I'm interested in what people would expect of an algorithm that co-ordinates the computer-controlled attacks of an enemy party against the player. How smart should the computer controlled enemy be (in my implementation the player will take control of each of his own characters in turn, and they wont be AI controlled, but the enemy party will - attacking, spell casting etc at-will).

For example; if an enemy character initially chooses a random pc from the players party on round 1, should that enemy continue to attack the same target in subsequent rounds. How about if another pc then attacks that enemy? What if the enemy is unable to cause damage to that pc (ie say the pc has something crazy like damage reduction 100/+5 - should the programme know in advance?), should they switch to another in the players party?

Has anyone implemented anything similar and would be able to provide any pointers?

sentences:
Using full resolution of depth buffer for 2D rendering I'm working on a front-to-back renderer for a 2D engine using an orthographic projection. I want to use the depth buffer to avoid overdraw. I have a 16-bit depth buffer, a camera at Z=100 looking at Z=0, zNear is 1, and zFar is 1000. Each sprite rendered sets its Z co-ordinates to increasingly distant values, allowing depth test to skip rendering anything which is underneath.

However I'm aware the way Z positions end up with Z buffer values is non-linear. I want to make use of the full resolution of the 16-bit depth buffer, i.e. allowing 65536 unique values. So for every sprite rendered, I want to increment the Z position to the next position to correlate to the next unique depth buffer value.

In other words I want to turn an incrementing index (0, 1, 2, 3...) of the sprite being drawn in to the appropriate Z position for each sprite to have a unique depth buffer value. I'm not sure of the maths behind this. What is the calculation to do this?

Note I'm working in WebGL (basically OpenGL ES 2), and I need to support a wide range of hardware, so while extensions like gl_FragDepth might make this easier, I can't use it for compatibility reasons.

sentences:
*Python* Class - self.x = self - What does it mean to set it to self? I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self

class SceneManager(object):
    def __init__(self):
        self.go_to(TitleScene())

    def go_to(self, scene):
        self.scene = scene
        self.scene.manager = self #<--

In the main game scene I also have a similar thing happening

class GameScene(Scene):
    def __init__(self, levelno):
        super(GameScene, self).__init__()
        self.player = Player(5, 40)
        self.player.scene = self

What is the purpose of setting it to self?

Another Question:
I have been using classes and for most of them I create a class and I include this within the class

Class myClass():
   super(myClass, self).__init__() #<----- This line here

Does this have something to do with my original question?
What is the purpose of doing this?

sentences:
How to blend the sprite into background? I try to blend the character into game but I still cannot remove the blue color in the sprite sheet and discover that the white area of sprite is semi-transparent.

Before that, the color D3DCOLOR_XRGB(255, 255, 255) is set in D3DXCreateTextureFromFileEx. You will see the fireball through the sprite.

After I change the color to D3DCOLOR_XRGB(0, 255, 255), the result will be

Now, I am trying to remove the blue color of the sprite sheet and my expected result is something like that

Until now, I still cannot figure out how to do that. Any ideas?

void initPlayer()
{
    //  Create texture.
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "player.png", 169, 44,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(0, 255, 255),
         NULL, NULL, &player);
}

void renderPlayer()
{
    sprite->Draw(player, &playerRect, NULL, &D3DXVECTOR3(playerDest.X, playerDest.Y, 0),D3DCOLOR_XRGB(255, 255, 255));
}

void initFireball()
{
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "fireball.png", 512, 512,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255),
         NULL, NULL, &fireball);
}

void renderFireball()
{
    sprite->Draw(fireball, &fireballRect, NULL, &D3DXVECTOR3(fireballDest.X, fireballDest.Y, 0), D3DCOLOR_XRGB(255,255, 255));
}

sentences:
Converting a quaternion in a right to left handed coordinate system I have a quaternion from an IMU that id like to represent in unity. The issue is that the sensor uses a right handed coordinate system while unity uses a left handed coordinate system. In order to have the rotations of the IMU reflect in unity correctly, I would need to remap the axis. How can I do this by altering the quaternion components?

Specifically, I would need to map

         sensor   unity
forward  x        z
up       z        y
right    -y       x

I have seen multiple questions regarding this question especially this one.

Convert quaternion to a different coordinate system

However, it only explains a specific case where its a right hand to right hand remapping.

If possible, include an explanation without mathematics equations of how you would map any coordinate system to any other coordinate system.

sentences:
IronPython with Python in Unity: How should I manage dependencies Python-side? I am currently trying to get Python working in Unity, and I was wondering how would I manage dependencies on the Python end. For example, say I have a Python script with the following dependencies:

 import tensorflow as tf
 import numpy as np
 import cv2

I would like to get these working in IronPython in Unity. Does IronPython have it's own package manager like pip for this, and if so, how would I go about integrating this in Unity? Is there other .dlls for specific packages? Thanks in advance.

sentences:
How can I read a portion of one Minecraft world file and write it into another? I'm looking to read block data from one Minecraft world and write the data into certain places in another.

I have a Minecraft world, let's say "TemplateWorld", and a 2D list of Point objects. I'm developing an application that should use the x and y values of these Points as x and z reference coordinates from which to read constant-sized areas of blocks from the TemplateWorld. It should then write these blocks into another Minecraft world at constant y coordinates, with x & z coordinates determined based on each Point's index in the 2D list.

The issue is that, while I've found a decent amount of information online regarding Minecraft world formats, I haven't found what I really need: more of a breakdown by hex address of where/what everything is.

For example, I could have the TemplateWorld actually be a .schematic file rather than a world; I just need to be able to read the bytes of the file, know that the actual block data starts always at a certain address (or after a certain instance of FF, etc.), and how it's stored. Once I know that, it's easy as pie to just read the bytes and store them.

sentences:
How to manipulate the two variables that rotate the camera with Input.GetAxis(“Mouse X/Y”)? A helpful fellow showed me the script for a free look camera mode that rotates with the mouse. The script is included at the bottom of the page.

I want to have a system that right clicks once to enter this camera mode and right clicks again to exit it and slerps back to the original position. I tried to do it, but it seems like when I right click once and then right click again, it works ok because it's the first time I do it. But when I right click again, it snaps back to the rotation that it last left off from in free look (the starting rotation of the slerp).

Does this have to do with the way the yaw and pitch variables are stored? I assume that after exiting free look, yaw and pitch still hold the values from the last rotation. Consequently, I tried resetting yaw and pitch, but it still has the same old problem.

On the other hand, after playing around a bit, sometimes it resets to a particular rotation no matter what. So does that mean I need to do a bit of testing and say,

if (rotation = x)
{
    pitch = y;
} // figure out what y should be through trial and error testing)

or something like that?

using UnityEngine;
using System.Collections;

public class FirstPersonCam : MonoBehaviour {

    public float speedH = 2.0f;
    public float speedV = 2.0f;

    private float yaw = 0.0f;
    private float pitch = 0.0f;

    void Update () {
        yaw += speedH * Input.GetAxis("Mouse X");
        pitch -= speedV * Input.GetAxis("Mouse Y");

        transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);
    }
}

sentences: Export normal map from unity? In unity I can create a normal map out of a black and white image (By changing the type to normal map and select create from grayscale) Im wondering if there is a way to export the normal map like it should look so I don't need to create it from grayscale when I use it in another project?

sentences:
How do I combine multiple squares into one Tetris block? I am learning Phaser by making a simple game—Tetris. I'm having difficulties:

Can I use simple rectangles as tetrominoes or they should be sprites? I don't know how make the figure's block from simple rectangles and apply physics to it.
How I can join 4 separate squares into one tetromino?

sentences:
Word Wrap in Editor Console I'm working as an educator - I am wondering is there any way to wrap the text of lines output from the Unity editor console?...

Thanks!

sentences:
If I convert my LibGDX game to an exe, is it legal? I have a LibGDX jar file, and I want to have it as an EXE. Would that be legal? (Using launch4j)

Also, how do I obfuscate a LibGDX game?

sentences:
How many texture units are available per shader stage when compared to the total number available on hardware? The answer to the question How many textures can usually I bind at once?, given here, explains that:

OpenGL 3.x defines the minimum number for the per-stage limit to be 16...

and that there can be a higher limit.
This still leaves some ambiguity that I would like to clarify. If we calculate the total number of texture units to be, for e.g., 192 (see here for more details), then does this mean:

theoretically, that we have access to 192 texture units available for the pixel shader? OR
we have access to 192 texture units across all stages, however that still doesn't mean we have access to 192 texture units on any particular stage. OR
?

If #2 is correct, then how do we figure out how many maximum texture units are available on any given stage?

sentences:
Can Unreal Engine Blueprints do everything C ++ code can? Can Unreal Engine Blueprints do everything that C++ code can?

Or are there limitations and some stuff you can't do in Blueprint and only using C++?

sentences:
Problem when importing fbx in Unity made in Blender First I will explain how do I make my object in Blender:

I want to make an object with a texture that have transparecies (png image). I unwrap my object and then apply the image to it in the UV editor. Then I export my object as fbx.

To try the transparecy first I imported a PNG image as a plane on Blender and adjusted the necessary things in order to make work the transparency. You can appreciate the settings I used in the following image:

Until there is all fine. The problem appears when I import the fbx in Unity. The material that I created with the png image is not well visualized.

When I import the fbx object in Unity, this messages appears in the Materials tab:

What do I have to set here in order to visualize well the image with its alpha channel working?

Furthermore, if I try to change the material settings it is impossible because I cannot click the different options as they are disabled:

Can anybody tell me what I'm doing wrong? I don't know if my error is when creating the material in Blender or when I import the fbx in Unity.

sentences:
Scaling HUD with variable resolution I'm unsure as to what people prefer when it comes to HUDs, and scaling them. What would you say is the best practice when it comes to sizing the HUD? I'm thinking there's really two options: Scale up, or use the same area (in pixels) to display it on a higher resolution.

The problems I see with each are with scaling, I may have a huge blurry mess in the corner, but if I don't, it could be hard to see from a distance. Any guidance?

sentences:
Help with character turning? I'm simply trying to make my character turn in his place, whether he's standing still or moving, currently, he isn't turning what-so-ever. Here is the code that I currently have for turning:

I AM NO LONGER USING THIS TURNING FUNTION vvv

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

    if (Physics.Raycast (camRay, out floorHit, camRayLength, floorMask))
    {
        Vector3 playerToMouse = floorHit.point - transform.position;
        playerToMouse.y = 0f;

        Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
        playerRigidbody.MoveRotation(newRotation);
    }
}

So what should be happening is my character should turn and face toward wherever my mouse is pointing, but that isn't happening and I'm not sure why.

Thank you in advance for any assistance.

WHAT I AM USING NOW

I have alternatively tried another bit of code which I will post below, I completely got rid of what is above in place of this:

Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.LookAt(mousePos);

This will actually make the camera follow the mouse, but it goes crazy, the camera seems to spin in circles rapidly : here is actually a gif of what is happening. https://gyazo.com/952da6c28e644b7b0e6500a597b6804e/preview Could anyone help me figure how how to fix it?

sentences:
Synchronizing "token" between players(multiplayer) I am implementing the multiplayer(client-server architecture) of a game, and I came to doubt about entities common to players.

I understand how to share information such as the position of the players among themselves. However I am caught up in the logic of how to do for the common entities between them.

Imagine: Two players and a chicken, how would you share the position of the chicken between them? because it needs to move, and can not move in different places in the two clients, the two clients should see the chicken in the local place, but if I send the position of the chicken of one client, and also the other, there may be conflicts.

What should I do. Choose one of the clients to be the "master" who will send the chicken position to the other players? How do they handle this in online games?

I am thinking of doing the following:

I can not imagine the calculations being done on the server working properly, I will use the example of the hens, my hens would have an AI maybe too complex to stay on the server. I thought the following, one of the clients of the update area, as it is a big map, the clients are receiving updates being in chunks of the map, then one of the clients would be the master (the first one that entered the channel) , the others would just listen to it, the "master" client would then send to the server the chicken positions/states and the server would send to all the clients enrolled in the channel the chicken position/status.

It works similar to a "token" who is at the top of the channel users list is going to deal with the chicken's calculations.

advantages:
- Less work for the server to handle.

Disadvantages:
- Poorly trained players could change the position of the hen and make the game experience unpleasant.

What could you do to avoid this disadvantage?

sentences:
Full screen shader causes performance hit I basically want to have a shader run that can do something like toon shading, or grayscale the whole screen, or radial lighting.

To do this, I create a new bitmap each time the display resizes that is the size of the screen. I then use this as my drawing buffer.

I realized this creates quite a performance hit. Especially on my laptop. Is there a way to do something like this without such a performance hit?

The framework I'm using is Allegro5. This is my current implementation:

void GraphicsContext::flipDisplay()
{
    if(!m_backBuffer)
    {
        al_flip_display();
    }
    else
    {

        setTargetToBackbuffer();
        if(m_shader)
        {
            m_shader->use();
            m_shader->setSampler(m_backBuffer,"tex");
        }
        drawSprite(m_backBuffer,0,0,0);
        if(m_shader)
        {
            m_shader->stop();
        }

        al_flip_display();
        clear();
        setTargetToBuffer();

    }

}

This way all drawing gets drawn to my bitmap, then that bitmap is blitted to the backbuffer.

I tried using single buffering display but it did not help.

Any advice for fullscreen effects?
I have a game I play on my laptop that uses fullscreen film grain and it does not lag. I wonder what they do.

I know that the default shader I set gets ran through every bitmap, but I do not think I can do lighting effects this way since I cannot know which pixel on the screen I'm on.

sentences:
Start timer when button pressed (what is wrong with my code?) I want a timer to start when my rocket takes off and stop when it lands. Stopping works fine (using a collider and state-switching) but I can't get the timer to start when I press the boost button.

Currently the timer text is displayed at the moment I pressed the button but clearly has been counting from the moment the scene started, not the moment the button is pressed.

Any help will be greatly appreciated. If there is a better way to start the timer rather than when I press the boost button then I am open to ideas!

Here is the all relevant code (I think). It appears as though it should be working to me, but it isn't.

// Timer
public Text timerText;
private float startTime;
private bool started = false;
private bool finished = false;

  void Start ()
{
    startTime = Time.time;  // get time since scene started
}

void Update ()
{
    if (currentState == State.Alive)
    {
        ProcessBoostInput();
        ProcessRotationInput();
        ProcessFiringInput();
        if (started)
        {
            RunTimer();
        }
    }

}

    private void ProcessBoostInput()
{
    if (Input.GetKey(KeyCode.A) || (CrossPlatformInputManager.GetButton("Fire1")))
    {
        BoostShip();
        PlayBoostSound();

        if (started != true)
        {
            started = true;
        }

    }

    private void RunTimer()
{
    if (finished)
    {

        return;
    }
    else if (started)
    {
        float timeSinceTimerStart = Time.time - startTime;

        string minutes = ((int)timeSinceTimerStart / 60).ToString();
        string seconds = (timeSinceTimerStart % 60).ToString("f3");

        timerText.text = minutes + ":" + seconds;
    }
}
private void StopTimer()
{
    finished = true;
    timerText.color = Color.green;
}

sentences:
How to achieve rendering at huge distances? These days I was reading some information about the upcoming GTA V technology, in particular, how it is able to truly render all buildings you can see without a draw distance cap or any faking.

Since I will soon be prototyping a big city environment, I wanted some advice on this topic. We're talking about a really big city, with simple geometry but fully lit and shadowed. My doubt comes in particular to the projection matrix, which imposes a maximum draw distance (the zFar parameter).

Now, at the same time, I read everywhere that zFar should be as small as possible for better rendering results, in particular related to depth buffer issues etc, because of the floating point issues.

So, assuming my computer can render this big city in a stable framerate, how should I approach the problem of rendering parts of the city which I can see REALLY far away, fully lit and shadowed? Shadow maps also seem to have problems with low depth buffer precision..

Thanks

sentences:
A way around the deprecation of AppInvite in Unity I was using FB.Mobile.AppInvite, but according to the Facebook documentation, it is deprecated.

So, how could I send an app invite?

sentences:
Using Unity3D from within Eclipse Is it possible to use Unity3D from within Eclipse?  I've seen that I can import a Unity3D project into Eclipse, but I cannot seem to be able to access classes such as Terrain or Ray.  I don't know if that's because I haven't imported the correct libraries or if that's a limitation and that data can only be accessed by methods within Unity3D.  I am designing an Android game within Eclipse and would prefer to use Eclipse than Unity3D, even if that means my game will only be available for Android.

The only real reason I'm using Unity3d is for use of the 3D terrain and to hopefully help in getting the data, such as slope, terrain type, collisions, etc.

sentences:
How does interpolation actually work to smooth out an object's movement? I've asked a few similar questions over the past 8 months or so with no real joy, so I am going make the question more general.

I have an Android game which is OpenGL ES 2.0. within it I have the following Game Loop:

My loop works on a fixed time step principle (dt = 1 / ticksPerSecond)

loops=0;

    while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){

        updateLogic(dt);
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

    }

    render();

My intergration works like this:

sprite.posX+=sprite.xVel*dt;
sprite.posXDrawAt=sprite.posX*width;

Now, everything works pretty much as I would like. I can specify that I would like an object to move across a certain distance (screen width say) in 2.5 seconds and it will do just that.  Also because of the frame skipping that I allow in my game loop, I can do this on pretty much any device and it will always take 2.5 seconds.

Problem

However, the problem is that when a render frame skips, the graphic stutter.  It's extremely annoying.  If I remove the ability to skip frames, then everything is smooth as you like, but will run at different speeds on different devices.  So it's not an option.

I'm still not sure why the frame skips, but I would like to point out that this is Nothing to do with poor performance, I've taken the code right back to 1 tiny sprite and no logic (apart from the logic required to move the sprite) and I still get skipped frames.  And this is on a Google Nexus 10 tablet (and as mentioned above, I need frame skipping to keep the speed consistent across devices anyway).

So, the only other option I have is to use interpolation (or extrapolation), I've read every article there is out there but none have really helped me to understand how it works and all of my attempted implementations have failed.

Using one method I was able to get things moving smoothly but it was unworkable because it messed up my collision.  I can foresee the same issue with any similar method because the interpolation is passed to (and acted upon within) the rendering method - at render time.  So if Collision corrects position (character now standing right next to wall), then the renderer can alter it's position and draw it in the wall.

So I'm really confused.  People have said that you should never alter an object's position from within the rendering method, but all of the examples online show this.

So I'm asking for a push in the right direction, please do not link to the popular game loop articles (deWitters, Fix your timestep, etc) as I've read these multiple times.  I'm not asking anyone to write my code for me.  Just explain please in simple terms how Interpolation actually works with some examples.  I will then go and try to integrate any ideas into my code and will ask more specific questions if need-be further down the line. (I'm sure this is a problem many people struggle with).

edit

Some additional information - variables used in game loop.

private long nextGameTick = System.currentTimeMillis();
//loop counter
private int loops;
//Amount of frames that we will allow app to skip before logic is affected
private final int maxFrameskip = 5;
//Game updates per second
final int ticksPerSecond = 60;
//Amount of time each update should take
private final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;
private double timeCorrection;

sentences:
Unity2019 - PrintDocument ignoring 'DefaultPageSettings.Landscape = true' So I'm trying to print from Unity in landscape and while I can get it to print just not in landscape.
So I create a PrinterSettings Object in 'void Start' and set the printer and tray from dropdowns... and that part appears to work but it's fully ignoring the Landscape property.
public void ShowDialog(string filePath, bool isLandscape)
{
    PdfiumViewer.PdfDocument pdfiumDoc = PdfiumViewer.PdfDocument.Load(filePath);
    _printDocument = pdfiumDoc.CreatePrintDocument();
    _printDocument.DocumentName = "Print Document";

    _isLandscape = isLandscape;

    _printPanel.SetActive(true);
}

public void Print()
{
    int index = _paperSourcesStrings.IndexOf(SelectedPaperSource);

    _printDocument.PrinterSettings = _printerSettings;
    _printDocument.DefaultPageSettings.Landscape = _isLandscape;

    if (index != -1)
    {
        _printDocument.DefaultPageSettings.PaperSource = _paperSources[index];
    }

    _printDocument.Print();

    _printPanel.SetActive(false);
}

sentences:
Proper asset management? I am unable to wrap my mind around designing a good way to manage resources in my game.
For instance, a vertex buffer in DirectX or OpenGL would lead me to believe I should have one central buffer in which I would adapt to my game. But how would I efficiently manage this?
If I had 2 game objects which used the same model but with different properties such as color or position, I would I assume reading from the same section of memory for geometry and having them each passing there own properties to the vertex/pixel shader. But what boggles me is having them read from the same section of the vertex buffer and having the vertex buffer manage the streaming of new data.

Textures and sound surface the same problem to me.

sentences:
Day/Night - Rotation from a sine wave I recently found this question on stack exchange with a great answer that showed how to condense game time into a sine wave, where 1 = midday and -1 = midnight

Converting time of day into a smooth day/night variable?

I've implemented this fine as far as I can tell but I'm a little confused as to how one would get a clean rotation from this to drive a directional light.

Currently I'm using arc-sine to revert the wave to radians and then converting it to degrees but I feel like this is going against the whole process of getting the sine in the first place. It doesn't actually work correctly anyway because we can't tell what side of the unit circle we're on, at least not with my current setup.

Is there a clean way for me to extract a rotation from this sine value so a sun would rotate smoothly? Thanks!

sentences:
Code Logic's execution with respect to time Events I have to show complete 24 hours cycle in Unity3d Scene. Where different kind of task will be executed in different Times.

Suppose

at 2pm I have to move a car,
at 6pm An Aeroplane will land on airport
at 07:07pm I have to open the door of Market's Buildings
and so on different task/works execution at different timing.

Now, I have some basic animation e.g., car, Aeroplane and door etc.,. Now I am confuse that how to play and stop my animation according to the time. And time can also be
changed manually using GUI. If currently 6pm (animation working) then user can switch to 8am to view 8am time's animation (or code execution). And User can also fast the timing to view complete hours in a single minutes or in an hour.

I can use if/else in Update Events but I guess this is not the right way to do and will be very difficult if I require to show significant number of works
in different time duration (which means significant number of if/else statements).  Just like below

void Update(){
if(time =1){
//logic
}
if(time =2){
//logic
}
if(time =3){
//logic
}
...//so on, tedious way
...//and also not possible if time require between the hours, suppose 06:06pm
}

What to do ? How to handle this?

sentences:
Reasonable texture Formats for VertexTextureFetch in GL Wich is a reasonable GL version that have support for vertex textures fetchs(VTF) in OpenGL ? (for example GL 3.0, 3.1, 3.3) What textures formats should I expect to be supported in average video cards when doing such vertex fetch.

Is that possible with GL ES 2?

sentences:
Translating yaw degrees into 2D movement I've been hitting my head on the wall for a while with this, and I'm almost sure I'm overcomplicating it.

I have a variable for yaw in degrees (and also pitch and roll, but those should be irrelevant). I want to turn that variable into normalized 2D movement, so the distance traveled per frame should always be a constant.

I was easily able to to workout movement when I had a fixed view direction, but translating it with yaw is what's confusing me. I've been trying a combination of converting to radians, then using cos(x) and sin(x) but it only works if I'm looking in a certain direction.

sentences:
Using Volumes to reveal secret doors in UE4 C++ project I'm working on a maze project and I would like to have secret doors. My basic idea is to have the walls be destroyed when the player is both within the bounds of a trigger volume, and presses a button. I know the basic way to implement the code, but my main concern is how to handle the volumes. Should I create a class, maybe called "SecretController" that holds the code that says:

"if player is in box[i] and presses fire, destroy door[i]"

This seems like it would work, but I'd rather know before I go create a ton of stuff I'll just have to delete later. Thanks for the help folks!

sentences:
how to render small texture on another texture? can anybody help me to render small texture on another texture.
i.e
I have one background image, when user touches on the screen it should draw small(circle or any object) on it.

can anybody suggest me good tutorial to starts with it?

sentences:
Native vs Framework development for simple board game development I have been working on a simple word game like Hangman Pro but for a different language and I have been using libgdx blindly. After a lot of hassle and unnecessary distractions, I am beginning to wonder if it is an overkill to use the library to do such a simple game. So my question is, is it possible or even professional to do such a game with just the native android libraries ? Will that be an uphill battle in itself.

P.S. I am not an android newbiew but am not a professional either. It is a hobby thing.

sentences:
How do I get my polygons to be lighted by either side? Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene.

The problem that I am having is that when I make a light and have my SR(screenrenderable) near it, it does not light up unless the face of the SR is facing the light...

I am wondering if there is a way to maybe set the material or code(which would be harder) so the SR is lit up whether the vertices of the polygon are facing the light or not. I feel it is possible but the main obstacle is how I would go about doing this.

sentences:
Benefit of storing chunks as Octree leafs vs single block as Octree leaf I saw many voxel game developers opt for a strategy that involves using an octree whose leaf nodes include a 16x16x16 (or 32^3 or 64^3) chunk instead of having leafs represent a single voxel.
What is the reason for this? I also don't understand how this will coincide with LOD, if the leaf is a 32x32x32 chunk, how does the tree manage LOD levels inside the chunk?
If it doesn't, then wouldn't you lose a lot of detail when considering this chunk as 1 voxel? I can't wrap my head around the benefits of doing this :)
I implemented my own version of Octree (Single voxel leaf) with face culling between nodes and I can get the following result (512 ^ 3 voxels):

This takes about 50 MB of RAM (60 FPS) and when transitioning to 1024 ^ 3 it jumps up to 190 MB of RAM (60 FPS).
I am trying now to optimize memory that's why I wanted to start experimenting with LOD but the more I researched the more I found mentions of chunks as leafs.

sentences:
Check whether a game object is inside the boundary I'm developing a small children game similar to Paperama. Here the player can scale rotate and move the object anywhere in the screen and the player should fit it in the boundary. I'm okay with everything (scale, move, rotate etc..) but I couldn't think of a way how to measure the percentage where the target object is inside the boundary object. Here is a graphical representation of what I want to achieve.

I tried comparing vectors and positions but it's so complex and inefficient for symmetrical objects where multiple positions are acceptable to fill the void.

Thanks in advance! :)

sentences:
Changing background images frequently within a specific time range with Cocos2D I am working on a game development project for Android. We use the Cocos2d framework. I have to design a page which contains two background images, I need to switch these images repeatedly within 1sec. How can I do this? How can I use CCTransitionScene in my Java code and change these images repeatedly?

Thanks in advance.

sentences:
When load my unity scene on vmware windows virtual machine, the color/lightening of the scene randomly changes? It turns pink Hi I have a unity scene doing all it is suppose to on mac but I had to load that scene on vmware windows virtual machine and when I did that, the color or the lighting of the scene was randomly changed and I don't know how to fix that. Any help will be highly appreciated.
Thanks

sentences:
Unity Anima2D - IK Limb for leg not working I'm having an issue getting an IK limb to work using Anima2D in Unity. If I place a limb IK for the neck joint, the head moves as expected, however trying to place one for the leg seems to have no effect.

A CCD IK seems to work, but only moving one bone of the leg, whereas I need both bones to move, like a real limb with a knee joint.

Is there anything obvious I'm doing wrong?

Thanks!

sentences:
Calculating the correct particle angle in an outwards explosion I'm creating a simple particle explosion but am stuck in finding the correct angle to rotate my particle. The effect I'm going for is similar to this:

Where each particle is going outwards from the point of origin and at the correct angle. This is what I currently have:

As you can see, each particle is facing the same angle, but I'm having a little difficulty figuring out the correct angle. I have the vector for the point of emission and the new vector for each particle, how can I use this to calculate the angle?

Some code for reference:

 private Particle CreateParticle()
        {
...

            Vector2 velocity = new Vector2(2.0f * (float)(random.NextDouble() * 2 - 1), 2.0f * (float)(random.NextDouble() * 2 - 1));

            direction = velocity - ParticleLocation;

            float angle = (float)Math.Atan2(direction.Y, direction.X);

...

            return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl, EmitterLocation);
        }

I am then using the angle created as so in my particles Draw method:

spriteBatch.Draw(Texture, Position, null, Color, Angle, origin, Size, SpriteEffects.None, 0f);

sentences:
What language and tools are good to start with for Linux game development? I would like to start learning about game development and I would like to do it using Linux. My main experience has been with Java and a bit of C++, but that was for applications and not games.

Now that I want to try with gaming, I'm wondering which IDE/language should I use in Linux, whether I should go with C++ and compiling files manually at the beginning, or maybe continue with Java/Eclipse, also I think I can use Eclipse with C++, I have also started reading about Python...

I was thinking in starting with the typical "Tetris" just to understand how a game works internally, and I think I can achieve that with all the previous options, but what do you recommend me or how have you started game developming under Linux?

sentences:
What is the little dot/icon at the center of the screen in an FPS game called? So I am developing a game and trying to find one of those to use, but I don't know what to search for. If you don't know what I am taking about, look at these examples:

What are these called?

sentences:
Units issue when exporting from 3DS Max to XNA I am working on a XNA game where we have defined that 1 XNA unit equals to 1 meter. Then, I set meters as system unit in 3DS Max and set to meters the units in the FBX exporter. However, when I export my models, they are much bigger in the game. Am I missing something? What should I do to avoid problems with my units?

Investigating the FBX file, I noticed that I it has two values called UnitScaleFactor and OriginalUnitScaleFactor. They both are 100 when I export the files... And if I manually change UnitScaleFactor to 1, it works fine :S

sentences:
Libgdx RotateToAction does not directly rotate between 179 and -179 It took me a bit of debugging to realize why I'm having trouble with my rotations and it seems that rather than just moving the 2 degrees between 179 and -179, it prefers to rotate all the way in the other direction, the full 358 degrees.

Is there any way to make it go the short way in this case?

Code I have so far:

public void rotateTo(float targetRotation)
    {
        RotateToAction rotateToAction = new RotateToAction();
        rotateToAction.setRotation(targetRotation);
        rotateToAction.setDuration(2f);
        if(Math.abs(this.getRotation()-targetRotation) > 180)
        {
        /*failed attempt to force rotation*/
            SequenceAction sequenceAction = new SequenceAction();
            RotateToAction rotateToAction2 = new RotateToAction();
            rotateToAction2.setRotation(180);
            rotateToAction2.setDuration(1f);
            sequenceAction.addAction(rotateToAction2);
             sequenceAction.addAction(rotateToAction);
            this.addAction(sequenceAction);
        }
        else
        {
            this.addAction(rotateToAction);
        }
}

sentences:
Need help in making buttons for MenuScreen in Java I'm making a Menu for my game and I made the MenuState(class) and made a MouseManager(class, implemented MouseListener and MouseMotionListener) and they are different class in different folder. Here is my problem, usually people make their buttons my drawing rectangles and adds font and makes that their button.
But I didn't do that. I made a button using Photoshop and I put it in my sprite sheet, cropped it and made it my button. now I want to make it that if I click on my 'play' button picture it sends to my GameState and if I click on my 'exit' button picture it closes my window

MyMenuState(class)

 package com.vescorspel.game.MyFirstGame.states;

import java.awt.Color;
import java.awt.Graphics;

import com.vescorspel.game.MyFirstGame.Handler;
import com.vescorspel.game.MyFirstGame.gfx.Assets;

public class MenuState extends State{
// Resizing my button from 64 pixels to 256 pixels
public static final int ButtonWidth = 256;
public static final int ButtonHeight = 256;

// coordinates where my buttons are placed in pixels ;)
public static final int PlayButtonX = 500;
public static final int PlayButtonY = 100;
public static final int ExitButtonX = 500;
public static final int ExitButtonY = 400;

public MenuState(Handler handler){
 super(handler);
}

// My tick method
@Override
public void tick() {
 //This If statement tells my game if I LeftClicked anywhere in the MenuScreen, then it send me to my GameState(GameScreen)
 if(handler.getMouseManager().isLeftPressed())
  State.setState(handler.getGame().gameState);;
}

//My render where i render the button pictures in my MenuScreen
@Override
public void render(Graphics g) {
 //PlayButton from my Assets class(this is an image)
    g.drawImage(Assets.PlayButton, PlayButtonX, PlayButtonY, ButtonWidth, ButtonHeight, null );
    //ExitButton from my Assets class(this is an image)
    g.drawImage(Assets.ExitButton, ExitButtonX, ExitButtonY, ButtonWidth, ButtonHeight, null);
    //these 2 commands tells my game to make a red cube and follow my mouse in the MenuScreen
    g.setColor(Color.RED);
    g.fillRect(handler.getMouseManager().getMouseX(), handler.getMouseManager().getMouseY(), 8, 8);
}
}

MouseManager(class)

package com.vescorspel.game.MyFirstGame.input;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class MouseManager implements MouseListener, MouseMotionListener{
 private boolean leftPressed;
 private int mouseX, mouseY;

 public MouseManager(){
 }

 //Getters

 public boolean isLeftPressed(){
     return leftPressed;
 }

 public int getMouseX(){
     return mouseX;
 }

 public int getMouseY(){
     return mouseY;
 }

 // Implemented methods

 @Override
 public void mousePressed(MouseEvent e) {
  if(e.getButton() == MouseEvent.BUTTON1)
   leftPressed = true;
 }

 @Override
 public void mouseReleased(MouseEvent e) {
     if(e.getButton() == MouseEvent.BUTTON1)
         leftPressed = false;
 }

 @Override
 public void mouseMoved(MouseEvent e) {
     mouseX = e.getX();
     mouseY = e.getY();
 }

 @Override
 public void mouseDragged(MouseEvent e) {
     // TODO Auto-generated method stub

 }

 @Override
 public void mouseClicked(MouseEvent e) {
 }

 @Override
 public void mouseEntered(MouseEvent e) {
     // TODO Auto-generated method stub

 }

 @Override
 public void mouseExited(MouseEvent e) {
     // TODO Auto-generated method stub
 }

}

sentences:
Everything is set to Bounciness 0 - Why am I still bouncing? I am creating a platformer where rather than manipulating the character to get them from the beginning of the level to the end, you manipulate the world.  Thus, when you want to make the character 'jump' over a gap, you actually use the land like a slingshot and 'fling' them.

This is all working well and good save for one thing - whenever I pull my land down and my player falls into it again, it begins to bounce - aggressively so!

I have made EVERYTHING out of a new physics material with 0 bounce, and I set my default physics to 0 bounce.

My player is a rigidbody2D that is moving itself along on top of other rigid bodies.

What gives? Why, even though EVERYTHING is set to 'no bouncing allowed' does my game turn into a bouncy-house whenever i start to play?

EDIT: Here is a video of the behavior:

FlingyJump - Bouncing Issues

EDIT: I have noticed a correlation to the bounce occurring and the spring being active.  It have noticed that two things are happening:

1) The spring is for some reason transferring force through to the ground piece while being stretched out.

2) The player is bouncing before even ever hitting the ground.  I don't know quite how that is possible but it seems like as soon as it is enters the original position of the rigidbody2D for the ground piece it bounces.

sentences: How can I prevent the knob from resizing when I use the Slider? I am using the Unity Slider component.  I have a custom background and custom knob.  But whenever I move the slider, my knob's size becomes distorted.  It is 100x100 pixels, and when I set it to its native size, it does so.  But I soon as I move the slider, it cuts its height in half.  How can I prevent this from happening?

sentences:
Andengine reducing sprite quality? I have a problem with bandings using andengine. When painting a picture on PC and uploading it to my phone, they look exactly the same. But as soon as I use that bitmap (PNG) in Andengine, I have bandings (big color steps).

Now I know that my display is capable of displaying the image right and I know how to us dithering but it bothers me. Does anyone know how to disable this quality reduction in Andengine?

sentences:
Animate Gradient Material Offset in Babylon.js I'd like to create an animated gradient material in babylon.js. I set up my gardient mateiral like this:
   var gradientMaterial = new BABYLON.GradientMaterial("grad", scene);
   gradientMaterial.topColor = new BABYLON.Color3(0, 0, 1);
   gradientMaterial.bottomColor = new BABYLON.Color3(0, 0, 0);
   gradientMaterial.offset = 0.8;
   gradientMaterial.offset = test;
   gradientMaterial.smoothness = 1;
   sphere.material = gradientMaterial;

I render my scene in the render loop:
    engine.runRenderLoop(function () {
    scene.render();
    }); code here

I'd like to animate the gradientMaterial offset so that every 5 seconds it repeats. I'm just not sure where to iterate the .offset value.

sentences:
Facilitating XNA game deployments for non programmers I'm currently working on an RPG, using the RPG starter kit from XNA as a base. (http://xbox.create.msdn.com/en-US/education/catalog/sample/roleplaying_game) I'm working with a small team (two designers and one music/sound artist), but I'm the only programmer. Currently, we're working with the following (unsustainable) system: the team creates new pics/sounds to add to the game, or they modify existing sounds/pics, then they commit their work to a repository, where we keep a current build of everything. (Code, images, sound, etc.) Every day or so, I create a new installer, reflecting the new images, code changes, and sound, and everyone installs it.

My issue is this: I want to create a system where the rest of the team can replace the combat sounds, for instance, and they can immediately see the changes, without having to wait for me to build. The way XNA's setup, if I publish, it encodes all of the image and sound files, so the team can't "hot swap." I can set up Microsoft VS on everyone's machine and show them how to quickly publish, but I wanted to know if there was a simpler way of doing this.

Has anyone come up against this when working with teams using XNA?

sentences:
Efficiently culling off-screen objects on a top-down 2D map I know efficiency is key in game programming and I've had some experiences with rendering a "map" earlier but probably not in the best of ways.

For a 2D TopDown game: (simply render the textures/tiles of the world, nothing else)

Say, you have a map of 1000x1000 (tiles or whatever). If the tile isn't in the view of the camera, it shouldn't be rendered - it's that simple. No need to render a tile that won't be seen. But since you have 1000x1000 objects in your map, or perhaps less you probably don't want to loop through all 1000*1000 tiles just to see if they're suppose to be rendered or not.

Question: What is the best way to implement this efficiency? So that it "quickly/quicker" can determine what tiles are suppose to be rendered?

Also, I'm not building my game around tiles rendered with a SpriteBatch so there's no rectangles, the shapes can be different sizes and have multiple points, say a curved object of 10 points and a texture inside that shape;

Question: How do you determine if this kind of objects is "inside" the View of the camera?

It's easy with a 48x48 rectangle, just see if it X+Width or Y+Height is in the view of the camera. Different with multiple points.

Simply put, how to manage the code and the data efficiently to not having to run through/loop through a million of objects at the same time.

sentences:
How can I show xna graphics content in a control on a form in xna? I was able to create a form in xna using "Add Windows Form", named "Form1" then adding:

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());

How can I add graphics to some control, perhaps a picturebox, on Form1 that could potentially show my game as in a level editor?

Thanks.

sentences:
Hide back button bar of android mobile while playing game I just want to hide back button bar of android mobile while playing the game.

I tried to make it close by pressing back button,it getting close but its always visible.
please help..

sentences:
Read function outside of code while run-time? Hi it is my first post on this community. So if i was rude or something please let me know :)

So I just started learning game development alone. It's been about 1 year since I begin to learn c and c++.
Recently I started planning to make a game for my own entertainment and future career.

I'm trying to make the game as mod-friendly as possible.
So I thought that I should make abstract classes that have most of the functions for working on run-time. Then when the game starts, the system reads mod files for filling out class information and stores that base object in some data storage made with a singleton(for easy access). And, then use a factory pattern(I hope I'm using it right) to copy the base object that I need, fill it with basic information and store it in the object storage.

The problem is, I can't figure out how I can make it so each object from each mod file acts with its own behavior.

For example:
Core mod(main game) has an abstract class named 'living entity'
'Living entity' has some information like bone structure type, mesh name, entity size, etc...
And a mod file from the core mod makes a 'human' class that has information for 'human bone type','basic human','human size' etc
The human class does not need any special functions because it only uses basic functions that the game provides.

But modder A wants to make a Vampire entity.
Vampire will have information like a human. So modder A fills up or copies the 'human' file and edits the class id value with which the system identifies objects and uses as a name.
Vampire needs new skills, health effects and custom death(leaves an ash pile instead of a corpse)
The game also has skills and health effects as a kind of component or class. So modder A fills up information but one of the skills has a unique projectile effect or one of the health effects has a unique behavior that the game does not provide
So modder A wants to override projectile or health functions only for the vampire's unique skill or health

In this case how would I support them to override functions for their own needs?
One of my idea was to read the dll and store function pointers in data storage and put the code on a base abstract object and then call it if the object has a custom function.
But I am not sure this works and that it is how people do it.
So if there is some kind of information or documentation for that please let me know
I'm arguing with this problem about month D;

sentences:
Why do Unity networking libraries fail when building for the Windows Store? I am using Lidgren and RSA in my networking framework, but things like IPAddress are "nonexistent" when I try building for windows store. RSA classes don't work, either.

Why is this? How could I still have a networked game on the Windows Store?

sentences:
Monogame crashes without any change I've written a game in MonoGame, which works great on my desktop computer. It's running Windows 8, has a good graphics card and can be assumed to be up to date with everything.

However, when I run on my laptop, it crashes within the starting function game.Run(). I created a new template project, and it still crashes. I've check the obvious places, it's running x86 config, I've installed the openAL, and the dlls are in the right places.

The error is "NullReferenceException" occurred in MonoGame.Framework.dll

I can't post images, but I've changed nothing about the new project. It runs the init and the loadContent functions, then crashes.

The thing that might be important, the laptop has openGL 2.1, Windows 7. I have OpenTK, OpenAL installed. If anyone has even suggestions on things that might be the cause, or want more info, just say.

EDIT: The stack is as follows:

at Microsoft.Xna.Framework.Audio.OpenALSoundController.Update()
at Microsoft.Xna.Framework.OpenTKGamePlatform.BeforeUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.OpenTKGameWindow.OnUpdateFrame(Object sender, FrameEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at OpenTK.GameWindow.OnUpdateFrame(FrameEventArgs e)
at OpenTK.GameWindow.OnUpdateFrameInternal(FrameEventArgs e)
at OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch update_watch, Double& next_update, FrameEventArgs update_args)
at OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e)
at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
at OpenTK.GameWindow.Run(Double updateRate)
at Microsoft.Xna.Framework.OpenTKGamePlatform.RunLoop()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Microsoft.Xna.Framework.Game.Run()
at Mojo.Program.Main(String[] args)

Posted as an error report to MonoGame, I'll answer this depending on their response.

sentences:
Time complexity of solving constraints in physics engine Erin Catto mentioned in a talk that solving constraints precisely requires cubic time and quadratic space. What algorithm is he talking about when he mentions cubic time?

pdf of slides with following quote:

  We can model and program our constraints perfectly. Good enough to drive a robot arm on an assembly line or
  launch a satellite into space. Unfortunately for games, we do not have enough cycles to solve constraints accurately.
  Solving constraints precisely requires cubic time and quadratic space. For games we make due with linear time and
  space, so we are constantly wrestling with our solvers. The better you understand constraint solvers, the better
  chance you’ll have of creating robust simulations in your game.

sentences:
Why would an online MMO throttle actions per day? I started playing Die2Nite and was surprised that it has such a strict limit on the number of actions per day. After a while, I figured it was just part of the charm.

I also started playing Magic Duel and it has a similar mechanic that limits the amount of actions per day.

Is there a game design principle behind a decision to limit actions per day in an MMO?

sentences:
Will Geolocations for IPs ever change? I'm making a game where the geographic location of a user is used to give them a little flag icon next to their user name. To do this, I've been using the ipstack API. However, the API only allows up to 10,000 requests per month, and since I make a request every time a user connects, this could easily lead to overuse.

Would it make sense to just store geolocation data on my server and only make a request when an unknown IP connects? Or will the geolocation data ever change for an IP?

sentences:
Blender 2.6: Changing the Resolution (Rings/Segments) of a UVSphere's I know that it's possible to change the resolution (I mean the rings and the segments) of a UVSphere by pressing [F6] and changing some arguments.

But what if I add a UVSphere to my canvas at first, then I do something else in the meantime and not till then I want to change the resultion of the UVSphere which I added before. Is that possible? Thanks.

sentences:
How can I create hemisphere worlds (floating islands?) with 3d (or 2d)? Noise (Perlin/OpenSimplex) I've been experimenting with noise for a while and I've gotten some terrain up: It looks like this:

What I'd like instead is to have planets like this (currently mine is in a cube shape)

My generation code actually skews the values so the top is not solid and the bottom is. I tried to reverse this but I got a giant mess, with the top being completely solid up to the worldheight and the bottom having holes caved into it. Here is my generation code:

                    float value = noise.GetPerlinFractal(worldLoc.x, worldLoc.y, worldLoc.z);

                    if (y <= waterHeight) {
                        for (int i = y; i <= waterHeight; i++) {
                            chunk.addBlock(x, i + 1, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.WATER));
                        }
                    }

                    if (value - ((y - 128) * 0.01) >= 0) {
                        if ((y > waterHeight && y < waterHeight + 2)) {
                            chunk.addBlock(x, y, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.SAND));
                        } else {
                            chunk.addBlock(x, y, z, BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.GRASS));
                        }

                    }
                    if (y < 105) {
                        if ((Math.pow(noise2.GetNoise(worldLoc.x, worldLoc.y, worldLoc.z), 2) + Math.pow(noise3.GetNoise(worldLoc.x, worldLoc.y, worldLoc.z), 2)) < 0.02) {
                            if (!(chunk.getBlock(x, y + 1, z) == (BlocksConfig.getInstance().getBlockRegistry().get(BlockIds.WATER)))) {
                                chunk.addBlock(x, y, z, null);
                            }
                        }
                    }

This is done for every block in every chunk.
I'm a bit confused here and saw other ancient posts about this. However, I don't exactly understand and was wondering if someone could explain such for me. Thanks so much in advance!

sentences:
Dynamic object creation from data I want to write somewhat randomized object activation effects, like when you step on a trap, you can be tepelorted, damaged, cursed and so on. I applied strategy pattern for this: damage/healing managed by class ChangeHealth, teleportation by class SetPosition etc.

I want to know how can I manage creation of objects in code from data, so, for example I want to be able to set that there will be trap which will damage player and there will be shrine which should teleport you upon activation from, for example, string or bit stream.

I'm working in C#, but interested in overall approach to this problem.

sentences:
Simplified math formula to calculate stock price based on supply/demand I am making an overly simplified version of a stock simulator game, because I:

am fascinated with how the stock market works
learn better & faster from a project like this, rather than text-books

Before writing any actual code, I started making an Excel spreadsheet to simulate the fluctuations of 1 company's stock based on how many people buy/sell the stock on any given day, so that when I have the code, I have something to compare it against to know that it works.

Variables I have access to:

a) Total amount of stock issued - 10000
b) Starting stock price when the company goes public - $10.00
c) Stock available on any given day
d) Stock bought/sold on that day - for example, 150 on day 1
e) Stock bought/sold the previous day - when first starting the simulation, this number is 0
f) Company profits on any given day - For simulation purposes, profits are calculated daily, not quarterly or yearly
g) Stock price - This is what I need calculated

I tried using (d-e)/a which gives me a difference, like 0.015 which I use to get the stock price for the next day.
But it just seems too simple, since buying 100% of the stock on day 1 and then selling 100% of it on day 2, brings down the price to $0.00. Perhaps this would work given enough random participants who all buy/sell the stock, but in this case, I need the simulation to work with just 1 person. And the simple function I wrote just gives too much power to that 1 person.

PS: For simulation purposes, I assume there is always a buyer and always a seller for the stocks.

PPS - Edited to provide the test numbers I'm starting with

sentences:
AABB of rotated sprite? Say I have a sprite. Its AABB is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I calculate the bounding rectangle of a rotated rectangle (given a center point, an angle, and its width and height)?

Note that OpenGL does the rotation so I do not have access to the vertex information.

What I'm trying to do is get AABBs so I can do 2D culling for rendering.

Thanks

sentences:
Mixing threads and coroutines in Unity3D Mobile I had a coroutine in Unity3D that downloaded a zip from a server, extracted it to the persistent data path, and loaded its contents into memory. The flow looked something like this:

IEnumerator LongCoroutine()
{
    yield return StartCoroutine(DownloadZip());
    ExtractZip();
    yield return StartCoroutine(LoadZipContent());
}

But the ExtractZip() method (which uses the DotNetZip library), is synchronous, takes too long, and leaves me no place to yield during the process.

This resulted in the application being killed (on mobile devices) whenever I tried to extract a large zip, which I assume is due to the main thread becoming unresponsive for too long.

Is this something that mobile OS are known to do (kill the app if a frame takes too long)?

So, I assumed that extracting the zip on a separate thread might solve the problem, and it seems to have worked. I created this class:

public class ThreadedAction
{
    public ThreadedAction(Action action)
    {
        var thread = new Thread(() => {
            if(action != null)
                action();
            _isDone = true;
        });
        thread.Start();
    }

    public IEnumerator WaitForComplete()
    {
        while (!_isDone)
            yield return null;
    }

    private bool _isDone = false;
}

And I use it like this:

IEnumerator LongCoroutine()
{
    yield return StartCoroutine(DownloadZip());
    var extractAction = new ThreadedAction(ExtractZip);
    yield return StartCoroutine(extractAction.WaitForComplete());
    yield return StartCoroutine(LoadZipContent());
}

But I'm still not sure if this is the best way to implement it, or if I need to lock _isDone (not too used to multithreading).

Can something go wrong with this / am I missing something?

sentences:
Writing the correct value in the depth buffer when using ray-casting I am doing a ray-casting in a 3d texture until I hit a correct value. I am doing the ray-casting in a cube and the cube corners are already in world coordinates so I don't have to multiply the vertices with the modelviewmatrix to get the correct position.

Vertex shader

world_coordinate_ = gl_Vertex;

Fragment shader

vec3 direction = (world_coordinate_.xyz - cameraPosition_);
direction = normalize(direction);

for (float k = 0.0; k < steps; k += 1.0) {
....
pos += direction*delta_step;
float thisLum = texture3D(texture3_, pos).r;
if(thisLum > surface_)
...
}

Everything works as expected, what I now want is to sample the correct value to the depth buffer. The value that is now written to the depth buffer is the cube coordinate. But I want the value of pos in the 3d texture to be written.

So lets say the cube is placed 10 away from origin in -z and the size is 10*10*10. My solution that does not work correctly is this:

pos *= 10;
pos.z += 10;
pos.z *= -1;

vec4 depth_vec = gl_ProjectionMatrix * vec4(pos.xyz, 1.0);
float depth = ((depth_vec.z / depth_vec.w) + 1.0) * 0.5;
gl_FragDepth = depth;

sentences:
Naming conventions for external resources? While we develop games, then we have utilize several external resources, for example

Image
Sound
Animation
Sprite Sheet

Is there any good naming convention regarding these external resources?

sentences:
Why use textures that are Power of Two? Possible Duplicate:
  Why are textures always square powers of two? What if they aren’t?

I am using C# and XNA (also MonoGame for other platforms than Windows) to create a game in 2D. Ususally for all textures I use the NVidia plugin for Photoshop to create DDS files with precomputed mip-maps (either full color, or DXT-5).

How important is it, nowadays, to stick to textures with extensions that are a power of two? What are the advantages and disadvantages of doing so?

The background of my question for that I use a number of quite large background images in with 1980 x 1080 pixels in size and storing them in textures of 2048 x 2048 pixels size seems like a tremendous waste of memory.

Let me stress that I am aware that having only power-of-two textures has been important in the past for certain specific optimizations BUT I would like to know whether this TODAY (GPUs of the last ~2 years, current consoles etc.) is still required?

sentences:
How can I determine how widespread support of OpenGL ES 3 is? I am developing new app in OpenGL which should run on iOS and Android devices.
I'd like to use OpenGL ES 3. For iOS that's not a problem, since any iPhone newer than the 5 has GLES 3.

But I am not sure how wide-spread GLES 3 is in the Android world or if all new devices support it. How can I determine how much support exists for GLES 3 so I can determine if I should use it or fall back to an older version?

sentences:
Cartesian Coordinates & Layout The way cartesian coordinations are presented and used is kinda confusing.

When working with 2D the vertical axis is Y, though when working with 3D the vertical axis is Z and Y becomes the "depth" axis.

Basically I'm thinking the correct way, and best way would be to use the layout of axis.

Though Blender (3D modelling program) and other program, a lot games, present the axis in the "weird order" (my opinion)

Also if you read on Wikipedia about cartesian coordinates, your are presented with that layout of axis.

Wikipedia Cartesian Coordinates

Is there any specific or logical reason for this "flip" of axis?

sentences:
What data should a generic collision detection system gather? I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?

sentences:
Algorithm to find all tiles within a given radius on staggered isometric map Given staggered isometric map and a start tile what would be the best way to get all surrounding tiles within given radius(middle to middle)?

I can get all neighbours of a given tile and distance between each of them without any problems but I'm not sure what path to take after that. This feature will be used quite often (along with A*) so I'd like to avoid unecessary calculations.

If it makes any difference I'm using XNA and each tile is 64x32 pixels.

sentences:
Making a parent system with euler angles (gimbal lock problem) I have a system where objects can be connected to each other - as the parent rotates the child objects will rotate too and child objects themself can rotate too. The system is already working, however, I am doing it with rotation matrices.
I want to dynamically simulate angular physics and for that, I would need the angular velocity for which I thought the direct and easiest way would be to get the difference of the euler angles.
I am still a beginner with those rotation maths like matrices, quaternions etc.
The problem is that the rotation of the children would be local and currently I am just adding the euler angle values (which works fine if I only rotate around one axis). So when I rotate a child on the x axis by 90 degrees and then rotate the parent on the y or z axis the system breaks (y and z should be swapped in this scenario with 90 degrees x rotation)
As far as I have understood it the problem could be explained with "gimbal lock".
Is there a way to calculate the local euler angles? Or is there in general a better way to achieve what I am trying to do here? I have heard that quaternions also don't save 360+ degrees, so that would be also a problem for angular velocity.

sentences:
GPU optimization question: pre-computed or procedural? I'm learning shader program and need some general direction.

I want to add noise to my laser beam.

Which is the best way to handle it?

I could pre-compute an image and pass it to the shader. I could then use the image to change the opacity and easily animate the smoke by changing the offset of the texture lookup.

I could also generate noise in the shader and do the same thing the texture was used for.

Is it generally better to avoid I/O to the graphics card or the opposite?

sentences:
NiftyGUI - Text isn't rendering I am trying to create a gui with nifty on top of lwjgl. I've already had some problems during the Nifty setup, however now Nifty is set up and running correctly but for text rendering.
Here is my xml file:

    <?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.4.xsd" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://niftygui.
sourceforge.net/nifty-1.4.xsd http://nifty-gui.sourceforge.net/nifty-1.4.xsd">
    <screen id="start">
        <layer childLayout="center">
            <panel id="panel" height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="center" visibleToMouse="true">
                <text id="text" font="aurulent-sans-16.fnt" color="#ffff" text="Hello World!"/>
            </panel>
        </layer>
    </screen>
</nifty>

and here the respective java class:

package niftylwjgl;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.nulldevice.NullSoundDevice;
import de.lessvoid.nifty.renderer.lwjgl.input.LwjglInputSystem;
import de.lessvoid.nifty.renderer.lwjgl.render.LwjglRenderDevice;
import de.lessvoid.nifty.tools.TimeProvider;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;

public class NiftyLwjgl {

    private static Nifty nifty;
    private static boolean close;
    private static LwjglInputSystem inSys;

    public static void main(String[] args) throws LWJGLException, Exception {
        init();
        initNifty();
        while (!close) {
            update();
            preRender();
            render();
            postRender();
        }
        destroy();
    }

    private static void init() throws LWJGLException {
        Display.setDisplayMode(Display.getDesktopDisplayMode());
        Display.setFullscreen(true);
        Display.create();

        GL11.glOrtho(0, 1920, 0, 1080, 1, -1);
    }

    private static void initNifty() throws Exception {
        inSys = new LwjglInputSystem();
        inSys.startup();

        nifty = new Nifty(new LwjglRenderDevice(),
                new NullSoundDevice(),
                inSys,
                new TimeProvider());
        nifty.fromXml("xml/main.xml", "start");
        nifty.loadStyleFile("nifty-default-styles.xml");
        nifty.loadControlFile("nifty-default-controls.xml");
    }

    private static void preRender() {
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);

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

        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    private static void postRender() {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
    }

    private static void update() {
        if (Display.isCloseRequested()
                || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)
                || nifty.update()) {
            close = true;
        }
    }

    private static void render() {
        nifty.render(false);
        Display.update();
    }

    private static void destroy() {
        inSys.shutdown();
        Display.destroy();
    }
}

Here is a screenshot of the application running:

I somehow feel like I'm missing something incredible simple but important, like an glXXXXX call.
Any help/suggestions are appreciated.

sentences: Blender modelling for a C++ game? I want to know if it were possible to integrate models created with Blender into a game written in solely C++.

sentences:
How do I create an efficient long, pannable, sprite-animated scene in a Windows Store game? I am creating my first Windows Store application in XAML, and I cannot seem to find a proper example for the requirements I have.

The basic idea of the app is to have a large scrollable canvas which would lazily start animating visible parts of the view as soon as user stops panning over a certain content (with some audio played also):

My original idea was to use a StackPanel to add a bunch of custom controls, each of which would then animate itself once visible (with a short delay), but I have a couple of concerns:

If the entire canvas is ~50 screen widths wide, is it feasible to load all content at the beginning, or do I need to plan doing some lazy loading during scrolling? For example, when I select a certain region in the Bing Travel app, it seems to lazily load tiles as I scroll it towards the end.
Since content is stretched 100% vertically, and these animations are vectorized to be resolution independent, I am not sure if XAML (CompositionTarget) will be able to handle this, or I have to go for DirectX (MonoGame or C++) to get rid of flicker.
Even better, is there an example for Windows 8 which uses a 100% vertically sized GridView with custom animated controls inside?

sentences:
What score/level function is often used? In many games you raise a level when you reach a certain score, and later levels are harder to reach than in the beginning.

I am suspecting that it is some sort of exponential function that is used in e.g. WoW.

Does anyone know of a good exponential function for this purpose?

sentences:
Applying velocity to parent that ignores children's mass not working I am making a VR data visualisation app in Unity and I have a parent with many children (just some primitive cubes) that I can toss around the scene by just setting the parent's rigidbody to the same velocity as my tracked VR controller.
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity(); // how I ref the controller velocity in SteamVR
rb.velocity = controllerVelocity * 2f; // the 2f is just to speed up the velocity

The above code works fine, but the problem is I think the scale of the children objects, which can be adjusted by the player, is affecting the velocity the parent moves at. Or maybe just when the children are very large...the controller velocity is comparatively too slow? Basically I need this to not be the case; I want the parent's rigidbody to move at roughly the same velocity no matter the children's scales/masses.
So to achieve that I thought to use Rigidbody.AddForce but it doesn't seem to be making any difference i.e. larger children are still moving slower. Here is what I have so far:
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity();
rb.AddForce(controllerVelocity  * 2f, ForceMode.VelocityChange);

I also tried ForceMode.Acceleration but then nothing moved at all? Am I using AddForce incorrectly? Or do I just need a scaling multiplier based on the size of the children? Any help is welcome.

sentences:
Is it better to track rotation with a vector or a float? In XNA, you can see that to draw a rotated sprite with SpriteBatch, you'll need a float describing the angle in radians.

I'm used to making games in OpenGL. I just want a rapid prototyping environment in XNA, but I'm a little lost. It's my preference to always use Vectors to store my rotation, to do vector math, et cetera.

So my question is: in XNA, is better to keep a vector for your rotations, and each frame transform to a float angle, or just keep the float angle itself? If I prefer the vector, what would be my drawbacks compared to just using a float?

sentences:
RGBA values not coming as intended | LibGDX As it states, my RGBA values aren't coming out the way I want it to be.
My RBGBA values are
    As it states, I am trying to create a orange tinted color on my game.

221, 189, 98, 0.7

I am using a ShapRenderer called tint, and here is the code:

ShapRenderer tint = new ShapRenderer();
tint.begin(ShapeType.Fill);
tint.setColor(221, 189, 98, 0.4f);
tint.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
tint.end();

I had tried this out in CSS, and it came out with the correct color. But with LibGDX, the game screen is plain white. The opacity (rgb 'A' value) does not have any affect on the tint color.

sentences:
Making a game preloader (Flash) Possible Duplicate:
  How do you create a single/internal pre-loader for a Flash game written using Flex?

Hi guys, Im trying to make a preloader in a Flash game.

Thing is, I need some advices on this since I never made one, I have the game almost complete, but when, i.e, I upload the game to a website I get a white screen for a few seconds, and then I see the game.

Is there a simple way, maybe using an a API or something like that, to make a preloader screen?

Im using Flash Builder fyi.

Thx!

sentences:
Compressing textures and recompressing textures Which tools are considered best-quality for compressing textures for use in OpenGL?  Which can be used from the Linux commandline?

And which lossless compressors give good ratio/speed on compressed textures?

(I see that Skyrim's BSA archives are typically only half the size of the DDSes they contain)

sentences:
Dynamic entities using classes and objects I'm trying to create a program which involves the creation of several characters/entities.

At the moment I have a Base Entity class an Entities class and a Main class. I can handle one entity alright, however I am trying to create each one editable through a standard function call.

Main Class: http://pastebin.com/AjgEBSke
Entity Class: http://pastebin.com/5y2wD3Qc
BaseEntity Class: http://pastebin.com/VfqRgeng

I feel a little confused on how to dynamically call and edit each specific character without limiting myself to lots of 'if' statements. I have tried to restart this project several times...

Basically I'm creating a private object in a class. That class will be used to talk to that private object, Save, load and edit etc.

Then in a seperate Entities class I create an instance of that object, this is where I think im getting caught up. As far as I know, I need to handle everything I want to do in that entity in this entity class.

I give the entity/object an ID, and a default name which I want to be able edit later. I also want to eventually be able to call that entity from other classes to 'draw' it, have it return the values I need to draw it, Name, body type etc (other variables in the object).

I have managed to interact with a specific instance of the object class by checking if the String is equal to an objects ID and then doing something, this however I feel is not dynamic and I'll just get into a bigger mess.

Ideally I think I want to be able to enter the object's class' instance name as a string and have it handle everything.

Sorry this has been rather long, if you know of any articles or information on how I'd learn to create dynamic entities to do what I need to do, that'd be great.

Im probably looking more for an explanation of the concept of what I'm trying to do as i've only just really sketched up this code. So this code might be a little pointless at the momemnt. Ive attempted it a few times, trying to set things up better each time, however ultimately fail when I try to make things behave dynamically. If i'm going about this completely the wrong way then please tell me as I'm still learning and don't want to get into the habit of doing things badly.

sentences:
How do I reference one game object in a script attached to another? This is all in Unity, with C#.

I have attached a script to my player that should destroy a TreeGroup (as in a forest) whenever I press 'Q' and instantiate one when I press 'E'.

Here is the code:

using UnityEngine;
using System.Collections;

public class DisableTrees : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetKeyDown (KeyCode.A)) {
            //Disable Trees on A Keypress

            Debug.Log("Trees Disabled!");
        }

        if (Input.GetKeyDown (KeyCode.E)) {
            //Enable Trees on E Keypress

            Debug.Log("Trees Enabled!");
        }

    }
}

How do I access and find my 'TreeGroup' object group while script not being attached to 'TreeGroup' but my character instead and then Destroy on Q Keypress?
And how do I Instantiate it?

sentences:
Multiplayer game communication framework for mac/ios (Cross post from stackoverflow)

I am creating a multiplayer 2D game for Mac and iOS devices. I'll be using cocso2d for graphics/game engine, however I am largely blank on what to use for multiplayer communication. Please note that I cannot use central severs e.g. SmartFox, RedDwarf, etc since I want the players to "host" games for others and be able to play it on their LAN, VPN or my own servers.

Any pointers? I checked lidgren but it's for .NET only and hence not an option for me.

EDIT: just in case it wasn't clear, the messaging has to be real time hence it's probably going to be over UDP

sentences:
How do I set shape density in PhysX 3.1? I'm using PhysX 3.1. I need to give shapes different densities (there are several shapes for my single rigid actor). I know that the shape's density can be set by NxShapeDesc::density in PhysX 2.8, but I can't find such an interface in PhysX 3.1.

I know mass properties can be set in PhysX 3.1 just as the snowman example in the SDK. Is there a direct interface to set density for each shape?

sentences:
Cocos2d-x v3.1 for WinPhone 8 auto change texture after resumed from background I have some sprites in my game (for Windows Phone 8). These are my steps to reproduce the problem:

Open game
Play (this is an optional step)
Press Windows button to send game to background
Press Back button to resume game

The problem is: After the game has resumed, some sprites exchange textures, some sprites go black (like there is no texture being bound).

I'm using cocos2dx version 3.1. Can someone help me to solve this problem?

sentences:
Blender: projecting an image via a spotlight onto a plane I've create a plane with a spot light shining from above onto it. The spot light projects a texture of an image onto the plane. The light shots out at an angle but the texture is projecting in a flat 2d form on the plane.

I expected it to stretch out much like the advertisements you'd see drawn on the pitch during a rugby or cricket match. Any idea how I'd change the way the image is shawn onto the plane?

The image should stretch out with the nearer section looking a bit more narrow than the top far section.

sentences:
How can I implement a "boost pad" with Farseer/Box2D physics? I'm trying to implement a boost pad in my XNA game using the Farseer Physics Engine. (This question applies to Box2D too, I would be happy to port working Box2D code to C#.)

By "boost pad", I mean an object that can apply a force to the player that makes him go faster than he usually can under normal circumstances. These are most often seen in non-realistic racing games (e.g., Mario Kart, F-Zero). (For the record, my particular game is a 2D side-scroller.)

I use a very simple Farseer physics Body for my player: it's just a square shape with basic linear velocity.

Normally, I move my player like this:

body.ApplyForce(ConvertUnits.ToSimUnits(force));

Then, in my Update loop method, I cap the player velocity like this (to make sure the player speed never goes above maxSpeed):

float speed = body.LinearVelocity.Length();
if (speed > maxSpeed)
    body.LinearVelocity = (maxSpeed / speed) * velocity;

I'm struggling to think of a good way to implement a boost pad. The issues:

What would be a good way to enforce two separate max speeds? There's one maximum speed for forces that are applied by normal player input, and another maximum speed for forces applied by boost pads.
If the character is going faster than the normal max speed (e.g., they just hit a boost pad), how can I still allow the player to influence his direction without increasing his overall speed?

sentences:
Knowing state of game in real time I'm trying to code a tic tac toe game in java and I need help figuring out how to efficiently and without freezing the program check if someone won the game.

I'm only in the design stages now, I haven't started programming anything but I'm wondering how would I know at all times the state of the game and exactly when someone wins?

Response to MarkR: (note: had to place comment here, it was too long for comment section)

It's not a homework problem, I'm trying to get more practice programming GUI's which I've only done once as a freshman in my second introductory programming course. I understand I'll have a 2D array. I plan to have a 2D integer array where x would equal 1 and o would equal 0. However, won't it take too much time if I check after every move if someone won the game? Is there a way or a data structure or algorithm I can use so that the program will know the state (when I say state I mean not just knowing every position on the board, the int array will take care of that, I mean knowing that user 1 will win if he places x on this block) of the game at all times and thus can know automatically when someone won?

sentences:
Quaternion Slerp and Lerp implementation (with overshoot) I am working with Unity (C#) and was looking for an implementation of Slerp and possibly Lerp that allow overshoot (progress not strictly limited to 0..1 range).  I want to do some tweening animation using an elastic ease-out function.  My ease-out function returns values slightly outside the 0..1 range in order to get an oscillating-around-the-target effect.  The problem is that Unity's Quaternion Lerp and Slerp functions appear to clamp the progress input in the 0..1 range.

Implementation code in any language would be helpful.  I don't know enough about Quaternion math to write this myself.

sentences:
Find out hit child with RaycastHit Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):

RaycastHit2D newSelectedObject = Physics2D.Raycast(cameraVector, Vector2.zero);

Now I'd like to find out if the head, body or feet was hit. How can I do that?

sentences:
Data Locality and Polymorphism I've been reading over the various chapters available at http://gameprogrammingpatterns.com, and in particular his chapter over Data Locality(http://gameprogrammingpatterns.com/data-locality.html) has raised a few questions. I've sent him out an email, but while waiting for it I figured I'd gather the opinions of others.

In the chapter, it is suggested that you would take your GameEntity class and strip everything away, sticking all of the components into an array and using a dirty bit to tell whether or not the component is active. This allows for faster iteration and avoids thrashing the cache.

However, it is also stated to avoid polymorphism in order to keep all components of some type the same size, and avoid virtual methods. Rather, for every type you would have an array.
To me, this sounds wasteful. Say I have 20 different enemies, and I allow for 100 enemies to exist at a time. That'd be 21(20 different MOBs + 1 array that would hold the entity) arrays of 100 entries, so 2100 objects just for the different enemies. And then each enemy needs a physics component, a rendering component, and maybe even more depending on the game.
If every enemy needs it's own physics and rendering component, that'd be 21 Entities + 20 Physics Components + 20 Rendering Components, all multiplied by 100(or however many entities you are allowing to exist at once). That's a lot of data for stuff that isn't going to even be used most of the time.

Wouldn't it be simpler(and smarter) to just have arrays of the base class, then stick in the needed subclass at some index? The base class would hold all the data that would need to be accessed by any of the subclasses, the subclasses would only have an overloaded Update() function. Yeah, it'd be a bit slower because then the program would have to look at the vTable over and over again to figure out which Update() function to use and not all the data in the base class will be used by every subclass, but it sounds simpler and faster than having 100+ arrays, each with 100+ members, when a large portion of them aren't even being used at any given moment. Are there any downsides to my take on it? Am I missing an important concept of data locality? What is your take / what would you do?

sentences:
How to determine if and when a point and triangle moving uniformly will collide? TLDR; I just learned this problem can be simplified to:  How to determine the time at which a uniformly moving point will intersect with a stationary triangle?  Also, how to figure out the time when the point will exit the triangle?

I have a player with a triangular line of sight ("field of vision" would be more a accurate term here).  I also have an NPC, represented by a point.  Currently I have the server update the client about both their positions only when one of them changes speed or direction of movement.

Without a limited field of vision, I was able to solve this.  How I intend to solve this new problem is as follows:

Each time either the player or NPC changes speed or direction (speed is a boolean at the moment, 1 or 0, and will probably remain that way), figure out if a line drawn from the point NPC to the edge of the game "room" at the angle of it's current direction, is within a triangle consisting of one point at the player's current position, and the other two points at the location they would be if the player were to reach the edge of the room moving at their current angle.
If the above is false, we can ignore the following steps because it means the NPC can't enter the vision field.  But if true, continue.
Figure out at what time the NPC will intersect the player's field of vision.  This, I do not know how to do, but I expect there is some formula I can use instead of checking every tick.
But once I do have this formula, I will use it's return value to set a timer that, when it goes off, will have the server update the client and tell it the location of the NPC.
Then I will have to also figure out at what time the NPC will exit the field of vision, and tell the client to delete or inactivate that NPC.

Does anyone know what mathematical formula I'm looking for?  I need to figure out when a moving point will intersect a moving triangle, when they are both moving uniformly (not changing direction or speed).  Also, the point in time when the point will exit the triangle.

sentences:
How to fix model matrices colliding in vertex shader? I am new to OpenGL programming and I'm writing some basic code to display a few objects onto a screen.

I have a pyramid shape that I'm displaying, as well as a box shape that I am displaying. The pyramid shape is a class (C++), and each pyramid object creates it's own VBO (storing the points/colours). The same thing goes for the box.

The problem I'm having is that I have two shapes, and the shapes use the same vertex shader. Since I apply a model matrix for each object in the shader, the model matrix gets set for one object, but then when the other object goes to display itself it overwrites the model matrix for the previous object with it's own. So only one object has the correct model matrix after they are all done their display method.

I am also using hierarchical transformations to attach objects to each other. I have the root object storing the view/projection matrices, and the children of the hierarchy tree storing their individual model transformations. When a child wants to display itself, it walks up the tree to compute all the transformations it needs to do to itself. The problem also applies here, since the last child to be displayed will be the one whose model matrix is applied in the vertex shader.

I can't seem to figure out how to differentiate in the shader which MVP matrix to apply to which vertex. I think I'm missing something very basic here but I can't seem to figure it out... Any help would make my life a lot easier!

Edit: Is it possible that the shader is overwriting the MVP matrix in between glDrawArrays()/glDrawElements() calls?

sentences:
How do I sense when the player collides with a door in a GameController script? I want to be able to sense when the player collides with a door from my GameController script. The player is a public GameObject and doors are tagged as such. Here is psuedo code for what I'm looking for:

public class GameController : MonoBehaviour
{
   public GameObject player;

   void Update()
   {
      if(player collides with game object tagged "Door")
         do something
   }
}

sentences:
What are the technical certification requirements for the Xbox 360? I came across this document listing the technical certification requirements from March 2009, but I haven't been able to track down anything more up-to-date, nor have I been able to find the "terminology list" that the document refers to.

Is there a current version that is available to non-developers like myself?

sentences: XNA C# Making the game scaleable for different resolutions I am currently developing a game in C# and XNA, and I want it to look right at all resolutions. How would I get started with doing that?

sentences: Follow a path in Unity I want to know how I can make this game object follow the specified path in unity

sentences:
Physics.CheckSphere() appears not to work in Unity My scene is simple, I have a single GameObject with the following script attached:
usings ...

public class GalaxyManager: MonoBehaviour
{
    public int numberOfStars = 300;
    public int maximumRadius = 100;

    public float minDistBetweenStars = 2f;

    void Start()
    {
        for (int i = 0; i < numberOfStars; i++)
        {
            float distance = UnityEngine.Random.Range(0, maximumRadius);
            float angle = UnityEngine.Random.Range(0, 2 * Mathf.PI);

            Vector3 cartPosition = new Vector3(distance * Mathf.Cos(angle), 0, distance * Mathf.Sin(angle));

            if (!Physics.CheckSphere(cartPosition, minDistBetweenStars))
            {
                GameObject star = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                star.transform.position = cartPosition;
            }
            else
            {
                i--;
            }
        }
    }

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

    }
}

What this is supposed to do is generate 300 "stars" within the maximumRadius of 100 that are separated by at least minDistBetweenStars.
I haven't been able to figure out what's actually happening -- sometimes the check finds a collider and sometimes it doesn't.  It's almost as if the CheckSphere() check is happening before the stars get placed via the star.transform.position = cartPosition.
I'm very new to Unity and appreciate the help.  Anyone have any idea what's going on?
*edit:
Some more information, I've tried the script in both 2020.1.12f1 and 2019.4.14f1 to no avail.
I'm also aware that this will lead to an infinite loop if it can't find a placement.

sentences:
Sound Manager class in Unity Starting with Unity having had experience of XNA im not sure if the way i want to solve my problem is the correct way. So id like the opinion of more experienced people.

I am doing a 2.5D game and have no need for 3D sounds that generate from a certain 3D position. I am used to creating a sound manager class that handles the loading of sound assets and has a static public method for each sound effect. This way it works like a toolbox i can call SfxManager.PlayDeathScreamSfx(); from anywhere in the solution.

How could i do the same in Unity?

I have tried making a game object called soundmanager and given it static methods that would play the sound effects but the SoundClips needs to be static for the static methods to be able to use them. And if the SoundClips are static then they dont show up in the inspector and i cant drag'n'drop a sound file on them to reference them.

What to do?

sentences:
Not able to see xbox live user status for friends? Developing an xbox application using UWP not really a Game. I would like to see the status of my signed in user on one xbox to the friends of the user. For Example, in device(Xbox) one signed in user is User1 and in device two signed in user is User2. Also the User1 and User2 are friends each other.

Now when the user1 runs the App say App1 in device1, under friends list of the user2 we should be able to see the status "App1 Xbox" for user1.

I am getting this behavior by default. But I would like to change the status from "App1 Xbox" to "App1".

Anybody have any idea on how to do this from within the application?

Another scenario is like in device1 with user1 signed in open the settings App, it just shows the status as "Settings" for user2 in device2. Like that I would like to see "App1" instead of "App1 Xbox".

sentences:
Understanding the ModelView Matrix I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this

sentences:
Marketing my mobile game I have almost finished my game; I want to upload it to Google Play and the App Store.  I will make it free but with Admob advertising.
What is the best way to market my app (without any app promotion companies)?
Please give me a detailed explanation.

sentences:
Beginner question about vertex arrays in OpenGL Is there a special order in which vertices are entered into a vertex array?  Currently I'm drawing single textures like this:

glBindTexture(GL_TEXTURE_2D, texName);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, coordinates);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

where vertices has four "xy pairs".  This is working fine.

As a test I doubled the sizes of the vertices and coordinates arrays and changed the last line above to:

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

since vertices now contains eight "xy pairs".  I do see two textures (the second is intentionally offset from the first).  However the textures are now distorted.  I've tried passing GL_TRIANGLES to glDrawArrays instead of GL_TRIANGLE_STRIP but this doesn't work either.  I'm so new to OpenGL that I thought it's best to just ask here :-)

Cheers!

sentences:
Restarting a level but with more time? So I'm trying to add a "Rewarded video ad" with the reward being more time to play in the next game.
my RewardedAd.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.SceneManagement;

public class RewardedAd : MonoBehaviour
{
    public static RewardedAd singleton;

    private void Awake()
    {
        if (singleton == null)
        {
            singleton = this;
        }
        else if (singleton != this)
        {
            Destroy(gameObject);
        }
    }

    public void ShowRewardedAd()
    {
        if (Advertisement.IsReady("rewardedVideo"))
        {
            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show("rewardedVideo", options);

        }
    }

    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Finished:
                Debug.Log("The ad was successfully shown.");
                StartCoroutine(NewGameWithTime());
                break;
            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                SceneManager.LoadScene(0);
                break;
            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                SceneManager.LoadScene(0);
                break;
        }
    }

    IEnumerator NewGameWithTime()
    {
        Debug.Log("NewGame Started");
        GameOverManager.singleton.GameOverAfterRewardAd();
        SceneManager.LoadScene(1);
        Timer.singleton.AddBonusTime(20);
        Debug.Log("NewGame Ended");
        yield return new WaitForSeconds(1);
    }
}

and my Timer.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System;

public class Timer : MonoBehaviour
{
    public static Timer singleton;
    public Text timeTF;
    private float seconds = 10f;

    private void Awake()
    {

        if (singleton == null)
        {
            singleton = this;
        }
        else if (singleton != this)
        {
            Destroy(gameObject);
        }
    }
    private void Update()
    {
        if (seconds > 0f)
        {
            seconds -= Time.deltaTime;
            TimeSpan timeSpan = TimeSpan.FromSeconds(seconds);
            string timeLeft = string.Format("{0:D2}",timeSpan.Seconds);
            timeTF.text = timeLeft;
            TimeLeftCheck(seconds);
        }
    }

    public void AddBonusTime(float bonusTime)
    {
        seconds += bonusTime;
        Debug.Log("New Timer script:");
        Debug.Log(seconds);
    }

    private void TimeLeftCheck(float _time)
    {
        if (_time < 5)
        {
            //Debug.Log("RunningOutTime sound");
            //SoundManager.singleton.Sound_RunningOutofTime();
        }
        if (_time < 2)
        {
            //Debug.Log("Out of Time sound");
            //SoundManager.singleton.Sound_OutofTime();
        }
        if (_time < 1)
        {
            Debug.Log("Game Over");
            GameOverManager.singleton.GameOver();
        }
    }

The video ad is playing fine and it's resetting my ad counter in my game over manager but I can't seem to figure out how to start the next game with more time (20 seconds to so) but ONLY if they've watched the ad.

Also, I'm still learning so any suggestions or things I can improve, more than happy to take that criticism too!

sentences:
Unity test/Play mode window problem I tried to find an answer to his problem but i wasn't successful. When i press play to test my game, instead of the play mode going to the Game tab and play the game there, with all the unity tabs and options still on the screen, it goes almost full screen, all of the unity window goes to the game mode and i can't see anything but the game, to see the scene, options, etc.. again i need to stop the play mode. For example, if i want to test triggers in play mode, i can't because all i see is the game window. How can i test the game just in the Game tab? Perhaps i changed some setting.

I'm not sure if im explaining my problem correctly.

Thank you

sentences:
A simple map, four biomes, and how to distribute them Here's the basic idea: I've got a Rogue-ish, perhaps Dwarf Fortress-ish game, with a randomly generated overworld and several dungeon entrances scattered around it. I already have the dungeons basically covered, but I'm stuck on an aspect of the overworld.

Said overworld, considered as a 2D map of screens, should have a perhaps blob-like distribution of four different themes or biomes -- grasslands, desert, snow and swamp, each with their own total amount of screens. Let's say the map is 8x8, which gives 64 unique screens. Half of those could be grasslands, a quarter desert, and swamp and snow get a quarter each:

It seems palette reduction has made snow the same color as swamp. Originally, there were eight snow screens in the bottom corner, and a slightly staggered eight-screen swamp area in the middle. Sorry 'bout that, and please ignore the location markers.

The best I could get was some snaking shapes, and often enough with nonsensical combinations like desert snaking through snow (or vice versa). I can't for the life of me figure out how to get it nice and blobby, let alone having it make climatical (?) sense. So how do I generate a biome map like in the mockup?

Okay, by request: the world really isn't much bigger than that example, and what I need is just a way to spread some blobs that determine thematic appearances, with the extra limitation that snow can't touch desert. Screens don't scroll, and if a screen is set to "desert", there'll be no grass anywhere on it.

sentences:
Use 2 values of a mask Let's say one has a black/gray/white mask and wants to draw picture A over the white/gray values and picture B over the black/gray values (the blacker the more B picture). The best I come up with would be something like:

Set to RenderTargetA
Draw Mask
Draw PictureA over Mask (using DepthStencilState)
Set to RenderTargetB
Draw Mask
Draw PictureB over Mask
Draw both RenderTargets over each other somehow

But that just seems a) overly complicated and b) both render targets still have the mask drawn on them so it wouldn't have worked anyway. So how would one achieve this?

sentences:
Algorithm for randomly generating reachable platforms I want to randomly generate reachable platforms on the fly for a 2D game.  Right now, I am just creating platforms at random x,y positions.  Only 4 platforms can exist at once, so once the 5th one is generated the 1st one is removed (fifo).

So, I want to ensure that the player can jump from his current platform to at least one other at any given time.

I was thinking of using some variant of the distance formula to calculate the location of the next platform being generated.  I was hoping someone could help me out with the formula for calculating the next platforms possible x,y positions.

The player variables I am assuming will be important are speedX, speedY, and gravity.

From here, I should be able to calculate the maximum distance to plug into the distance formula.

However, I am thinking that some variation of the distance formula that contains a variable for slope would be better in my case.

I want to ensure that the player will never get stuck on a platform with no where it can jump.  Also, I want to ensure that platforms aren't generated on top of each other.

Formulas/images/code are a huge plus.

Here is how jumping is currently working.

Field speedY:Float = 4
Field GRAVITY:Float = .05

Method Update:Void()
    If KeyDown(KEY_SPACE) And not jumping Then
        dy=-speedY
        jumping = true
    EndIf

    If jumping
        dy += GRAVITY
        local tempY:Float = y + dy
        y = tempy
    Endif
End Method

Edit:
I now understand that the formula is just the displacement of basic projectile motion.

Except, in my case, we don't care about cos/sin because the angle will always be the same.

sentences:
Pattern for performing game actions Is there a generally accepted pattern for performing various actions within a game? A way a player can perform actions and also that an AI might perform actions, such as move, attack, self-destruct, etc.

I currently have an abstract BaseAction which uses .NET generics to specify the different objects that get returned by the various actions. This is all implemented in a pattern similar to the Command, where each action is responsible for itself and does all that it needs.

My reasoning for being abstract is so that I may have a single ActionHandler, and AI can just queue up different action implementing the baseAction. And the reason it is generic is so that the different actions can return result information relevant to the action (as different actions can have totally different outcomes in the game), along with some common beforeAction and afterAction implementations.

So... is there a more accepted way of doing this, or does this sound alright?

sentences:
Rendering tile maps for mobile devices Hitting a bit of a roadblock with my game's development and I'm just looking for some outside advice.

I'm trying to render a tilemap for my mobile game (Android) and I'm using LibGDX.

Now, here's the issue.  Using my simplified version of LibGDX's own native OrthogonalTiledMapRenderer gives me:

60fps on desktop
~40fps on my Nexus 10 tablet
~20fps on my Nexus S phone

Here's my renderer for reference, it's very simple as to keep performance up.  The function renderTileLayer() is called every frame to render the tiles in the viewport's range.

Now, this is with all tiles in a single TextureAtlas, blending disabled, and actively culling the tiles.  Since this is the beginning stages of the game, anything below 60fps is only going to result in horrid performance later on, so I need to get this fixed.

I don't understand how people are able to render tile maps on mobile devices in their finished games if I seem to be having so much trouble with rendering my own simple 1 layer map with no other objects or lighting effects or particles, etc...

The code for rendering the tiles is as straightforward as possible and results in only 1 render call to the SpriteBatch (no Texture swapping).

Any help/input appreciated!

sentences:
Client-side physics simulation I am trying to create a very simple client-server based physics game, using box2d library. A simple football game.
Obviously, the server runs only the box2d world.
My question is:
is it correct to state that the client should run not only the needed rendered simulation but another box2d world as well?

I ask this because I know that the client should receive state information of the elements that have a changing state. And this information is received in packets every few ticks. And between every packet received, there's a time gap where I need to run the world like "nobody did nothing", and then correct the world state if somebody did something after I received the next packet.
That is why I need to run the box2d world in the client as well, but I feel it's kinda awkward and assymetrical.

Is this right? Is box2d prepared for this?

sentences: How to read a color of a pixel from texture (cocos2d-js)? How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?

sentences:
How client movement prediction syncs with server position to avoid a clip around collision? I have searched a lot on stackexchange and on google, yet I have not found a satisfactory answer to this seemingly simple question.

I am making an online multiplayer game where the players navigate a 2d map with basic square obstacles. In this case I am making collision checks both on the client and the server, where the server broadcast everyone's position once per second as authority. However, when making a sharp turn around a square, often times either the client makes the turn while the server clips, or the client clips at the corner while the server makes the turn. That is understandable considering the possible discrepancy between the position on the server and the predictive position of the client. How do online multiplayer games usually work around this simple yet crucial problem?

I understand that it comes down to a pixel perfect sync which isn't possible, but how do other games navigate around this issue, to give a flawless collision experience?

What I am considering of doing:

Increase the position broadcasting rate from 1 time per second to however high needed to accurately sync the positions (20/sec). I believe this is the solution most games are doing. This however, will drastically increases the load on the server.
In my case, the game's main mechanism isn't the navigation (think MMO), so I am leaning towards only checking collision on the client side, and have a simpler collision check on the server to ban walk-through-wall hackers. This would relax the server from heavy collision operations which is nice too.

sentences:
Pass information between states in slick 2d? I am making simple game in java using Slick 2d. My question is how many ways of passing information between states are available in Slick 2d. I am having a Hero class that holds all the hero stats and carry them between states using Singleton pattern- aka creating a single instance of the object and accessible from everywhere . Are there any possible solutions and workarounds ? Some XML-alike solutions ? Is there DB option ? Is it worth the effort ?

[Edit] Put it simple I want instance of my class hero to be accessible from every state. For example my hero goes to the market and buys some armor.  That should change his stas in all states. My question was if there is another way to do that like storing the hero stats not in a class but a XML or data base.

sentences:
Deleting Objects Before Export from Maya Causes .PSK to Crash UDK on Import I'm using Maya 2008 Complete and 03/11 build of UDK as well as 07/10 build (haven't got around to installing newer version on other computer). I am using ActorX to export.

I have a character that I have rigged and animated (I'm not using UDK rigs).

Here was my process:

Early on in the process, I had other objects skinned to the character's skeleton.
I hid those objects while weighting the character
I decided later that I wanted to delete them.
I tested my .psk in both UDK builds with those objects hidden and noticed that they still showed up (in UDK)
So, I went back into Maya, detached the skin on those objects and deleted history, then deleted them.
I then re-exported my .psk and now when I try and import, udk crashes.

Here are my input/output connections for one of the objects before detaching the skin.

http://i.stack.imgur.com/hoDdv.jpg

Here is my log:

0002.77] Log: >>>>>>>>>>>>>> Initial startup: 2.77s <<<<<<<<<<<<<<<
[0002.81] Cmd: MODE MAPEXT=udk
[0002.87] SourceControl: Source Control disabled in GAMEEditorUserSettings.ini.  [SourceControl] has Disabled=False
[0005.61] Log: TIMER ALL OF INIT : [5.028131]
[0070.42] Log: FactoryCreateBinary: SkeletalMesh with SkeletalMeshFactory (0 0 Z:\websterProject2\EXPORTTESTING\SK_snailMesh01.PSK)
[0070.42] Log:  * Skeletal skin VPoints            : 812
[0070.42] Log:  * Skeletal skin VVertices          : 1166
[0070.42] Log:  * Skeletal skin VTriangles         : 1596
[0070.42] Log:  * Skeletal skin VMaterials         : 1
[0070.42] Log:  * Skeletal skin VBones             : 73
[0070.42] Log:  * Skeletal skin VRawBoneInfluences : 1520
[0070.42] Log:  * Skeletal skin VertexColors          : 0
[0070.42] Log:  * Skeletal skin Num Tex Coords    : 1
[0070.42] Log:  Mesh material not found among currently loaded ones: lambert3SG
[0070.42] Log: Bones digested - 73  Depth of hierarchy - 15
[0070.49] Critical: appError called: Assertion failed: Wedges.Num() == WedgeInfluenceIndices.Num() [File:c:\depot\UnrealEngine3\Development\Src\Engine\Src\UnSkeletalTools.cpp] [Line: 301]
Stack: Address = 0x402228f9 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x40924bb1 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412bfbc8 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x401a178d (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412964a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412823a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x983633   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983d73   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983e30   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x800a34c6 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_core_vc_custom_64.dll]
Address = 0x800aec65 (filename not found) [in C

I would like to know why deleting these objects is causing the .psk to crash on import and how I can fix it.

Thanks very much for your time.

sentences:
Tower Defence stat storing system I'm trying to find a smart way to store and retrieve stats for a tower defence game, but am currently unsure as to which approach would be best.

Description:

The stats system should quite basic, there are 4 different towers, with up to 5 different levels each.
One important requirement is that the stats should be stored in an XML file so that the game designer easily can access and balance the stats. (He knows nothing about programming)

I can see two ways of doing this:

By creating a TowerStats class which hold values for one type of tower for one level. Something like:

public class TowerStats2
{
    public TowerType type;
    public int lvl;
    public int damageLow;
    public int damageHigh;
    public float range;
    public float attackFrequency;
}

Then i would load the stats from the XMl file using Linq and XDocument and load it directly into a TowerStat List. I would do this for each tower so in the end there would be 4 different List's which would hold the different level stats for the specified tower.

gunTowerStats[0] would hold level 1 stats of the gun tower
rocketTowerStats[2] would be level 3 stats of the rocket tower

When a new tower is bought by the player or when a tower is upgraded, the stats would then be taken from the List so something like:

UpgradeTower()
{
    lvl++;
    towerStats = gunTowerStats[towerLevel - 1]
}

Alternativly I could hardcode all the values, and have one big class which would go something like this:

gunTowerDamageLvl1 = 4;
gunTowerDamageLvl2 = 8;
gunTowerDamageLvl3 = 15;
rocketTowerDamageLvl1 = 10;

you get the point.
I know that hardcoding is never never really the way to go. But does that also count for this kind of example where all possible tower attributes are known and will not change? the only thing that will change are the values of these attributes.

Question
I'm personally in favour of the first way, but I must admit that I find both ways a bit clumsy, would it be alright to do it one of these ways or is there a much smarter  and more obvious way to deal with this that I'm completely unable to see?

I hope my question is understandable.

sentences:
Unity Initializing class of a script not working I have been trying to find a solution for the last couple of hours so please hear me out. At first I got a NullReferenceException, which I resolved(?) by initializing the class first (This is my problem! I can't seem to initialize my class sucessfully). However, here are my next errors. I tried using the new keyword, which resulted in You are trying to create a MonoBehaviour using the 'new' keyword. Next I tried GetComponent<>(), which resulted in a CS0120, that I didn't know how to fix. The AddComponent<>(), resulted in a CS0103 The name AddComponent does not exist in the current context. What I tried next was GameObject.AddComponent<>(), which threw a CS0120, and gameObject.Addcomponent<>() which threw a CS0236.

Here is my code for the class I am trying to initialize if it should be needed:

public class Dialogue : MonoBehaviour {
public TextMeshProUGUI textDisplay;
public string[] sentences;
private int index;
public float typingSpeed;

public GameObject continueButton;

void Update() {
    if (textDisplay.text == sentences[index]) {
        continueButton.SetActive(true);
    }
}

public IEnumerator Type() {
    foreach (char letter in sentences[index].ToCharArray()) {
      textDisplay.text += letter;
      yield return new WaitForSeconds(0.01f);
    }
}

public void NextSentence() {
    continueButton.SetActive(false);

    if (index < sentences.Length - 1) {
        index++;
        textDisplay.text = "";
        StartCoroutine(Type());
    } else {
        textDisplay.text = "";
        continueButton.SetActive(false);
    }
  }
}

Here is from where I tried to initialize:

public class Mace : MonoBehaviour {
//Dialogue dialogue = gameObject.AddComponent<Dialogue>();

private void OnTriggerEnter2D(Collider2D otherCollider) {
    if (otherCollider.CompareTag("Player")) {
        StartCoroutine(dialogue.Type());
    }
}

}

sentences: How do mobile mmo's deal with the graphical resources? I'm am creating an MMO(probably won't be so massive), and was wondering how to deal with the graphical resources. Obviously, I can't have what could be possibly a few gigs of images and animations loaded up to the client, so I need another way of doing it. I have tried having a php webserver that updates itself and writes to a file that the client draws, however this seems slow. How can I speed up the process of updating the graphics while not having too much into the client?

sentences:
Built-in Terrain analogs search: is it worth to use imported 3d-model? I think 3d-model is better than the built-in terrain-component in Unity when it comes to optimization. But when it comes to texturing terrain made in 3rd party 3d-modeller, how to apply resulting texture in Unity? If the terrain is too big you can't bake it in UV map. Otherway you should split it in many UV's and each one is separate material, which kills performance in the game. Other decision that i see is to use generated type of material and just tile it across the terrain-mesh, but you can't draw the details like roads on it...

So i'm confused is it really worth it to use Unity's terrain analogs or there is no way to do so efficiently?

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

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

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

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

Example:

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

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

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

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

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

break;

Also Were is World.RayCast Coming from?

Note

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

EDIT: 3/7/14

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

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

I make a class called Ray.

I then add the following code:

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

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

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

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

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

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

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

What have I done wrong?

sentences: Where do components get added in Unity? In unity's GameObject class, there are a few default data members. When we add a component to the game object, light for example, where exactly does it get added? Does it become a part of the GameObject class?

sentences: Rotate a 3D object in Unity3D on button click There is a 3D character in my application developed using Unity3D.  Now I want to rotate this 3D character when the user press the rotation button. I tried several ways, but didn't work. How can I rotate a character when the player presses the rotation button?

sentences:
What's wrong with my method of getting intermediate rendering to my postprocessing shader? I'm working on a project in OpenGL. Earlier this week, I successfully implemented Deferred Shading, but I'm not sure how to pass the information from the Deferred Shader to the Post Processing Shader.

glBindFramebuffer(GL_FRAMEBUFFER, fboId);
glViewport(0, 0, int(ScreenSize.x), int(ScreenSize.y)); // Render on the whole framebuffer, complete from the lower left corner to the upper right

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//...Drawing for Opaque objects, pass all transparent objects to a seperate texture
//after having drawn them using Forward Shading

//glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, int(ScreenSize.x), int(ScreenSize.y));

// Clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Use our shader
glUseProgram(quad_programID);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gBuffTextures[0]);
glUniform1i(gBuffPosnID, 0);

//More Textures

//Uniforms

glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, quad_vertexbuffer);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0 );

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // 2*3 indices starting at 0 -> 2 triangles

glDisableVertexAttribArray(0);

So far this works just fine. Now here's the difficult part - passing the final image to the post processing shader.

glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, int(ScreenSize.x), int(ScreenSize.y));

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glUseProgram(post_programID);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gBuffTextures[0]);
glUniform1i(UniformPostImage, 0);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, gBuffDepthTextures);
glUniform1i(UniformDepthImage, 1);

glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, dirt);
glUniform1i(UniformDirtImage, 2);

glUniform1f(UniformTime, (float)currentTime);

glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, quad_vertexbuffer);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0 );

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // 2*3 indices starting at 0 -> 2 triangles

glDisableVertexAttribArray(0);

I'm loading the image from the deferred shader normally, and passing it using:

layout(location = 0) out vec3 image;

All I recieve is the first texture I pass, the position shader. Can anyone tell me how to pass the image from the deferred shader to the post processing shader?

sentences:
How to use multiple tilesets in a map? I'm currently looking at this phaser example: http://phaser.io/examples/v2/tilemaps/blank-tilemap

Here, the author creates a simple tilemap editor. In line #33 he adds a preloaded image as tileset.

The problem is: the author adds only one tileset but I'd like to add multiple tilesets to the map (via map.addTilesetImage), switch between them and paint with the "current one".

I've read multiple times on the internet that it is possible to add and use many tilesets on a single map, but so far I haven't found any examples of that and the phaser docs also don't give that away.

sentences:
OOP architecture for Hero with many attributes I'm about to start a simple browser text RPG, with characters that can (passively) fight other people. This involves a list of about 10 skills like strength, dexterity and so on, with additional proficiencies for different weapons.

Is there a better way to design this character class then just having those skills as class attribute? It seems easy, but I'm reluctant because it's clumsiness.

class Char(self):
    int strength
    int dexterity
    int agility
    ...
    int weaponless
    int dagger
    ...

sentences: Are there any good tools or suites out there that help with building AI/Robots for browser based games? I've found some HTML/Canvas/Javascript browser based games that I don't particularly enjoy playing, but which I think would be fun to write robots for. Are there any tools out there which help remove some of the tedium of the work, and get me closer to writing the actual AI portion of the code?

sentences:
Confused about calculation of steering force I'm reading Programming Game AI by Example, by Mat Buckland. What I don't understand there is why the individual behaviors return a vector representing change in velocity, but the combined result is treated as a force vector.

Here's the excerpt from the update function:

  Vector2D SteeringForce = m_pSteering->Calculate();

  //Acceleration = Force/Mass
  Vector2D acceleration = SteeringForce / m_dMass;

  //update velocity
  m_vVelocity += acceleration * time_elapsed;

  //make sure vehicle does not exceed maximum velocity
  m_vVelocity.Truncate(m_dMaxSpeed);

  //update the position
  m_vPos += m_vVelocity * time_elapsed;

And m_pSteering->Calculate() returns the weighted sum of different steering "forces", like Seek

Vector2D SteeringBehavior::Seek(Vector2D TargetPos)
{
  Vector2D DesiredVelocity = Vec2DNormalize(TargetPos - m_pVehicle->Pos())
                            * m_pVehicle->MaxSpeed();

  return (DesiredVelocity - m_pVehicle->Velocity());
}

So, how come steering functions like Seek just return change in velocity and don't take mass into account, but still get used as force?

Here's the source code

sentences:
Testing for connected maze cells I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces.

I have a 'start' cell that is a different colour to the others,when cells are rotated in such a way that they become 'linked' to this start cell, then all the cells that are linked back to this cell should change colour.The start cell itself can be rotated as well so just because a cell is back in it's initial rotation it doesn't mean it's connected. Also any random cell can be rotated regardless of whether it's neighbour is already connected. E.g if the start cell is at [8,8] in a grid, then all the other cells bar it's immediate neighbours could get connected and then finally the closest neighbours get rotated to form a completely connected grid in which case all cells should change colour like a flood fill.

Are there any good algorithms to solve an issue like this? I was thinking of a flood fill from the start cell every time a cell is rotated somewhere but I'm not sure if this is the optimum way to do this, especially as I have to check what each type of cell is (e.g is it a corner piece, a straight piece, a T Junction or a dead end with only one connecting side) and then check what it's current rotation is compared to it's neighbours rotation and type. Obviously this is fine if you can stop at immediate neighbour to the start piece, but when other sections of the maze might be 'complete' and then an interjoining piece is linked I would need to flood fill all of them. I had started writing this but I found myself just pretty much duplicating switch statements for all the different types of piece and then what type of piece their neighbour was and comparing the rotations of each piece. It felt very 'DRY' even though the comparisons were changing

I'm writing this in swift, but I guess an algorithm would be generic

thanks

sentences:
Scene graphs and spatial partitioning structures: What do you really need? I've been fiddling with 2D games for awhile and I'm trying to go into 3D game development.
I thought I should get my basics right first.

From what I read scene graphs hold your game objects/entities and their relation to each other like 'a tire' would be the child of 'a vehicle'.
It's mainly used for frustum/occlusion culling and minimizing the collision checks between the objects.

Spatial partitioning structures on the other hand are used to divide a big game object (like the map) to smaller parts so that you can gain performance by only drawing the relevant polygons and again minimizing the collision checks to those polygons only. Also a spatial partitioning data structure can be used as a node in a scene graph.

But... I've been reading about both subjects and I've seen a lot of "scene graphs are useless" and "BSP performance gain is irrelevant with modern hardware" kind of articles.

Also some of the game engines I've checked like gameplay3d and jmonkeyengine are only using a scene graph (That also may be because they don't want to limit the developers).
Whereas games like Quake and Half-Life only use spatial partitioning.

I'm aware that the usage of these structures very much depend on the type of the game you're developing so for the sake of clarity let's assume the game is a FPS like Counter-Strike with some better outdoor environment capabilities (like a terrain).

The obvious question is which one is needed and why (considering the modern hardware capabilities).

Thank you.

sentences:
Black Area in skybox in opengl Hi I am using opengl and I am having a problem if I go further from the skybox with the camera I get black areas, a smaller radius of the skybox will make the camera too close to the object to stay inside the skybox and increasing it obviously doesn't help.
:

Here is the code for the skybox:

  glEnable(GL_TEXTURE_2D);
    glPushMatrix();
    qobj = gluNewQuadric();
    glTranslated(50,0,0);
    glBindTexture(GL_TEXTURE_2D, underwater);
    gluQuadricTexture(qobj,true);
    gluQuadricNormals(qobj,GL_SMOOTH);
    gluSphere(qobj,100,100,100);
    glPopMatrix();

sentences:
Should I scale gravity for small objects? If I am working with objects that are small in real life, but in the Unity world they are scaled larger, should I increase the Gravity with the scale of the objects?

For example, if an object of size one would actually be 10 cm across, would gravity scaled to be 10x make the object behave more like a small object would in real life.

I know objects fall at the same rate, but the rate is the same so small objects fall more in proportion to their size don't they?

sentences:
Unity FPS Offline Multiplayer (MultiLan) Player Animation I am creating an FPS game in local multiplayer. One player creates the hot-spot game, and the other one connects through WiFi network and plays the game. And i am doing this using unity MultiLan Package available in Unity Assets Store.

when the player connect to the Game i play the player animation like walk , jump etc. But the problem is animation can play only which player who host the Game, not play to other player who join the Game in host network.

That is Player Script.

private MNetwork networkSrc;
public Btn_Jump jumpScript;
public Btn_DPad Btn_DpadScript;

void Awake() {
    if (GetComponent<NetworkView>().isMine) {
        trans = transform;
        contr = trans.GetComponent<CharacterController>();

        if (jumpScript == null) {
            jumpScript = GameObject.Find ("3 Jump").GetComponent<Btn_Jump> ();
        }
        if (Btn_DpadScript == null) {
            Btn_DpadScript = GameObject.Find ("6 D-Pad").GetComponent<Btn_DPad> ();
        }
    }
}

void Start() {
    if (GetComponent<NetworkView>().isMine) {

        // If it's my player : search the networkManager component
        networkSrc = GameObject.Find("MNetwork").GetComponent<MNetwork>();
        PlayerAnimatorComponent = GameObject.Find ("Swat").GetComponent<Animator> ();

        FPS_Events.ChangeCharacterMotor(motor);
    }

}
 void Update() {

    if (!networkSrc.isPlayerExitGame) {

            if (currentMotor == null)
                FPS_Events.ChangeCharacterMotor (motor);
            try {

                currentMotor.Update ();
            } catch {
            }

            if (jumpScript.Player_jump) {

            }
            if (Btn_DpadScript.Player_Run) {
                RunAnimation ();
            }

    }
}

void RunAnimation(){
    GetComponent<NetworkView> ().RPC ("SyncAnimation", RPCMode.All);
}

[RPC]
void SyncAnimation(){
    if (Btn_DpadScript.Player_Run) {
        PlayerAnimatorComponent.SetFloat ("Walk",2f,0.1f,Time.deltaTime);

    }
}

In this Script there is "Btn_DpadScript" object of Virtual joystick Script name is "Btn_DPad" for Player Movement.

When player move then "Player_Run" Boolean variable is true and play the Walk animation of player in SyncAnimation() method.

But it is stuck to play animation in all player in same network.

Any one can know how to play animation in all network player using MultiLan Package then tell me. I can't found in Google Search about player Animation in network using MultiLan Package.

what should i do don't know any one can suggestion then i really appreciate thank you.

sentences:
Unity - blur on one camera effects the other as well I'm trying to fake a DOF effect for Sprites by using 2 cameras, one for the sharp objects, one for the blurred ones. I have set up the layers like Blur and Sharp accordingly.

So I have these 2 cameras, and I use Unity's Blur (optimized) script to blur things, and I have this script on only one camera, the one that is responsible for the blurred render.

I have the cameras like:

Cam 1:

Clear flags: Don't clear (this is the main, sharp cam)
Culling mask: sharp layer
has no blur effect (or any other post proc effect).

Cam 2:

Clear flags: don't clear (this is the blur cam)
culling mask: blur
Has Blur (optimized).

Now, if this blur cam is on the back, meaning its depth is LESS than the main cam's depth, I have a sharp player ground and a blurry background. However, I need a blurry foreground too that should be on top of the player ground.

The issue starts when I set the blur camera's depth higher than the main cam's. In this case, everything gets blurred, no matter that the main cam has no blur effect on it.

Question is, how to set this up so only the desired layers get the blur?

sentences:
How to create a correct Unity package copy, which will not be replaced when you import? I create a "Package 1" consisting of section A (unique) + section B (which will be repeated in all my other packages). This package works correctly is he is alone.

Next, I create a "Package 2" consisting of: section C (unique)  + Section B (from Package 1).

To save time, I replaced the texture maps in the materials belong to old section A parts and replace this part on section C (directly on models in the Mesh.)

I renamed most objects in the scene and in the package as a whole.

I delete all prefabs of «section A» and create prefabs «section C», because they are not pick up name changes. The prefabs of «section B», I left as is.

Now when I import «Package 2» in the scene that already contains the «Package 1», it begins the mess: «Package 1» Files are replaced by «Package 2», even them are named differently.

How to avoid it?

I can’t create each scene from scratch, unfortunately it will lead to the insane time-consuming.

Huge thanks for your support!

sentences:
Unity plane that is normal to Z axis I want to create a plane that will be normal to the Z axis, but I am having difficulty  visualizing what rotation it needs to have.

I want to have a top-down view upon the plane such that I can use the X and Y coordinate system for position, and the Z axis for height.

It seems intuitive for me to point the camera in the same rotation as this plane, and give it an orthogonal view and a positive Z value (and set gravity to have a negative Z value), but I seem to be fighting against the grain and running into more issues than I should be, so I would like to ask what rotations I should be using for this.

What rotation should I use for the plane? can the camera share the same rotation? (assuming I want the top to be +y and the right to be +x as seen from the camera.

sentences: Google Sketchup pro exporter/importer for MD5 model format? Where can I find google sketchup pro MD5 (The doom3 model format) exporter/importer? If there isn't one what modeling program can I use to export/import MD5 models?

sentences:
SFML Animation class as a strategy or an inheritance everybody.
I need to add animations to my game.
And I have a question.

I found AnimatedSprite class on SFML Github which is an inheritance, but in my project, I am using a lot of elements made with strategy pattern,
for example movement behavior, jumping behavior, fighting behavior, etc.
I just try to avoid inheritance because it makes class inflexible.

But this time in contrast to other classes Animation class has a lot of methods
that can be used at runtime. I mean Play(), Stop(), Pause(), and more.
If I use this as a strategy I would have to give access to this object.

What do you think?
Maybe I just need to use another design pattern?

sentences: How to make a collider the follows all the animations of a prefab? I have attached a capsule collider with my player(prefab) and made a script so that when Space key is down it does the jump animation in Unity. But because of the collider not jumping with the player, the player gets stopped by obstacles though he visually passed it. How can I make a collider that moves with my animations attached to a prefab?

sentences: Animation library for XNA I'm looking at implementing an existing XNA Animation library into my engine.  I would ideally like to be able to use BVH animations, but I'm not sure on which is a good library to work with.  Any ideas?

sentences:
Unity 5 Networking Send Rate: Send Rate is Zero but server movement is still happening I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29.

Why is it, that when the network send rate is set to 0 that my character still moves on the server?

sentences:
libgdx(android) touchup triggers more than once? I have a function I run inside the touchUp method but when I click with the mouse during emulation, it triggers my function multiple times. I don't think its an error with the called method itself because if I put the call in KeyUp then it triggers once as expected.

If it matters I am working in android studio.

sentences:
How do I implement Pokemon-style moves? I'm developing a Pokémon/classic Final Fantasy inspired game, in the sense that game play consists in many creatures, possessing many moves with different effects (attacking, healing, buffing, debuffing, etc) taking turns fighting each other.

I'm having some doubts on how to implement the movement system, especially the part of how to organize the code responsible for the effects of the move.

Some important characteristics of the system:

Creatures should be able to learn and forget moves
All moves can be learned by more than one creature

I have come up with some ideas, but none seem very good. Is there any known standard in the industry for doing this, or any known optimal solutions?

Here are the ideas I had:

Every move inherits from an abstract class Move, overriding an execute() method.
A MoveProcessor class, containing a method executeMove(), called every time any move is made, receiving the move id code. Something like:

switch(moveCode){
     case 1: //Attack code
     break;
     case 2: //Heal code
     break;
     //...
}

I am developing in Unity and C#, but answers need not be specific to said platform and language.

Please note that this is not a duplicate of Modeling what moves a pokemon can learn or Storing data for a pokemon-like game, since those questions ask about storing move information, not implementation.

sentences:
How can I make sprites from multiple images using SDL2? Using SDL2 in C++ I can load textures with out problem however, I have sprites that are from about 15 different png's that I was hoping I could load them all up and for loop through them. However, when I try this it looks like the image is still .

I am hoping that I wouldn’t have to photo shop them into one image and shift/pan through that considering I have about 3K of images to go through.

can some one provide an example of how this could be done cleanly?

I have been working on this for a while for a bit and yes, this is probably a coding mistake as I am learning C++ still and know that for me to learn is to take up a project.

int main ( int argc, char *argv[] )
{

    SDL_Init(SDL_INIT_EVERYTHING);
    Window = SDL_CreateWindow("NEW WINDOW",100,100,300,300,SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    renderer = SDL_CreateRenderer(Window,-1,SDL_RENDERER_ACCELERATED);

    if (Window == NULL)
    {
        std::cout << "Window Couldn't be Created!\n";
    }

    struct imagebatch
    {
        const char *image;
    };

    imagebatch foto;

    //  A for loop is needed here to loop through Healer0.png Healer1.png to Healer15.png
    foto.image = "DData/towners/healer/healer/Healer0.png";
    HealerTexture = IMG_LoadTexture(renderer,foto.image);

    //loads an image;
    //HealerTexture = IMG_LoadTexture(renderer,"DData/towners/healer/healer/Healer0.png");

    //defines the rect of this image;
    SDL_Rect HealerRect;
    HealerRect.x = 0;
    HealerRect.y = 0;
    HealerRect.w = 90;
    HealerRect.h = 90;

    while (!quit)
    {
        while( SDL_PollEvent( &event ) != 0 )
        {
            //User requests quit
            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }
        SDL_RenderClear(renderer);

        //Blit everything here.
        SDL_RenderCopy(renderer,HealerTexture,NULL,&HealerRect);

        SDL_RenderPresent(renderer);
    }
    close();

    return 0;
}

Full code is here: http://pastebin.com/H5fD6cfX

sentences:
How is structural analysis done in games (e.g.: bridge building, Dig or Die, and 3D)? From what I understand a typical interactive truss system would need substantial calculations since every component affects the entire system. I think you could arbitrarily stop at a given number of iterations at cost of accuracy in the simulation, but I don't know if that's the approach these games use (bridge building games are an example of truss systems). On the other hand, games like Dig or Die have a quite complex structural system that also takes torque into account (I believe) and compression and is very fast and works on very extensive systems. I guess the basic calculations could be similar, but if not I'm interested in both approaches.

Do you guys know how these are made? Do they have an arbitrary limitation or do they use a different algorithm altogether? Also, I guess whatever you guys come up with can be applied to 3D systems but if not or if it's not obvious please at least give a clue on how you could use it for 3D since I'm interested in this for both 2D and 3D games.

I know I'm not supposed to thanks here but I find unfair not to at least thank you for your time in advance, I hope this paragraph don't get removed.

EDIT: If I were to make a guess I'd say Dig or Die stores vectors for each block and then run an iterative algorithm up to a point that the extra accuracy in the simulation is meaningless for the limits of the system (for example, the system would be too large to not collapse anyway), so it's limited by a semi-arbitrary (because it's based on application) number of iterations. But I could be wrong.

sentences:
Words to describe stat stacking behavior? A character has a series of attributes.

Char {
    BaseStrength 1
    BaseHealth 100
    BaseLuck = 50
    BaseCharm = 20
}

and items will grant them modifiers

item0 {
  Modifier {
    Charm: + 1
  }
}

itemA {
  Modifier {
    Strength: ++ 1
  }
}

itemB {
  Modifier {
    Health: * 2
  }
}

itemC {
  Modifier {
    Luck: ** 1
  }
}

The way I was planning the operations + ++ * ** to work
was if a player has 2 of each type of item. it would stack as follows.

finalCharm = BaseCharm + item0.Charm (no stacking)

finalStrength = BaseStrength + itemA.Strength + itemA.Strength

finalLuck = BaseLuck + BaseLuck*(itemC.Luck + itemC.Luck)

finalHealth = BaseHealth + (BaseHealth * itemB.Health) + (BaseHealth * itemB.Health)

All except charm could be considered 'stacking' buffs.

itemA stacks additively, items B & C stack multiplicative.

How can I describe the stacking behavior differences between B & C to the player using words?

sentences:
Matrix interpolation for animation blending I use the XNA Animation Component library to perform blending between animations. It uses spherical linear interpolation between matrices.

In most cases this works without problems. However, I have one model where all of the animations are blended wrong. Weird rotation and warping of the model occurs.

I was told by a math expert that the problem may lie in the method that does the matrix interpolation. He said:
"The right way to do it would be to decompose A=UP (polar decomposition), obtain quaternion from U and lerp/slerp it, while interpolating P component-wise.
I'm not sure why the original author refrained from implementing the polar decomposition as its implementation is straightforward and easy."

I have included the code below.

I need some help in making the recommended changes. I am an expert in C# but know almost nothing about matrix interpolation.

private static Quaternion qStart, qEnd, qResult;
private static Vector3 curTrans, nextTrans, lerpedTrans;
private static Vector3 curScale, nextScale, lerpedScale;
private static Matrix startRotation, endRotation;
private static Matrix returnMatrix;

public static void SlerpMatrix(
        ref Matrix start,
        ref Matrix end,
        float slerpAmount,
        out Matrix result)
    {
        if (start == end)
        {
            result = start;
            return;
        }
        // Get rotation components and interpolate (not completely accurate but I don't want
        // to get into polar decomposition and this seems smooth enough)
        Quaternion.CreateFromRotationMatrix(ref start, out qStart);
        Quaternion.CreateFromRotationMatrix(ref end, out qEnd);
        Quaternion.Lerp(ref qStart, ref qEnd, slerpAmount, out qResult);

        // Get final translation components
        curTrans.X = start.M41;
        curTrans.Y = start.M42;
        curTrans.Z = start.M43;
        nextTrans.X = end.M41;
        nextTrans.Y = end.M42;
        nextTrans.Z = end.M43;
        Vector3.Lerp(ref curTrans, ref nextTrans, slerpAmount, out lerpedTrans);

        // Get final scale component
        Matrix.CreateFromQuaternion(ref qStart, out startRotation);
        Matrix.CreateFromQuaternion(ref qEnd, out endRotation);
        curScale.X = start.M11 - startRotation.M11;
        curScale.Y = start.M22 - startRotation.M22;
        curScale.Z = start.M33 - startRotation.M33;
        nextScale.X = end.M11 - endRotation.M11;
        nextScale.Y = end.M22 - endRotation.M22;
        nextScale.Z = end.M33 - endRotation.M33;
        Vector3.Lerp(ref curScale, ref nextScale, slerpAmount, out lerpedScale);

        // Create the rotation matrix from the slerped quaternions
        Matrix.CreateFromQuaternion(ref qResult, out result);

        // Set the translation
        result.M41 = lerpedTrans.X;
        result.M42 = lerpedTrans.Y;
        result.M43 = lerpedTrans.Z;

        // Add the lerped scale component
        result.M11 += lerpedScale.X;
        result.M22 += lerpedScale.Y;
        result.M33 += lerpedScale.Z;
    }

sentences:
How to get the Javascript equivalent of GameMaker's `hspeed` and `vspeed` given only `direction` and `speed`? I'm using a NodeJS server to control NPC movement in a multiplayer game, and when they get too close to the edge of the room I need to reverse either the horizontal or vertical components of their velocities (how to decide which, is a bridge I'll cross when I get there).

The problem is I already have their direction and speed, and am able to convert it to hspeed and vspeed, but not back again.

I need the inverse of this function:

function velocityToSpeeds(direction, speed) {
  return {
    x: -speed*Math.sin(Math.toRad(direction - 90)),
    y: -speed*Math.cos(Math.toRad(direction - 90))
  };
}

sentences:
What technique should I use to implement the following type of "diggable" terrain? I'm trying to replicate a certain game mechanic from the game Diggles.
This game takes place in a vertical cross-section of the earth and allows the player to dig tunnels and caves into the environment.
You can see this bevhaviour in action in the following Let's Play on Youtube.

https://www.youtube.com/watch?v=3lIN37JyNTU&t=7m40s

My question is: How can I implement such a modifiable terrain?

My first idea would be to keep a copy of the vertex and index buffer in memory, modify it accordingly and send it to the gpu each time it is modified. However, this seems very inefficient considering the size of the map and how often it would need to be updated.

sentences:
Randomly generating the hallways between a network of rooms So here's my base map:

(It won't necessarily be 5x5, just using this as an example.)

It's kinda boring the way it is with all the rooms connected. I want it to be more of a randomly generated labyrinth, where every room is accessible like so:

I've tried setting the hallways randomly:

foreach(Room r)
{
    r.northWall = randomBoolean();
    r.southWall = randomBoolean();
    r.eastWall = randomBoolean();
    r.westWall = randomBoolean();
}

But that almost always ends up with rooms that you're unable to go to, like this:

And often some rooms have no hallways at all. I tried saying each room must have a minimum of 2 hallways, but it still doesn't fix the problem that sometimes there an inaccessible areas.

How should I go about doing this? I'm not too worried about the speed, as long as it's not ridiculously slow (Some levels will have 100+ rooms).

sentences: Weird texture applied So I applied  the baked texture (on the right side of screen shot) but it shows in this manner. What is the problem? I made the model in Blender and also the baked image. The house consists of multiple separate objects.

sentences:
Rendering transparent textures in directX I am working with a directX application with WPF, I am facing a problem with videos and images that contains transparent pixels, I have to draw a color in background an then a video/image over it. What I expect is background color should be visible while playing video only non transparent pixels should be visible but what I get is a black background behind the video.
I am using following settings on device to achieve alpha blending :

device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
device.RenderState.AlphaBlendEnable = true;

What am I missing here? What is the best approach to handle transparent videos?
Any help will be of great value to me.

sentences:
How do we make online games deterministic? I am trying to understand how networking in games work as I am trying to make an online game myself. I can't grasp how it is possible to synchronize the players, in order to make the game deterministic. I found an article saying this:

  in order to ensure that the game plays out identically on all machines it is necessary to wait until all player’s commands for that turn are received before simulating that turn. This means that each player in the game has latency equal to the most lagged player.

This makes sense and I also came to the same conclusion after hours of drawing graphs with various scenarios. However, there are some games where one player can have 500ms delay, and another player could have 40ms delay. In this case, how is the game deterministic ?

Lets name players with 40ms, 500ms delay: Player40, Player500

Lets say that Player40, shoots Player500 with an instant laser shot at T1 = 0ms. Exactly 40ms after the Player40 actually clicked with his mouse to shoot (so T2 = 40ms), The "laser shooting event" registered on the server and returned "ok, you can execute laser shoot" to Player40. So, the shot is being applied on Player40's machine and on his screen he sees that he killed Player500, and the corpse is lying on (x1,y1,z1).

Meanwhile, what happened on Player500's machine, was that Player500 was running straight. A few moments later he sees a laser a few feet behind him, he dies even though the laser didn't hit him, and his corpse is lying on (x2,y2,z2).

Since this scenario never happens in some games, does this mean that those games are deterministic ? How is something like this possible, without forcing all players to get a delay equal to the delay of the most lagging player ?

sentences:
Collision detected at different times depending on speed? Imagine a scenario where there are four cubes. Two blacks that do not move, one red moving at a constant speed of two (2) straight and the other blue moving at a constant speed of five (5) also straight.

They all have equal bounding boxes.

By doing a test, I realized that if I put a command so that as soon as the red cube strikes against the black it turns left, the command does not run as soon as they collide ...

With the blue he wanted him to turn right as soon as he hit. The command takes longer to happen, I think because it is faster than red ...

Illustration of the incident:

It seems that the faster the object is, the longer it responds to the collision command. I would like you to give me a solution to this problem.

I've already moved with some bounding box options, but nothing that has given the desired result.

I also moved at the speed of the room, but it did not work either.

Sorry for any translation error. Thanks in advance!

sentences:
Lua Unknown error when typing something in Zerobrane studio IDE What is this weird error that I am getting when I typing something in the Zerobrane studio IDE? It crashes my IDE. But The game project compiles and runs fine.

When I turn off "Autocomplete Identifiers" from Edit menu, then the error doesn't come up.

Also, I searched entire google and facebook for some help or solution but no luck at all.

sentences:
Box2D + Love2D (Lua) - Assertion fail with polygon meshes When I try to create a triangle collider for my game it sometimes leads to an assertion fail. I use the physics engine that comes with love2d (Box2D). That's the error message that appears when the assertion fails:

love: modules/physics/box2d/Source/Collision/Shapes/b2PolygonShape.cpp:85: b2Vec2 ComputeCentroid(const b2Vec2*, int32): Assertion `area > 1.19209289550781250000e-7F' failed.

Here's an example of a triangle that doesn't cause the error (represented by a table with 3 points): {{258,451},{740,767},{284,597}}

And this one leads to a crash: {{258,450},{222,569},{306,723}}

The bodies of both shapes lie at {0, 0} (upper-left corner of the screen)

Does anyone know a possible reason and/or solution for the problem?

Edit:
I'm not allowed to answer my question right now for some reason so I'll post the answer here before I've forgotten it:
In Box2D, the order of placement of vertices seems to play an important role, since I was able to avoid the crash with the "problematic" triangle in my example from my question just by placing the first vertex between the second and the third one.
Maybe I'll repost the answer when I'm able to provide more information (and am also allowed to do so)

sentences:
Area Lights in DirectX So after reading https://www.guerrilla-games.com/read/killzone-shadow-fall-creating-art-tools-for-a-new-generation (a guerilla games presentation on PBR) I noticed the Area lights as opposed to the standard Directional, Point & Spot lights in DirectX can produce very realistic shadows.

Now a lot of the resources online talk about it and what it is but there's not much regarding implementation. Some websites online say that it is just an array of lights but I don't think that's what it is.

Can somebody explain how I can implement this (and maybe with some code). If you could include any links to some good resources regarding implementation that would be great aswell.

sentences:
Editor Window Show method is not working properly Documentation says that EditorWindow.Show show the EditorWindow.

I have two classes:

public class WindowOne : EditorWindow {

    public static WindowOne windowOneInstance;

    [MenuItem("Window/Open Window One")]
    public static void Init() {
        windowOneInstance = GetWindow<WindowOne>(false, "Window One", true);
    }
}

and

public class WindowTwo : EditorWindow {

    public static WindowTwo windowTwoInstance;
    public static WindowOne windowOneInstance;

    [MenuItem("Window/Open Window Two")]
    public static void Init() {
        windowTwoInstance = GetWindow<WindowTwo>(false, "Window Two", true);
        windowOneInstance = WindowOne.windowOneInstance;
    }

    public void OnGUI() {
        if (GUI.Button(new Rect(0, 0, 200, 50), new GUIContent("show window one"))) {
            windowOneInstance.Show();
        }
    }
}

In menu I click Open Window One, then Open Window Two, then I close the first window

Now if I click a Button on WindowTwo it doesn't show me WindowOne. Or at least it shows one-pixel of window that I cannot move or resize or do something else.

If I use GetWindow(typeof (WindowOne)); instead of  .Show() - it shows the window, but I'm not sure that it shows the same instance I created before, because instanceID of that window will be different.

Why Show method works so strange? Am I doing something wrong? And  what should I do to show the same instance of closed (temporarily hidden) window?

Unity version - 5.6.0p4

sentences:
Precomputing Visibility Having noticed that UDK (Unreal) and Unity 3 include similar pre-computed visibility solutions that unlike Quake are not dependent on level geometry, I've been trying to figure out how the calculation is done.

The original Quake system is well documented: You divide the world into convex volumes that limit both the camera and the geometry. Each volume has a list of all the other volumes that are visible from it.

Visibility would be computed by firing rays at some random distribution of points in the target volume and see if any hit. And because the position of the camera in the source volume could have an effect, those thousands of rays would have to be fired from multiple places in the source cell.

So what I'm wondering is if there's any been fundamental change to this basic scheme in the intervening 15 or so years? I can see how to adapt it to a UDK/Unity scheme that has regular source volumes and deals mostly with arbitrary meshes as the targets, but is there a better way than stochastic ray testing?

sentences:
Rotation pitch/yaw reverse problems when picking a tile (2.5D) Set-up: 3D world, isometric sprite rendering (4 fixed angles).
This transform matrix is used as camera:

 _transform =
            Matrix.CreateRotationZ(Roll) *
            Matrix.CreateRotationX(Pitch) *
            Matrix.CreateTranslation(new Vector3(-cameraPosition.X , -cameraPosition.Y, -cameraPosition.Z))* //this matrix controls camera position
            Matrix.CreateScale(new Vector3(_zoomScale)) * //scale representing zoom level. This one applies to the textures too
            Matrix.CreateScale(new Vector3(_textureScale)) * //world scale to fit current texture pixel size.
            Matrix.CreateTranslation(new Vector3((_port.screenWidth / 2) - TileOffset, _port.screenHeight / 2, 0)) //offset for having focus in center of screen instead of top left corner + little offset so it will be a tile center
            ;

Roll=-45, Pitch=60. Result:

I've hoped to find a quick picking solution in the inverse matrix:

_inverseTransform =
           Matrix.CreateTranslation(new Vector3(-(_port.screenWidth / 2) + TileOffset, -_port.screenHeight / 2, 0))*
            Matrix.CreateScale(new Vector3(1/_textureScale)) *
            Matrix.CreateScale(new Vector3(1/_zoomScale)) *
            Matrix.CreateTranslation(new Vector3(cameraPosition.X, cameraPosition.Y, cameraPosition.Z))*
            Matrix.CreateRotationX(-Pitch)*
            Matrix.CreateRotationZ(-Roll)
            ;

It doesn't work as expected.
If i remove rotation from matrix build, everything works. The interesting part is if i leave roll component only, everything works too.
I've tried transposed matrices, inverted matrices, rotating on -angle, FromPitchYawRoll matrix (inverted/transposed/-angles). Every time roll works, pitch and yaw aren't.
Pitch only/yaw only can't be inverted too.

It's probably something basic in the matrix math/rotation principles, but i'm failing to grasp it. Any help would be appreciated.

--code removed, not relevant to the case--

Some gifs for better understanding.
Current implementation do this:

If we switch the pitch off, inverse matrix work as intended (white dots mark real tiles grid. Graphical tiles aren't rotated, of course.)

EDIT:
After some matrix calculations i've realised simple thing. Let's point the mouse on the tile (0,2). If i dump all transformations but pitch by several degrees, then tile (0,2) will be drawed somewhere on (0, 1.25).

But if i'll apply inverted (or transposed, or "rotate by -value") matrix to the mouse position (0,2), i'll get same (0, 1.25), which means that the mouse is pointing at (0,1) tile. While it should point at (0, 3). And i don't know how to invert this correctly.

I've also discovered this. But, as you can see in the first answer, knight666 is using scale instead of pitch rotation.

sentences:
How can I instantiate my variables in Boo? I have a Player Attributes class:

import UnityEngine

class Stat ():
    public current as int
    public max     as int

class PlayerAttributes ( MonoBehaviour ):
    public Name          as string
    public level         as int
    public hp            as Stat = Stat()
    public ep            as Stat = Stat()

public strength      as int   // How accurate and how much damage with melee attacks
public dexterity     as int   // How accurate and how much damage with ranged attacks
public vitality      as int   // How many hit points he has
public power         as int   // How much damage his energy attacks deal
public resistance    as int   // How much defense he has against energy attacks
public agility       as int
public speed         as int   // How fast character attacks

public meleeAtk      as int
public rangedAtk     as int
public defense       as int
public powerAtk      as int
public powerDef      as int
public initiative    as single

public exp         as Stat = Stat()

def SetInitialStats (
            name       as string,
            strength   as int,
            dexterity  as int,
            vitality   as int,
            power      as int,
            resistance as int,
            agility    as int,
            speed      as int,
            exp        as int
          ):
   self.level      = 1
   self.Name       = name
   self.strength   = strength
   self.dexterity  = dexterity
   self.vitality   = vitality
   self.power      = power
   self.resistance = resistance
   self.agility    = agility
   self.speed      = speed
   self.exp.max    = self.level * (self.level + 1) * 500
   AddExp(exp)

def AddExp ( experience as int ):
   exp.current += experience

   while exp.current >= exp.max and level < 99:
     exp.current -= exp.max
     exp.max      = level * (level + 1) * 500
     level       += 1
     IncreaseStats()

def IncreaseStats ():
   strength   += 1
   dexterity  += 1
   vitality   += 1
   power      += 1
   resistance += 1
   agility    += 1
   speed      += 1

   meleeAtk   = (level * 7) + strength
   rangedAtk  = (level * 7) + dexterity
   defense    = (level * 2) + agility
   powerAtk   = (level * 7) + power
   powerDef   = (level * 2) + resistance
   initiative = 20 + ((speed * level)/1500)

   hp.max     = ((level * 5) + vitality) * 10
   hp.current = hp.max

   ep.max       = ((level * 5) + power)
   ep.current = ep.max

Jut anything simple really. Well I read in the docs to not use constructors with MonoBehaviour, but I try instantiating my variables with the Start() function which is SetInitialStats (...)

So In another script in the Start() function I call it up like this

    Player = PlayerAttributes.SetInitialStats('Robo', 20, 21, 19, 20, 18, 22, 22, 57000)

I get the warning: ' An instance of type 'PlayerAttributes' is required to access non static member'

Not sure what else I can do to setup my beginning stats.

I got this to work I Unityscript which worked with a constructor without MonoBehaviour so I don't know where else to go from here. I would like to stay using Boo.

sentences:
Hold touch at the screen to move object I'm using unity2D and C#, and I have a code for touch screen:

if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;

        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;
            swipeDist = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if (swipeTime < maxTime && swipeDist > minSwipeDist)
            {
                swipe();
            }

And this code for swipe:

void swipe()
{
     Vector2 distance = endPos - startPos;
    if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
           if (distance.x > 0)
        {
            Debug.Log("Right swipe");
        }
        if (distance.x < 0)
        {
            Debug.Log("Left swipe");
        }
    }
    if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        if (distance.y > 0)
        {
            Debug.Log("Up swipe");
        }
        if (distance.y < 0)
        {
            Debug.Log("Down swipe");
        }
    }
}

}

How can I add to this code hold function, for for example move object at the screen?

sentences:
Surface creation algorithm using points cloud I am looking for a realtime algorithm to create a 2D mesh using points. But I am quite confused. It seems that Delaunay triangulation can help me create mesh using point clouds, but Meta-balls seems also useful for isolated points for example. And what about concave shapes ?

I am looking for interesting links, white-papers, code sample, etc...

Here is an example of what I am trying to achieve. As you can see the aim is to create a 2D fluid surface.

In red should be the generated mesh, I tried to reproduce the special condition that could happen like concave shape, isolated points, etc. In black you can see the points used to create the shape.

Thank you.

sentences:
Normals in my skinned model are not animated I have a blender skinned mode with animation. Normals look like they are messed up. This is how it looks in Unity3D before and after animation.

As you can see, my model should be lit up just like the cube next to it. When I apply Armature modifier in blender, my model looses animation and its locked in particular position, but the light on that model works.

My question is: The normals are set as they would be for a static model, not for a animation. Why are normals not animated ?

sentences:
Overriding the sprites in a Animation clip Right now we are in the process of adding seasonal content to our game. I would like to know of a way to override animation clips. Specifically I want to change the sprites being show at each key-frame. Looking from the text of a animation clip I found the following :

 m_PPtrCurves:
  - curve:
    - time: 0
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    - time: 0.6
      value: {fileID: 21300000, guid: ae9111d826eb24442b21523b30b748bd, type: 3}
    - time: 0.6666667
      value: {fileID: 21300000, guid: 88840e4f59c4a6040922d9b6eed3dec3, type: 3}
    - time: 1.2333333
      value: {fileID: 21300000, guid: 88840e4f59c4a6040922d9b6eed3dec3, type: 3}
    - time: 2.0001667
      value: {fileID: 21300000, guid: ae9111d826eb24442b21523b30b748bd, type: 3}
    - time: 2.05
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    - time: 3.1166666
      value: {fileID: 21300000, guid: 502fc97a961e4424ea008c0e546c83ef, type: 3}
    - time: 3.45
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    attribute: m_Sprite

This corresponds to the key frames and amount of sprites in the animation clip but I have no idea from where to get the data for the new sprites. I'm guessing the guid is a hashed path to the png files. can someone  explain where to find this data so I can write myself a neat little parser to do the job?

sentences:
Collectible Card Game Card Text To Code Association I am making a collectible card game using a command pattern for using card abilities and creating a class for each card text ability. The game is setup to work with an authoritative server structure. I have each cards stat values in a MySQL database. My question is what would be the best way to associate a cards text with the class that executes it?

For example, I have a Card class that pulls card stats from the database for the specific card. I would like to have an entry in the database for each card that determines what ability class the card has. Since, I'm limited to the basic data types in the database I'm trying to find the best way to associate a string or int to a class that executes the cards ability in my code.

My first solution is having each database entry for a card hold a string that holds the code for the class, and compiling that string on the fly. A second solution is having a giant switch statement class that associates each card name with the class of its ability. I feel like there should be a simpler way to get this accomplished though. Anyone have any insights? Thanks

sentences:
Checking if a click happened "off" an object Having made the first game in Game Maker, Catch the Clown, I realised there was no way to win or lose.

Winning is easy enough, set a maximum score and a test that fires whenever a score increments, but losing has proved challenging. I had an idea; if the player attempts to click on the clown but misses he/she loses a life. I have tested every check, read the manual and looked through forums but I can't find a way to do this.

I also can't figure out where to put the event. I tried on the clown; tests like checking to if there would be a collision between where the click occurred and where the clown is... nothing works. I am at a complete loss so any help would be greatly appreciated.

sentences:
Collision detection circle-segment-segment I've already implemented collision detection in my game loosely following this tutorial, which works great, but I realized there's one major flaw.
The player and the enemies are circles, while the obstacles can be either segments or polygons or circles.
Now, let's say I have segment A from point (100, 100) to point (300, 100) and segment B from point (100, 200) to point (300, 100), which means they form an acute angle, and player has it center in point (100, 125), with a radius of 25.
If player starts moving right, it will eventually collide against segment B. My method checkCollisions() will return a vector, but if I apply that vector on player, it will be moved up and left, and will overlap segment A.
If I call checkCollisions() a second time, player will be pushed down and collide again with segment B, so recursive invocations aren't a solution. Any ideas?

Here's a picture to explain:
 The g->n vector direction is along the bisector of the two little vectors, but how do I find the length?

sentences:
How would you guys call a class to instantiate both NPCs and players? My idea is having a class to instantiate both NPCs and players. I have thought of some names like Entity but that is way too broad, as it could refer to anything from a block to an event really. I've also thought of Character, but that name seems to refer to only important characters in the story, not any NPC that you might encounter in the world.
It's a pretty straightforward question, yet I've been racking my brain for about an hour and can't seem to get any useful ideas.

Thanks guys, and peace.

sentences:
Transparency in GLSurfaceView I'm new in game development. I have a view using GLSurfaceview and call in MainActivity.

I want to make transparent that view. I have tried setZOrderOnTop() method in MainActivity and glClearColor() but both are not working.

public class RubikActivity extends Activity {

        cubeView cv;
        GLSurfaceView gv;

        @SuppressLint("NewApi")
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity);
        cv = (cubeView) findViewById(R.id.cubeView);
        cv.initialize(PreferenceManager.getDefaultSharedPreferences(this));
         cv.requestFocus();
            cv.setFocusableInTouchMode(true);
            cv.setEGLConfigChooser(8, 8, 8, 8, 8,0);
          //  cv.setRenderer( new CubeRenderer(getApplicationContext(), font, mWorld, rCube, mMenu, prefs);

            cv.getHolder().setFormat(PixelFormat.TRANSLUCENT);
        cv.setZOrderOnTop(true);

        }

cubeView.java

public cubeView(Context context, AttributeSet attrs) {
super(context, attrs);
font = new TextureFont(getContext(), R.drawable.roboto_regular, "roboto_regular_dims.txt");
mWorld = new GLWorld();

}

public void initialize(SharedPreferences prefs) {
rCube = new Rubec(mWorld, prefs.getInt("dim", 3));
mMenu = new CubeMenu(rCube, font);
_renderer = new CubeRenderer(getContext(), font, mWorld, rCube, mMenu, prefs);
rCube.setRenderer(_renderer);
mWorld.setRubeCube(rCube);
setRenderer(_renderer);

getHolder().setFormat(PixelFormat.TRANSLUCENT);
setZOrderOnTop(true);
}

cubeRenderer.java

@Override
public void onDrawFrame(GL10 g) {
GL11 gl = (GL11)g;

surfaceSetup(gl);

gl.glClearColor(1.0f, 1.0f, 1.0f,0);
gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
gl.glDisable(GL11.GL_DEPTH_TEST);
gl.glMatrixMode(GL11.GL_MODELVIEW);
gl.glShadeModel(GL11.GL_SMOOTH);
    gl.glLoadIdentity();

GLU.gluLookAt(gl, 0f, 0f, 7f,
          0f, 0f, 0f,
          0f, 1f, 0f);
gl.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, modelViewMatrix, 0);
if(!worldBoundsSet) {
    getWorldBounds();
}
gl.glColor4f(0.5f, 0.5f, 0.5f, 1);
gl.glEnable(GL11.GL_DEPTH_TEST);
gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
    gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
menu.draw(gl);
mWorld.draw(gl);
gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
/*gl.glDisableClientState(GL11.GL_COLOR_ARRAY);*/
gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);

//gl.glFlush();
}

I want the white color to show as transparent background in my layout.
I am already use glClearColor(0,0,0,0) which shows as a black color
and already use in xml file:

 <com.rtpl.rubikgame.cubeView
  android:id="@+id/cubeView1"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_weight="1"
  android:background="#000000"
  android:windowIsTranslucent="true"/>
</LinearLayout>

but nothing happened; when we use glClearColor(0,0,0,0) it shows this:

sentences: Is it true that to test a game on the iPhone or iPad, we either need to pay $99 to join Apple Developer program, or jailbreak the iPad? To test a program for iPhone or iPad, seems like the only way is to join the Apple Developer program and pay $99 per year?  Can you also jailbreak the iPhone or iPad and be able to test it?

sentences:
What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform? I am thinking about giving a go to one of my ancient ideas for a game. The core point of this game would be the possible level of functional customization of the game environment and objects (such as modifying the behavior of a space ship weaponry). For this the game would need to be scriptable. Also I don't aim to commercialize it, it is merely an interesting programming challenge for me.

As I am mostly a .NET guy I will use XNA/C# for the game itself. For the scripting I think about going with Python or Lua. I have previous experience with Python and have nothing against it as a language. Lua on the other hand is almost completely new to me, besides some minor World of Warcraft addons modifications I did here and there, and it looks promising. So here is my question:

What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform?

Is one of them considerably easier to use with XNA/C#? Has one of them some specific advantages or disadvantages when used with XNA/C#? Why would you recommend one over the other for XNA/C#?

sentences:
Physics - Determine how much thrust to apply at each thruster for linear/angular acceleration I have a question somewhat similar to this one: 2D Spaceship Thruster Movement - Turning.

I have a ship with thrusters placed randomly on it (not necessarily symmetrically), and I need to know which thrusters and how much to fire them to have a perfectly linear acceleration, as well as how much they contribute to the angular acceleration of the ship to know which ones to fire when you want to turn the ship.

What I know: the position and orientation of the thrusters, the center of mass of the ship.

Basically I just need a way to make the ship obey the commands as best as physically possible, the commands being 'move' (apply acceleration on thrusters so if results in a linear acceleration), and 'rotate' (apply differential acceleration to maximize angular and minimize linear acceleration).

The game is 2D.

Thank you very much in advance.

sentences:
Android - Using opengles through java vs c++ Ive been reteaching myself opengl so I can make a game on android. However Ive been struggling with how to build objects and scenes in opengl using c/c++ and passing them through the jni to the virtual machine where android can use them. Can some one point me towards some tutorials that actually show the use of natively built objects being created and passed through to the jni. Im fine using c++ or java I just dont have much experience using the jni.  Ive built some sample projects where I pass primitives like floats and perform operations on them on the native side and then passed them back but I cant figure out how to create a scene in opengl in c++ and then pass it to java.  Ive been looking at writing everything using java but Im not sure if the java bindings make for some performance loss.

Any help would be much appreciated

sentences:
How to create / draw clickable object (such as Button in WinForm) in XNA WP8? I am developing a 2D (No 3D in every aspect) Windows Phone 8 turn based tactical games for my college project. I use Monogame.

I want to draw an object similar to Button in windows form, that if the object is tapped / touched, then an event / method started. I am looking for a way to create a similar event like "OnClick" attached on an object, so I know which tile is tapped by the user specifically.

The object is not entirely visible, because I used an empty transparent texture2D (In case you wondered)

Thank you.

(Please feel free to ask anything if my question is not clear enough, and sorry for my jumbled language, if any.)

===============================

FURTHER EXPLANATION :
In front of every sprite, I want to draw a "transparent object" that can run an event when tapped (so it appear like user tapped the character, but behind-code-ly, the "transparent object" which is tapped, because it the one that can receive tap input).

Why I need this kind of object, because if I get the tapped coordinate, the coordinate fetched is relatively based on the viewport, once the map bigger, then it's so hard to calculate the tapped thing. But with the "transparent object", wherever the tile is, I can get which tile is tapped precisely.

I think this also an attempt to make my code as detached as possible by dividing each action into a separate class.

sentences:
OpenGL, Blender and model optimization I'm learning OpenGL and there is something I don't understand regarding model loading.

Lets say I found a free .blend model of a tree. The problem is - currently in my program all models have only one texture. But this model use two textures, one for trunk and another for branches and leaves. Actually trunk and leaves are two separated models on one scene.

What to do in this situation? Editing model manually could take a long time (I'm not an expert in Blender). I could join two textures in one and correct UV's automatically. But most likely a lot of space will be wasted on such an automatically created texture. I could also modify my model format (it's more like memory dump + header actually) so I could store N models with N textures as one object. But using N times more VBOs and textures when you actually need only one is inefficient.

I'm wondering maybe there is a well known tool for automatically joining multiple objects in one? Or maybe some good practice for this case? Or something like this.

sentences:
Picking a specific point of a map in Direct 3D I'm trying to pick a specific point on a randomly generated terrain with bunch of tiny triangles. Right now, I'm just iterating through every triangle and picking a intersected triangle using D3DXIntersect function. It serves its function but the performance is just not tolerable.

Is there a way to pick a triangle without millions of iteration?

sentences:
Should I ping for a TCP-based game? I have a head-to-head game where two players communicate through a server based on TCP.

I am planning to implement a ping/pong mechanism in order to detect network disconnection situations. For example,

A pings B every 500ms.
If A receives no response from B, A shall consider B is disconnected.
If A receives no response from the server, A shall consider A is disconnected itself.

Do you think this ping/pong system is needed or other method is recommended?

sentences:
Example/Tutorial of passing structured data over network C++ This is very general question, about strategies how to pack same information about state of my game-world on server ( e.g. position/orientation of players, projectiles, etc. ) into data stream so that I can sent them over network and unpack them on the client side to draw on screen.

I know it's called serialization. But still I have many doubts.

My game already has some structure of objects. I do not want to re-design it ( too much ) in order to use some automatic serialization. I also do not want to make dependency on an other library (such as boost::serialize ) if not necessary
My classes/objects e.g.(class Airplane) contain some properties which should be passed over network to the client ( e.g. position and orientation ) but also some which should not ( e.g. some temporary variables relevant just for computations on server; pointers to nearest neighbor objects; array of Lift and Drag coefficient for set of angles-of-attack )
If I pack more objects into one message/packet I will probably need some protocol and parser to unpack the objects properly on the other side. The client should know of which Class type data are and to which instance it should be assigned.

Probably by trial and error I can figure it by myself, but it would take some time, and it would be helpful to have some example solution of similar problem to start with.

background - I have some skill with physics and graphics programming (Java,C++,Frotran,GLSL,OpenCL...), but I know absolutely nothing about networking. I have done some games into which I would like multiplayer. Just simple games with only few players and moving objects (projectiles). For reference consider something like LIERO

sentences:
Where is the error in my perspective projection implementation? My question is not really a game development question, but since it's based on 3D programming, I thought it would fit best here.

I've got a line made out of Point3D objects where the value of x, y, and z are somewhere in those regions:

x: 0 - 640
y: 0 - 480
z: 0 - 4000

I'd like to project those lines into a plane with the size of 640 * 480 (the same size as the base x * y values were) using a oerspective projection. I found some information about the matrix I should use in an old computer graphics script (there are a lot of different matrixes around the net too), but could not get it to work.

Based on this tutorial, I'm using the following parameters:

float n = 1000; // near plane
float f = 4000; // far plane
float l = 0;    // left side
float r = 640;  // right side
float b = 480;  // bottom
float t = 0;    // top

float m11 = (2 * n) / (r - l);
float m22 = (2 * n) / (t - b);
float m31 = (r + l) / (r - l);
float m32 = (t + b) / (t - b);
float m33 = (-1 * (f + n)) / (f - n);
float m43 = (-2 * f * n) / (f - n);
float m34 = (-2 * f * n) / (f - n);

m = new Matrix3D(m11,   0,   0,   0,
                   0, m22,   0,   0,
                 m31, m32, m33,  -1,
                   0,   0, m43,   0);

Now all the result-points I receive from doing a m.Transform(myPoint3D) are in ranges like:

x = -1,015 to -1,694
y = 1,568 to 1,572

In my understanding those values should be in ranges from -1 to 1, and I would scale them to fit into my plane, but those results look totally chaotic... Also, the resulting z-values aren't "flat" but ranging from 2.903 to 2.996.

Any ideas where my error is?

sentences:
Detecting image curve to move a truck on this surface I have an image background in surface view

I want to move something according to black surface.But i can not do this using height of this image as it return same height.and one more thing bitmap.getPixel is also not working.and my background is moving.So what is the way to achieve this feat

sentences:
How to access sprite sheet via row and column I'm currently designing a 2D game engine in C#, just had a quick question.

I have a SpriteSheet class that splits up a sprite into several different sprites (like a tileset for a example) and stores them in a list. Which is great, because now I can access sprites via it's corresponding index in the sheet.

However, I would really like to add a feature that will let me access a sprite by specifying the row and column it resides in (in the original sprite). I just don't know the equation to find where the sprite is in the list.

Here is what I have so far:

    public Sprite this[int index]
    {
        get { return this.sprites[index]; }
    }

    public Sprite this[int row, int column]
    {
        get
        {
            // Get the width and height of each individual sprite in the sheet.
            int cellWidth = this[0].Width;
            int cellHeight = this[0].Height;

            // Figure out and how many rows and columns are in the entire sprite sheet
            int rows = this.sprite.Width / cellWidth;
            int columns = this.sprite.Height / cellHeight;

            // Here is where I want to return the sprite located at the row and column specified.
            return this.sprites[ /* what do i put in here? */ ];
        }
    }

Also, I don't know if it will help but here is the method I use to fill the list with sprites:

    private void CreateSheet(Sprite sprite, int xOffset, int yOffset)
    {
        for (int y = 0; y < sprite.Height; y += yOffset)
        {
            for (int x = 0; x < sprite.Width; x += xOffset)
            {
                this.sprites.Add(sprite.Clone(new Rectangle(x, y, xOffset, yOffset)));
            }
        }
    }

sentences:
Best method for 2 layer tile based map scrolling What is the best general approach to implement scrolling for a 2D tile based game?

I need to scroll the map with a constant speed, lets say 2 pixels every frame (like in a top down shooter).

The tiles are 32x32 and the map is quite big, lets say 10 x 300.

There are 2 layers:
- first is the background layer
- second is the forgeground layer with obstacles and enemies

The target plattform is android and I want to use OpenGl.

What is best practice?

a) Draw only the visible Screen all the time (every frame)
b) Load complete map into memory and just move the camera

Is there a difference in performance and determining collision etc.?

Thanks for any help!

sentences:
Webgl: is possible to use one color buffer to unsharp masking the depth buffer? I'm noob to webgl. After reading the tutorials at webglfundamentals.org and "Introduction to Computer Graphics", i'm able to succesfully draw some stuff and the depth buffer without thirty-party libraries.

Now, i try to go a step further and apply some visual enhancement to my drawings, by usharp-masking the depth buffer, also called "the cheap SSAO".

What i understand is, that i should:

draw the depth buffer
blur X
blur Y
combine the blurred depth buffer with the diffuse component of the initial image

What i learned so far is, that to apply these four steps, i could use two textures, ping-pong back the textures, apply the effects in sequence to the textures and at the end draw to the screen the final result.

It would be easier with a gl.RGB4 color attachment?

It seems to me, that the final effect is just only to dim the diffuse color of the initial image, so i could draw the depth buffer to the red channel, blur-X the red channel to the green channel, blur-Y the green channel to the blue channel, and then combine this last with the initial drawing.

Isn't this faster or memory-cheaper than swapping two textures, for example by thinking mobile-first?

What are the drawbacks? Anyone already tried this? Thanks in advance

sentences:
Zooming to point of interest I have the following variables:

Point of interest which is the position(x,y) in pixels of the place
to focus.
Screen width,height which are the dimensions of the window.
Zoom level which sets the zoom level of the camera.

And this is the code I have so far.

void Zoom(int pointOfInterestX,int pointOfInterstY,int screenWidth,
   int screenHeight,int zoomLevel)
{
glScalef(1,1,1);
glTranslatef( (pointOfInterestX/2) - (screenWidth/2), (pointOfInterestY/2) - (screenHeight/2),0);

glScalef(zoomLevel,zoomLevel,1);
}

And I want to  do zoom in/out but keep the point of interest in the middle of the screen. but so far all of my attempts have failed and I would like to ask for some help.

sentences:
Rotate mesh to normal I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with.
So head pixel in my texture is a normal and I want to rotate each instance with the corresponding normal in a shader. How can I achieve that in a shader only?
Unless I am mistaking, there should only be a rotation around the X and Z axes.

sentences:
How do I show a Quit button on Desktop but don't show it on Android with libgdx? So I would like to display a Quit button on the Desktop main menu screen, but I wouldn't want to have it on Android too. What is the correct approach to achieve this? Do I have to check the ApplicationType of the app each time I want to display something different on the two platforms, or is there a more general approach maybe?

The same question is valid for text for example.
Say, on Desktop it should say "Click to continue" whilst on Android - "Tap to continue".

To mention that both projects (Desktop and Android) share the same main project, since they have been created using the gdx-setup-ui tool.

Thank you.

sentences:
What would make a good cursor movement sound effect? I know specific questions like this are very borderline on acceptable - but I am having massive trouble finding a non-annoying sound effect for moving the cursor in my game.

The game is a Fire Emblem like SRPG and think it would be cool if I could have a little sound each time the cursor ticks in a menu/selection of character/etc. - it should be a non-intrusive sound (keeping in mind I can adjust volume).

What have you guys used for something like this? Going to various free soundclip sites putting in "cursor move" isn't doing much for me.

sentences:
How can one achieve the mechanic of hitting cars or bumping into them like in Burnout games' takedown modes? In Burnout games there's this game mode where the player can trash other cars by bumping into them or bumping them into walls. As you can see in this video link This is known as a takedown.
I'm working on a racing game and I would like to work on a similar feature. I added a bouncy material to my cars collider in hopes that this effect would be replicated to some degree but all it did was to slightly push the cars away from the player.
I don't have that much experience in making games so I'd appreciate any help I could get about the subject.

sentences:
Photon2 Unity2D How to send float with RPC I have big problem in my code .. I want to spawn obstacle exactly on the same position as on the server is spawned so I made rpc Method and tried to pass random variable of float , but when i run the game obstacles are spawned on the diffrent position. I am loosing a lot of time to get it done but I still can not find solution.

Here is the code

   [PunRPC]
    void RPC_SpawnColumn(Vector3 position)
    {
        // Instantiate(prefab, position, Quaternion.identity);
        Debug.Log("THIS IS SPAWNYPOSITION" + spawnYPosition);

        Instantiate(prefab, new Vector2(9, spawnYPosition), Quaternion.identity);

    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        //print("Are we here");
        if (collision.GetComponent<ColumnsMultiplayer>() != null)
        {

            print("Or are we here");
            if (SpawnOnce)
            {
                spawnYPosition = Random.Range(-3.36f, 2.98f);

                photonView.RPC("RPC_SpawnColumn", RpcTarget.Others,new Vector3(9, spawnYPosition));  // this is

            }
                //SpawnColumn();

            SpawnOnce = false;

        }
    }

Thank you so much for reading post.

Edit: I need to send spawnYPosition  from method two to method one and spawn it with same position of spawnYPosition  in the second method.

sentences: What are Unity3D Substances? I recently was a tutorial use substances in Unity3D. I understood that a Substance is a material we can dynamically manipulate at run time, but I am still unclear about it. Could someone shed some light on this?

sentences:
2D Lighting Problem with Black Backgrounds I'm currently experimenting with simple lighting in my game made with SFML and C++ (though I don't think that's relevant to the question). It's my first time messing with lighting in 2D, and my basic system is to:

Create a lightmap
Every frame, clear the lightmap and add all lights back to it (they move).
Every frame, draw the lightmap to the window on top of the game and multiply the colors from both textures (the game texture and the lightmap texture). In SFML I do this by:

window.draw(lightMap, sf::BlendMultiply);

My issue is that my lights don't show up against a black background, which doesn't seem to make sense. It's as if that specific color (and colors close to it) just can't be illuminated. Is this because of how color multiplication works? If so, is there a workaround?

Thanks!

sentences:
Android LibGDX 1.9.6 Augmented Reality captured images are black Using LibGDX for an AR application and capturing image and merging lines and texts on LibGDX with image with this code.

 private Pixmap merge2Pixmaps(Pixmap mainPixmap, Pixmap overlayedPixmap) {
    // merge to data and Gdx screen shot - but fix Aspect Ratio issues
    // between the screen and the camera
    Pixmap.setFilter(Filter.BiLinear);
    float mainPixmapAR = (float) mainPixmap.getWidth() / mainPixmap.getHeight();
    float overlayedPixmapAR = (float) overlayedPixmap.getWidth() / overlayedPixmap.getHeight();
    if (overlayedPixmapAR < mainPixmapAR) {
        int overlayNewWidth = (int) (((float) mainPixmap.getHeight() / overlayedPixmap.getHeight())
                * overlayedPixmap.getWidth());
        int overlayStartX = (mainPixmap.getWidth() - overlayNewWidth) / 2;
        // Overlaying pixmaps
        mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(),
                overlayStartX, 0, overlayNewWidth, mainPixmap.getHeight());
    } else {
        int overlayNewHeight = (int) (((float) mainPixmap.getWidth() / overlayedPixmap.getWidth())
                * overlayedPixmap.getHeight());
        int overlayStartY = (mainPixmap.getHeight() - overlayNewHeight) / 2;
        // Overlaying pixmaps
        mainPixmap.drawPixmap(overlayedPixmap, 0, 0, overlayedPixmap.getWidth(), overlayedPixmap.getHeight(), 0,
                overlayStartY, mainPixmap.getWidth(), overlayNewHeight);
    }
    return mainPixmap;
}

In 1.9.6 Pixmap.setFilter(Filter.BiLinear); is not available and it does not merge 2 pixmaps correctly. I tried setting BiLinear filter for both pixmaps or one at a time but none works.

sentences:
VBO and gl*Pointer management practises? I'm aware it's not a simple yes/no question and for the moment I can't tell if it can be simply answered, or is it a topic for a long discussion which is not suitable for our Q&A format.

I want to do some VBO management in order to reduce calls to GL.

I have 4 VBOs for all meshes:

one for static draws
one for dynamic draws
one for stream draws
one for indices

I want these four to handle my whole scene - this is going to reduce calls to glBindBuffer.

My mesh object consists respectively of static part, dynamic part and stream part, each of the part is specified by vertex specificator that is created at runtime, just by pushing back attribute objects containing size/type/offset to a member vector.

Based on the vertex specificators you can fill the parts with interleaved data, you don't have to do this for all the parts though. As I read here, separating vertex parts with different usage modes is good as it allows you to update all the dynamic/stream data at once without ever touching the static data. For example, doing particle simulation I may not be necessarily interested in streaming texture coordinates - changing vertex positions may be enough.

What's going to happen next:

sort all mesh objects by the vertex specificator of its static part
upload all the meshes' static parts' vertex data in obtained order to the static VBO
sort all mesh objects by the vertex specificator of its dynamic part
upload all the meshes' dynamic parts' vertex data in obtained order to the dynamic VBO

... and so on.

In short, static/dynamic/stream chunks (each in one of the 3 VBO's to which it belongs) with the same vertex types will be next to each other, and this is going to reduce calls to glVertexAttribPointer. Here I will need to smartly organize meshes that may want to use various parts, and then implement kind of lazy binds, probably if mesh needs to call glPointer for two different VBOs (separate static and stream parts for example), check if one of them is not already bound and call corresponding glPointer first.

Of course, each of the big batch obtained that way will then be sorted inside on the level of draw calls to reduce switches of shaders, textures and so on.

In short, this is my idea:

Although such a case may be uncommon, it's just to illustrate what should my mesh organizer be able to deal with.

Well, now it's only a plan and I haven't yet implemented it but..

How do the modern, high performance engines do their VBO and gl*Pointer state management? Is there something wrong with my concept, or am I totally misguided? Google results for VBO management and similiar tend to give me topics where people are asking for help because their programs crash, or just usage examples that tell nothing about optimizing my rendering procedures on VBO level but just "avoid redundant calls to GL", or some actual one-line tips (like glBufferData with NULL). So what I've described above is what I've concluded myself using those informations and I'm not sure if I am even on the right path.

Could somebody show me some good and actually proven practises managing VBOs in big 3D scenes, or maybe guide me a bit if I am actually reasoning right ?

sentences:
Convert vector interpolation to quaternion interpolation? (Catmull-Rom) I have some existing code which does catmull-rom interpolation on two vectors (facing and up). I'm converting this to use quaternions instead (to replace the two vectors). Is there a general way to convert the vector based interpolation to a quaternion one?

The approach I'm using now is to exact the axis and angle from the quanternion. I then interpolate each of those independently and convert back to a quaternion. Is there a more direct method?

sentences:
Models not rendering when far away I am making a game where objects are represented by colored cubes. I have files that mark the location and rotation of the cubes. I've been using Processing's 3D library and the cubes disappear within a certain distance, like this:

Why is this happening?

sentences:
Footstepper with Vr Unity I have the Footstepper: Complete Footstep Solution from the unity store, and i dont get it working with the Vr,
I made the footstep material like official documentation said, Then
i put the Footstepper Setup in the ovrPlayer object.
The problem is that sometimes sound the default fallback, so i think that the colission is not detected as it suppose.
Some idea ?

sentences:
How to set "useGravity" for Rigidbody to entities in Unity For the position you can use this:
[Inject] private ComponentDataFromEntity<Position> _position;

But cant use it for Rigidbody. How to access the parameters for Rigidbody for entities?

sentences:
What kind of project management should a solo developer project use? I’m working by myself on a game project whose development could be seperated into 3 independent parts (map generation, the “overworld” engine and the battle engine), but as the development progresses, I am not sure how I should be dealing with the management of this project, especially concerning these 3 points:

Is it worth it using a version control system, since I’m working solo?
Should I use a formal method to register planned features / bugs (I just remember what needs to be done for now)
The most important question: how can I know what to develop first? Now that the very basics are done, I know the list of features to code but I don’t know in which order I should do it.

sentences:
multi-threading for openGL in Android? In my old game based on canvas and bitmaps I used surfaceHolder and Thread to call onDraw:

public class GameThread extends Thread {
private SurfaceHolder _surfaceHolder;
private ScreenObjectsView _panel;
private boolean _run = false;

public static int mOnDrawPeriodGap = 20;

public GameThread(SurfaceHolder surfaceHolder, ScreenObjectsView panel) {
    _surfaceHolder = surfaceHolder;
    _panel = panel;
}

public void setRunning(boolean run) {
    _run = run;
}

public SurfaceHolder getSurfaceHolder() {
    return _surfaceHolder;
}

@Override
public void run() {
    Canvas c;
    while (_run) {

        if(!_surfaceHolder.getSurface().isValid()){
            continue;
        }

        c = null;
        //Log.e("test","thread running");
        try {
            c = _surfaceHolder.lockCanvas(null);
            synchronized (_surfaceHolder) {
                _panel.updatePhysics();
                _panel.onDraw(c);

                /** onDraw() method  run too fast, lets slower it*/
                try {
                    Thread.sleep(mOnDrawPeriodGap);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        } finally {
            // do this in a finally so that if an exception is thrown
            // during the above, we don't leave the Surface in an
            // inconsistent state
            if (c != null) {
                _surfaceHolder.unlockCanvasAndPost(c);
            }
        }
    }
}

}

Today I try to adapt my game to openGL 2D. I'm new in openGL world.

Do I need to do the same for new framework?

As I know  It (openGL) seems already starts a second thread for rendering, calling into the Renderer methods.

Thank you,

sentences:
Convert large range of numbers to a smaller scale What is a good formula to use in order to relate two different scale distances to each other? For example, I have a camera that can have a minimum size of 2 and a maximum of 10. I would like the camera to zoom proportionally with the mouse distance from an object.

The problem is the distance is returned in terms of pixels (e.g. 500px) and I'd like to transform that into a relative value between 2 and 10. What's the best way to do this?

Thanks

sentences:
TileEntitySpecialRenderer only renders from certain angle I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples code and it looks pretty much like them.

The block is opaque and not to be rendered and the renderer is registered normally so the fault must be in the renderer.

Here's the renderer code:

public class TERender extends TileEntitySpecialRenderer
{
    public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d, (float)d1, (float)d2);
        HeatConductTileEntity TE = (HeatConductTileEntity)tileEntity;
        renderBlock(TE, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mod.EMHeatConductor);
        GL11.glPopMatrix();
    }

    public void renderBlock(HeatConductTileEntity tl, World world, int i, int j, int k, Block block)
    {
        Tessellator tessellator = Tessellator.instance;
        GL11.glColor3f(1, 1, 1);
        tessellator.startDrawingQuads();
        tessellator.addVertex(0, 0, 0);
        tessellator.addVertex(1, 0, 0);
        tessellator.addVertex(1, 1, 0);
        tessellator.addVertex(0, 1, 0);
        tessellator.draw();
    }
}

sentences:
How do I programmatically remove an image's background color? I have a sprite sheet (image) and want to draw it on screen.

image  = sprite sheet image
x      = player x position
y      = player y position
width  = player width
height = player height

public class main extends japplet
{
    ...

    public void paint(Graphics g)
    {
        g.drawImage(image, x, y, x+width, y+height,
                   0, 0, 40, 40 ,sprite_sheet.m1);
    }
}

On the sprite sheet, I have the image of a player with a blue background color. Calling drawImage shows the blue background too. I could remove the color with Photoshop, but I really don't want to, because it would remove part of my player.

Can I remove the background color with Java code?

sentences:
Dealing with collisions across adjacent static bodies The Problem:

I have the following setup:

A, B and C are rectangular static bodies in box2d.
p is a circular dynamic body in box2d.

The movement of 'p' is solely controlled by the current gravity force of the world.

When 'p' collides with a static body (A, B or C) I play a bouncy sound. I handle this through a standard ContactListener. No problems there.

The problem arises when 'p' is on 'A' and traveling left towards 'B'. This causes another collision to fire (on 'B') which results in another bouncy sound which is unwanted. If however 'p' was to be traveling right and contacted 'C' I would want the sound to play (given enough velocity, etc).

TL;DR - When sliding across multiple static bodies how do I effectively ignore collisions from a body that is on the same 'line' I'm already on?

What I've Tried:

I've tried numerous different approaches such as on collision tracking that normal as my 'ground' normal and ignoring collisions from the same normal. This works until I do something like make contact with 'C' which then becomes my new 'ground' normal. But having never lost contact with 'A' if I go back towards 'B' I will trigger another collision and we're back to square one.

The Plea:

Looking for code-based solutions or ideas if at all possible. I've considered trying something like a chain shape around my level's collidable areas, but with certain parts of my world being dynamic I don't feel like that's an adequate solution.

Thanks!

sentences:
Why a point light not cast shadow on my moving object, but only on static? In my Unity3d scene i've two light: a directional (sun, outside the window) and a point light.
In my scene, I can see shadow correctly, also if i "play" with settings like Intensity or Range.
But in Play mode, my moving player don't cast shadow when hitted by my point light, but cast shadow  correclty when hitted by directional light.

The image here is explicative: the shadow you see is from a chair, hitted by the point light.
My player instead, hasn't shadow.

What am i wrong ?

sentences:
Having the player face themselves after the mid-game I am writing a game, in the vein of a jRPG, in which you begin playing as the main villain. You don't know it. You think you are playing the hero and the more successful you are and the stronger you make them the harder they will be to defeat at the very end of the game.

My main concern is anyone who puts in a significant effort early game could feel punished for it. It is also troublesome if the player finds the challenge of the final boss insurmountable because of actions from very early in the game. Is there a way I can signal early on in the second act that if they over-powered the villain it may haunt them? And there is also the possibility the twist will get out and people will just game it from the beginning. It is my intent to get some replay value out of it by having people do multiple runs based on different villain playthroughs. But is it a distraction if everyone learns the twist. Or conversely is it better if I reveal it myself in-game so everyone knows what they are working at from the start?

How do I make my potentially disengaging design hold up without turning people away?

sentences: Can I use Node.js on consoles? I was wondering if Node.js was suitable for making games and apart from threads and engines, a big problem is can I port my game to Xbox or PS3/PS4?

sentences:
TiledMaps and real objects I'm creating a simple game for the iPhone using Cocos2d.
I'm having a hard time understanding how add real objects to a tiled map.

I know that you can add an object-layer to the tiled map and set the position of it,
but I'm not sure how to define WHAT object it should be.

For example, if I'm creating a simple Super Mario Bros. I want to add different blocks to the map, one should hold a star, one should hold a coin, and so on.

How should I define what object it is?

So my question, how do I correctly create class-objects in a tiled map?

sentences:
Selecting Dictionary item based on custom classes instead of keys I am attempting to write my own path finding code for a game I'm working on that will implement a form of the A* algorithm.  I store my nodes of the path finding system as a class called nodes and add these to a dictionary with their position in world space as the key for the dictionary.  Here's the problem.  At one point I need to test the dictionary and return from it the node with the lowest "f" value.  I came across the morelinq MinBy function with seemed promising, but so far have not had any luck getting it to work. Here is a stripped down version of the code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MoreLinq;

public class GMove : MonoBehaviour
{

    public Dictionary<Vector3, Node> vectorNodesOpen = new Dictionary<Vector3,Node>();
    public Dictionary<Vector3, Node> vectorNodesClosed = new Dictionary<Vector3,Node>();

    private KeyValuePair<Vector3, Node> currentNode = new KeyValuePair<Vector3,Node>();

    private bool goal;
    private bool findingPath;

    void Start()
    {
        goal = false;
        findingPath = false;
    }

    public void addNodes()
    {
        //several nodes get added to the dictionary based on the A* algorithm
        //ending way point and beginning waypoint are stored as Vector3
    }

    public class Node
    {
        public int h { get; set; }
        public int g { get; set; }
        public int f { get; set; }
        public Vector3 pos { get; set; }
        public Vector3 parentNodeVector { get; set; }
    }

    void Update()
    {
        if(findingPath)
         while (!goal)
            {
                currentNode = new KeyValuePair<Vector3, Node>(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);  //This is the line in which I'm attempting to get the node in the open list with the smallest f value.
                vectorNodesClosed.Add(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);
                vectorNodesOpen.Remove(vectorNodesOpen.MinBy(x => x.Value.f).Key);  // remove current from open.

                if (currentNode.Value.pos == waypointEnd)   // if current node = end position we are done.
                {
                    goal = true;
                }

                addNodes(currentNode.Value.pos, waypointEnd);  //Add and update nodes
    }

}

The line that is giving me trouble is the first line inside the while loop.

I need a way to return the Dictionary item with the smallest "F" value, this would be pretty easy if it were an integer but the F value resides in the Node class.  I don't have to use MoreLinq,  I would be happy to do it any other way that someone can come up with.  Cheers!

*One more note:  the code above is incomplete in an effort to minimize it down to only what is necessary to understand the problem more complete code can be provided if necessary.

sentences:
Algorithmic error in tile engine? I'm toying with creating a tile-based 2D java game engine. I can render the "local" area without issues(I.E. deciding which local tiles to render). The problem came when I introduced floating point locations. I want my "camera" location to be a double. My thought was "I'll multiply the double by the tilesize, round it, and get a pixel approximation". That doesn't work, for one reason or another. The code below is the most functional code I've been able to construct. It works almost entirely correctly except around the 0,0 area it skips tiles(?) and it looks hackish and the code's overall hideous. Is there some easier method I'm missing here, is there an example I can examine?

private HashMap<Integer, HashMap<Integer, Tile>> tiles = new HashMap<>(); // Tiles stored here
public double cameraX = 0, cameraY = 0; // Camera location(centered on screen)
private final int TILE_SIZE = 100; // Size of tiles
private final int TILE_BUFFER = 5; // Buffer of tiles to be rendered/loaded around screen
private int screenTileWidth = 0, screenTileHeight = 0; // Tiles that fit onto the screen

@Override
public void render(Graphics g) {
    // Calculate tile width/height of screen
    int screenWidth = this.screenTileWidth + (TILE_BUFFER * 2), screenHeight = this.screenTileHeight
            + (TILE_BUFFER * 2);

            // Supposedly the offsets from the camera's location to be applied to the rest of the tile locations
    int locOffsetX = (int) Math.round((cameraX % 1) * TILE_SIZE);
    int locOffsetY = (int) Math.round((cameraY % 1) * TILE_SIZE);

            // Big mess of "eww" hackish stuff to fix negatives messing with things
    if (cameraX >= 0 && locOffsetX >= 0) {
        locOffsetX *= -1;
    }
    if (cameraX < 0 && locOffsetX < 0) {
        locOffsetX *= -1;
    }
    if (cameraY >= 0 && locOffsetY >= 0) {
        locOffsetY *= -1;
    }
    if (cameraY < 0 && locOffsetY < 0) {
        locOffsetY *= -1;
    }

            // Base offsets to center tile
    int offsetX = ((GameEngine.g.getWidth() / 2) - (screenTileWidth / 2)
            * TILE_SIZE)
            + locOffsetX;
    int offsetY = ((GameEngine.g.getHeight() / 2) - (screenTileHeight / 2)
            * TILE_SIZE)
            + locOffsetY;

    // Loop through loaded tiles(x/y tile coord)
    for (int x = (int) (Math.floor(cameraX) - (screenWidth / 2)); x < Math
            .floor(cameraX) + (screenWidth / 2); x++) {
        for (int y = (int) (Math.floor(cameraY) - (screenHeight / 2)); y < Math
                .floor(cameraY) + (screenHeight / 2); y++) {
                            // The screen-relative tile coord
            int sx = (int) (x - Math.floor(cameraX));
            int sy = (int) (y - Math.floor(cameraY));

                            // Tile pixel location
            int locX = sx * TILE_SIZE + offsetX;
            int locY = sy * TILE_SIZE + offsetY;

            // Draw box/location info
            g.setColor(Color.RED);
            g.drawRect(locX, locY, TILE_SIZE, TILE_SIZE);
            g.drawString(x + ", " + y, locX + 10, locY + 20);
        }
    }
}

sentences:
How to setup a public github unity repo with paid assets? From what I gathered (like in this thread or here) I am allowed to push my own game code on github and choose a license, as long as I avoid putting assets I do not own. I want to make it public to be able to show it (to potential employers for instance) but I cannot make it open source as I plan to use paid assets (like DoozyUI).

I can avoid pushing  the asset itself on the repo (with .gitignore for instance). Should I prevent gameobjects created with this package to be pushed as well ? That would make the game unusable, even with the rights to use the package...

Once that is settled, Is it ok to push it to github without license ?

Specifically, I do not know if objects generated by a paid asset are still considered that asset or not...

Edit: I asked the question directly to DoozyUI support, which quickly responded :

  You can upload your project, without the Doozy folder. Thus excluding our source code from being shared. Also, unsert a disclaimer letting anyone know that DoozyUI is required to be installed (before getting your files) for the project to work.
  You can share any GameObject (or prefabs) you create, but they will not work if DoozyUI is not installed due to missing references (scripts). Once Doozy is installed, they will work as expected. Thus anyone who has the system will be able to see/use your project.

sentences: Unity ceiling light issues I'm trying to get back into Unity and I've been playing around with lighting. I modelled a simple lightbulb in Maya and have been trying to create a hanging ceiling light but I'm struggling to get it to work. No matter where I place the point light, it appears to originate from the ceiling and the bulb remains dark. Ideally, I would like the light to originate from inside the bulb and spread across most of the room, while also making the bulb glow. I'm sure this is a simple task but I would really appreciate any tips in the right direction. Thanks

sentences:
Xna Xbox framedrops when GC kicks in I'm developing an app (XNA Game) for the XBOX, wich is a pretty simple app.
The startpage contains tiles with moving gif images.

Those gif images are actually all png images, wich gets loaded once by every tile, and put in an array. Then, using a defined delay, these images are played (using a counter wich increases everytime a delay passes).

This all works well, however, I noticed some small lag every x seconds in the movement of the GIF images. I then started to add some benchmarking stuff: http://gyazo.com/f5fe0da3ff81bd45c0c52d963feb91d8

As you can see, the FPS is pretty low for such a simple program (This is in debug, when running the app from the Xbox itsself, I get an avg of 62fps).
2 important settings:

Graphics.SynchronizeWithVerticalRetrace = false;
IsFixedTimeStep = false;

Changing isFixedTimeStep to true increases the lag. The settings tile has wheels wich rotate, and you can see the wheels go back a little every x seconds.
The same counts for SynchronizeWVR, also increases lag.

I noticed a connection between the lag and the moment the garbage collector kicks in, everytime it kicks in, there is a lag ...

Don't mind the MAX HMU(Heap memory usage), as this is takes the amount of the start, the avg is more realistic.

Here is another screen from the performance monitor, however I don't understand much from this tool, first time I'm using it...

Hope it helps: http://gyazo.com/f70a3d400657ac61e6e9f2caaaf17587

sentences:
How can I get/find all the UI texts and TextMesh Pro in the hierarchy? When pausing/resuming the game, I want to disable/enable all UI texts.
The following code works for finding UI texts, but I also want it to find TextMesh Pro text.
How can I do this?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class BackToMainMenu : MonoBehaviour
{
    [ContextMenuItem("Fetch", nameof(FetchAllTexts))]
    public Text[] uiTexts;

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

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 0)
            {
                SceneManager.UnloadSceneAsync(0);
                DisableEnableUiTexts(false);
                Cursor.visible = false;
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
                MenuController.LoadSceneForSavedGame = false;
                DisableEnableUiTexts(true);
                SceneManager.LoadScene(0, LoadSceneMode.Additive);
                Cursor.visible = true;
            }
        }
    }

    private void FetchAllTexts()
    {
        var tmp = new List<Text>();
        foreach (var root in SceneManager.GetSceneAt(0).GetRootGameObjects())
        {
            tmp.AddRange(root.GetComponentsInChildren<Text>(true));
        }
        Text[] texts = tmp.ToArray();

        uiTexts = texts;
    }

    private void DisableEnableUiTexts(bool uiTextEnabled)
    {
        if (uiTexts.Length > 0)
        {
            foreach (Text ui in uiTexts)
            {
                ui.enabled = uiTextEnabled;
            }
        }
    }
}

sentences:
Unity 2D: Inconsistent jump height in game window Whenever I start the unity editor and play it in the Game windows, sometimes the object can jump higher sometimes it is just small jump. I didn't change any value in my script nor changed it in inspector window.

It usually happens when I restart the unity editor or having my computer shutdown / restart and reopening the project.

Here are the jump code

void jump() {
     if (isInGround) {
         float currentJumpForce = jumpForce * Mathf.Abs(rigidBody.velocity.x) / 3.53f;
         rigidBody.AddForce(Vector2.up * currentJumpForce);
         animator.SetTrigger("isJump");
     }
}

I place the code inside the FixedUpdate method, for what I have read the physics calculation should be inside FixedUpdate right?

private void FixedUpdate() {
    if (Input.GetKeyDown(KeyCode.UpArrow)) {
        jump();
    }
}

I have read many are having similar problem, but it really doesn't answer this question.

UPDATE:

I forget to explain it in the question. The jumpForce is calculated based on the velocity of the gameObject has. I capped the velocity to certain speed based on this code

void accelerate() {
     if (rigidBody.velocity.x <= maxSpeed) {
         rigidBody.AddForce(Vector2.right * acceletateForce);
     }
}

where maxSpeed is a constant. I know this is probably not the accurate way to cap the velocity, or is it? Maybe this is where it gets messed up?

I just kinda assume the velocity is the capped from the camera movement and the 'display' or the movement of the screen. It seems the same to me.

sentences:
How to create bullet hole decals in Godot engine? How can you create decals such as bullet holes in Godot?
Godot doesn't seem to have any native method of creating decals.
I am trying to create decals so that bullet holes will be displayed properly on curved and angled surfaces and corners.
I have tried a few plugins, but none of them worked, they all either had a texture stretching issue or they didn't work at all.
For example, when I tried using the Screen Space Decals plugin (https://godotengine.org/asset-library/asset/241), it did draw decals when a texture wasn't provided (a simple black rectangle by default), but when I assigned the bullet hole texture to the decal property the bullet holes became invisible.
What would be an ideal method of creating decals in Godot?

sentences:
What does 'vertex splitting' mean? In the documentation of MeshUtility.SetPerTriangleUV2 it is said the following:

Will insert per-triangle uv2 in mesh and handle vertex splitting etc.

What do they mean by 'vertex splitting' ?

sentences:
How to display image in second layer in Cocos2d I am very new at Cocos2d and is testing to displaying an image over the "Hello World" text on a second layer and need help to get it work. I guess it is some basic stuff here and appreciate any tips etc. with this.

I know that if i put the display-code (myLayer1) in the "init" it work or do the call [self goHere] from the "init" in myLayer1 it works but i want to call the "goHere" directly.

I have the following code:

HelloWorld.m:

#import "HelloWorldLayer.h"
#import "myLayer1.h"

// HelloWorldLayer implementation
@implementation HelloWorldLayer

+(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];

// 'layer' is an autorelease object.
HelloWorldLayer *layer = [HelloWorldLayer node];
myLayer1 *layer1 = [myLayer1 node];

// add layer as a child to scene
[scene addChild: layer];
[scene addChild: layer1];

// return the scene
return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];

    myLayer1 *a1 = [myLayer1 new];
    [a1 goHere];
    [myLayer1 release];

}
return self;
}

myLayer1.m:

#import "myLayer1.h"

@implementation myLayer1

-(void)goHere {

NSLog(@">>>>goHere<<<<");

CGSize size = [[CCDirector sharedDirector] winSize];

CCSprite *vv = [CCSprite spriteWithFile:@"hand.png"];
vv.position =  ccp( size.width /2 , size.height/2 );
[self addChild:vv z:3];
}

-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

}

return self;
}

@end

sentences:
Pathfinding and BSP with Box2D I'm looking into implementing AI in my 2D side-scrolling platformer, and I'm looking into using algorithms such as A*. For many kinds of pathfinding, we need some sort of grid or systems of nodes or polygon areas. My problem is that I am using Box2d for physics and I am not sure how best to create a structure that my AI can use besides placing individual nodes manually (something I really want to avoid) and using some sort of steering behavior.

My level design is tile-based with each tile being about half of the height/width of my main character. The tiles are not all square (some are sloped). I'd like to have a system that can see what the terrain looks like for pathfinding and also keep track of the positions of other actors such as enemies. I'd like to avoid directly placing any nodes into my level design except for possible endpoints or goals.

This question is related: How do you do AI path following within a 2d physics engine like farseer/box2d?, but it doesn't specify what kind of structure I could use instead of a list of nodes. I'm looking for some kind of grid or type of BSP that I can query for algorithms like A*.

EDIT: I am looking for a data structure that meets the following requirements:

Can be searched by algorithms like A*
Can keep track of objects that move around
Can keep track of objects of different shapes and sizes
Does not require me to manually create paths or place nodes

When I first load my level, I have a 2D array (actually just a width, height, and string of ints), but this doesn't allow me to track objects that move not to mention other shortcomings.

sentences:
How to make Unity ground mix up with sky I'm building up a scene with Unity, I want the plane to extend far enough and mixed up with sky like the picture showing bellow

The only way I can think off in unity is by creating two plane with 90 degree with each other to simulate this scene, I tried to set solid color for the sky but still there is clear gap between the ground plane and the sky, how do you manage to extend the ground far enough and mixed up with sky?

sentences:
IAP consumable stuck with reason DuplicateTransaction I've implemented Unity IAP. I have succesfully implemented it before and all went well.
Now at the moment, everything goes well except for 1 consumable. When I try to purchase it, i get the PurchaseFailureReason with value DuplicateTransaction.

After some googling, I found out that it probably is because the transaction was cleared by Google, but the callback was never invoked inside the app. So somehow and somewhere, a flag is set indicating that this transaction is still pending or something? (The purchase on the - now not working consumable - had also indeed been made before and the callback was NOT called, so this seems to be correct.)

All other consumables work fine. They are configured exactly the same, just with another reward on the callback. (Same method, different parameter. I'm 100% sure this has nothing to do with the bug).

So now I want to try and fix this product.

I tried reverting the purchase (even though it is a test purchase) inside Google Play.
I tried manually adding a restore button and clicking it.

Some info:

I am using Unity Codeless API.
Game is only available on android as of yet.
The bug originates from when I tried making a purchase, but (due to bad wifi) i managed to navigate to another screen before the GooglePlay popup came. This disrupted the callback somehow and probably flagged the purchase as "purchased but not completed" or something.
I store receipts from the products in my database so I can compare/ provide support for clients when purchases go sour. The purchase in question never arrived in my database. All corresponding purchases on the same product ID now fail with reason DuplicateTransaction
Consumable products are configured in Google play, online unity monetization console, in editor iap catalog. All are configured exactly the same 100%
The game is still in Alpha, soon going to Beta (once I fix this :)).

sentences:
Frustum Culling with VBOs I have terrain being rendered in my project using VBOs in OpenGL. I would like to apply some Frustum Culling but have no idea how to access each polygon as its drawn to check if it is in view. I think this is where octrees come into play but I have no idea how this is really done. Does anyone know a good tutorial on how to do this specific thing or have some pseudocode for me?

Thanks in advanced!

sentences:
Implementing an existing (but out of print) game electronically One of my favorite games is the old Avalon Hill class, PanzerBlitz.

I would like to implement it electronically, and have a couple questions related to that:

Would I be in legal trouble if I do this? (note - this is not for sale or distribution)
How would I go about implementing the hex grid and piece database most effectively (each piece has a variety of 'factors' (movement, carryability, attack, defense, unit type)?

The game play and mechanics are already well-defined in the written rules - so I'm not writing the game from scratch - just programming it to follow the board game.

sentences:
Low CPU/Memory/Memory-bandwith Pathfinding (maybe like in Warcraft 1) Dijkstra and A* are all nice and popular but what kind of algorithm was used in Warcraft 1 for pathfinding?

I remember that the enemy could get trapped in bowl-like caverns which means there were (most probably) no full-path calculations from "start to end".
If I recall correctly, the algorithm could be something like this:

A) Move towards enemy until success or hitting a wall

B) If blocked by a wall, follow the wall until you can move towards the enemy without being blocked and then do A)

But I'd like to know, if someone knows :-)

[edit] As explained to Byte56, I'm searching for a low cpu/mem/mem-bandwidth algo and wanted to know if Warcraft had some special secrets to deliver (never seen that kind of pathfinding elsewhere), I hope that that is more concordant with the stackexchange rules.

sentences:
How should I load/change/activate scenes? Scenes are confusing the hell out of me and I'm pretty sure they should be simple to understand.

When the game loads, only the current scene has a buildIndex != -1. In order give it a 'real' build index I need to load it by path or name (because there's no build index).

The scenes are ten game scenes, one title scene and one persistent scene (which has the player and the status bar with the score etc.).

Should I load a scene every time I change scene and then load additive afterwards or should I be using Set Active Scene?

All the scenes are ticked in the Build Settings.

I'm looking at the index with this:

private void Start()
{
    var sceneName = "Persistent";
    var sceneBeforeLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneBeforeLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
    SceneManager.LoadScene(sceneName);
    var sceneAfterLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneAfterLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
}

Which outputs:

----------------------------------------------
Scene , BI = -1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:10)
----------------------------------------------
Scene Persistent, BI = 1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:13)
----------------------------------------------

sentences:
How to calculate a projection of 360° equirectangular slides? My goal is to have a light source inside of a transparent sphere that has an equirectangular texture to act as a 360°-slide. I want to get the projection on arbitrary objects as a texture image on these objects in high resolution. This will happen on a webserver.

So my input should be the equirectangular and the object and optionally position of the light source and my output should be texture files of each flat surface of the arbitrary object.

What algorithms can I use to make this as simple, quick and fast-in-action as possible?

sentences:
How can I make my button do something when clicked? I'm trying to create a game with libGDX in Android Studio, and I am struggling with my code to add a command to the program to do something when I press the button.

I have added an ImageButton, but now I struggle to get it to do something when I click on it.

Here's my code:

 bplay.addListener( new ClickListener(){
        public void clicked(InputEvent event, float x, float y){
            batch.begin();
            batch.draw( splash, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight() );
            batch.end();
        }
    });

sentences:
Why nearby triangles tend to disappear? I've just enabled back face culling and I'm noticing a weird behavior: when all vertices of my triangle is outside the view and 2 of them is behind me (I think) the triangle disappears.

So to see it, here is a GIF.

I suspect the projection matrix reverses the order of the two vertices when they fall behind me, and changes the winding of my triangle.

But it's unclear why does the triangles disappear only if all vertices out of view...

How can I work around this problem, if possible?

I develop on Linux if that matters.

UPDATE:

It's pointed out it might not be due to the back face culling. I disabled it and I can indeed reproduce it. The cubes are 20×20 and the vertical field view is 90°. Its vertical apparent size roughly fills the window.

UPDATE 2:

Ok I'll post the relevant part of the code, projection and view matrixes are set up using my own functions:

void createViewMatrix(
    GLfloat matrix[16],
    const Vector3 *forward,
    const Vector3 *up,
    const Vector3 *pos
)
{
    /* Setting up perpendicular axes */
    Vector3 rright;
    Vector3 rup = *up;
    Vector3 rforward = *forward;

    vbonorm(&rright, &rup, &rforward); /* Orthonormalization (right is computed from scratch) */

    /* Filling the matrix */
    matrix[0] = rright.x;
    matrix[1] = rup.x;
    matrix[2] = -rforward.x;
    matrix[3] = 0;

    matrix[4] = rright.y;
    matrix[5] = rup.y;
    matrix[6] = -rforward.y;
    matrix[7] = 0;

    matrix[8] = rright.z;
    matrix[9] = rup.z;
    matrix[10] = -rforward.z;
    matrix[11] = 0;

    matrix[12] = -vdp(pos, &rright);
    matrix[13] = -vdp(pos, &rup);
    matrix[14] = vdp(pos, &rforward);
    matrix[15] = 1;
}

void createProjectionMatrix(
    GLfloat matrix[16],
    GLfloat vfov,
    GLfloat aspect,
    GLfloat near,
    GLfloat far
)
{
    GLfloat vfovtan = 1 / tan(RAD(vfov * 0.5));

    memset(matrix, 0, sizeof(*matrix) * 16);
    matrix[0] = vfovtan / aspect;
    matrix[5] = vfovtan;
    matrix[10] = (near+far)/(near-far);
    matrix[11] = -1;
    matrix[14] = (2*near*far)/(near-far);
}

Projection matrix set up with this call:

createProjectionMatrix(projMatrix, VERTICAL_FOV, ASPECT_RATIO, Z_NEAR, 10000);

(VERTICAL_FOV = 90, ASPECT_RATIO = 4.0/3, Z_NEAR = 1)

Level drawing is simply:

void drawStuff()
{
    GLfloat projectView[16];

    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    createViewMatrix(viewMatrix, &camera.forward, &camera.up, &camera.pos);

    multiplyMatrix(projectView, viewMatrix, projMatrix); /*< Row mayor multiplication. */

    glUniformMatrix4fv(renderingMatrixId, 1, GL_FALSE, projectView);
    bailOnGlError(__FILE__, __LINE__);

    renderLevel(&testLevel);
}

Cubes are rendered wall by wall (optimizing this will be another story):

    for (j = 0; j < 6; j++)
    {
        glBindTexture(GL_TEXTURE_2D, cube->wallTextureIds[j]);
        bailOnGlError(__FILE__, __LINE__);

        glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, (void*)(sizeof(GLuint) * 4 * j));
        bailOnGlError(__FILE__, __LINE__);
        glUniform4f(extraColorId, 1, 1, 1, 1);
        bailOnGlError(__FILE__, __LINE__);
    }

Vertex shader:

#version 110

attribute vec3 position;
attribute vec3 color;
attribute vec2 texCoord;

varying vec4 f_color;
varying vec2 f_texCoord;

uniform mat4 renderingMatrix;

void main()
{
    gl_Position =  renderingMatrix * vec4(position, 1);
    f_color = vec4(color, 1);
    f_texCoord = texCoord;
}

Fragment shader:

#version 110

varying vec4 f_color;
varying vec2 f_texCoord;

uniform sampler2D tex;

uniform vec4 extraColor;

void main()
{
    gl_FragColor = texture2D(tex, f_texCoord) * vec4(f_color) * extraColor;
}

The depth buffer simply set up by enabling it.

sentences:
Authoritative movement with client side prediction I don't fully understand how client side prediction works with authoritative movement.

Let's say we have:

client at position(0,0)
server at position(0,0)

Now the client wants to move forward and calls a client side function move and then sends the server that the client wants to move forward.

Now the client has moved to position(10,0), while the server is still at position(0,0). Now the server moves to position(10,0) and sends an update to all clients.

But the client has now moved to position(20,0) and now receives the position state from the server that the client should be at position(10,0).

What happens now? The client can't just apply the position from the server otherwise the client would jitter around.

One simple solution that I could think of would be a distance check.

if(Distance(position(10,0),position(20,0) > SomeNumber){
   ForceUpdatePos();
}

But this is probably not a good idea because SomeNumber depends on the MovementSpeed and latency.

I probably also would have to include a timestamp of the package because maybe the client has not heard back from the server for several ticks and then receives a bunch of unordered position updates.

What is a common technique to solve this problem?

sentences:
What's best to use OTF or TTF? What's the most recommended format should I use for fonts, OTF or TTF or another?

In looking for:

Performance/Efficiency with SDL_ttf library
Free/Open-ness [1]

[1] I'm planning to use GPL3 and Open Font License.

sentences:
Unable to destroy collider Unity3d So I was making an android game in unity3d. I wrote a script to draw straight lines with touch what I do is I first create a gameobject named temp and add line renderer to it and give the line renderer properties. Then I create a collider gameobject , parent it to the line and change its dimensions to the dimension of the line. What I am trying to do is add two colliders one while the line is being moved i.e "touch.phase == TouchPhase.Moved" and delete this collider and add another collider when "touch.phase == TouchPhase.Ended". For some weird reasons I am not able to delete the first collider.

Here is my code

void Update()
{

    foreach (Touch touch in Input.touches)
    {

        if (touch.phase == TouchPhase.Began)
        {
            temp = new GameObject();
            temp.AddComponent<LineRenderer>();
            temp.layer = LayerMask.NameToLayer("lines");

            lr = temp.GetComponent<LineRenderer>();
            lr.positionCount = 2;
            lr.SetWidth(0.2f, 0.2f);
            lr.material = new Material(Shader.Find("Sprites/Default"));
            lr.SetColors(Color.black, Color.black);

            temp.transform.position = camera.ScreenToWorldPoint(touch.position) + camOffset;
            fingerUp = camera.ScreenToWorldPoint(touch.position)+camOffset;

            lr.useWorldSpace = true;
            spawnCollider = false;

        }

        //Detects Swipe while finger is still moving
        if (touch.phase == TouchPhase.Moved)
        {
            lr.SetPosition(0, fingerUp);
            fingerDown = camera.ScreenToWorldPoint(touch.position)+camOffset;
              lr.SetPosition(1,fingerDown);
            spawnCollider = true;

            lastLine = temp;

            // The first collider temporary one

            BoxCollider2D col1 = new GameObject().AddComponent<BoxCollider2D>();
            col1.transform.parent = temp.transform;
            float lineLength = Vector2.Distance(fingerUp, fingerDown);
            col1.size = new Vector2(lineLength, 0.2f);
            Vector2 midPoint = (fingerUp + fingerDown) / 2;
            col1.transform.position = midPoint;
            float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
            if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
            {
                angle *= -1;
            }
            angle = Mathf.Rad2Deg * Mathf.Atan(angle);
            col1.transform.Rotate(0, 0, angle);

        }

        if (touch.phase == TouchPhase.Ended)
        {
            if (spawnCollider == true)
            {
                Destroy(col1);  // Deleting the first collider

                // Adding the final collider
                BoxCollider2D col = new GameObject("Collider").AddComponent<BoxCollider2D>();
                col.transform.parent = temp.transform;
                float lineLength = Vector2.Distance(fingerUp, fingerDown);
                col.size = new Vector2(lineLength, 0.2f);
                Vector2 midPoint = (fingerUp + fingerDown) / 2;
                col.transform.position = midPoint;
                float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
                if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
                {
                    angle *= -1;
                }
                angle = Mathf.Rad2Deg * Mathf.Atan(angle);
                col.transform.Rotate(0, 0, angle);
            }
        }

    }

}

I have added comments where I am doing what.

sentences:
Angle range detection I'm trying to make game like portal which players can transform between two holes.
My problem is, how to detect if player's have the right angle to the hole. (hole has an angle to a direction, if player's angle to hole meet the right direction can do transform)

Pseudo code:

var range=30;
 if(collission){
     if(abs(ball.getAngle()-player.getAngle())<=range){
            ball.doTransform(player);
     }
 }

below is some situation:

ball.setAngle(20);
player.setAngle(30);
abs(ball.getAngle()-player.getAngle()) ==10 //ok
player.setAngle(350);
abs(ball.getAngle()-player.getAngle()) ==320 //not ok
ball.setAngle(350);
player.setAngle(20);
abs(ball.getAngle()-player.getAngle()) ==330 //not ok
ball.setAngle(120);
player.setAngle(100);
abs(ball.getAngle()-player.getAngle()) ==20 //ok

and anybody can help me to figure out the right condition so that ball can transform player? thanks!

sentences:
Libgdx collision detection and response I am trying to create a simple platformer game with libgdx.
I implemented a collision detection for the player's bounding box with the map's tiles using the Rectangle.overlaps method.

In response I am trying to find out at what edge the player hits the tile and then react accordingly.

Somehow it happens that when the player collides on the X axis, the response of a collision on the Y axes happens (player gets moved to the top of the tile).

I was looking into the SAT (Seperating Axis Theorem), but I don't feel like it's applicable here, since I am not trying to draw any line betwen the Rectangles. In fact, since Rectangle.overlaps() is used I am only reacting to a collision already happening.

Here the source:

private void resolveCollision() {
    setUpPlayerRec(allObjects.get(0));
    for (Rectangle r2 : tiles) {
        if (!playerRec.overlaps(r2)) {
            continue;
        } else {
            onCollisionWithTile(r2);
        }
    }
}

private void onCollisionWithTile(Rectangle r2) {
    Gdx.app.log("Collision Detected", "Player collided with tile");

    float diff;

    if (playerRec.x +playerRec.width < r2.x) {
        // LEFT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x - playerRec.width);
        controlledPlayer.getVelocity().x = 0;
    } else if (playerRec.x > r2.x + r2.width) {
        // RIGHT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x + r2.width);
        controlledPlayer.getVelocity().x = 0;
    }

    if (playerRec.y < r2.y) {
        // HIT TOP OF TILE
        diff = (playerRec.y + playerRec.height) - r2.y;
        controlledPlayer.getPosition().y -= Math.abs(diff);
        jumptime = MAXJUMP;
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
    } else if (playerRec.y < r2.y + r2.height) {
        // HIT BOTTOM OF TILE
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
        jumptime = 0;
        diff = playerRec.y - (r2.y + r2.height);
        controlledPlayer.getPosition().y = r2.y + r2.height;
    }
}

sentences:
How can I easily create textured physics objects of different shapes and sizes? I want to make a 2D game with this art system:

Whats the best way to achieve this in Unity?
Can I use sprite renderers or do I need quads or something different?
Rectangles seem possible and easy with Sprite Renderer, but Circles, Triangles and other shapes... how would those be done?

sentences:
Why isn't my mouse input working as expected in a DX10 game? I've made myself a camera for a DirectX 10 game, and the keyboard control works fine. However, I can't see to get the mouse to work. My biggest problem is I can't find out how to hide the mouse on the display to allow a crosshair (I don't need a visual one) and make movement like it would be in any other common 3D game. I looked at this tutorial, but it doesn't seem to work (The mouse part, that is). Everything I try just seems to result in the camera spinning very fast...

I'm using C++ and DirectInput.

sentences:
Unity 2D: Why does my character stutter if I add deltaTime to moveSpeed? So I'm following a tutorial on youtube, first time Unity user, but been making games in other frameweorks before. In the tutorial he does not use deltaTime for movement, which has always been the standard for me, so I added it my self, but it makes my character "stutter/lag" really weirdly (does not stutter without deltaTime). Surely I must use deltaTime for movement in the Update()method?

Script for Player movement:

void Update () {

     playerMoving = false;

     if (!playerAttacking) {
         Vector2 direction = new Vector2();

         if (Mathf.Abs (Input.GetAxisRaw ("Horizontal")) > 0.5f) {
             Debug.Log ("Moving on X");
             playerMoving = true;
             direction.x = Input.GetAxisRaw ("Horizontal");
             lastMove.x = direction.x;
             lastMove.y = 0;
         }

         if (Mathf.Abs (Input.GetAxisRaw ("Vertical")) > 0.5f) {
             Debug.Log ("Moving on Y");
             playerMoving = true;
             direction.y = Input.GetAxisRaw ("Vertical");
             lastMove.y = direction.y;
             lastMove.x = 0;
         }

             if (playerMoving) {
                 myRigidBody.velocity = direction.normalized * moveSpeed * Time.deltaTime;
             } else {
                 myRigidBody.velocity = Vector2.zero;
             }
     }

My Camera (Stutters unless I use fixedUpdate):

void FixedUpdate () {
    targetPos = new Vector3 (followTarget.transform.position.x, followTarget.transform.position.y, transform.position.z);
    transform.position = Vector3.Lerp (transform.position, targetPos, moveSpeed);
}

sentences:
Detecting collisions during animations I am creating a prototype enemy swordsman, and I'd like to be able to parry his attacks, like the parry system from VR Dungeon Knight.

This is my method of implementation:

Parent a sword to his hand that has a child cube trigger collider + kinematic rigidbody + a custom script called ParryableWeapon.
In the animation clip, when he raises his hand before his swing, use an AnimationEvent to tell the ParryableWeapon to start 'listening' for a parry. This is done by checking an internal boolean during OnTriggerEnter of the sword.
If the ParryableWeapon collides with another ParryableWeapon while listening, the UnityEvent 'OnParried' is invoked.
After the swing completes, use another AnimationEvent to tell ParryableWeapon to stop 'listening'.

I have a simple model and animation from the Asset store that I'm using to accomplish this. For some reason, the OnParried event is only being fired every 5 or so swings at a stationary test sword.

I played the animation frame by frame, and I found that the enemy swords' position sometimes does not go through the other sword, despite them being on a collision course. In one frame, the enemy sword is to the left of the other, and in the next frame, it is on the other side.

It seems that the interpolated frames between the animation keyframes can only sometimes collide with the other sword. What would be the proper way to remedy this? Adding more keyframes to the animation? Some sort of calculation of the sword's path between the two keyframes?

sentences: What C++ containers should I use for my UI elements? I am writing some UI stuff for my games in C++. Basically its a very common problem, but I dont know the best answer yet. Suppose inside my UI Library I have a view class which renders 2D/3D scene. This view can contain many subviews. I needs a container which allows me to iterate over these views fast and also insert/delete subviews. I am not sure which container is best for the job - list, vector or something else?

sentences:
Loading player position from file but player object not at right position sometimes In my current project I am developing a game saving system and I have encountered a problem where in some cases when I save the game and re-load it the player will not be loaded in at the correct position.

I've printed the position that is loaded in from file to the console to see if it's being changed and it's not.

Is there anything i'm not seeing?

For reference here's the two methods I use when loading the game:

    public void LoadData() {
    if (File.Exists(filename)) {
        byte[] soupBackIn = File.ReadAllBytes(filename);
        string jsonFromFile = encryption.Decrypt(soupBackIn, JSON_ENCRYPTION_KEY);
        copy = JsonUtility.FromJson<SaveData>(jsonFromFile);
        print(copy.playerPosition);
        DataToLoad();
    }
}

private void DataToLoad() {
    player.transform.position = copy.playerPosition;
    player.transform.rotation = copy.playerRot;
    player.playerHealth = copy.playerHealth;
    player.agility = copy.agility;
    player.attack = copy.attack;
    player.defense = copy.defense;
    player.strength = copy.strength;

    for (int i = 0; i < copy.inventory.Count; i++) {
        inv.AddItem(copy.inventory[i].id);
    }
}

sentences:
How can I create explosions like in Zelda: Breath of the Wild? The explosions in BotW look spectacular. Here's a video of them in slow motion: https://www.youtube.com/watch?v=bZtaNoUOSDQ

It looks like it's not all billboards, but also some volumetric geometry - it's hard to see all the details.

Ideally, an answer would be API agnostic, but I am using OpenGL with a homemade renderer, if that helps.

Which techniques are combined to create such a fantastic effect?

sentences:
How to detect GLSL warnings? After compiling a shader with glCompileShader, I can call glGetShaderiv with GL_COMPILE_STATUS to check if the shader compiled successfully. I can also call glGetShaderInfoLog to get information about possible errors, warnings or other info. The information log returned by this function is unspecified.

In a tool where users can write their own shaders, I would like to print all errors and warnings from the compilation, but nothing if no warnings or errors were found. The problem is that the GL_COMPILE_STATUS returns only false if the compilation failed and true otherwise. If no problems were found, some drivers return empty info log from glGetShaderInfoLog, but some drivers can return something else such as "No errors.", which I do not want to print to the user. How is this problem generally solved?

sentences:
How to make child object a member of two parents in unity? So I have an parent game object that has multiple objects.

This format is desirable:

-GameObject
    -object1 (abstract)
        -subobject1

    -object2 (abstract)
        -subobject2

    -object3 (abstract)
        -subobject1
        -subobject2
// There are two objects in the scene, subobject1 and subobject2

The problem is when i drag and drop one subobject from an object it removes it from the other object. When i copy the subobjects to another object, there are now two.

I hope this makes sense.

sentences:
Why the renderers Renderer[] array are all null? using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LightsEffect : MonoBehaviour
{
    public List<UnityEngine.GameObject> waypoints;
    public int howmanylight = 5;
    public Generatenumbers gn;
    public bool changeLightsDirection = false;
    public float delay = 0.1f;

    private List<UnityEngine.GameObject> objects;
    private Renderer[] renderers;
    private int greenIndex = 0;
    private float lastChangeTime;

    private void Start()
    {
        //waypoints = new List<UnityEngine.GameObject>();
        objects = new List<UnityEngine.GameObject>();

        if (howmanylight > 0)
        {
            UnityEngine.GameObject go1 = UnityEngine.GameObject.CreatePrimitive(PrimitiveType.Sphere);
            duplicateObject(go1, howmanylight);
            LightsEffects();
        }
    }

    private void Update()
    {
        LightsEffectCore();
    }

    public void duplicateObject(UnityEngine.GameObject original, int howmany)
    {
        howmany++;
        for (int i = 0; i < waypoints.Count - 1; i++)
        {
            for (int j = 1; j < howmany; j++)
            {
                Vector3 position = waypoints[i].transform.position + j * (waypoints[i + 1].transform.position - waypoints[i].transform.position) / howmany;
                UnityEngine.GameObject go = Instantiate(original, new Vector3(position.x, 0, position.z), Quaternion.identity);
                go.transform.localScale = new Vector3(0.3f, 0.1f, 0.3f);
                objects.Add(go);
            }
        }
    }

    private void LightsEffects()
    {
        renderers = new Renderer[objects.Count];
        for (int i = 0; i < renderers.Length; i++)
        {
            renderers[i] = objects[i].GetComponent<Renderer>();
            renderers[i].material.color = Color.red;
        }

        // Set green color to the first one
        greenIndex = 0;
        renderers[greenIndex].material.color = Color.green;
    }

    private void LightsEffectCore()
    {
        // Change color each `delay` seconds
        if (Time.time > lastChangeTime + delay)
        {
            lastChangeTime = Time.time;

            // Set color of the last renderer to red
            // and the color of the current one to green
            renderers[greenIndex].material.color = Color.red;
            if (changeLightsDirection == true)
            {
                Array.Reverse(renderers);
                changeLightsDirection = false;
            }
            greenIndex = (greenIndex + 1) % renderers.Length;
            renderers[greenIndex].material.color = Color.green;
        }
    }
}

In this line if for example objects count is 5 then there will be 5 renderers but they will be all null.

renderers = new Renderer[objects.Count];

sentences:
MonoGame - Left/Right Sided Collision Not Working I'm working on a platformer as part of my course, the problem I have come across is Left/Right sided collision is not working very well. I already have bottom & top collision working. Here is an example of the problem in action:

As you can see pretty much all the time I'm slowing down, I know this issue but haven't found a work around code solution yet. The main problem I'm having as you can see is my player being able to slide almost into the middle of the block if he's coming down and moves into the block.

The slow down problem is due to my left/right collision code, I just haven't found a viable solution yet for sided collision.

Collision Code:

        foreach (SkyTile block in PlatformBlocks)
        {

            IntersectRectangle = block.GetRect();
            GetRect().Intersects(ref IntersectRectangle, out IntersectResult);
            if (GetRect().Intersects(block.GetRect()))
            {
                if (IntersectResult && (IntersectRectangle.Bottom > GetRect().Bottom))
                {
                    isPlatformColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Top < GetRect().Top))
                {
                    isPlatformBottomColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Left > GetRect().Left))
                {
                    isPlatformLeftColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Right < GetRect().Right))
                {
                    isPlatformRightColliding = true;
                }
                break;
            }
        }

        if (isPlatformColliding)
        {
            velocity.Y = 0;
        }

        if (isPlatformBottomColliding && !isPlatformColliding)
        {
            velocity.Y = 20;
        }

        if (isPlatformLeftColliding)
        {
            velocity.X = 0;
        }

        if (isPlatformRightColliding)
        {
            velocity.X = -0;
        }

sentences:
margin of error trying to check if a point lays on line Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or even external) library for c# to ignore the problem.

An example could be: more than comparing 2 float values like this

if(myVector3.X == anotherVector3.X)

I would appreciate something like this

if(myVector3.X.isInTheNeighbourhood(anotherVector3.X))

This is not well-written, I know. That is just to simplify the explaination. What I am exactly doing is checking if a point (Vector3) lays on line segment. So basically the calculations I make are nothing more than

(x - x1)/(x2 - x1) = (y - y1)/(y2 - y1) = (z - z1)/(z2 - z1)

But these values won't be always the same, so I need to write down some code which includes a sort of tolerance a sort of Neighbourhood mathematical concept to accept values close enought to the line.

Hope that I made myself clear.
Has anyone a solution for this?

sentences:
Is there a way to setup an Android game project with a large assets during development to allow for fast testing/iteration? I'm working on an Android port of an iOS game at the moment. I am using the Android NDK only (android_native_app_glue) in Eclipse (CDT + ADT). I am using the Android emulator, API 15 (but we are targeting API9+) as we do not yet have an Android device. The game has about 200-300mb of assets and I'm unsure of how to include them properly or how to get into a fast testing/debugging cycle with assets attached.

As it stands I am linking the assets folder in my Android project to the resources folder that contains the game assets. This works but the problem lies in the fact that when I build it takes about 9-10 minutes for the 200mb .apk file to be installed onto the emulator. This is simply unacceptable when things need to be tested quickly.

If I strip the assets out of the project, it installs very quickly. Because of this I am stripping out the bulk of the assets at the moment to do my testing but when it comes to the long run I need a better solution.

My question, is there a way to setup an Android game project with a large asset collection during development to allow for fast testing/iteration? E,g. fast deployment or updating of .apk to allow for quick testing.

sentences:
How does copyright on sources work If I want to create a game in which I use sources from another game that has copyright is illegal. But what if I use screenshots from a 3D game to make another 2D game (something like a questionnaire)? Or what if I use the 3D models from the first game, render them with a program like cinema4D or blender in 2D and use them in the 2D game? And if it is illegal please explain me why and what laws of copyright would apply in that case.

I know that observing how a game works or any software for that matter and then reverse engineering it is legal so doing the same thing with resources from a game is legal. That's why I wanted to make clear my question is not related to reverse engineering.

sentences:
How do I convert a Source engine NPC model to a player model? The Source engine's NPC and player models differ: An NPC model applied to the player has no animations. It cannot walk and holds its arms out to the side by about a foot. The weapon is held in the right hand and you can see the player switch weapons, but the weapons also have no animation.

How do I convert between these model types?

sentences:
Devkitpro msys errors Whenever I try to install devkitPro, I get these command prompt windows for short periods of time with the following errors:
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
:: Synchronizing package databases...
 msys                                           206.2 KiB   729K/s 00:00 [#######################################] 100%
 msys.sig                                       438.0   B   214K/s 00:00 [#######################################] 100%
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update msys (invalid or corrupted database (PGP signature))
 dkp-libs is up to date
 dkp-windows is up to date
error: failed to synchronize all databases

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))

Interestingly enough, when I go to the C:/devkitPro folder, I find that I have no devkitpro related files in there whatsoever - just an msys2 folder. I did manage to find a repository online with the files that would have been installed... but when I try to build a project, it says that it can't find the appropriate .specs file.
I would like to know if there is any way I can properly install devkitPro on my windows 10 device. Thanks in advance

sentences:
NPC daily routines and scene loading I'm making a basic survival RPG in Unity 3d. I'm separating my world into different scenes to save memory but I'm not sure how I'm going to program NPC daily routines.

For example, if the player arrives in a town scene in the morning, how do I ensure that the NPCs are working in appropriate places with the appropriate equipment? I suppose I could hard code it so NPCs are in certain places at certain times. Therefore, if the player arrives at 9:00am then all the NPCs will move to their 9:00am places. I'm just wondering if there is a better way of doing it than that. I can see myself needing to write a lot of code to cover all the possibilities so it could get really messy. I was hoping there was some way I could have the NPC routines continue seamlessly in the background but this would be taxing on memory -if it's even possible.

Any ideas/pointers on this issue would be appreciated.

sentences:
openTTD tileset atlas I'm trying to create an isometric game and would like to use some tiles from Open Transport Tycoon Deluxe
newGRF library link
The atlas I'm used to work with are basically a big image that can be splitted in 64x32 tiles, so I can use any Atlas import tool or just easily extract the tiles with a loop.
However, OpenTTD uses atlas that I don't understand. The files look something like this, where each tile has a numer and starts at positions that are not evenly distributed.
I assume it might exist some file with metadata that contains the locations and sizes of each tile, in order to be extracted and used.
Has anybody experience with this type of Atlas? How can I extract the tiles so I can use them?
Thanks

sentences:
How can I draw 500 million triangles with OpenGL? I am a beginner. I have a problem with my frame rate. I am trying to see my GPUs maximum performance with using VBO. I saw that everybody says a GPU can draw 1 billion triangles (so 3 billion vertices) with VBO easily, is it right? If it is right, then why am I getting 37 FPS at only 8 million triangles (24 million vertices)?

I am not using a shader and I don't know how to use it.

My GPU is (amd radeon hd 6870).

When drawing 20k triangles, the frame rate is 6000, when drawing 8 million triangles, the frame rate is 37 and CPU usage 1%. I don't think the CPU is the bottleneck..

My code is like this:

I create in header file

GLuint terrainVBO;

I made an init() function:

glGenBuffers(1,&terrainVBO);
glBindBuffer(GL_ARRAY_BUFFER,terrainVBO);
glBufferData(GL_ARRAY_BUFFER,terrainVertices.size()*sizeof(terrainVec),&terrainVertices[0],GL_STATIC_DRAW);

and draw in my main loop:

glBindBuffer(GL_ARRAY_BUFFER,terrainVBO);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,3*sizeof(float),0);

glDrawArrays(GL_TRIANGLES,0,terrainVertices.size());

glDisableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER,0);

Summary: How can I draw 500-600 millions triangles (1.5 billion vertices) with a good frame rate? I could only draw 8 million triangles.

sentences:
Recommendations to protect music and sound effects I can make some very basic music and sound effects, but prefer to have some actual real audio happening. There are some audio that does support game development - Artlist for one. They state that the music and audio is fine to include in a game, as long as you don't offer them as a jukebox style where the player can select tracks. They also stated that the license is not transferrable, so I would need to ensure to prevent anyone from extracting the assets and grabbing the sounds/songs directly.
I am using MonoGame for my project with .NET Standard and .NET Core. Is there really a perfect way to prevent someone from accessing the files? Would encryption be recommended? Should I instead have my game download audio assets on startup from a website?

sentences:
What should I set my managed stripping level to? I know the higher the Managed Stripping Level the smaller binary size but I also know the higher the level more issues you can run into so I have some questions about all this.

If I set my managed stripping level to high will I see the effect of that and be able to properly test it when running my game in the editor or would I have to compile to make sure everything runs alright?
Can issues with a high managed stripping level be platform specific (Meaning a high level is good on one platform but causes issues on another)?
Does managed stripping level only effect binary size or can it also effect performance? If it can effect performance would a binary with a high managed stripping level run faster than a binary with a low managed stripping level or would it be the other way around?

sentences:
Terminology in a hierarchy of levels My game has a 2-tier hierarchy of levels, it is composed of 6 or more "outer levels" that consist of 8 or more "inner levels". Reaching an inner level unlocks the next inner level. Reaching the top inner level of an outer level unlocks the next outer level. The first inner levels of an outer level resemble the inner levels of the previous outer level, but each outer level has more inner levels than its predecessor.

What terms are common to refer to "outer levels" and "inner levels" in such a situation? The game is very abstract, so something like "world" for the outer level would be inappropriate.

sentences:
Why is the SFML shape not being displayed when I make it a member of the Game class instead of a local function variable? I created a window successfully in SFML using a Game class which hold all of the key components of the game. I then tried to start rendering shapes on the screen. When I first rendered the shapes, I was creating local copies inside of the render function. Of course, that doesn't allow me to do much and it isn't good organization of code, so I moved the main shape of the game I have in mind to the Game class. Now the shape doesn't show up at all. The application doesn't crash but it just doesn't show the shape. I feel like this might have something to do with the scope of the shape, but I just can't make sense of it. I looked at "The white square problem" on SFMLs site but I do not feel like this relates since the shape is a member of the class (which I thought meant it shouldn't go out of scope until the instance of the class does). I'm using g++ and am on a iMac running El Capitan if that helps any. Any help at all is greatly appreciated! Please help me understand this if you can!

p.s. Feel free to comment on any part of my code that isn't even directly related to the question but rather should just be improved.

Main.cpp

#include "Game.hpp"

int main(int argc, char** argv)
{
    Game game;

    game.setup();

    while (game.isRunning())
    {
        game.events();
        game.update();
        game.render();
    }

    game.cleanup();

    return 0;
}

Game.hpp

#ifndef GAME_H
#define GAME_H

#include <SFML/Graphics.hpp>

class Game
{

private:
    enum GameState
    {
        GAME_STATE_RUNNING,
        GAME_STATE_CLOSING
    };

    sf::RenderWindow window;
    GameState state;
    sf::CircleShape leader;

public:
    Game();
    ~Game();

    void setup();
    bool isRunning();
    void events();
    void update();
    void render();
    void cleanup();

};

#endif

Game.cpp

#include <SFML/Graphics.hpp>

#include "Game.hpp"

Game::Game()
{
}

Game::~Game()
{
}

void Game::setup()
{
    this->window.create(sf::VideoMode(1000, 750), "Follo");

    this->leader.setFillColor(sf::Color::Black);
    this->leader.setPosition(100, 100);

    this->state = GAME_STATE_RUNNING;
}

void Game::events()
{
    sf::Event event;

    while (this->window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
        {
            this->state = GAME_STATE_CLOSING;
        }
    }
}

bool Game::isRunning()
{
    return this->state != GAME_STATE_CLOSING;
}

void Game::update()
{
}

void Game::render()
{
    this->window.clear(sf::Color(203, 209, 219, 255));
    this->window.draw(this->leader);
    this->window.display();
}

void Game::cleanup()
{
}

Makefile

COMPILE         = g++ -c
LINK            = g++ -o
FLAGS           = -g -Wall -O2
O_FILES         = Main.o Game.o
LIB_PATH        = /usr/local/lib
INCLUDE_PATH    = /usr/local/include
LIBS            = -lsfml-graphics -lsfml-window -lsfml-system
EXE_NAME        = Follo

program: build
    ./$(EXE_NAME)

build: $(O_FILES)
    $(LINK) $(EXE_NAME) $(O_FILES) -L$(LIB_PATH) $(LIBS)

Main.o: Main.cpp
    $(COMPILE) $(FLAGS) Main.cpp

Game.o: Game.cpp Game.hpp
    $(COMPILE) $(FLAGS) Game.cpp

sentences:
Looking for an elegant way to represent fixed parts of a randomly generated level map I'm coding from scratch a small experimental game on a medium-sized random rectangular square tile map. (Say, a map of a dungeon.)

There are several types of tiles (for example: floor, wall, monster, boss, treasure, player etc.). There are no extra information stored in the map tiles, just tile type.

Most parts of map are randomly generated. However there are several features that are to appear on every generated map in pre-set places. Say, walls around the dungeon, boss locations, player spawn point and the treasure.

Note: Since the game is small, coded for fun, and the only game designer is a programmer (that is, me myself), I do not plan to spend resources on coding a level editor or supporting an existing one. Also, I do not plan to support existing tile map libraries as I want to dig into some of the related coding problems myself (see above about fun), but I be happy happily to look at relevant existing code as a reference.

When I look at my map generation code, I find it rather ugly.

Is there an elegant way to deal with the problem? If that matters, I'm writing this game in JavaScript, but I will be happy to see a relevant reference in any programming language.

Here is a partial pseudocode to illustrate how my current tile generator solution looks like:

this.init = function(w, h) {
  this.w = w;
  this.h = h;
  this.tile_presets_ = { };

  var mid_h = Math.floor(h / 2);
  var quarter_w = Math.floor(w / 4);

  /* Here is the part I don't like -- a set of generator rules: */

  this.preset_col_(0, Tile.GRASS);
  this.preset_tile_(0, mid_h, Tile.FLOOR);

  this.preset_col_(1, Tile.GRASS);
  this.preset_tile_(1, mid_h, Tile.FLOOR);

  this.preset_col_(2, Tile.WALL);
  this.preset_tile_(2, mid_h, Tile.FLOOR);

  this.preset_tile_(2, mid_h, Tile.PLAYER);

  this.preset_tile_(1 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(2 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(3 * quarter_w, mid_h_, Tile.TREASURE);

  this.preset_col_(w - 1, Tile.WALL);
};

Implementation details that may help to understand the code above:

this.tile = function(x, y) {
  var preset = this.tile_presets_[x + y * this.w];
  if (preset !== undefined) {
    return preset;
  }

  return this.random_tile_();
};

this.preset_tile_ = function(x, y, tile) {
  this.tile_presets_[x + y * this.w] = tile;
};

this.preset_col_ = function(x, tile) {
  for (var y = 0; y < this.h; ++y) {
    this.preset_tile_(x, y, tile);
  }
};

Note that I shown a rather simple set of generator rules above. Actual thing is several times longer.

I hate that the code looks imperative — and it is hard to figure out what is going on from the first glance. I think that declarative approach could help. But so far I can't figure out a good solution.

Any clues?

sentences:
Collision detection in multiplayer games This a followup to my previous question: How to implement physics and AoE spells in an MMO game?.

There, we concluded that all physics have to be done on the server, and that I should use cylinders for calculations.

Now, how can I check for collision detection on a ground-to-player basis on the server? It's fairly easy if the ground is a flat space, I just check if the player's z coordinate is lower than some value and voila, but, what if the map/ground itself is a model? How do I know where hills are on the server-side? How do I know when object collisions happen?

I'm using node.js and socket.io.

sentences:
How to Divide Responsibilities Between a Two-Man Group? A partner and I are in the midst of creating a (not so) simple game via C++ and SFML (2D). We have both created some simple games (not together) and would like to start work on a more serious, larger project that challenges our abilities to program, interact with large code as well as working together without getting in each other's way.

The problem is the getting in each other's way- well, not yet at least.

We had our first group session today (us two working on the project, one to-be tester and a friend of ours) and wrote down some ideas. It's going to be a birds-eye perspective zelda-like (from SNES) game with a streamlined map and quasi-linear gameplay like Gothic (open world, but you'll likely get yourself killed if you wander around too much).

Needless to say, I'm not sure if we're aiming too high for the moment, but our biggest concern is the division of responsibilities. Our first impulse was to work on aspects of the game that had nothing in relation to the other (I would work on the menu, he would work on the map, for example).

Our next impulse was to work on closely-related things in a list-manner. (First the menu, then a map, then the character, then the monster, etc) so we can, piece-by-piece, see our code coming to life in an orderly fashion.

We haven't picked a VCS yet, but I'm thinking it's going to be Mercurial for the simple reason that I have heard good things of it (neither of us have yet to use a VCS).

Question:  What would be the proper way to divy up the responsibilities between the two of us? How should we start, how should we continue and how do we do it together with maximum efficiency? Any other tips would be greatly appreciated!

sentences:
Something orbital rotation is happening when I added player movement I think this is happenning because of my player movements which is this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public float speed;

    // Update is called once per frame
    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Horizontal");

        Vector3 move = new Vector3(x, 0f, z);
        GetComponent<Rigidbody>().AddForce(move * speed);
    }
}

When ever I rotate my camera, the player is moving as well like in an orbital rotation I can't explain it so I made a video.
This is my camera movement:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMovement : MonoBehaviour
{
    public Transform head;
    public Transform container;
    public float mouseSensitivity;
    float xRotation = 0f;

    private void Start() {
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;
    }

    private void Update() {
        float mouseX = Input.GetAxis("Mouse X") * Time.deltaTime * mouseSensitivity;
        float mouseY = Input.GetAxis("Mouse Y") * Time.deltaTime * mouseSensitivity;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.position = head.position;
        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        container.Rotate(Vector3.up * mouseX);
    }
}

I think this is bugging because I am suppose to rotate the Player only not the whole container? This is my player container setup:

I put the player movement on the player object, camera movement on the camera (not the main camera)

sentences:
How to trigger onclick for Unity Selectable by script? As title, I know Button can be triggered onclick by button.onClick.Invoke();
But how to simulate onclick event of Selectable?
Thanks for the help.

sentences:
Understanding the "gradient" in Perlin Noise If I didn't get it wrong from the wikipedia, the word "gradient" should represents either the derivative for continuous functions, or the differential for discrete functions.
To rebuild the original function, I would integrate the gradient function, or calculate the partial sum of them.
Dot production between a unit vector and a gradient vector represents the slope/change-rate along the direciton of the unit vector.

But perlin noise seems unable to be explained. We calculate 4 gradient productions between related positions and random generated gradients in 4 corners, then simply interpolate them resulting the final value.

Is there something I've missed? How to understand operations on gradient vectors for perlin noise?

sentences:
Packaging JARs for Linux I realise that this question exists but the answer doesn't explain how to create DEB packages and whether they're suitable.

I'd like to package my Java 8 game for Linux. Most people don't have Java 8 (and some don't even have Java), so including the JRE in the package would be great.

The package should also have a logo that shows up on most desktop environments.

Lastly, the package should be cross distro (or cover a large number of distros), if possible, because there are simply so many distros.

How would I go about achieving this?

sentences:
Why the while loop is not pausing the coroutine? I'm trying to find a way to pause the game the whole game. timeScale = 0f is not working on coroutines.

I have this script that pause the game on escape key :

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

public class BackToMainMenu : MonoBehaviour
{
    public static bool gamepaused = false;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gamepaused = true;
            Time.timeScale = 0f;
        }
    }
}

And a script with a coroutine :

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        var depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, clipLength));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        while(BackToMainMenu.gamepaused)
        {
            yield return null;
        }

        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            if (Time.timeScale == 0)
                counter += Time.unscaledDeltaTime;
            else
                counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }
}

But when I hit the escape key the freeze for a second or two but then the blurry effect in this script is keep on going then it also keep on running the game after this script part. It seems that the timeScale is not pausing the game at all but only for few seconds if at all. Or pausing only some stuff.

What I want is to pause the whole game. Maybe I should use a game state somehow? I don't want to disable/enable the gameobjects in the hierarchy.

I checked again now. For example the player I can't move it with the keys but I can rotate the player looking around with the mouse while in pause mode. But other things are paused like other npc's I have they stopped moving(Not using animation). So some stuff is paused but some stuff not.

sentences:
Does LibGDX abstract OpenGL ES away or can I still use my OpenGL ES knowledge? I've been learning OpenGL ES, and am now turning my attention to using LibGDX.

My main concern with LibGDX is, if needed, will I be able to apply my OpenGL ES knowledge to something if needed and essentially override bits and pieces of the framework, or does LibGDX essentially hide any implementations of OpenGL?

sentences:
Using keyword [NonSerialized] causes Property to disappear from Inspector I have the following class to represent items in an inventory:

[System.Serializable]
public class InventoryItemInfo : MonoBehaviour
{
    public int Row = 0;
    public int Col = 0;
    public int Rotation = 0;
    public InventoryItemType ItemType;
    public int Amount;
    public int EffectiveWidth = 0;
    public int EffectiveHeight = 0;

    public int Width = 0;
    public int Height = 0;

    public bool Selected = false;
    public Vector3 TilePosAccordingToCurrentRotation;
    public Vector3 TileScaleAccordingToCurrentRotation;

    [NonSerialized]
    public Transform TheNicelyPositionedMesh;

    [HideInInspector]
    private int _iCurRow = 0;
    private int _iCurCol = 0;
    private int _iRotationToCheckForDirtyness = -1;

    public Vector3 DefaultRotation;

    public bool Initited = false;

    public bool Dirty = true;
    private bool _bInitialRotationGotten = false;
    (...)

With the keyword [NonSerialized], the property "TheNicelyPositionedMesh" disappears from the Unity Inspector.

I don't see why. Why is that keyword coupled with the visibility in the Inspector?

Thank you!

sentences:
How to load values into a script from a file? I have a prefab of a "generic unit;" each one has a script with some public variables: name, health, and attack.

Currently, I am manually making copies of that prefab and editing their names, health and damage values in the inspector. This seems unwise to me.

I would rather be able to make a simple file for each unit type, containing its important information, like this:

name = "Archer"
health = 3
attack = 1

And so on. Then, I would like to be able to turn that into actual GameObjects in Unity, presumably by instantiating the prefab and filling in its values with values from the file.

I could then make a script that runs when the game begins and iterates through, making all the objects I need.

However, I do not know the proper way to go about doing this. Is there some way to read files and slot values into variables of a script?

To be clear, I would like to be able to tell Unity to make an Archer, then have it read the Archer file, look up its values for health and attack, then instantiate a copy of the Generic Unit prefab and slot the values that it read into the public variables of a script component of the newly-created game object.

sentences: Getting grid coordinates of cells bordering a square region I have a board that is 4x4 ( the blue cells) with the origin (0 , 0) being in the bottom left for example, how can I get the coords which are adjacent to the board (the red cells) to store them in an array?

sentences:
Understanding the z-axis vector from OpenGL modelview matrix I would like to shoot spheres in the current view direction in a simple scene. I use an FPS camera, so no z-rotation. The vector pointing in the correct direction should be (m[8], m[9], m[10]) where m is the modelview matrix as returned by glGetDoublev(...).

In my understanding that vector is normalized, so when I scale it by some scalar its length will equal that scalar. If I draw an object every frame and translate it by the scaled z-axis vector (plus camera position), the object should be directly in front of me, all the time, right?

However, when I run my program, the object is not in front of me all the time. It is in front of me, as long as no rotation around the y-axis is done. Here is the relevant (I think) source code:

/* camera */
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(g_cam.rx, 1, 0, 0);
glRotatef(g_cam.ry, 0, 1, 0);
glTranslatef(-g_cam.tx, -g_cam.ty, -g_cam.tz);

/* get z-axis vector */
double mm[16];
glGetDoublev(GL_MODELVIEW_MATRIX, mm);

/* should be in front of me, all the time */
glPushMatrix();
glTranslatef(g_cam.tx + 10 * mm[8], g_cam.ty + 10 * mm[9], g_cam.tz - 10 * mm[10]);
glColor3f(0, 0, 1);
glCullFace(GL_FRONT);
glutSolidTeapot(2);
glCullFace(GL_BACK);
glPopMatrix();

Note that this is not about how to place an object in front of me all the time, but rather what is wrong with my understanding, that using the z-axis vector does not work here.

I know that this is a frequent question, because I found lots of material on the internet. However, I seem to be missing something yet. It would be great if you could help me with it :)

If the problem is not as obvious as I think it is, I can prepare a small example demonstrating the issue.

sentences:
How to add custom control shapes to a rig in Maya I find most Maya animation videos has these circle lines to control character part rotation:

Why does my imported fbx not have these circle lines?

sentences:
How to describe the performance requirements for a PC game? System requirements describe the minimum specifications of the hardware and software required to play a game, in terms of performance and compatibility. Some requirements are clear-cut, like the operating system(s), 32 or 64 bit, minimum RAM and disk space, minimum DirectX versions, but for CPU and GPU performance, it's complicated:

The megahertz/gigahertz myth applies, so it's inaccurate to say "1.6GHz or faster"
CPU and GPU vary by generation ("Is my Core 2 Duo too old for this?") and segment ("Do I need a high-end rig or a budget rig is enough?"), so "1.2 GHz Pentium" won't cut it

Many minimum system requirements mention Athlon, Core 2 Duo, Pentium, ATI and GeForce 8800 GT which sound irrelevant in the age of i3/i5/i7 and A6/A8/A10/FX, AMD-branded (not ATI) GPU and three-digit GeForce GPU numbers (like 760).

Benchmark scores like 3DMark are accurate, but not everyone are aware of benchmarks or bother to run them.
Screen resolution and graphic settings are variables not mentioned in most system requirements.
"Playable frame rate" is subjective: It can be 12, 24, 30, 40, 60

My question is, is there a way to communicate the performance requirements of a game to a buyer that address the issues above. Or, should we ditch performance requirement descriptions and let the buyers do their own research on forums, benchmark sites and review sites? Are there any unusual ways of communicate system performance requirements?

sentences:
How do I efficiently choose the terrain chunks to render based on the player position? Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered.

The problem is that if I add all the terrains of the array to the list (let's call it toRenderList), my computer explodes because of the number of terrains.

What I've tried to achieve it's to add to the list ONLY the terrains that are into a certain range. This is what I've done:

private static Terrain[][] terrains;
private List<Terrain> toRenderList;
private static final int NUMBER_CHUNKS = 3; //Number of terrains that are added to the list.

public void update(Player player){
    if(player.hasChangedTerrainPosition()){
        toRenderList.clear();
        for(int x = player.getTerrainPosition()[0]-NUMBER_CHUNKS;
            x == player.getTerrainPosition()[0]+NUMBER_CHUNKS; x++){
            for(int y = player.getTerrainPosition()[1]-NUMBER_CHUNKS;
                y == player.getTerrainPosition()[1]+NUMBER_CHUNKS; y++){
                terrainList.add(terrains[x][y]);
                System.out.println("Terrain "+x+","+y+" added!");
            }
        }
    }
}

Just to clarify, the method player.getTerrainPosition returns a int[] with the current terrain coords in where the player is standing. The method player.hasChangedTerrainPosition returns true if the player has changed of  terrain.

The problem of this method is that for example if the player is in the position [0,0] it pops an error of ArrayIndexOutOfBounds because of a negative number.

I don't know if I've been specific. This is more basic Java than GamePrograming, but any help will be appreciated. Thanks!

sentences:
How to set up bloom in Unity Last time I used image effects in Unity it was back when 3.0 was released and for bloom you used the object's alpha to indicate whether it should glow or not. Now in 4.2 I couldn't grasp how to apply the image effect properly. It seemed to put the whole scene to glow and alpha did not affect it.

There was no help from the Unity docs which are pretty much just spec sheets for the effects and no proper tutorials around. This leads to couple of questions:

How do you create something like the screenshots in the Bloom page in the docs? Only the car windows and metal parts glow, but no glow on the concrete.
How do you make a light source like the second image on the above link? I tried different shaders and lights on a gameobject but none of them produced anything like that.
What does the HDR checkbox in the camera actually do?

sentences:
How can I do Mouse Selection In OpenGL 3.0? Hello I'm pretty good programmer I've made my own 2D games in SDL and made a gui in 3D using Old OpenGL and Modern OpenGL but.. I'm having problems with trying to click 3D models with opengl I have no idea what to do too be honest.

Do I read the area that I've clicked?

or what do I do?

100% shore this has been asked before but I just don't know what to do...??

using :

OpenGL 3.0

WIN32 API

C++

sentences:
About making damage between units I am making my own Tower Defence game engine. I havent built one before and I don't know lot of stuff how games work.

I will take Starcraft as an example. You have a marine shooting a zergling from a certain distance. But you dont see the bullets  traveling trough the air because the marine and the zergling are either too small. So if there are no bullets at all how does the game engine does damage to the zergling under the hood (Use hitTestObject() in flash with what :) )?

I have and idea to add in my game engine and it work this way as explained in the example but I dont know how to implement it trough code.

thanks

sentences:
How to make a changeable color constant for editor materials? Due to the nature of a project I'm working on, the models I got have a bunch of redundant materials on them. I have to fiddle around with some of the colors, but every time I want to change the colors, I have to change each material to the exact same color.

Is there any way to declare some kind of swatch that I can change and have those changes just apply to the materials or anywhere else? For instance, in code, you'd just make a readonly Color mainColor, that you'd use wherever you need and could change at will. I'm looking for this kind of behavior in the editor itself.

sentences:
Drawing image with an angle Edit: the images below aren't supposed to have whitespace. I am just trying to show you that i am trying to create a rectangle from a 1x64 image, positioned as shown in the second picture

I know how to rotate an image like that in XNA

But how is it possible to draw a sprite in this angle this way ?

I can't seem to be able to find an answer on that and i'm sort on ideas

sentences:
What is the better way to speed up gameplay as the level rises? I started with game programming couple of weeks back. For the starters I tried to develop ZigZag (link takes you to 2 min gameplay).

I am done with the logic of gameplay by now. It runs well and all. Now I want to speed up the gameplay as user passes some score. Say after 100 points increase the speed of the ball.

I have two options:

Control the speed using time-delay by varying time.delay(var).
Actually increasing the speed of the moving ball

Not sure which one is a good idea in long term, I'm looking for help from experienced game developers.

You can checkout the source code: https://github.com/ravi-ojha/zigway/blob/master/zigway.py

sentences:
How to make dynamic DOF from mouse position in Unity 5? I found a video a while ago for how to make a dynamic DOF in unity. It fires rays from the camera and positions an empty at the location that the ray first hit. How can I change this so that it doesn't fire rays from my camera but rather from my mouse position, and then positions the empty from there?

Code:

public Transform origin; //Raycast origin
    public GameObject target;

    public CameraMovement cameraMovement;

    void Start () {

    }

    void Update () {
        Ray ray = new Ray(origin.transform.position, origin.transform.forward);
        RaycastHit hit = new RaycastHit();

        if(Physics.Raycast(ray, out hit, Mathf.Infinity)){
            Debug.DrawRay(Input.mousePosition, origin.transform.forward, Color.cyan);
            target.transform.position = hit.point;
        }else{
            Debug.DrawRay(Input.mousePosition, origin.transform.forward, Color.red);
        }
    }

sentences:
Unity - Can not select Desired unity version I'm coming back to Unity after around a 4 month break and finding that opening my past unity projects/ creating a new project will not create it in the unity version I select(v2018.4), and rather always creates it in v2018.1, regardless of having both installed.(image attached below, file I speak specifically of is RPGprojr)

If anyone has a clue to why this is happening any solution would be very much appreciated. I have tried reinstalling 2018.4 version and deleting the 2018.1 version altogether, to no avail.

sentences:
How to disable mipmapping? I'm making a 2D game in which I create some textures dynamically for displaying as simple 2D quads. To achieve this, I call ID3D11Device::CreateTexture2D that requires a D3D11_TEXTURE2D_DESC.

typedef struct D3D11_TEXTURE2D_DESC {
  UINT             Width;
  UINT             Height;
  UINT             MipLevels;
  UINT             ArraySize;
  DXGI_FORMAT      Format;
  DXGI_SAMPLE_DESC SampleDesc;
  D3D11_USAGE      Usage;
  UINT             BindFlags;
  UINT             CPUAccessFlags;
  UINT             MiscFlags;
} D3D11_TEXTURE2D_DESC;

One of the fields is MipLevels. What I understand about this is that mipmaps consist of a collection of the same texture downscaled for better representation and performance of them when they are far away from the view camera.

Since what I'm making is a 2D game, I don't need this feature and I want to disable it. Is there any way to do so? At first, I thought I could just set miplevels parameter to 0, but then I read this:

  MipLevels Type: UINT The maximum number of mipmap levels in the
  texture. See the remarks in D3D11_TEX1D_SRV. Use 1 for a multisampled
  texture; or 0 to generate a full set of subtextures.

and:

  pInitialData [in] Type: const D3D11_SUBRESOURCE_DATA* A pointer to an
  array of D3D11_SUBRESOURCE_DATA structures that describe subresources
  for the 2D texture resource. Applications cannot specify NULL for
  pInitialData when creating IMMUTABLE resources (see D3D11_USAGE). If
  the resource is multisampled, pInitialData must be NULL because
  multisampled resources cannot be initialized with data when they are
  created.

This is what confuses me. I want to create an IMMUTABLE 2D texture (once it's dynamically generated at runtime it's not going to change anymore) plus I don't want any mipmap levels. How am I supposed to do this?

sentences:
Switching between levels, re-initialize existing structure or create new one? This is something I've been wondering for quite a while.
When building games that exist out of multiple levels (platformers, shmups etc) what is the prefered method to switch between the levels?

Let's say we have a level class that does the following:

Load data for the level design (tiles), enemies, graphics etc.
Setup all these elements in their
appriopate locations and display them
Start physics and game logic

I'm stuck between the following 2 methods:

1: Throw away everything in the level class and make a new one, we have to load an entirely new level anyway!

2: pause the game logic and physics, unload all currents assets, then re-initialize those components with the level data for the new level.

They both have their pros and cons. Method 1 is alot easier and seems to make sense since we have to redo everything anyway. But method 2 allows you to re-use exisiting elements which might save resources and allows for a smoother transfer to the new level.

sentences:
Libgdx Hud with two stages I have an app that's currently working with a single stage but i need to add a side display/section as a HUD, with scores/lives etc on it, so that the HUD is on the left, and the main hand screen on the right. The main game screen will be fixed and will not move around.

From researching I've found a couple of solutions.

1 - two stages 2 - a group with two groups to it, possibly using a horizontalgroup 3 - two cameras one stage 4 - one stage, one camera, but changing the position of the camera for each set of actors.

I think, option 1 is my preference, but i have some questions.

Do stages always fill the whole screen, or can i start then where i want? This would make it easier for the right hand screen to calculate positions based on 0,0 of that screen rather than always having to add the width of the HUD on to any calculations.
Do i need to work about viewports? Currently I'm not using one (which i think means my stage is set to scaling by default) but nothing looks stretched as a result of this. I don't know much about viewports, but there always seems to be a compromise to be made with them, i.e. black bars top or sides.
If I have two stages, do they each have their own camera? Do I need to with about this? Can I possibly aim the right hand camera at an offset so i can still draw things from 0,0 with that being the bottom left corner of the right stage, not the whole screen?
Finally, off topic, I am a little confused about spritebatch. I'm not currently using one, because I use a stage. Is that OK, or should i still be using one in conjunction with a stage somehow? And add all my actors to that?

sentences:
Depth buffer values reset on change shader? I have 2 different shaders, and when I change the shader (glUseProgram), it seems that the depth information is lost, because everything drawn with the 2nd shader appears completely on top of anything drawn by the first shader.

If I switch the order of shader use/drawing, then it's the same (the last drawn object always appears on top of the first drawn object if there is a shader change between the 2 objects, even if the last drawn object is further away)

sentences:
Lua script for World of Warcraft: Get Quest Info I'm looking to make a very simple addon or even a macro where I can enter a quest ID and get the quest completion status.  As it is, I know I can use IsQuestFlaggedCompleted to get the quest status, but I wanted to also get the name of the quest so the return in the chat log will show something a little more understandable.
For example:
Enter /questDone 43502
instead of just 43502: true as the output, I want it to look like A Change of Seasons: Quest Completed.

I see a function C_TaskQuest.GetQuestInfoByQuestID that's supposed to return the quest's title, but it doesn't seem to work as expected.  It always seems to return nil for the quest name...

sentences: How do you simulate frictionless movement? I am building a game in which I want to simulate smooth movement of an object upon pressing a key or any other event. Could someone advice me to get that feel of gliding of an object, sliding on a frictionless surface. How could I have that?

sentences:
Cocos2dx v3 Problem with moving Sprite on tilemap after it was scrolled up I have a problem I can't solve so far.
I have a scene with tile map on it. And there is a Sprite spawnpoint on map. This Sprite should do MoveTo() action to the point where TouchEnded().

It all works perfectly in the borders of the screen, but after I scroll my map up and do touch again my Sprite stuck in the max Y point of the screen. (Let's say there is max 480px of screen's Y, but 850px of tile map)

Please help!

sentences:
How are one-to-many relationships usually expressed in ECS architecture? I'm trying to implement a simple ECS to help understand the concepts, and I am having a bit of trouble wrapping my head around how it would be used in cases where there is not a 1-to-1 mapping between entities and components.

For instance, an example of ECS, as I understand it, is that you might have a "drawable" component defined, which contains a mesh ID and a material ID required for drawing.  This is easy to understand  in the case you want a game like Super Mario, where each character is represented by exactly one sprite at any time, but what if you need more than one mesh to draw some characters?

Is it common to allow more than one component of the same type on an entity?  Or else would you typically have an entity for each drawable component, and implement some kind of "join table" to map sub-components to a parent?

sentences:
2D helicopter game, how to create corridor walls? I'm looking into adapting the classic "helicopter" game (i.e. http://www.addictinggames.com/helicopter.html), but I haven't yet figured out how to create the walls-generation engine.

Any pointers into the pseudocode? I'm not so interested in the objects in the middle- only the methodology for generating the sides in a way which increases with difficulty (closes in more, has more unexpected curves) as the game progresses.

sentences:
Unity: 'Quaternion.RotateTowards' animation is too fast (instantaneous) I have a 'block-on-a-hinge' scenario where I just want it to smoothly rotate into the position of a stair step. I messed with this for a day and finally verified that my start and end angles are correct. The problem now is that the rotation animation is instantaneous instead of smooth over time. How can I adjust this so the rotation takes about 2 seconds? Plugging this into the 'maxDegreesDelta' argument felt intuitive but didn't do anything at all:

endAngle * Time.deltaTime / 2.0f

See the Documentation

video footage

The block itself is parented to this empty (hinge location):

The parent of all the hinges is just 10 blocks in a row rotated by \$-\arctan{\left(\frac{4}{3}\right)}\$ (so that is the angle to be undone):

Here is the script:

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

public class SpinningStep : MonoBehaviour
{
    [SerializeField]
    GameObject triggerObj;
    bool disabled = false;
    Quaternion startAngle;
    Quaternion endAngle;
    // Start is called before the first frame update
    void Start()
    {
        startAngle = transform.localRotation; // correct
        Debug.Log(startAngle.eulerAngles);
        endAngle = startAngle * Quaternion.Euler(Mathf.Rad2Deg * Mathf.Atan(4.0f / 3.0f),0,0);
        Debug.Log(endAngle.eulerAngles); // FINALLY correct!
    }

    // Update is called once per frame
    void Update()
    {
        disabled = GameObject.Find(triggerObj.name).GetComponentInChildren<ItemBox>().disabled;

        if (disabled)
        {
            gameObject.transform.rotation = Quaternion.RotateTowards(startAngle, endAngle, Time.deltaTime);
        }
    }
}

EPILOGUE - Corrections:

This script, based off of feedback and answer from DMGregory, eliminates initialization errors for the triggerObj and gives smooth time animation:

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

public class SpinningStep : MonoBehaviour
{
    [SerializeField]
    ItemBox triggerObj;
    bool disabled = false;
    Quaternion startAngle;
    Quaternion endAngle;
    // Start is called before the first frame update

    float rotationSpeed;

    void Start()
    {
        float travelDegrees = Mathf.Rad2Deg * Mathf.Atan(4.0f / 3.0f);
        startAngle = transform.rotation;
        endAngle = startAngle * Quaternion.Euler(travelDegrees, 0, 0);

        // Speed in degrees per second.
        rotationSpeed = travelDegrees / 2.0f;
    }

    void Update()
    {
        if (triggerObj.disabled)
        {
            transform.rotation = Quaternion.RotateTowards(
                  transform.rotation,
                  endAngle,
                  rotationSpeed * Time.deltaTime  // Our third argument is a degree limit.
            );
        }
    }

I knew that how I was getting the trigger was garbage and wanted to ask, because I had trouble making it work, but I wanted to keep this question focused. Very silly oversight not using the name of the script as the type. Thanks!

sentences:
Wrong distance in Depth-buffer I am currently trying to get the Depth Buffer as a texture to use it for edge detection algorithms. Since XNA4 does not allow direct access to the Depth Buffer as texture i have to render it into a texture. The effect i currently use looks like this:

float4x4 World;
float4x4 View;
float4x4 Projection;

struct DEPTH_VS_OUTPUT
{
    float4 Position : POSITION;
    float2 Depth : TEXCOORD;
};

DEPTH_VS_OUTPUT DepthTextureVS(float4 Position : POSITION)
{
    DEPTH_VS_OUTPUT output;

    float4 worldPosition = mul(Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
    output.Depth = output.Position.zw;

    return output;
}

float4 DepthTexturePS(DEPTH_VS_OUTPUT input) : COLOR0
{
    float4 result;
    result.rgb = input.Depth.x / input.Depth.y;
    result.a = 1.0;
    return result;
}

technique DepthTextureRender
{
    pass P0
    {
        CullMode = NONE;
        ZEnable = TRUE;
        ZWriteEnable = TRUE;
        AlphaBlendEnable = FALSE;

        VertexShader = compile vs_2_0 DepthTextureVS();
        PixelShader = compile ps_2_0 DepthTexturePS();
    }
}

It looks like this:

The cubes in this scene are 1x1x1 the projection matrix is made like this:

var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 16f / 9f, 0.1f, 1000f);

As far as I understood the Depth Buffer concept z/w should give me the distance from the camera position to the pixel as value between 0-1 where 0 would be the Near-plane and 1 the Far-plane but since the cubes in this scene are only about 5 Units away they shouldn't be  white.

sentences:
How to do this sprite motion blur? Some of you may know fraxy...

Basically, I was watching this video: http://www.youtube.com/watch?v=uL7zWdDCtOE And there are some times where some sprites spin really fast (4:00 mark for example), and I cannot figure how the motion blur effect was done.

I looked in the game folder, and found the sprite, it certainly does not has the blur added to it (in fact, it is even a .bmp! Not a PNG or anything that supporta alpha natively), and the engine IF using OpenGL, may not be clear (the resolution is fairly low too), also nothing else is getting blurred (so the effect is localized to some sprites... if you pay attention there are other moving objects that get blurry too).

So, how they do this glowing blur?

EDIT: On the video I am talking about the two things "spinning" in the left and right edge of the screen, they are shooting, and the sprite of their bullets are the same as their own sprite, but if you pay attention as they spin their sprites leave a trail, actually if you put the video some seconds before, you will see with the screen more empty, and the effect can be seen clearly.

EDIT2: I don't think Fraxy use shaders, and I am sure it does not use OpenGL either (since it run on computers that don't run OpenGL games). I know it is easy to do with shaders, with per-pixel calculations, I am asking how to do WITHOUT them.

sentences:
Separating .js elements/ .js element communication So I have 2 questions regarding the code below:

function goldClick(number){
    gold = gold + number;
    document.getElementById("gold").innerHTML = gold;
};

function buyMiner(){
    var minerCostG = Math.floor(100 * Math.pow(2.1,miner));
 var minerCostW = Math.floor(10 * Math.pow(3.1,miner));
    if(gold >= minerCostG){
  if(wood >= minerCostW){
   miner = miner + 1;
   gold = gold - minerCostG;
   wood = wood - minerCostW;
   document.getElementById('miner').innerHTML = miner;
   document.getElementById('gold').innerHTML = gold;
   document.getElementById('wood').innerHTML = wood;
    }};
    var nextCostMG = Math.floor(100 * Math.pow(2.1,miner));
    document.getElementById('minerCostG').innerHTML = nextCostMG;

 var nextCostMW = Math.floor(10 * Math.pow(3.1,miner));
    document.getElementById('minerCostW').innerHTML = nextCostMW;
};

window.setInterval(function(){

 goldClick(miner);

}, 1000);

Question 1: Is it possible to separate these functions (goldclick, buyminer, window interval,) into their own documents so that if I have say, 50 different XXXXclick functions, and 50 buyXXXX functions and 50 interval functions, I have just 3 .js documents instead of 50.

Question 2: If it is possible to separate them, how would I ensure that they are communicating with each other and variable values are not being confused or sent to the wrong <span> in the displaying html.

sentences:
How to take into consideration gravity when moving AI I'm making a 2D game. There is currently a helicopter flying around, controlled by the player. It's controlled using the arrow keys: UP, LEFT and RIGHT.

It's speed along the y axis is dy, and speed along the x axis is dx.

It's physics is as follows:

Whenever UP isn't pressed, dy accelerates in constant acceleration, indefinitely towards down. (Gravity). dx stays in it's current value.

When UP is pressed, dy accelerates in constant acceleration from whatever it currently is, up to 4 (upward, until it reaches speed 4). dx stays in it's current value.

When LEFT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to -4.

When RIGHT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to 4.

(When LEFT or RIGHT are pressed and UP is not pressed simultaneously, as I said: dy increasingly becomes smaller and smaller, because gravity is affecting the helicopter)

All of this makes the helicopter often follow arches in the air, rather than straight lines.

This creates physics that seem quite realistic.

My question is:

The opponent helicopter, an AI, should move using the same physics system.

Lets say the AI wants to get from where it currently is, to point B.

If there was no gravity and no gradual acceleration in the game, it would be easy. I would simply draw a vector from the AI's position to point B, and make the AI follow it.

But since there is gravity and gradual acceleration, the AI can never move in a straight line (almost). what would be the best way to make the AI go to point B, as time-efficiently as possible?

How can I take the gravity into consideration when moving the AI toward a specific destination?

(If it's easier to explain, please consider point B to be on the same level on the y-axis as the AI, and not in diagonal to it.)

Thanks

sentences:
What kind of physics to choose for our arcade 3D MMO? We're creating an action MMO using Three.js (WebGL) with an arcadish feel, and implementing physics for it has been a pain in the butt.

Our game has a terrain where the character will walk on, and in the future 3D objects (a house, a tree, etc) that will have collisions. In terms of complexity, the physics engine should be like World of Warcraft. We don't need friction, bouncing behaviour or anything more complex like joints, etc. Just gravity.

I have managed to implement terrain physics so far by casting a ray downwards, but it does not take into account possible 3D objects.
Note that these 3D objects need to have convex collisions, so our artists create a 3D house and the player can walk inside but can't walk through the walls.

How do I implement proper collision detection with 3D objects like in World of Warcraft? Do I need an advanced physics engine? I read about Physijs which looks cool, but I fear that it may be overkill to implement that for our game.

Also, how does WoW do it? Do they have a separate raycasting system for the terrain? Or do they treat the terrain like any other convex mesh?

A screenshot of our game so far:

sentences:
Recommended formats to store bitmaps in memory? I'm working with general purpose image rendering, and high-performance image processing,  and so I need to know how to store bitmaps in-memory. (24bpp/32bpp, compressed/raw, etc)

What is the "usual" or "normal" way to store bitmaps in memory? (in C++ engines/projects?)

How to store bitmaps for high-performance algorithms, such that read/write times are the fastest? (fixed array? with/without padding? 24-bpp or 32-bpp?)

How to store bitmaps for applications handling a lot of bitmap data, to minimize memory usage? (JPEG? or a faster [de]compression algorithm?)

I'm not working with 3D graphics or DirectX / OpenGL rendering and so I don't need to use graphics card compatible bitmap formats.

Some possible methods:

Use a fixed packed 24-bpp or 32-bpp int[] array and simply access pixels using pointer access, all pixels are allocated in one continuous memory chunk (could be 1-10 MB)
Use a form of "sparse" data storage so each line of the bitmap is allocated separately, reusing more memory and requiring smaller contiguous memory segments
Store bitmaps in its compressed form (PNG, JPG, GIF, etc) and unpack only when its needed, reducing the amount of memory used. Delete the unpacked data if its not used for 10 secs.

sentences:
Avoid unreachable rooms in duengons Good evening.

Im currently trying to create a Dungeon Generator . First I place randomly some rooms. Right after that I dig in a randomized maze.

But sometimes it happens that some rooms or even some maze paths are unreachable.

Is there any way to avoid that ? Are there any good Methods for avoiding that ? Any ideas or examples?

Im currently doing it like so (pseudocode) :

Pick a random Number of rooms
Create an arraylist for those rooms
Pick random Positions with random sizes
Try to place all those rooms without overlapping and add them to the list.

-- Room placement Done --

-- Maze Generation Begins --

Loop over the whole Map, if Theres an empty tile ( No wall, No floor and No paths) than Beginn to grow the maze .
When the Statement above ist true, than create a 'Cell arraylist' and put the 'start' cell into it with the coords of the empty tile above  . ( A cell just contains x and y coords) .
While the cell list isnt empty, Pick the latest cell (cellsList.Size()-1) and Check the possible direction it Can move. If Theres just empty space in that direction ( No wall, No floor and No paths) than the direction is true.
Pick a random Number and Check for every direction if the assigned Number fits with the random one. If it fits, then dig into that direction and create a new cell at the End . If Not redo this step until one paths ist diged Out.
At least kill 'Dead ends'. Those path tiles which are surounded by 3 empty tiles or those which are completly isolated.

I Hope I mentioned everything . Im currently at my phone and cant acess my Files at my Home PC :/ im gonna Update this later when im Back Home.

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

void Parallax::Draw(SDL_Surface* buffer) {

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

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

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

        SDL_Rect blitrect = buffer->clip_rect;

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

This works.

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

void Parallax::Draw(SDL_Surface* buffer) {

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

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

        ParallaxLayer* layer = (*it);

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

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

        SDL_Rect blitrect = buffer->clip_rect;

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

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

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

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

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

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

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

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

sentences:
How to interpolate a height-map with normals My Task

I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this question to get a image of it how it's working ).

My Approach

I want to interpolate the height of two points by using the normal of them. To do this i need the tangent of both. When having the tangents i want to interpolate this way:

float resultHeight = Interpolate(TangentVector0, TangentVector1, 0.5f);

public float Interpolate(float p0, float p1, float amount)
{
    amount = Math.Sin(x* Math.PI - Math.PI/2) / 2 + 0.5;
    // Move vectors along tangents
    p0 = p0 * (amount - 1f);
    p1 = p1 * amount;
    return (p0 + p1) / 2f;
}

Problem ( Question )

I'm a little bit stuck with the math behind. How to i get the tangent of the x or z axis when having a 3D normal.

sentences:
Unity- how to render-to-texture with VR distortion I've also asked the question here http://answers.unity3d.com/questions/1392099/how-to-set-a-render-to-texture-camera-to-be-a-vr-c.html (but it's currently "under moderation")

So, I want to do some post processing effects in VR. I put a camera as a child of the Main Camera and set it to render-to-texture. Then, I take what is rendered, and display it (with my post-proc shader) on a quad in front of the Main Camera (The main camera and the child camera render different layers, so I don't render the same thing twice). (Also worth noting- I know that the depth will be collapsed out of the rendered-to-texture content; this is intentional.) The problem is, in this process, the positional data (that was rendered to texture) gets misaligned.

I've already fixed a problem where I have to manually set camera_project.GetComponent<Camera>().aspect = main_camera.GetComponent<Camera>().aspect; every frame. (Changing/setting the screen size auto sets the aspect ratio of the main camera- it does not automatically set the aspect ratio of the child camera.

So, with just that, everything lines up great and looks fine when it isn't in VR. But, when it is in VR, it appears that maybe some distortion is happening to the main camera that isn't happening to the render-to-texture camera, and thus, the overlay (the post-proc'd content) isn't lining up.

So what can I do to emulate the VR distortion in the child camera? Are there other properties of the Main Camera that are getting auto-set in VR that I can manually copy to the Main Camera? (I also noticed that aspect wasn't listed in the camera documentation [https://docs.unity3d.com/Manual/class-Camera.html] unless you knew to search for it explicitly, so I think it might be likely there is some other property I'm missing?)

sentences: Unity - Access animation clips/motion of an animator So I have an animator on my GameObject. I need to change the animation clip/motion of different states in my animator to the one I assign in my EditorGUILayout.ObjectField. Problem is, I have no idea how to access those clips. This is purely Editor Scripting.

sentences:
How do you make Direct3D work in a browser? I've come across games that are 3D that are playable in a browser.  They require a plugin to be installed to work.  I guess the plugin creates a D3D window inside the browser.

How would I go about implementing something similar?

sentences:
How to make a long highway in unity? I'm planning to make a long highway for a Racer game. What is the best way to do it ?

Do you make it in a single scene which I think is difficult to manage ? Or do you make multiple scenes or anything else ?

sentences:
Implementing a camera / viewport to a 2D game What is the most practical way to implement camera/viewport to a 2D-game?

I've read, that I should store the object world position instead of position relative to the screen?

Current situation:

I have implemented a simple 2D-game where I load objects and levels from XML-files. Currently the level XML-file looks like this:

<map>
   <tile obj="ground" x="0" y="555" />
   <tile obj="ground" x="16" y="555" />
   <tile obj="ground" x="32" y="555" />
   ...
</map>

All objects have a 2d-vector "position" storing their current location on the screen.

What I want it to be:

In the picture:

Camera is either 800x600 or 640x480
Blocks and sprites are 16x16 pixels.
World size may vary
The coordinates probably should be normalized relative to the world, not to the screen?
Viewport position relative to player's x, y and moves when the player reaches camera dead zone (similar to this video).

I'm asking pseudo examples / articles, but if you need to know what I'm using for the development: SDL & C/C++.

sentences:
AS3 > Mouse Event not happening? Background: Trying to make a ball appear in the same location the mouse is positioned. Using Box2D Library. Working on a class file (.as)

Issue: The mouse event does not work (I click but nothing happens) . No output errors whatsoever. :(

Mouse Event:

   private function _clicked(e:MouseEvent)
            {
                sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
                sim.start();

Full Code:

package  {

    import flash.display.MovieClip;
    import com.actionsnippet.qbox.*;
    import flash.events.MouseEvent;

    [SWF(width = 350, height = 600, frameRate = 60)]

    public class MouseTest extends MovieClip {

        public var sim:QuickBox2D;

        /**
         * Constructor
         */
        public function MouseTest()
        {
            sim = new QuickBox2D(this);
            sim.createStageWalls();

            addEventListener(MouseEvent.CLICK, _clicked);
        }

        /**
         * ..
         * @param e MouseEvent.CLICK
         */
        private function _clicked(e:MouseEvent)
        {
            sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
            sim.start();

        }
    }

}

Download Project (BOX2D Included)

http://gabrielmeono.com/download/BOX2D-Mouse_Test.zip

sentences:
Does one need normals for a strictly 2d Game? I'm starting to learn OpenGL by creating a pure 2D game.

I have to decide on the format of the Vertices. Do I need a normal component? Or is this for a 2d component not needed?

My gut feeling says I won't need it since everything is flat. But perhaps I need it for some shader or other thing I don't see yet.

sentences:
Event-driven Communication in a Game Engine: Yes or No? I am reading Game Coding Complete and the author recommends Event Driven communication among game objects and modules.

Basically, all living game actors should communicate with the key modules (Physics, AI, Game Logic, Game View, etc.) via an internal event messaging system. This means having to design an efficient event manager. A badly designed system eats CPU cycles, especially affecting mobile platforms.

Is this a proven and recommended approach? How should I decide whether to use it?

sentences:
Ogre3D particle effect causing error on iPhone 1) First I have added the Particle Folder from the Ogre SDK (contains Smoke.particle).

2) Added the Smoke.material And smoke.png and smokecolors.ong.

3) After this I added the Plugin = Plugin_ParticleFX in the plugins.cfg.

Here is my code:

#Defines plugins to load

# Define plugin folder
PluginFolder=./

# Define plugins
Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX

4) I have added the particle path in the resources.cfg (adding the particle file in this causes the crash):

#Resource locations to be added to the 'bootstrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=media/packs/SdkTrays.zip

# Resource locations to be added to the default path
[General]
FileSystem=media/models
FileSystem=media/particle
FileSystem=media/materials/scripts
FileSystem=media/materials/textures
FileSystem=media/RTShaderLib
FileSystem=media/RTShaderLib/materials

Zip=media/packs/cubemap.zip
Zip=media/packs/cubemapsJS.zip
Zip=media/packs/skybox.zip

6) Finally I did all the settings, my code is here:

mPivotNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode();  // create a pivot node

// create a child node and attach an ogre head and some smoke to it
Ogre::SceneNode* headNode = mPivotNode->createChildSceneNode(Ogre::Vector3(100, 0, 0));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("Head", "ogrehead.mesh"));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createParticleSystem("Smoke", "Examples/Smoke"));

7) I run this and got the error below:

An exception has occurred: OGRE EXCEPTION(2:InvalidParametersException): Cannot find requested emitter type. in ParticleSystemManager::_createEmitter at /Users/davidrogers/Documents/Ogre/ogre-v1-7/OgreMain/src/OgreParticleSystemManager.cpp (line 353)

8) Getting crash at:

(void)renderOneFrame:(id)sender
{
    if(!OgreFramework::getSingletonPtr()->isOgreToBeShutDown() &&
       Ogre::Root::getSingletonPtr() && Ogre::Root::getSingleton().isInitialised())
    {
      if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isActive())
      {
         mStartTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
//( getting crash here)

Does anyone know what could be causing this?

sentences:
In Unity, why do I get a "does not implement right interface" error when trying to sort my list of objects? I am trying to create a crafting panel that sorts the list of items you can make alphabetically, yet I cannot figure out why .Sort() is not working.

What I have is a game object that holds a list of all the items you can make and the requirements, then in my crafting script I access the game object for the list and display the info.

Everything works fine until I try to sort anything. craftDatabase is what I need to be sorted. Also, it needs to be sorted by ItemID.

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

public class CraftDatabase : MonoBehaviour
{
    public List<Blueprint> craftDatabase = new List<Blueprint>();
}

[System.Serializable]
public class Blueprint
{
    public string itemId;
    public int itemAmount;
    public float itemCraftTime = 1f;
    public CraftPanel.subsections subsection;
    public CraftPanel.workstations workStation;
    public List<requiredItem> requiredItems = new List<requiredItem>();

    [HideInInspector]
    public string desc;

    [System.Serializable]
    public struct requiredItem
    {
        public string itemId;
        public int itemAmount;
    }

    public Blueprint()
    {
    }
}

When I try to throw in craftDatabase.craftDatabase.Sort(); it gives me this error:

  ArgumentException: does not implement right interface

How do I fix this error to use Sort()?

sentences:
How do game engines like Unity and Game Maker exports to other platforms? From what I understand, if you want to export a Unity or GameMaker game from the editor, the game needs to be compiled to create an executable. I thought that to produce a Windows executable, you needed to be on Windows. How does Unity and GameMaker compile to Mac and Linux, if the engine is running on Windows? Likewise, How do they export to Android and iOS? Do they use the NDK for Android? What about WebGL?

How does the export actually work? Do they use a cross-platform framework written in some programming language, and when you do things with the editor it generates code using that programming language and framework, so that when you export, that code gets compiled? For WebGL, since the UnityScript code doesn't get compiled, can we see the .js files with the code?

sentences:
UE-Sequencer - Foot slide with character movement What is the best way to implement the character movement on the sequencer so there is no foot slide?
I would go with Root Motion but the animations I have are on place.
Thank you

sentences:
Unity Text Mesh Pro can not get referenced in VSCode I am using Text Mesh Pro in my Unity 2019.3.4f. The TMP works fine in unity, but in the code editor, Visual Studio Code, the TMP related things are marked with red wave underline, which means the VSCode could not get the reference of TMP.
In my csproj file, the TMP reference exists, here are some related codes:
<ProjectReference Include="Unity.TextMeshPro.csproj">
  <Project>{e8ae9ed6-ed86-3de7-e777-7e6794b003b2}</Project>
<Name>Unity.TextMeshPro</Name>

ProjectReference Include="Unity.TextMeshPro.Editor.csproj">
  <Project>{af8771c0-66d3-f01a-48b5-78951bce8a23}</Project>
<Name>Unity.TextMeshPro.Editor</Name>

My TMP works fine in every aspects, but there are code warnings in the VScode, "could not fine the namespace of TMPro". Is there anyone know how to fix it?

sentences:
What is the relationship between clipping and the fog of war concept? I'm currently developing a 2D top down game and recently implemented clipping.

I understand clipping in a 2D top down game as rectangle or any other geometrical form which defines a viewport for the player of what exactly he sees and what is technically rendered from the engine. As I'm centering the clipping area around the player I recognized that it is similiar to the fog of war concept.
So the player has a limited view perspective depending on his current position.

My questen is what is the concrete difference to the fog of war concept? Is this concept usually using clipping? I often recognized that for example the map is rendered but simply not the objects which are on that map. Are these objects rendered and simply invisible or are they not rendered at all because of the clipping? Could clipping be defined as a way to achieve fog of war?

Would be cool if anyone could shed some light on this topic.

sentences:
Handling incoming packets immediately or queuing them I'm using Golang to write a game server. I was wondering what the advantages of queuing the incoming packets for processing over processing them immediately.

For example (processing immediately) each new connection/client a new goroutine/coroutine is created and within that goroutine a loop that reads from the network socket and has a switch statement that routes and handles each packet.

Or (queuing) each new connection/client a new goroutine is created and within that goroutine a loop that reads from the network socket and passes it to a queue. A second dedicated goroutine for this connection/client has a loop that process the packets in the queue.

Is this a pre-optimization? How are MMORPG's (server side) packet recv/handling handled in principle?

I'm using TCP.

sentences:
Do I need a Point and a Vector object? Or just using a Vector object to represent a Point is ok? Structuring the components of an engine that I am developing along with a friend (learning purposes), I came to this doubt.

Initially we had a Point constructor, like the following:

var Point = function( x, y ) {
    this.x = x;
    this.y = y;
};

But them we started to add some Vector math to it, and them decided to rename it to Vector2d.

But now, some methods are a bit confusing (at least in my opinion), such as the following, which is used to make a line:

//before the renaming of Point to Vector2, the parameters were startingPoint and endingPoint
Geometry.Line = function( startingVector, endingVector ) {
    //...
};

I should make a specific constructor for the Point object, or there are no problems in defining a point as a vector?

I know a vector have magnitude and direction, but I see so many people using a vector to just represent the position of an object.

sentences:
Robust Architecture for Flash Games? What's a good architecture for Flash games? I've read that MVC is great, with symbols just used purely for views (set states, use the class to manage which state/frame to show).

I would presumably then stick all my code in one or more .AS files, use object-oriented programming, try to unit test whatever I can, and make my art and symbols purely view-state stuff with no code.

Has anyone tried this? On anything other than a small game? How do these big flash RPGs and MMORPGs architect their games?

sentences:
Accessing struct in glut I have to write a game for a uni project using openGL / glut. I am just going to use a generic example code as I'm just looking for a solution to one specific problem:

Using glut, I have to call a function 'glutDisplayFunc(display);' in the main function. I am also using an IdleFunc(update). The problem is that, as described here, the 'display' function cannot pass anything. I have some structs outside my main that I wish to be initialized in the main, and be accessible by display and update. Hopefully some code will explain my problem better:

#include <gl/glut.h>

struct Player
{
GLfloat x;
GLfloat y;
GLfloat z;
int score;
...
}

//function prototypes (showing how I would normally pass the struct)
void InitPlayer         (Player &player);
void DrawPlayer         (Player &player);
void UpdatePlayer           (Player &player);

void main (int argc, char **argv)
{

    Player player;

    InitPlayer(player);

    //...
    //glut / openGL initialisation code left out
    //...

glutDisplayFunc         (display);
glutReshapeFunc         (reshape);
glutIdleFunc            (update);

glutMainLoop();

}

void display()
{
DrawPlayer(player);
}

void update ()
{
UpdatePlayer(player);
glutPostRedisplay ();
}
//end

The above code doesn't work: I hope it demonstrates what I would like to do though. Access the struct 'player' in 'display' and 'update', having the same values stored globally. How would I go about ?

sentences:
Efficient way to implement animation from spritesheet? I'm actually trying to port a GBA game to SDL for educationnal purpose.
The game has many sprites and tiles. Since the GBA screen size is 240x160px, I decided to scale it 2x. At first, it went okay creating spritesheet for animations, because typical animations had something around 2-8 frames.

However, I faced yesterday a problem that I had not seen coming. I got a 89-frame animation. Including the scale, each frame is around 480x320px. With 89 frames, it creates a huge image.

When I load it into a SDL_Texture with IMG_LoadTexture, the size of the test program goes from ~9MB to 56MB. I find this huge considering the image weights at most 4MB (without compression, PNG-32 bits I believe). No matter what compression I do, it still takes ~50MB.

Here's the code that loads the image:

m_frameDestRect = { 0, 0, 480, 320 };
m_frameSrcRect = { 0, 0, 480, 320 };
m_pTexSprite = IMG_LoadTexture(pRenderer, "image.png");

I keep the SDL_Texture in a SDL_Texture* property of my class. It also never change.

Here's the code that "draws" the texture:

SDL_RenderCopy(m_pRenderer, m_pTexSprite, &m_frameSrcRect, &m_frameDestRect);

Here's the code that "update" the frame:

uint32_t frameX = (m_frame + 1) % 5;
uint32_t col = (m_frame + 1) / 5;

m_frameSrcRect = { frameX * 480, col * 320, 480, 320 };

I could live with that, but then I saw that I got an animation that has 489 frames...

Since I am no expert in video games programming, nor in imaging, I came here to ask this very question.

1. Is the RAM consumption of SDL_Texture (and whatever loaded behind) normal ?
2. Animation wise, are there other ways to implement them?

I find it totally impressive all these sprites (got tons of them, in gif formats) actually loaded quite smoothly on the GBA, considering the number of frames.

Any advice / solutions / answers is more than welcomed.

Thanks

sentences: How does Unity know that you make more than one hundred thousand dollars on the Personal plan? How do they check if you make more than 100k? That is really puzzling me.

sentences: Does 2D Platformer games still have popularity among gamers? I'm currently working on a 2D platformer game that i wanted to put out as my first game but seeing the popularity of other games made by Voodoo and others are quite distressing and made me ask myself this question and now you guys. will the 2D Platformer games that had the popularity will have any popularity for developers to take interest and make some living out of it in the for future projects or can they work on the more popular games like color bump 3d.

sentences:
Python mini RPG enemy movement. (how to have two infinite loops running at the same time) I have a problem with my RPG.

I want enemies to wander randomly. So I put:

enx_speed = random.randint(-2, 2)
eny_speed = random.randint(-2, 2)

in the main loop (while true:).
However, that loops every 20 milliseconds (it's what I use to redraw, find key presses, etc).

How can I have two infinite loops running at the same time with different loop times?

sentences:
Ogre 3D Visibility Advice I would like an advice about some real-time rendering optimization.
I'm rendering a BSP level, by only using the mesh, textures, entities, and lightmaps, not using VIS at all.

I'm trying to make my own Cell/Portal rendering system, a very basic one, but here is the problem, since Ogre uses a basic frustum culling (as I've heard), I think it would render everything behind the walls if every portals are in the field of view :

Do you have some better ideas to implement this ?

I am getting 650 FPS at a resolution of 1920x1080 if I render only zone only. I can get 1300 FPS if I see nothing.

Is 300 FPS good for a complex scene like this one?

I would like to make a lot of basic things clear for me.

sentences:
SetColorMod() with mini delay when the texture is rendered for the first time I have one image.png that I load using SDL_IMG. I load by creating a surface. Then I create a texture using CreateTextureFromSurface() and I free the original surface. I repeat the same process but now at the end I use SetColorMod(128, 128, 0) to this new texture. This changes the color of the image as I wanted! Cool!

This whole process is done way before the images are rendered to the screen. The original texture (without the color change) is rendered normally. The texture with the color change creates a mini delay when rendered for the first time. After that it keeps rendering without any delay.

I’m using SDL 2.0.2 (I’m using ubuntu 14.04)

A quick preview of the code to give an idea of what is happening

// load function
func load() {
    newSurface, err = img.Load(fname)
    defer newSurface.Free()
    newTexture, err = renderer.CreateTextureFromSurface(newSurface)
    return newTexture
}

// pre load
func init() {
    sprite1 := load()

    sprite2 := load()
    sprite2.SetColorMod(128, 128, 0)
}

// render...
func render() {
    Renderer.Clear()
    //loop for each object
    obj1 := sprite1
    obj2 := sprite2
    Renderer.CopyEx(obj1, &crop, dst, render.Angle, render.Center, render.Flip)
    // LAG HERE
    Renderer.CopyEx(obj2, &crop, dst, render.Angle, render.Center, render.Flip)
    Renderer.Present()
}

sentences:
Help with open and close UI Menu on background mouse click I am trying to make a point and click game in unity 5.2.2.

My problem is that I need to have a UI menu to open, when the player clicks with the left mouse button on the background sprite, and it should close again, when he click on it again. I have created a script, and so far it works like that, but It also closes, when I click on the menu buttons itself, which means that I can't use the menu which opens. Please help me to how I can achive that.

The way the menu should work, is like in the game Game Dev Tycoon, where the player can open and close the menu, when clicking on the game background.

Here is my script, in its current form.

using UnityEngine;
using System.Collections;
/// <summary>
/// This is the main class, for the entire game. The purpose of this class, is to control any gameplay in the game.
/// </summary>
public class GameManagerScript : MonoBehaviour {

public GameObject gameUI;                                           //The actual Game UI

    public void Awake()
    {
        gameUI.SetActive(false);
    }

    // Game Manager Game Loop
    public void Update()
    {
        CheckForKeyInput();
    }

    void CheckForKeyInput()
    {
        //Mouse0 = First mouse button
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            Debug.Log("Mouse0 button fired!");
            gameUI.SetActive(!gameUI.activeSelf);
        }
        //If escape, exit the game
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            Debug.Log("Application has been exited");
            Application.Quit();
        }
    }
}

sentences:
Problems with Unity3D Animator controller states I have an object (a simple card) equipped with the Rigidbody, Collider and Animator components. In particular, Animator performs two simple clips: Cover and Uncover that rotates the card 180 degrees. The first starting from 0 degrees to 180, the second from 180 to 0.

So the clips should cover or uncover the card. The problem is that the card returns to its original state.

For example, the original state of the card is the "uncovered state" so when I click on it to cover it covers as expected. The I register the state "covered" programmatically. However, immediately after the animation ends, it returns to its original state (uncovered). The card now has an internal (C# variable) state as "covered", but I see it to still be uncovered. When I click it again, will be fired the correct animation clip: "uncover".

What should I do to leave it covered at the first click?

I have uploaded here a short clip that shows the behavior of the card, also below find some screenshots that refer to the various views of the IDE that may have useful information. The video clip is uploaded to Dropbox for the while.

The video of the behavior: Dropbox link

The code of the Flip script:

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

public class Flip : MonoBehaviour {

    private Animator anim;
    private enum cs_e {covered, uncovered};
    private cs_e coveringState;

    // Use this for initialization
    void Start () {
        anim = this.GetComponent<Animator>();
        coveringState = cs_e.uncovered;
    }

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

    }

    private void OnMouseUp()
    {
        Debug.Log("Mouse up");

        if (coveringState == cs_e.uncovered)
        {
            anim.Play("Cover");
            coveringState = cs_e.covered;
        } else {
            anim.Play("Uncover");
            coveringState = cs_e.uncovered;
        }

    }

    private void OnMouseDown()
    {
        Debug.Log("Mouse down");
    }

    private void MouseDrag()
    {
        Debug.Log("Mouse drag");
    }
}

Some screenshots:

sentences:
How to deal with lot of textures in one draw call? I'am currently developing text rendering & some kind of tile based texturing for simple landscape with textures blending. e.g. something like this but in 3D.

In first realization I have been used 2D texture arrays to achieve problem of texture switching to be able to draw whole landscape mesh at one opengl draw call and it works great, but this should run on opengl es 2.0 devices and they are don't have 2 texture array support. So my question is - what can I do to deal with that kind of problem?

Of course i can just draw every landscape quad separately, but I'm pretty much sure, that this solution will really, really heart the performance. (mb i wrong?)

Also i know about texture atlases, but can I guarantee that I can put all possible textures into fragment shader for every possible tiles  combination?(terrain tiles for landscape & every possible text chars with different sizes, I think you get the point) I almost sure that i can't, that's basically why I'm asking this question here.

Sorry for my horrible english, I'm working on that.

sentences:
Cannot draw around the screen after zooming out with LibGDX projection coordinate I've just started developing game in android using LibGDX.
I've follow some samples and now my simple game can draw path when user move their finger around the screen.

now problems appear when i add another feature to allow user to pinch zoom in and out.
after zooming OUT the orthographic camera user can still draw the path BUT
the path can no longer follow user finger to the edge of the screen, the user can only draw the path around the center of the screen. looks like the coordinate projection after zoom out not changed and still limited to the projection before zoom out!

how can i make my game to keep drawing line around the entire screen even after the user have zooming out the camera?

here's my code:

   1. in my Screen implemented class:

@Override
public void render(float arg0) {
    Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.render();
}

@Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        // TODO Auto-generated method stub
        isDrawing = true;

        Vector2 v = new Vector2(screenX, Gdx.graphics.getHeight()-screenY);

        //add new point for drawing path
        inputPoints.insert(v);

        return true;
    }

   2. in my Renderer class:

cam = new OrthographicCamera();
    cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.cam.update();

public void setZoom(float zoom) {
     this.cam.zoom = zoom;
     this.cam.update();
 }

//the triangle strip renderer
    path = new PathClass();

public void render() {
    cam.update();
    batch.setProjectionMatrix(cam.combined);

    //generate the triangle strip from our path
    Array<Vector2> xox = screen.path();
    path.update(xox);

    //the vertex color for tinting, i.e. for opacity
    path.color = Color.WHITE;

    //render the triangles to the screen
    path.draw(cam);
}

   3. on my PathClass:

public void draw(Camera cam) {
    if (tristrip.size<=0)
        return;

    gl20.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
    for (int i=0; i<tristrip.size; i++) {
        if (i==batchSize) {
            gl20.end();
            gl20.begin(cam.combined, GL20.GL_TRIANGLE_STRIP);
        }
        Vector2 point = tristrip.get(i);
        gl20.color(color.r, color.g, color.b, color.a);
        gl20.vertex(point.x, point.y, 0f);
    }
    gl20.end();
}

sentences:
Particles/instancing groups in an Entity/Component system I've been playing with an entity/component/system design recently, and I've come across a couple of stumbling blocks.

Instancing

Let's say I have a few hundred "things" (asteroids, chickens, whatever) that are being drawn with instancing. In a classic component hierarchy, I'd have a game object that keeps the individual instance index and vertex buffers, as well as the second dynamic vertex buffer for the instance data (collection of matrices, etc.). That object would be responsible for checking collisions with other objects and between the instances themselves.

In an ES system, I'd like to track each instance as an individual entity, but I don't want to give up simplicity and performance of instancing. The first thing that occurred to me was to create an "instance group" component, with a field that defines a group ID to enable handling of multiple types of instanced geometry.

An "Instance System" would collect those components and maintain the instance vertex buffer. My entity manager already notifies systems when an entity is created or destroyed which makes this part pretty easy to implement.

My confusion comes from how to cleanly integrate that with the rendering system. If each instance appears as a separate entity with a "renderable" component/attribute, the render system will process them individually.

I could:

Include a special case for entities that have both a "renderable" and an "instanced" component, but that seems messy and feels like starting down the path of having a huge render system with tons of special cases.
Have the render system maintain a collection of instance vertex buffers, query the entity list for "instanced" entities, filter based on a group ID, etc., and render as appropriate, so the render system becomes responsible for maintaining instance collections, but that seems like the wrong place to put that sort of logic.
I could also include a single entity in addition to the instances with, say, an "InstanceOutput" component/attribute and a Renderable component, and remove the Renderable component from the individual instance entities, giving a single render point for all of the instances. This component would probably also server as a place to keep the geometry and persistent instance/vertex buffer.

Is there a better way?

Rendering

I have several types of renderable entities. Some have procedural geometry and textures, some are just sprites, some are text displays. What's the best way to differentiate these from the point of view of the rendering system without having to write a massive switch statement? In a game object hierarchy, each of these types would have their own Draw() method, but moving the logic into a Render System doesn't seem to provide a lot of flexibility in terms of different effect parameters, etc.

sentences:
Where is the Aves game engine? The Aves game engine made a splash last spring/summer, with very impressive demo videos. I went back to check on them, and it looks like their site has long since died. Google also doesn't seem to know anything new about them.

Where can I find news about Aves? Is the project dead?

sentences:
3ds Max Skeleton Import into Unreal Engine Fail I tried following the "Introduction to UE4 Animation and Rigging Tools" tutorial with maya but I dislike maya and don't under stand it so I tried importing the skeleton from the "3rd Person Game with Blueprints" tutorial into 3ds max and hoping I could just edit the mesh because I want about the same skeleton.

So I imported it and just made a basic mesh to test, Then removed the old mesh

Now I did it like this hoping I could use the existing animations for the original but when I try to play an animation with it in unreal engine 4.7.3 it says it does have any with the same skeleton, then when I tested it trying to ragdoll it stays rigid and just falls over.

Please help, am I importing it wrong am I missing a step? Why doesn't it work?

sentences:
Unity 2D ROPE connected to moving platform Hey guys I have realy big problem with my rope. I use a hinge joints 2D to create my rope and distance joint  to connect it with moving platform.

On moving platform I have a distance joint that show on a first chain joint, so that allows move platform and rope should fallow that platform.

Problem is that, when I will move platform then joints connection will brake and joints goes crazy. Is there any solutions for that ??

When I will move than green circle which is on image 3 then all joints go crazy :

sentences:
How to implement Fog Of War with an shader? Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW).
That means a tile(or pixel) can be:

0% transparent (unexplored)
50% transparent black (explored but not in viewrange)
100% transparent(explored and in viewrange)

RTS means I'll have many explorers (NPCs, buildings, ...). Okay, so I have an 2d array of bytes byte[,] explored. The byte value correlates the transparency.

The question is, how do I pass this array to my shader? Well I think it is not possible to pass an entire array. So: what technique shall I use to let my shader know if a pixel/tile is visible or not?

sentences:
Calculate intersect point / aim point I'm working on a simple game, and I need to calculate the position to aim.

Since my math days are a bit behind me, I put together a simple example to illustrate:

So given that I know the position of the two objects, and the velocity, how do I calculate the point at which they intersect (i.e. the point to aim for)?

EDIT: To clarify, the cannon is fired at time 0, there is no waiting.

sentences: Translating Objects in Worldspace Given the worldspace coordinates of a collection of arbitrarily positioned objects, how do I translate them while preserving their relative placement? For instance, I have a table and a few bowls that are placed on top of it at (x1, y1, z1) and wish to moved them to (x2, y2, z2).

sentences:
Level and Player objects - which should contain which? I've been working on a several simple games, and I've always come to a decision point where I have to choose whether to have the Level object as an attribute of the Player class or the Player as an attribute of the Level class.

I can see arguments for both:

The Level should contain the player because it also contains every other entity. In fact it just makes sense this way: "John is in the room." It makes it a bit more difficult to move the player to a new level, however, because then each level has to pass its player object to an upcoming level.

On the other hand, it makes programming sense to me to leave the player as the top-level object that is persistent between levels, and the environment changes because the player decides to change his level and location. It becomes very easy to change levels, because all I have to do is replace the level variable on the player.

What's the most common practice here? Or better yet, is there a "right" way to architecture this relationship?

sentences:
How can I scale my UI elements to the lesser screen dimension in Unity 5? I want to create a custom mobile pad for my game. The mobile pad consists of two parts (both inside an ui canvas):

The D-Pad, which will be anchored to the bottom-left side.
The button group will be anchored to the bottom-right side.

I would like to resize the element on different resolutions, so that the element (in my case, the D-Pad is an image):

Has a size of 20% of the minimum of the width and the height.
Has pivot of x=0.5, y=0.5.
Having anchor of left-bottom, its coordinates are (15%, 15%) wrt the minimum of the width and the height.

What I tried is to use an Aspect Ratio Filter in the D-Pad image with ratio=1, but it did not work as intended (the coordinates led the image to an unexpected place).

Note: I am a n00b to Unity. I don't know whether it is right but my Canvas Scaler scales by Constant Pixel Size

These images should illustrate what I want to achieve:

What should I do to make it work like in the pictures?

Edit I attached this behavior, based on answer, to handle the change by runtime:

[RequireComponent(typeof(UI.CanvasScaler))]
class CanvasSmartScaler : MonoBehavior {
    private CanvasScaler _scaler;
    void Start() {
        _scaler=GetComponent<CanvasScaler>();
    }
    void Update() {
        //OMITTED CODE: here I set the scale mode as in the Editor but right now i am in my mobile device and cannot remember the exact lines
        if (Screen.currentResolution.width < Screen.currentResolution.height) {
            _scaler.matchWidthOrHeight=0;
        } else {
            _scaler.matchWidthOrHeight=1;
        }
    }
}

And attached that behavior to the canvas. However, for my debug exe (just for debug purposes) it always picks the 1-case regardless how do I resize the window. What am I missing?

sentences:
a flexible data structure for geometries What data structure would you use to represent meshes that are to be altered (e.g. adding or removing new faces, vertices and edges), and that have to be "studied" in different ways (e.g. finding all the triangles intersecting a certain ray, or finding all the triangles "visible" from a given point in the space)? I need to consider multiple aspects of the mesh: their geometry, their topology and spatial information.

The meshes are rather big, say 500k triangles, so I am going to use the GPU when computations are heavy.

I tried using arrays with vertices and arrays with indices, but I do not love adding and removing vertices from them.
Also, using arrays totally ignore spatial and topological information, which I may need studying the mesh. So, I thought about using custom double-linked list data structures, but I believe doing so will require me to copy the data to array buffers before going on the GPU. I also thought about using BST, but not sure it fits.

Any help is appreciated. If I have been too fuzzy and you require other information feel free to ask.

sentences:
Libgdx Back button exit the app when I press back button on android, it exits the game although I ask it to go to other screen instead. It goes to the other screen for one or two seconds then it exits.:

if((Gdx.input.isKeyPressed(Input.Keys.BACK)))
    game.setScreen(new GameOverScreen(game,4));

sentences:
Simple javascript HTML5 canvas start menu I'm currently looking for a simple and basic start screen for a game using javascript, so basically its the first function that is called and then press play which then goes into the game.

Looked online and they all seem to be advanced ones and can't seem to find any tutorials either.

sentences:
HTML5 platformer collision detection problem I'm working on a 2D platformer game, and I'm having a lot of trouble with collision detection. I've looked trough some tutorials, questions asked here and Stackoverflow, but I guess I'm just too dumb to understand what's wrong with my code.

I've wanted to make simple bounding box style collisions and ability to determine on which side of the box the collision happens, but no matter what I do, I always get some weird glitches, like the player gets stuck on the wall or the jumping is jittery. You can test the game here: Platform engine test. Arrow keys move and z = run, x = jump, c = shoot. Try to jump into the first pit and slide on the wall.

Here's the collision detection code:

function checkCollisions(a, b)
{
    if  ((a.x > b.x + b.width) ||
        (a.x + a.width < b.x) ||
        (a.y > b.y + b.height) ||
        (a.y + a.height < b.y))
    {
        return false;
    }
    else
    {
        handleCollisions(a, b);
        return true;
    }
}

function handleCollisions(a, b)
{
    var a_top = a.y,
        a_bottom = a.y + a.height,
        a_left = a.x,
        a_right = a.x + a.width,
        b_top = b.y,
        b_bottom = b.y + b.height,
        b_left = b.x,
        b_right = b.x + b.width;

        if (a_bottom + a.vy > b_top && distanceBetween(a_bottom, b_top) + a.vy < distanceBetween(a_bottom, b_bottom))
        {
            a.topCollision = true;
            a.y = b.y - a.height + 2;
            a.vy = 0;
            a.canJump = true;
        }
        else if (a_top + a.vy < b_bottom && distanceBetween(a_top, b_bottom) + a.vy < distanceBetween(a_top, b_top))
        {
            a.bottomCollision = true;
            a.y = b.y + b.height;
            a.vy = 0;
        }

        else if (a_right + a.vx > b_left && distanceBetween(a_right, b_left) < distanceBetween(a_right, b_right))
        {
            a.rightCollision = true;
            a.x = b.x - a.width - 3;
            //a.vx = 0;
        }
        else if (a_left + a.vx < b_right && distanceBetween(a_left, b_right) < distanceBetween(a_left, b_left))
        {
            a.leftCollision = true;
            a.x = b.x + b.width + 3;
            //a.vx = 0;
        }

}
function distanceBetween(a, b)
{
    return Math.abs(b-a);
}

sentences:
Collision detection with isometric tiles stored in rectangular files So I'm working with a player moving across a grid of isometric tiles. Each tile is stored in a .png file. I have a class that crops out BufferedImages from different sprite sheets and initializes them for use in my game. When I crop out a tile image, the image is cropped out like this (minus the black border):

Because the four corners of this rectangle are transparent, I'm able to tessellate the tiles perfectly. I'm now trying to implement collision detection and having a tough time. The player moves by following the mouse around. In the player's tick/update method, I am checking to see if his new position will be in a tile marked as being solid. If the tile is solid, I don't update his position so that movement doesn't occur. My problem is that when I check to see if the player is moving into a solid tile, I'm checking the entire .png image, including the transparent corners.

So, if I'm moving towards these 'stone' tiles and I mark them as being solid, the player isn't colliding with the tiles in a natural way.

In the image you see here, I've updated these stone tiles with a black border showing the edge of the BufferedImage, and I've updated my player with a red rectangle indicating his bounding box. I've marked these tiles as solid. As I approach the tiles from the left moving right, I collide with these black lines rather than the colored portion of the tile. Actually, sometimes I collide with nothing to the left of the tile, like in this image (I'm sure that's just my math somewhere.)

I considered trying to attach a Polygon object to each solid tile that covers only the visible pixels of each .png file and doing collision against the polygon instead of the whole tile. I'm currently trying to implement this and having troubles.

My question here then is, how would you implement collision detection in this scenario? Would you draw polygons in the shape of the visible portion of each BufferedImage and do collision against these polygons like this? Is there a change that I can make or a technique I can use to implement smooth collision detection? Should I use a polygon object to crop my tiles in the first place? I'm looking for the simplest way to go about this.

sentences:
How can I unpack texture data following a 16 * 8-bit pattern? Is possible to unpack texture data following a specific bit packing scheme?

I have read that texture data in HLSL can be read in as 4 floats of 32 bits each totaling 128 bits. The packing scheme I'm looking to use is 16 packing groups of 8 bits each. I am having trouble figuring out how to unpack this data without loss due to it being interpreted as floats.

sentences:
How exactly do you deconstruct the Tiled Map Editor exported tile ID? I am trying to build 2D maps with Tiled Map Editor for my game, and I export them under text format, so a tile can look like this:

1,2,3,15,2,12,2
5,23,1,6,2,3,4,6

and so on, for many rows. In this link you can see an example of a map, to get a better idea.
Now let's say I have 3 layers, each using its own tileset. The numbers in the layer represent the ID of the tile, basically the number of the tile in the sheet. If grass is the 2nd tile, then the ID is 2, and so forth.
However, as you can see in the link, different tilesets will export different IDs per layer, notice how in the object layer I can have IDs such as 81, when in fact the ID is only 1, so it adds up 80 or so.
Since I am trying to make my map system as flexible as possible, I need the real ID in order to make some calculations. How does tiled export these sort of IDs? I simply want to determine what number to substract in order to get the id, like so:

tile.id = currentid - something_strange;

sentences:
What causes polygonal twitching in older games? I'd like this answer large part to curiosity and I'd like to recreate it with our modern computers somehow.

By old games I'm referring to ps1 games. My specific example would be Megaman Legends I've not really noticed it in any other games maybe Final Fantasy 8. There probably are others.

When your looking around, vertices "lock" into different locations very twitchily. The Textures follow too. Sometimes vertices supposedly connecting to each other are in two different locations looking like one is jutting out of place.

Heres a video of the game. You have to look at about mid range to see changes is location.

https://www.youtube.com/watch?feature=player_detailpage&v=ojGrAcZw3pA#t=961s

Its probably not something uncommon to old polygonal graphics.

My only theory is its rounding floating points to the closest integer but that doesn't seem plausible to me.

[edit] PSX doesn't have floating points there goes my theory XD.

I'd like to hear anyone's theory even if they don't know. Take a stab. I'll investigate any of them myself.

sentences:
Joystick like controls in unity for mobiles How can i achieve joystick like controls on mobile?

For example i have a 2D platform game where character should keep on moving right when swiped right and held and vice versa, just like a real joystick.

I'm beginner in unity so don't know where to start. Are there any assets in the store from which i can create these controls?

sentences:
Ideas for attack damage algorithm (language irrelevant) I am working on a game and I need ideas for the damage that will be done to the enemy when your player attacks. The total amount of health that the enemy has is called enemyHealth, and has a value of 1000. You start off with a weapon that does 40 points of damage (may be changed.) The player has an attack stat that you can increase, called playerAttack. This value starts off at 1, and has a possible max value of 100 after you level it up many times and make it farther into the game. The amount of damage that the weapon does is cut and dry, and subtracts 40 points from the total 1000 points of health every time the enemy is hit. But what the playerAttack does is add to that value with a percentage. Here is the algorithm I have now. (I've taken out all of the gui, classes, etc. and given the variables very forward names)

double totalDamage = weaponDamage + (weaponDamage*(playerAttack*.05))
enemyHealth -= (int)totalDamage;

This seemed to work great for the most part. So I statrted testing some values...

//enemyHealth ALWAYS starts at 1000
weaponDamage = 50;
playerAttack = 30;

If I set these values, the amount of damage done on the enemy is 125. Seemed like a good number, so I wanted to see what would happen if the players attack was maxed out, but with the weakest starting weapon.

weaponDamage = 50;
playerAttack = 100;

the totalDamage ends up being 300, which would kill an enemy in just a few hits. Even with your attack that high, I wouldn't want the weakest weapon to be able to kill the enemy that fast. I thought about adding defense, but I feel the game will lose consistency and become unbalanced in the long run. Possibly a well designed algorithm for a weapon decrease modifier would work for lower level weapons or something like that. Just need a break from trying to figure out the best way to go about this, and maybe someone that has experience with games and keeping the leveling consistent could give me some ideas/pointers.

sentences:
How do I support multiple platform patch cycles in a client/server multiplayer game? I'm making a game with network multiplayer that will be playable with crossplay from multiple platforms. The game is written in c++ and uses regular TCP sockets for network communication. Currently the game exists on windows but ideally it will exist on ios/android/linux/mac as well. The server is a single process written to run on Ubuntu Linux. Currently, clients find the server by hard coded url which is resolved to the server IP, and a hard coded port.

This is fine as long as the clients/server are developed/shipped in perfect lockstep. If I change the client or network code in some way, I have the power to just release the client update and start running the new server version simultaneously.

The problem is that once I've released on multiple platforms, I'll never be able to ship an update to all clients at once. Additionally, old versions of the client will exist in the wild forever.

If I add a version handshake to the beginning of each connection, I could detect and deactivate multiplayer features in old clients. With this constraint, I could only operate one server for all platforms (big upside).

Delayed updates would cause a version of the game to be broken temporarily (for example the App Store could reject an update unexpectedly). If my App Store build falls behind, it would not be supported by the current server.

What simple methods exist for supporting multiple api versions when your server is a single process communicating over TCP?

What are the typical solutions to this problem? I know games like Hearthstone achieve this but I assume they have some massive server infrastructure/ops team to help with this.

sentences:
which is the best approach or algorithm to calculate real-time ranking I want to know the fastest and most efficient way to compute points and ranking in real time.

I'm doing a betting football game (a game where users try to predict the outcome of a game before it). In my country is called "Quiniela".

Players put "predictions" just before the match starts. My question is: from the moment the game starts, which is the most efficient way (not just code level but to the database and server) to calculate the ranking for the players "real time" as their predictions regarding the actual outcome of the game.

For example:

If a Team1 vs Team2 plays, the user U1 predicted that the game would end 0-0, U2 predicted the game would end 1-0, U3 predicted the game would would end 1-1.

When starting the game, the U1 would be to first in the ranking because, if the match ends like this, his prediction would be correct, or at least the most accurate.

Then the score switches to 1-0, and the user U1 would be the last of the ranking (because his prediction is not possible anymore), U2 would be the first and U3 second.

If the score changes to 1-1, U2 would go first, U3 would be second (because he guessed part of the result) and U3 last.

I thought about creating a tree of possibilities with one level (0-0 first node, with 1-0 and 0-1 as child nodes) as you change the score, changes the Ranking "temporarily" and I would keep it in cache.

Once the game is over, I keep the latest Ranking in the database.

There is a more optimal way to solve this problem? It has been proposed before and already solved? I'm using MySQL for database, PHP (Cake Php) for the server and a bunch of mobiles who ask for the ranking once in a while.

sentences:
Driver AI in racing game I'm curious how I could control cars in a racing game.

Should my AI agent control its car with commands like "throttle on 0.35, steereing wheel on 0.5 right, brake on 0.0"? Or should I rather pre-compute a curve the car sticks to, and visuals like front wheels turning are just to make everything looks consistent? Or is there any other way?

sentences:
Change the title name of a XNA window? I have tried to change the title with this source:

http://msdn.microsoft.com/en-us/library/ff966436.aspx

but this isn't working!? Help preciated!

sentences:
How do I generate a 3D race track from a spline? I want to generate a 3-dimensional race track around a spline that describes its shape.  Here's an illustrative video.

The track should be an endless tunnel that sweeps along a 3D spline, with some obstacles thrown in.  My best idea so far has been to loft a circle shape along the spline.

I would also like some pointers into how to manage the geometry i.e. how to create it from the loft operation, manage its 'lifecycle' in memory, collision and texturing.

sentences:
Can I combine 2 UnrealEngine forks? I am using Daz Gen 8 characters and clothes in my project.
After I read this I decided to use a fork of UE4 which uses Dual Quaternion Skinning.
Basically if you use Daz characters under UE4, they going to distort better if you use DQS, which UE4 doesn't support by default.
You can get the DQS modded engine from here.
I compiled it and I managed to get all my stuff from my original project to a DQS one.
No problem.
But I also need a soft body and a clothing solution in the project.
4.25 has a clothing solution and it does work fine, but there is no soft body, that I know about...
So there are a few options:

Vico Dynamics from the Marketplace
using a Flex branch of UE4
if you know any more please please let me know

Tested Vico, and it works fine for simple meshes, up to 20k poligons. Over that the editor becomes unresponsive... But this works with my modded DQS engine.
The latest version of an UE4 branch with Flex is 4.22. I could get this compiled and running.
I would like to know if I can merge the 2 repositiories (4.22 DQS and Flex) into one, and source build it...
What software or workflow do you recommend to do merge these big branches of UE4?
I guess there will be quite a few conflicts, because Flex distorts the mesh in it's own way, so does the DQS version of Unreal...

sentences:
Score system for "little bit more complex" snake game I have created snake game.
I can't think of good score system so that is is fair.

There is only one highscore list for all modes.

Player can choose any size of board
- Let's call that param "Board area", it is defined in cells. One snake segment takes one cell.

Player can choose any speed of snake
- Speed, in cells per second

I don't know how to calculate it so that score is fair for all players.

Firstly I thought of this:
score = length * speed
But is is not fair for players that reach end of board (nearly no free spaces to go, careful planing is needed to survive).

Then I thought that I need somehow award players that can survive for long in small amount of free place. The new formula looks like that:
score = (length/board size) * (length * speed)
But I still don't like it.

My score should reward players for:
Longest snake, tight turning and planning (bigger multiplier when board is full), and speed at which they are playing.

sentences:
Multimonitor Support in MonoGame How can I support multiple monitors in mono game ? As far as I know I can not override OnPreparingDeviceSettings and in GraphicsDeviceInformation class there is no DeviceName property in Adapter.

Thanks.

sentences:
Rotate a ds_grid 90 degrees in GMS2 I need a function that allows me to rotate a grid data structure an arbitrary number of times 90 degrees clockwise.
Currently it doesn't appear as though the function has any effect on the ds_grid.

Below is the code I'm currently using, the function that calls it looks like:
ds_grid_rotate_alt(global.grid, irandom(3), 10);.

/// @description rotate grid clockwise 90 degrees x times

var grid = argument0;
var turns = argument1;
var width = argument2;

var gx = 0;
var gy = 0;

if turns > 0
{
    var grid_copy = ds_grid_create(width, width);

    for (gy = 0; gx < width; gy++)
    {
        for (gx = 0; gx < width; gx++)
        {
            //grid copy
            var data = ds_grid_get(grid,gx,gy);
            ds_grid_set(grid_copy,width-gy,width-gx,data);
        }
    }
    //copy results back to origional grid
    ds_grid_copy(grid_copy,grid);
    ds_grid_destroy(grid_copy);

    turns -= 1;
    ds_grid_rotate_alt(grid,turns,width);
}

sentences:
Spatial Partitioning - How do I find the object is in the tree? I understand the structure of Spatial Partitioning Trees - BSP, Quad and Octal. You just take a space and split it into however many parts specified by your tree - BSP:2, Quad:4, Octal:8. I've written a self managing quad-tree (in Java but this shouldn't matter) before, and I had the same question I'm having now (in XNA).

How, once an object is in the tree, do I find it specifically. ie. I put the player in the tree, he updates ever frame, but unlike the other AI driven/world objects, he needs input, and his health needs to be checked every frame to see if the game is over. How do I get him out, without knowing his exact location.

My solution last time was to just leave the player out of the tree, and when I need to do collision checking, just pass in his coordinates to get the possible collisions, but I feel like this isn't using the tree the way it's supposed to be used.

Right now I'm trying to write a tree for a 3D game this time in XNA. So my second question really is which tree is better? I've heard BSP trees are the standard, but weren't oct trees written for dividing 3D spaces (Same as quad trees are for 2D)?

sentences:
Unity problems with OnTriggerStay and Input.GetKeyDown Background information

Some weeks ago, I start by creating my own platform game. You control a character, that can collect logs and should hold all the campfires on in the game.
When the user has collect more then one log, the player have to use this log to hold the fire on. So you should walk to the campfire and should press E to give the log to the fire.

Problem

What the problem momently is, is that when I press the E key, it will fired the input more then one time. This is because I use a OnTriggerStay2D function, to check every second if my Player is collide with the campfire object.

Do some search on the internet, results in people with the same problem. So one of the solutions was to create an bool and set it to true on OnTriggerEnter2D. But this isn't working for me. The same problem as before will occur.

Is there another solution to fix this conflict. When the user press the button, it should be fired ones. Below script is linked to the campfire object.

Also tried it with: if(Input.GetKeyDown(KeyCode.E)) { isTrigger = true; } and the same for GetKeyUp, but then isTrigger = false;

My current working code:

public Animator anim;
    public int campfireStatus;
    bool inTrigger = false;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update () {
        anim.SetInteger("Intensity", campfireStatus);
    }

    void OnTriggerEnter2D(Collider2D other) {
        inTrigger = true;
    }

    void OnTriggerExit2D(Collider2D other) {
        inTrigger = false;
    }

    void OnTriggerStay2D(Collider2D other) {
        // If player comes in contact with gameObject
        if (other.gameObject.tag=="Player"){
            print ("player");
            if(Input.GetKeyDown(KeyCode.E)) {
                print ("E Pressed");
                if (WoodBehaviour.count > 0) {
                    campfireStatus++;
                }
            }
        }
    }

So when the Player is collide with the campfire object AND the player pressed the E key AND you have more then one logs (this counter will be set in the WoodBehaviour script, that is linked to the player object ) than it should increase the campfireStatus with plus one.
The problem is, that the if statements will fired more then one times when pressing the E key.

sentences:
XNA 4.0: Problem with loading XML content files I'm new to XNA so hopefully my question isn't too silly. I'm trying to load content data from XML.

My XML file is placed in my Content project (the new XNA 4 thing), called "Event1.xml":

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="MyNamespace.Event">  // error on this line
    <name>1</name>
  </Asset>
</XnaContent>

My "Event" class is placed in my main project:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace MyNamespace
{
    public class Event
    {
        public string name;
    }
}

The XML file is being called by my main game class inside the LoadContent() method:

Event temp = Content.Load<Event>("Event1");

And this is the error I'm getting:

There was an error while deserializing intermediate XML. Cannot find type "MyNamespace.Event"

I think the problem is because at the time the XML is being evaluated, the Event class has not been established because one file is in my main project while the other is in my Content project (being a XNA 4.0 project and such).

I have also tried changing the build action of the xml file from compile to content; however the program would then not be able to find the file and would give this other warning:

Project item 'Event1.xml' was not built with the XNA Framework Content Pipeline. Set its Build Action property to Compile to build it.

Any suggestions are appreciated. Thanks.

sentences:
How to represent rotation quaterion to another coordinate system? I am trying to combine rotation information from two system in a VR/AR scenario, one is a computer vision solution/ visual SLAM coordinate, initializing the first frame as the world origin as position[0,0,0] and rotation[0,0,0]. the other one is a IMU coordinate, always gives the roll, yaw and pitch Euler angle with respect to the physical environment coordinate.

I think I can represent the rotation in the visual SLAM coordinate by the difference from the IMU coordinate.

In frame 0: visual SLAM system initialized, visual SLAM coordinate as origin with zero position and zero rotation; IMU gives a Quaternion: q_imu_zero, with respect to IMU coordinate.

In  frame 1: IMU gives current Quaternion: q_current; the transform from frame 0 to current: q_imu_transform: q_imu_zero(-1) * q.

Question: Can I use the q_imu_transform to rotate in the visual SLAM coordinate system?

In my experiment in Unity editor, some of the axis rotation is meshed up and always wrong. when I rotate around y axis of my device, IMU gives the right rotation in the IMU coordinate, but visual SLAM system is rotated around z axis.

sentences:
Without using a pre-built physics engine, how can I implement 3D collision detection from scratch? I want to tackle some basic 3D collision detection and was wondering how engines handle this and give you a pretty interface and make it so easy... I want to do it all myself, however.

2D collision detection is extremely simple and can be done multiple ways that even beginner programmers could think up:

When the pixels touch;
when a rectangle range is exceeded;
when a pixel object is detected near another one in a pixel-based rendering engine.

But 3D is different with one dimension, but complex in many more so... what are the general, basic understanding/examples on how 3D collision detection can be implemented?

Think two shaded, OpenGL cubes that are moved next to each other with a simple OpenGL rendering context and keyboard events.

sentences:
How to make an object oscillate left and right? I can't seem to make an object move left and right, back and forth, on room start whilst on solid ground.

Codes I used:

Step Event:

if image_index is greater than 5, then physics_apply_force (0,0,100,0) for the right

if image_index is less than 5, then physics_apply_force (0,0,-100,0) for the left

sentences:
How would I balance a multiplayer competitive game I'm looking at my first foray into developing a game, and would love to know whether you guys have any thoughts on game balancing on limited multiplayer games.

The game I have in mind involves a neutral player that has to achieve a goal, with two supporting "deity" players who are one of 'good' and 'evil' - One of the deity players would try to help the player achieve their goal, while the other would try to thwart them.

Any thoughts or pointers on how I can ensure the deities are balanced?

If you want me to expand, I will, just didn't want to give away too much of the game play before I finish it.

sentences: What considerations should I be aware of when placing an Unreal project under source control? I want to give it a try to creating a git repository from my UE4 project and uploading it to Github.com but I wonder what special considerations should I have to avoid posting sensitive information like my developer key/certificate, or avoid adding large binaries files, or temporary/intermediate files.

sentences:
'Zoning' up areas on a large tile map, as well as dungeons My game is having a map like that of Minecraft, in the way it's pseudoinfinite and randomly generated. And big. Say the user has explored a 1000x1000 zone (2D here), so that's 1,000,000 tiles.

Obviously I'm not going to be able to store it all in memory. Nor do I just want to ignore everything out of a 10 tile or whatever radius - both will nothing update (all the NPCs, perhaps reactive tiles) and I would have to work with awkward positions like 1382,12918.

So if I was to split it down into chunks or zones or whatever of say 64x64 tiles, I would have to store each tile and object's position like:

  Chunk a,b. Position x, y.

But what if I wanted dungeons and the like in my map? So a single tile that leads to maybe a 40 floor dungeon, each with an area of 40x40. I can't exactly store those in the same map.

And there's the memory side; how much could I potentially store in memory at the same time reasonably? I could do tiles by ID quite easily, and have the normal 2D array there. Or again, is there a more effective solution than having a data file of tile types? So for a 64x64..that's only going to be 20K or whatever. I'd like as much as possible surrounding to be loaded for the most realistic update. But I don't know what sort of limits I can hit without becoming memory hogging.

sentences:
Smooth out movement of the snake in a 2d Snake game I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently.
How the Snake moves
The snake is made up of a list of parts. If I want to move the snake, I simply remove one part from the back (.pop_back()) and then add a new part in the front accrding to the velocity. This works perfectly. The speed of the snake must be the same as the distance between the parts.  So if the distance is 15, the will be 15. But a speed of 15 is extremely high, so I need to only update the snake every few frames or use sf::Sleep(). Since the snake moves such a high distance every frame, the movement doesn't look smooth at all. And since the speed must be equal to the distance between the parts, reducing the speed doesn't work too. How can I come about tackling this?

sentences:
Object outlining, stencil is not working WebGL I can't seem to figure out my problem with stencil buffer in object outlining algo.

function init() {
   ...
   gl.enable(gl.STENCIL_TEST);
   gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE);
   ...
}

var mscaled = [];     // scaled model matrix of a cube
function render() {
   gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);

    gl.stencilFunc(gl.ALWAYS, 1, 0xFF);
    gl.stencilMask(0xFF);
     // use program1
     // set attrib pointers
     // bind cube's ebo buffer
     gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);

     gl.stencilFunc(gl.NOTEQUAL, 1, 0xFF);
     gl.stencilMask(0x00);

      // set scaled model matrix
      mat4.fromRotationTranslationScale(mscaled, cube.rotation, cube.translation, vec3.fromValues(1.1, 1.1, 1.1));

      // use program2
      // set attrib pointers
      // bind cube's ebo buffer
      gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);
}

And it just draws the whole second cube on top of the first, like there's no stencil test. I've tested with up-scale and down-scale.

the red cube should be the outliner. In the first image it is scaled up - but WebGL draws it just on top of the first one, in the second image it is scaled down - ideally it shouldn't been even drawn due to stencil test (of course, depth test is disabled in the case of a second image)

sentences:
Hierachy organisational methodology in Unity I'm just getting into Unity, so I do not know if my system of organisation will have any negative consequences.

I intend to store my project files and assets under an assets directory, then into scripts and such, as is commonplace. For the hierarchy I intend to have a top level empty object titled something like "Hierarchy", under which all objects will be children.

I am also thinking that I will further subdivide into logical and physical objects, putting objects that do not have components on them but have a physical space in the game (not including transforms) under the former, and anything with a physical presence under the latter (lights, player etc).

The main reason is so that I know where to look, based on functionality. I can also use alt-click to close all objects at once. I find this helpful for navigating the hierarchy.

Is this a bad plan?

sentences:
How do I find the name of the current audio clip being played? I have a title scene and a credits scene that use the same music. When I start my game the title scene music plays, and I have my game set up so the audio manager is not destroyed on load. When I enter my credits scene I do not instruct any new music to play, but each time I reload my title scene the title music restarts because a script in the scene tells it do so.

How can I get the name of the current audio track so that I will only play audio if it differs from what's currently being played?

This is my "LevelMaster" script which is responsible for handling the audio in each scene.

public class LevelMaster : MonoBehaviour
{
private AudioManager AudioManager;

[SerializeField]
private string trackName;

private void Start()
{
    AudioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
    AudioManager.Play(trackName);
}

public void PlaySound(string soundName)
{
    AudioManager.Play(soundName);
}

public void StopSound(string soundName)
{
    AudioManager.Stop(soundName);
}

sentences: How to make it so my cursor is not behind the UI? My cursor keeps going behind the UI how to make it go above?

sentences:
Is restitution the wrong value, to make bouncing objects? I have been experimenting with Bullet. Specifically I was modifying the Hello World tutorial, to make the ball bouncing.

The first thing I noticed is, that I need to set  both the restitution of the ball and the ground above 0 to make the ball bouncing.

For a simple setup, with two objects, this seems fine. However, for larger simulations I fell like, restitution is the wrong way, to make bouncy objects. Here are my reasons:

Reason 1

Consider three objects: ball, box and ground. ground is just some plane. box is a box, which is not supposed to be very bouncy, thus its restitution is near or equals zero. ball is supposed to be bouncy, so I give it a restitution of 0.5.

If now the ball collides with the ground, it only actually bounces, if the ground also has a restitution higher than 0, so let's give it a restitution of 1. So our ball is bouncy as expected, when colliding with the ground.

When it collides with box it won't bounce, because the box has a restitution of 0. If we give box a higher restitution, the ball will bounce from it. But now we have a different problem. If the box collides with the ground, it will bounce off, but it isn't supposed to.

I see no way, with restitution only, to make this scenario work.

 Reason 2

Restitution describes the amount of energy, that remains as impulse after a collision. The rest of the energy goes into deforming the colliding bodies and other side effects.

If we now look at a typical bouncy object, like a rubber ball, we see that they are easily deformable (compared to less bouncy objects). When the rubber ball collides with something, it takes up energy from the collision, by being deformed and then goes back into its original form, thus releasing the energy taken up during the collision and bouncing back off.

 The solution (?)

Reason 2 suggests, that a bouncy ball (like a rubber ball) shouldn't have a restitution close to 1, but rather be elastic (thus being deformed and then going back to its original form), to model bouncy objects as expected.

The way to model this in Bullet, would be a soft-body and I think it would be the way to go, in such a scenario.

 The actual question

The text above looks more like an answer than a question, so here's the question I'm trying to ask:

I'm really unsure, whether this is right. Are soft-bodies really the better way for bouncy stuff or am I just mistaking the principle of restitution?

sentences:
OrthographicCamera and viewport not giving expected effect I recently asked a question about this area that I think was too broad, so I will try a new approach.

I have the following code I am experimenting with:

        batch = new SpriteBatch();
        texture = new Texture(Gdx.files.internal("bg_test.png"));

        sprite = new Sprite(texture);
        sprite.setSize(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);

        myGameWidth = Gdx.graphics.getWidth();
        myGameHeight = Gdx.graphics.getHeight();

        float aspectRatio = (float)myGameHeight / (float) myGameWidth;

        cam = new OrthographicCamera();
        viewport = new StretchViewport(GAME_WORLD_WIDTH * aspectRatio, GAME_WORLD_HEIGHT * aspectRatio, cam);
        viewport.apply();
        cam.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);

Now I thought StretchViewport was supposed to stretch the image across whatever screen you tried, however I get this result in desktop when I try with config.height=800, config.width=400:

Now if I change the following line:

viewport = new StretchViewport(GAME_WORLD_WIDTH * aspectRatio, GAME_WORLD_HEIGHT * aspectRatio, cam);

to:

viewport = new StretchViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, cam);

(I remove aspect ratio) This makes the image fill the screen the way I thought StretchViewport should, but I dont want to ignore the aspect ratio.

What makes it even weirder is that this only happens when I run desktop heigt>width(portrait), if I change it to the opposite width>height(landscape) then the image fills the screen too much, so the edges of the image go outside the screen :S

Am I missing something here? Is my aspectRatio wrong? I want to make sure my games will scale nicely across devices before I really get started with libgdx, right now all different viewports show me the same result with this padding.

I really can't figure this out, I get the behaviour (stretch) I want when I dont use aspectratio, but everywhere I read it tells me to use aspectratio. I really just wanna solve this so I can start with the fun stuff  ^^

sentences: Serverside libs/examples for html5 WebSocket in .net? Hey guys, I wanted to know what libraries or examples exist for WebSockets in .NET

sentences:
How can I convert a string to quaternion? private GameObject GetObjectFromFile(string path)
    {
        GameObject newobj = new GameObject();
        string[] text = new string[3];
        if (File.Exists(path))
        {
            text = File.ReadAllLines(path);
            foreach (string s in text)
            {

                    text = s.Split(':');
                    break;

            }
            var parent = text[0];

            var localPosition = StringToVector3(text[1]);
            var localRotation =StringToVector3(text[2]);
            var localScale = StringToVector3(text[3]);

            newobj.transform.localPosition = localPosition;
            newobj.transform.localRotation = localRotation;
            newobj.transform.localScale = localScale;
        }

        return newobj;
    }

    public static Vector3 StringToVector3(string sVector)
    {
        // Remove the parentheses
        if (sVector.StartsWith("(") && sVector.EndsWith(")"))
        {
            sVector = sVector.Substring(1, sVector.Length - 2);
        }

        // split the items
        string[] sArray = sVector.Split(',');

        // store as a Vector3
        Vector3 result = new Vector3(
            float.Parse(sArray[0]),
            float.Parse(sArray[1]),
            float.Parse(sArray[2]));

        return result;
    }

It's converting fine the localPosition and localScale but the localRotation is a quaternion and not vector3.

This is the text file format I'm reading from:

Main Camera (UnityEngine.Transform):(297.7, 5.1, 228.5):(0.0, 0.0, 0.0, 1.0):(1.0, 1.0, 1.0)

The part (0.0, 0.0, 0.0, 1.0) is the rotation.

sentences:
Unit turning in navmesh-based pathfinding I'm working on an RTS game, and I'm using navmeshes for unit pathfinding. I do know how to find a general path within a navmesh, but how do you determine if the unit have enough space to turn?

I have units of different shapes (mostly rectangles with different dimensions), and with different turn radii. Additionally some of units can turn in place, and some can move in reverse.

So, how to find a path which unit can follow, considering that it can not rotate easily?

sentences:
The practical cost of swapping effects I use XNA for my projects and on those forums I sometimes see references to the fact that swapping an effect for a mesh has a relatively high cost, which surprises me as I thought to swap an effect was simply a case of copying the replacement shader program to the GPU along with appropriate parameters.

I wondered if someone could explain exactly what is costly about this process? And put, if possible, 'relatively' into context?

For example say I wanted to use a short shader to help with picking, I would:

Change the effect on every object, calculting a unique color to identify it and providing it to the shader.
Draw all the objects to a render target in memory.
Get the color from the target and use it to look up the selected object.

What portion of the total time taken to complete that process would be spent swapping the shaders?
My instincts would say that rendering the scene again, no matter how simple the shader, would be an order of magnitude slower than any other part of the process so why all the concern over effects?

sentences:
Flixel: Is it possible to use a spritesheet for FlxButtonPlus? I'm trying to change the graphic on a FlxButtonPlus. I want to get the graphic from a spritesheet. However, if I try the ' regular' way (make an animation and play it), it refuses to use just the part of the spritesheet I want and instead insists on showing the complete spritesheet.

Creator of the sprite:

public function ButtonSprite(c:int){
    loadGraphic(ImgButtons, true, false, 30, 80);
    addAnimation("static", [c]);
    play("static");
}

How I try to add it to the button:

currentButton = new FlxButtonPlus(30, 80, playLevel, [0], "Unlimited", buttonWidth * 3, buttonHeight);
var sprite = new ButtonSprite(1);
currentButton.loadGraphic(sprite, sprite);

Thanks!

sentences:
What is the logic beyond cube collisions? I am trying to simulate a colliding of two cubes , I actually tried and read a lot for many days but i did not get the idea beyond it,I know how to detect when they collide.

Maybe my question is divided for many aspects, How to detect rotation and movement of these cubes after colliding , What is status of two cubes would be ?

Sorry if was not clear or dumb, I would thankful if you could help

sentences:
Is it a terrible practice to NOT initialize an object in its constructor? I'm currently working on my own game engine, more precisely on the resources management part.

For now, most of my assets inherits of the following - simplified - class:

class   Asset
{
public:
    Asset(const char* file);
    virtual ~Asset();

    virtual void    load() = 0;
    virtual void    unload() = 0;
}

As you can guess, the constructor and destructor do almost nothing, while load and unload functions respectively initialize and delete all asset's data.

I'm doing it because I don't want to load a file each time I create an asset object, but instead do it on a method of my AssetsManager that would load everything needed.
But I still want to be able to prepare other objects using these unloaded assets. For instance, an unloaded texture can be set on a mesh material. This material just won't be able to be rendered if the texture is not loaded.

The problem is, I heard this is a terrible way to code a class structure, especially from programmers supporting the RAII idiom.

Is it a correct way to handle assets? If not, what would be better for this class?

sentences:
Are browser games still profitable? Back in middle school I would play games like bowman, kitten cannon, sniper assassin, etc. On sites like addictinggames.com, or crazymonkeygames.com.

I know these games would have ads run on them, which I assume was profitable for the developer. Especially titles like those that probably have 8 figure play-stats across the internet.

I was wondering if anyone has any experience with this market, and could provide some insight as to how it is doing now, and what is used to make these games: Is it financially worth developing a browser game? Do I have to use flash to be accepted on these sites?

Back then they were all flash games, but there has been a large uprising of javascript game engines since then (which I am much more familiar with.) But I'm not sure if that's something these sites would accept.

sentences:
Component based architecture - Rendering approach? I'm planning to use a component based architecture for a new 3D game engine I plan to work on, however I don't know how to approach the rendering side of things.

I can see two options here:

Every renderable game object has a RenderComponent, which stores a mesh and OpenGL-specific stuff like VBOs and VAOs. When the time comes to have update() called, it will use OpenGL to render itself.
Every renderable game object has a MeshComponent. When it's time to render, the Renderer would go through a list of all MeshComponents, extract vertex and material information, and render it.

Which option would be most flexible if I want to implement things like post-processing (bloom, motion blur), skyboxes, LOD, blending/transparency or implementing a deferred renderer?

sentences:
Need insight on item system I have made an item database that takes keyed values from a database script then assigns them to an item class, then stores that item class in a List variable.

This works fine but I have come across something that I see as potentially troublesome. For every unique effect, I have to make another keyed value and apply it to all the existing collections in the database.

I want to make it such that an item can hold only 6 special values(physical damage, magical damage, armor, heal, etc) but with this method, I don't know how to tell the script which value goes to which special effect.

Below is a template item from the database file. I use GRFON for this.
See how I have written down all the possible damage types but for special values, I made 7 only with 6 of them being generic.
The damage types can easily be assigned but when it comes to the special values, I have a hard time assigning magnitudes to special effects.

{
iD: 0
name: Template
category: Null
type: Null
subtype: Null
values: {
    physical: 0, magical: 0, hot: 0, cold: 0, electric: 0, dark: 0 }
specialvals: {
    spMag1: 0, spMag2: 0, spMag3: 0, spMag4: 0, spMag5: 0, spMag6: 0, spDuration: 0 }
special: none .
properties: {
    mass: 0, durability: 0, maxdurability: 0, charge: 0, maxcharge: 0, accuracy: 0, useRate: 0, reloadRate: 0, range: 0 }
description: This is a template item.
equippable: 0
usable: 0
stackable: 0
maxStacks: 1
count: 0
rarity: 0
price: 0
uID: template
}

sentences:
XNA 3D Unable to Position Bounding Sphere I have a collision method that seems like it would work, and it does, but the bounding sphere is always at 0, 0, 0. How do I fix this? Any more code and or details are available upon request.
BoundingSphere CreateBoundingSphereForModel(Model model, Matrix worldMatrix)
{
    Matrix[] boneTransforms = new Matrix[this.model.Bones.Count];
    this.model.CopyAbsoluteBoneTransformsTo(boneTransforms);

    BoundingSphere boundingSphere = new BoundingSphere();
    BoundingSphere meshSphere;

    for (int i = 0; i < model.Meshes.Count; i++)
    {
        meshSphere = model.Meshes[i].BoundingSphere.Transform(boneTransforms[i]);
        boundingSphere = BoundingSphere.CreateMerged(boundingSphere, meshSphere);
}
return boundingSphere.Transform(worldMatrix);
}

bool IsCollision2(Model model1, Matrix world1, Model model2, Matrix world2)
{
    BoundingSphere bs1 = CreateBoundingSphereForModel(model1, world1);
    BoundingSphere bs2 = CreateBoundingSphereForModel(model2, world2);

if (bs1.Intersects(bs2))
    return true;

return false;
}

private bool checkPlayerCollision(Model model1, Matrix world1)
{
    //Make player location matrix
    Vector3 playloc = new Vector3(X, Y, Z);
    //Make ship1 matrix
    Matrix ship1WorldMatrix = Matrix.CreateTranslation(ship1loc) * Matrix.CreateScale(0.1f);
//Make ship2 matrix
Matrix ship2WorldMatrix = Matrix.CreateTranslation(ship2loc) * Matrix.CreateScale(0.1f);
//Check for collision with ship1
if (IsCollision2(model1, world1, model, ship1WorldMatrix)) return true;
//Check for collision with ship2
if (IsCollision2(model1, world1, model, ship2WorldMatrix)) return true;
return false;
}

sentences:
Raycast can't hit my player I have been trying for the past 5 hours to get this to work.

So i have an enemy that has the following script:

        private bool Look(StateController controller)
    {
        Debug.DrawRay(controller.transform.TransformPoint(controller.mCombatant._CombatOffset),  controller.transform.TransformDirection(Vector3.forward) * 800,
            Color.green);
        RaycastHit hit;

        if (Physics.SphereCast(controller.transform.TransformPoint(controller.mCombatant._CombatOffset), 360,
                controller.transform.TransformDirection(Vector3.forward), out hit, 800)
            && hit.collider.CompareTag("Player"))
        {
            controller.mCombatant.Target = hit.transform;
            controller.chaseTarget = hit.transform;
            return true;
        }
        else
        {
            return false;
        }

        return false;
    }

Now both my enemy (the one this script is attached to) and my player are on the default layer

Here are some images that shows the gameview:

As you can see from the above picture The "Ray" should hit the player:

My Player prefab looks like this:

So my question is what have i done wrong?

EDIT

So after alot of time i managed to make the following code work (however its a normal raycast :( )

    RaycastHit hit;

    if (Physics.Raycast(controller.transform.position, controller.transform.forward, out hit) &&
        hit.collider.CompareTag("Player"))
    {
        var g = 0;
    }

This is good but not good enough since i want the vision of my enemy to be more than a straight line :(

sentences:
How to serialize animation state? In Unity, I have an Animator on a character.
Upon saving/loading the game, I want to preserve the pose and animation state the character is in.
However, I can see no way to read/write all the data from the Animator/Animation Controller in such a way that I can store it in and retrieve it from a binary file.
Is there a non-obvious way to achieve this?

sentences:
How to sync a LineRenderer in a multiplayer game? After a lot of searching online, I have come here as a last resort for my problem.

The question says it all. How to sync a LineRenderer?

One answer I found was to use a ClientRpc. I tried it with no effect.

Below is the snippet of my code,

    IEnumerator laserBeam()// This is called through another method on the click of a button
        {
            Beam = GetComponent<LineRenderer> ();
            Beam.SetVertexCount (2);
            Beam.material = BeamMaterial;
            Beam.SetWidth (0.07f, 0.07f);
            Beam.enabled = true;
            Beam.SetPosition (0, gameObject.transform.position);
            Beam.SetPosition (1, target.position);
            RpcDrawLines (gameObject, target.position, true);
            yield return new WaitForSeconds (1.0f);
            Beam.enabled = false;
            RpcDrawLines (gameObject, target.position, false);
        }

    [ClientRpc]
    public void RpcDrawLines(GameObject start, Vector3 end, bool isOn)
    {
        LineRenderer beam = start.GetComponent<LineRenderer> ();
        if (isOn) {
            beam.SetVertexCount (2);
            beam.material = BeamMaterial;
            beam.SetWidth (0.07f, 0.07f);
            beam.enabled = true;
            beam.SetPosition (0, start.transform.position);
            beam.SetPosition (1, end);
        }
        else
            {
                beam.enabled = false;
            }
        }

So, this is the code. Works fine on the Server but no effect in the client. I know I am doing something wrong in the client rpc. But I have no idea what it is. Any way of help would be appreciated. Thanks

Note: I am using UNET

sentences:
How can I scale a color component by Time.deltaTime and still fit it into a byte? I am confused about this issue, and I can't find why I get this and how to fix it properly from  the Google searches I've tried.

This is a short version of my code:

     byte redtarget = 70;
     byte greentarget = 222;
     byte bluetarget = 255;
     byte opacitytarget = 1;
     byte redcurrent = 0;
     byte greencurrent = 0;
     byte bluecurrent = 0;
     void OnMouseOver() {
        redcurrent = redcurrent + redtarget * Time.deltaTime;
        greencurrent = greencurrent + greentarget * Time.deltaTime;
        bluecurrent = bluecurrent + bluetarget * Time.deltaTime;
    if(redcurrent >= redtarget) {
        redcurrent = redtarget;
    }
    if(greencurrent >= greentarget) {
        greencurrent = greentarget;
    }
    if(bluecurrent >= bluetarget) {
        bluecurrent = bluetarget;
    }
    theobject.GetComponent<Renderer>().material.SetColor("_EmissionColor",new Color32(redcurrent,greencurrent,bluecurrent,opacitytarget)) ;
     }

Please ignore the other errors that could have been introduced when I copy + pasted it to here.

And this is the error I get:

As you see the error, "cannot implicit convert type float to byte", the problem is caused by Time.deltaTime that returns a float value, and I need a byte due to Color32.

Is there any way to turn Time.deltaTime to byte? Or should I use another type of color that use floating point numbers?

I'm a beginner with Unity so I'm sorry if this has already been asked somewhere; as I said, I can't find it on the Internet.

sentences:
Unity3D and Texture2D. GetPixel returns wrong values I'm trying to use Texture2D set and get colors, but I encountered a strange behavior.
Here's the code to reproduce it:

Texture2D tex = new Texture2D(2,2, TextureFormat.RGBA32 ,false);

Color col = new Color(1.0f,0.5f,1.0f,0.5f); //col values: 1.00, 0.500, 1.00, 0.500
tex.setPixel(0,0,col);
Color colDebug = tex.getPixel(0,0);  //col values: 1.00, 0.502, 1.00, 0.502

The Color retrieved with getPixel is different from the Color set before.
I initially thought about float approximation, but when inspectin col the value stored are correct, so can't be that reason.

It sounds weird even a sampling error because the getValue returns a value really similar that not seems to be interpolated with anything else.
Anyway I tried even to add these lines after building the texture but nothing change:

this.tex.filterMode = FilterMode.Point;
this.tex.wrapMode = TextureWrapMode.Clamp;
this.tex.anisoLevel = 1;

What's my mistake? What am I missing?

In addition to that. I'm using tex to store Rect coordinates returned from atlas generation, in order to be able of retriving the correct uv coordinate of an atlas inside a shader. Is this a right way to go?

sentences:
Is there a way to export 3D objects with animation from Blender or any other app into OpenGL ES 1.1 code? The problem is that all the examples I've found are obsolete or iOS/Android specific and not "pure" OpenGL ES 1.1.

If anyone can provide me with a good example/tutorial/book it would be very much appreciated!

Thank you!

sentences: making an object follow a path libgdx I am making a game that has objects that shoot other objects. I need the enemies to follow a path. The easiest way I can think of doing this is by having an array of coordinates and they move between them. But when I make a curve in the path, I don't want to have to put in 100 coordinates. There must be a better way.

sentences:
Cannot use sprite sheet to add texture to RawImage? I am basically trying to recreate this sample image

from this sprite sheet

(Source)

I split the sprite sheet in the sprite editor of unity, now I want to use the top left texture for ground. But when I add UI->Raw Image, I cannot add the split texture to the texture source. How do I add it as a texture? In the source it does not show the split assets but the full sprite sheet.

How do I add this one single texture? That I have already split in the unity sprite editor.

sentences:
Behavior Trees or GOAP for Rimworld-like game? I am currently making a Rimworld-like game. For now, it is identical in appearance, how the map works and how the pawns (colonists) are supposed to function.
Core world-generation logic and A* pathfinding is done, so my next step is to implement AI.
The question - for a game such as Rimworld (since the original author of the game never mentioned what sort of technology he used), is it preferable to use Behavior Trees or Goal Oriented Action Planning AI methods?
I use Unity and have found assets for both of the technologies:
GOAP
Behavior Trees
I am expecting large map sizes, anywhere from 200x200 to 400x400, and an AI agent might have to take a lot of things into consideration (his environment, the position of his allies and enemies, possibly nearby items and structures).
I am leaning towards GOAP because even though it seems harder to implement at first, it seems easier to maintain later, because the agents figure out stuff on their own based on the information they are given, so I won't have to hard-code every single action or pattern (please correct me if this is wrong.) I also have no experience with either of the technologies so this might be something to take into account, but I am willing to learn.
Any suggestions, comments or ideas are much appreciated and I'm open for discussion.

sentences:
How can I discourage camping while still supporting a "sniper" style of play? I am trying to add features into a third person shooter that suit a sniper style of play, in addition to the current rush/deathmatch style it was designed for. The current gameplay is similar in style to Gears of War and Battlefield, perhaps similar to Call of Duty in terms of combat ranges but a little slower paced. The levels are similar in size to large COD maps, or medium Battlefield maps.

Two things which I was planning to add includes some long sight lines and also some "sniper nests". I am concerned though because these two features can open the door to a lot of camping. Sniping and camping are not the same things in my opinion, but it can be easy for campers to abuse such features for easy gain, when they were intended to promote tactical sniper use. That said, I don't believe in blaming the flaws of a game on a player's choice of play style.

Sniper: Uses long range rifles, may stay in a specific spot that is tactically advantageous at the time, but knows how to move to other locations good for sniping. Provides spotting and suppression for more offensive/rush style team members.

Camper: May use any weapon, always stays in the one spot and waits for players to pass by, leading to easy low risk kills. Follows the same strategy regardless of what is happening in the game/match. Is more focussed on own performance as opposed to supporting team members.

So, I am trying to think of some ways in which to try to discourage camping while still allowing legitimate sniper play and preserving the original rush gameplay.

sentences:
One Android app, dynamic load several Unity games I'm a newbie in this unity world, exciting about everything in it.

Days ago I came up with this idea:

One day someone finds this android app, naming "Blahblah Game Engine" or anything else. This app has to be very small, containing only some simple activity and Unity runtime, without further resources related to any specific game.
He installs it and sees an android activity, maybe a webview, showing a list of unity games the server currently hosting, produced by the very same Blahblah company.
Then he clicks on one and this "Blahblah Game Engine" loads the game build via network, starts an Unity activity, without prompting an installing dialog.
He can exit the current game whenever he likes, returns to the previous game list, and plays another, all working well in one app's lifetime.

In a word, the user experience is very much like how we play games on www.kongregate.com with pc browsers: light-weight app, mutiple games in one list, all loads via network, playing right away and installing-less.

Any game that listed in this app should not be installed as a standalone android app, it should be part of the "Blahblah Game Engine", stored as a file inside data folder of "Blahblah Game Engine", run as an activity of "Blahblah Game Engine".

Is it possible with Unity 5, both technically and legally? If I were to start this "Blahblah Game Engine" project, should I choose Unity 5 personal or pro licence?

sentences:
How do I play music at half speed? I'd like to slowdown music playback, say at half speed. I'm currently using SDLmixer. I assume I'd need to tell SDL that I have a 44KHz music and want to stream it at 22KHz, but when I pass in 22Khz it seems it re-samples my audio and plays at normal speed.

Does anyone know how to do that, or any lib that supports it? I'm looking for free libs that allow me a commercial license (so no FMOD)

Thanks in advance.

sentences: ATI driver bug and rendering to a texture 2d array in OpenGL I am trying to render to a texture2Darray in OpenGL, with a similar setup as descriped in this post. My question is, if anyone has gotten this to work on ATI hardware? Or is there still a bug in the driver, preventing multi layered rendering? The bug is also mentioned in the forum post.

sentences:
Change rigidbodys default height from floor? I am new to unity and I have a few questions:
There is a mesh that has a rigidbody and a box collider that I placed on the scene.
I also added a generic terrain to the scene from the 3D objects menu.
When I put the mesh at a certain height and it drops I notice that it always stops at Y = 0.500000.
How do I change this default value? What controls this? For example, does unity have it so that when any other type of collider hits the terraincollider the other collider automatically updates the rigidbody to be 0.50000 above it and this only happens when it hits a terrain collider?
If this is the case, Is this causing a collision every frame and adjusting it to 0.50000 every frame so it doesnt fall through?
Finally, assuming that the Y = 0.50000 value above the ground cannot be changed, if I wanted something to "hoover" above the ground, would I always need to take that the maximum amount that I can get to the ground is Y = 0.500000?

sentences:
How to implement weighted blended order independent transparency in OpenGL? I want to implement weighted blended OIT in my C++ OpenGL 3D game, but I didn't find any C++ examples about weighted blended order independent transparency.

Paper

How to clear accumTexture(framebuffer attachment) to vec4(0)?
How to clear revealageTexture(framebuffer attachment) to float(1)?

sentences:
What backwards compatibility to specify for an app for iOS and Android? I'm having an app built, I'm not a programmer and I dont know exactly what to specify.

I want it to work on iPhones and iPads and iPod touches and also on Android devices - tablets as well as smartphones, and the Kindle Fire.

What backwards compatibility do I need to specify, at a sensible level?

sentences: How do i draw a ray in unity So i am trying to scrap together something for vr in which the locomotion is about the player holding the direction where he wants to go to(basically planning what he is going to do)while holding down the button a ray is beeing drawn and when the player lets go the character moves until he reaches the end of the ray i tried looking up something but couldnt find anything regarding something like this

sentences:
How to fold a view from 2 3D cameras in Unity? I need to combine view from 2 or more 3D static cameras. Let's say I have 3 humans standing in line side by side.

The first camera is viewing the left person and the left half of the middle person.
The second camera is viewing the person on the right and the right half of the middle person.

Now I need to see the whole middle person.

Any ideas how I can do this?

I don't need to see code or some finished implementation, I just need some ideas, because I can not find anything on this.

sentences:
Why it isn't possible to get a progress in SceneManager.LoadSceneAsync between 0.0 and 0.9? I am trying to understand why does SceneManager.LoadSceneAsync progress always jumps from 0.0 to 0.9, no matter how big a scene can be.

To try trigger smoother progress of the scene being loaded, I've tried the following:

Generate a large scene from an EditorWindow, containing tens of thousands of objects referencing thousands of assets. Loading this scene didn't produce the intended behavior, rather, it ended up being exactly the same (jumps from 0.0 to 0.9) but with a huge lag at the end since there are many objects.

According this behavior, I am now considering that the supposed asynchronicity in SceneManager.LoadSceneAsync is just about the loading of the scene file itself, not processing its content for being usable by Unity.

Is this correct?

An example on how to load a large scene and report its progress would be appreciated :)

sentences: hosting a windows game on a linux server there! I am currently working on a game on Unreal 4, and although im still in early production(barely any code written, mostly visual assets at this point), i want to ask this now, so that i know how to organize my work schedule. If the game it self is running on windows, can the games multiplayer server be on a linux machine? If possible will there be any complications during coding or setup that i need to look into? would very much apreciate any help. :)

sentences:
GLSL Shader compiles, but source is empty I'm trying to compile a GLSL shader, to which I use the following code.

Initialization

SDL_Window* boringInitStuff(){
    SDL_Init(SDL_INIT_VIDEO);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    Uint32 windowFlags = SDL_WINDOW_OPENGL;
    SDL_Window* sdlWindow = SDL_CreateWindow("Boooring", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, windowFlags);

    SDL_GL_CreateContext(sdlWindow);

    glewExperimental = GL_TRUE;
    glewInit();

    return sdlWindow;
}

File parser

void readFile(std::string path, std::string& data){
    std::ifstream f(path.c_str(), std::ios::binary);
    data.assign((std::istreambuf_iterator<char>(f)),
                (std::istreambuf_iterator<char>()));
}

Main

int main(int argv, char** args) {
    SDL_Window* sdlWindow = boringInitStuff();

    std::string buffer;
    readFile("./compile_test.vert", buffer);
    const char* cBuffer = buffer.c_str();

    GLuint shaderID = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shaderID, 1, &cBuffer, nullptr);
    glCompileShader(shaderID);

    while(!SDL_QuitRequested()){
        SDL_GL_SwapWindow(sdlWindow);
    }

    return 0;
}

But when I try to inspect the source code in gDEBugger, the source code is gone. Linking of course doesn't work aswell. The weird thing is, that the compilation error checking works.
EDIT: When I copy & paste the main part into another opengl project, it works.

sentences:
How do I sync entity ids with the server and client? I'm continuing my experimentation with entity component design by making a multiplayer space/trading/combat game with python and panda3d. My component system is a simple version of java's artimis. The entity id is stored in a simple list with it's position as its id. Components are stored in a second list of dictionaries with the position as the entity id. Components are then mapped in a {Class: instance} dictionary.

The client will only know about entities near it's local space. Entities to be networked will have a ClientComponent which tracks what clients that object is broadcasting to. The server and client sends updates with the entity id of the object being acted on, then the action type, followed by the relevant data and yes, the server will check if it is a valid action by the client. The client needs to have a local copy of the relevant entities and components but I am running into issues on how to set this up.

My initial reaction is to just use the entity id's from the server on a client. The client will probably need its own entities for elements like the UI which can interfere with a future entity from a server. I could reserve the first 64-128ish entities for client local use only, but that seems very awkward
Next though was to have the client generate the entity ids locally and have a map of client vs server entity ids. The problem here is that some components will have an id of what entity owns it, which can make the mapping system fall apart and hard to debug.

Here are my two questions. Is there a better way to set up the network protocol where I wont run into this issue. If not, what is a decent solution for the client to know the server's entity ids.

sentences:
Unity2D - Horizontal Scaling to Support Various Aspect Ratios? I am trying to work out how to support various resolutions for my Android game. I have come up with a solution, but do not know how to implement it.

Automatically, I am told that Unity vertically scales the screen to match the screen, leaving more room at the sides. How can I change this behaviour? I am hoping to shrunk the game down till it fits horizontally, and filling it the background above and below with more decorative features. How can I achieve this?

I'm sorry if there is an obvious answer, I'm quite new working with the Unity UI system.

If it makes it any easier, my game is heavily based on UI, and is locked in landscape.

BIG EDIT: I completely rephrased this question because it was so broad and messy.

sentences:
How to convert coordinates between world coordinates and screen coordinates I am using a tilemap in which I have square tiles.
Knowing that, the size of the screen and the player position(in world coordinates) how I convert between this systems? Is there any formula?

EDIT:
For example:
The top left corner is (0,0)
player position in tiles: (ScreenX / 2, ScreenY / 2)
player position in screen: always (0, 0)
grass tile position in tiles: (Gx, Gy)

Now the question is: how can I get the screen coordinates for the grass tile?

sentences:
Conceptual question regarding Belief-Desire-Intent agent I've been researching the Belief-Desire-Intent model and the way they used it in the original Black and White Game(which is the same, but they also defined decision trees as opinions).

I have a question about the distinction between opinion and belief.

From what I understand, beliefs are linked lists in the form of attribute: value.

So let's say a tree would be something like:
Condition: Inanimate
Type: Plant

So let's say I try to apply the command cut on it and the npc cuts down the tree in like 2 turns, by doing 50 damage each turn. So the newly formed belief is that the hp of a that tree is more than 50.

From what I understand, that this is now a newly formed belief, so the new belief about the tree would be:
Condition: Inanimate
Health: >50
Type: Plant

What about the fact that the npc now knows it takes 2 turns to cut down the tree, is that now a newly formed belief or an opinion? If it's not, what kind of opinion could be formed out of that?

Help from anyone who's dealt with this would be appreciated as I'm finding it hard to find open source code examples of this.

sentences:
No output to screen using Multiple Render Targets and multisampling I'm having a little trouble with XNA, but I doubt it's specific to the framework.

I draw a few 3d models to 1 rendertarget with multisampling turned on, and it works fine. If I draw the same scene to 2 rendertargets (of course the second one gets a different output (configured this in HLSL shaders)) with multisampling turned on, I get absolutely no output. Nothing. Blank. Also, when I render to both outputs but turn off multisampling, it works perfectly (but looks hideous due to a lack of antialiasing).

The strange thing is: This happens on my desktop (Nvidia GTX 560 Ti), but not on my laptop (Intel HD Graphics 4000, which sits on the CPU). On my laptop, it outputs just fine to both rendertargets and multisampling turned on.

Can anybody explain what could be wrong?  I won't copy all my code here but just to clarify:

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents)
device.SetRenderTargets(RT_Scene,RT_Light)
'Draw

Works but looks hideous

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
device.SetRenderTarget(RT_Scene)
'Draw

Works but obviously only draws to one rendertarget

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
device.SetRenderTargets(RT_Scene,RT_Light)
'Draw

Works on my laptop, but not on my desktop.

Again, to clarify: The top picture is what my laptop shows (with multisampling and multiple render targets), and the bottom picture is what my desktop shows with the same settings:

sentences:
GetContactList stops reporting collisions on welded bodies I have some strange problem with my game which uses Box2D as physics engine and I'm out of ideas on what I can do to solve it.

My game is a class assignment where I need to build a simple game where the main character moves in a 2D environment while square blocks comes from below him. Each time a collision occurs, that block is attached to the character using a weld joint, when three blocks of the same colors are together, they annihilate themselves(an effect similar to Bejeweled). I'm using a recursive function to iterate through all the attached blocks of a given block to see if there are enough blocks for them to be deleted.

I'm using GetContactList function to iterate through the list of contacts to see which blocks are adjacent to each other. The results are quite disappointing, the blocks only get annihilated in few cases. After a lot of debugging, I found the issue, but I still don't know how to solve.

My issue is: after some time, GetContactList STOPS returning contacts (return NULL) to blocks that were already attached for some time. I spent some time reading the Box2D manual as well as some tutorials and still didn't find any clue of what is happening.

Below there's some simplified version of the code that I wrote.

for(int a = 0; a < blocksList.size(); a++)
{
   blocksList[a].BuildConnections();
}

And on BuildConnections

b2ContactEdge* edge = body->GetContactList();
while(edge != NULL)
{
   if (long_check_to_see_if_there's_a_block_nearby)
   {
       // add itself to the list to be anihilated
       globalList.push_back(this);
       //if there's, call BuildConnections again on the adjacent block
       adjacentBody->GetUserData()->BuildConnections;
   }
   edge = edge->next;
}

I know that there's another issue related to circular inclusions, but I fairly sure that this problem isn't causing the problem with the collisions.

You can download my entire code from this page if you'd like http://code.google.com/p/fellz/source/list

sentences:
Job finding algorithm My issue seems simple enough to me, but I can't break it down the the bare essentials to be able to program it into my game.

First of all different professions requires different skills, these skills are contained inside the class Person. I have a world map where I can ask for all empty buildings, thereby finding all available jobs.

With this information I want to calculate from some weights that the player can modify on each profession to how important it is to be fill a certain position.

so my current approach would be something like this pseudo code:

    Job findJob(wm : WorldMap) {
      Queue priority <- empty;
      for each building {
        queue.add(skill * need);
      }
      return prority.max();
    }

Does that sound inefficient stupid or do you see any special cases that you think I should be aware of?

sentences:
How can I implement voxel-based lighting with occlusion in a Minecraft-style game? I am using C# and XNA. My current algorithm for lighting is a recursive method. However, it is expensive, to the point where one 8x128x8 chunk calculated every 5 seconds.

Are there other lighting methods that will make variable-darkness shadows?
Or is the recursive method good, and maybe I am just doing it wrong?

It just seems like recursive stuff is fundamentally expensive (forced to go through around 25k blocks per chunk). I was thinking about using a method similar to ray tracing, but I have no idea how this would work. Another thing I tried was storing light sources in a List, and for each block getting the distance to each light source, and using that to light it to the correct level, but then lighting would go through walls.

My current recursion code is below. This is called from any place in the chunk that does not have a light level of zero, after clearing and re-adding sunlight and torchlight.

world.get___at is a function that can get blocks outside of this chunk (this is inside the chunk class). Location is my own structure that is like a Vector3, but uses integers instead of floating point values. light[,,] is the lightmap for the chunk.

    private void recursiveLight(int x, int y, int z, byte lightLevel)
    {
        Location loc = new Location(x + chunkx * 8, y, z + chunky * 8);
        if (world.getBlockAt(loc).BlockData.isSolid)
            return;
        lightLevel--;
        if (world.getLightAt(loc) >= lightLevel || lightLevel <= 0)
            return;
        if (y < 0 || y > 127 || x < -8 || x > 16 || z < -8 || z > 16)
            return;
        if (x >= 0 && x < 8 && z >= 0 && z < 8)
            light[x, y, z] = lightLevel;

        recursiveLight(x + 1, y, z, lightLevel);
        recursiveLight(x - 1, y, z, lightLevel);
        recursiveLight(x, y + 1, z, lightLevel);
        recursiveLight(x, y - 1, z, lightLevel);
        recursiveLight(x, y, z + 1, lightLevel);
        recursiveLight(x, y, z - 1, lightLevel);
    }

sentences:
Fastest way to find closest triangle of mesh from specified point I have two triangle meshes (let me call them A and B). The meshes may be really big (10.000 - 100.000 polygons). I want to find for every point in A the closest triangle from mesh B.

Is there a fast way to do it? Does a near real time solution exist?

I found several papers that describe ways to find distance from a point to a triangle and I know a little bit about kd-tree/bvh-tree. Hence I may be able to find several triangles that are close enough to the specified point and then I can find triangle by brute force.

But I guess that this method will be not fast enough.

sentences:
How does a point squared equal the radius squared? I am working on a simple ray tracer but I don't understand some of the formulas.

One that is bugging me at the moment is this:

  If a sphere is centred at origin, a point p lies on a sphere of radius r2 if
  p*p = r2

Now, as I understand it, 'p' is a point in 3D space, (x,y,z), so how is it possible to square the point and have it equal the radius squared?

For what it's worth, I'm reading this article on calculating the intersection of a ray and a sphere.

sentences:
Find required entities to accomplish specific task in shortest time I have a grid like map with entities that can perform turn-based actions like moving or growing strength. When I have a task that requires a certain strength, I want to find the entities required to solve that task as fast as possible and move them to the target.

The distance to the target is important, since moving a tile takes 1 turn. When entities move on a tile with an existing entity, their strength is combined together. A task can be solved only if the combined strength of the last entity is greater than the requirement. This logically means that entities near the target can grow while additional entities need to move to the target immediately.

It feels like I could use a modified pathfinding, but I can't formulate the procedure to get something meaningful. This inablity also worries me a bit that the problem might be np-hard.

Can you help me?

sentences:
Trying to make a game with C++, using lists to store bullets and enemies, but they are not erased I've been trying to make a pretty simple space shooter game with C++, and I have been having a lot of trouble trying to use lists to store enemies and bullets.

Basically I followed the post here almost exactly to store my bullets:

SDL Bullet Movement

I've done something similar to store my enemies.

However, when I call bullets.erase(it++), for some reason the bullet is not erased.

When the bullet movement is run for the next frame, it tries to re delete the bullet and segfaults the program.  When I comment out the erase line, it runs fine, but the bullets are then never erased from the list...

Is there any reason why the elements of the list aren't being deleted?  I also set it up to print the number of elements in the list for every iteration, and it does not go down after deleting.

Thanks!

EDIT:

Here's the specific code I'm using to store my enemies and having them act:

std::list<Grunt*> doGrunts(std::list<Grunt*> grunts)
{
  for(std::list<Grunt*>::iterator it = grunts.begin(); it != grunts.end();)
    {

      if((*it)->getHull() == 0)
        {
          delete * it;
          grunts.erase(it++);
        }
      else
        {

          (**it).doUnit(grunts, it);
          ++it;
        }
     }
  }

Grunt is my enemy class, and the list grunts is a global variable.  Is that my problem?  When I pass the global into the function it becomes local?  I assumed lists would be a reference type so thought this wouldn't be a problem.

Sorry if this was a dumb question, I'm very new to C++, this is the first major thing I'm working on.

sentences:
How detect which OpenGL texture formats are natively supported? For example, how detect if my videocard doesn’t support "bgr8" and convert it to another format, such as "rgba8" in software mode.

UPDATE: Sorry for the confusion. This question more about situation when I set internalFormat in glTexImage2D to something like "bgra8" but videodriver internally convert data to another format, like "rgba8".

sentences:
Bullet 3D Physics Objects Not Rotating? So I've got Bullet 3D controlling the motion of objects rendered with DirectX.
In the clipping below I've got 2 identical rectangles & 5 balls.
The lowest rectangle has a mass of 0 and doesn't move (as expected).  All other objects have a mass of 1 and fall as expected.

There are two issues that I'm seeing:
1. When the balls land on an angled surface (not shown) they don't rotate, but they do move 'down hill'.
2. Pictured below you see that the top rectangle is perched on the bottom rectangle when it should've rotated a bit and kept falling.

What do I need to do in Bullet to enable object rotations? I'm not a physicist so I suspect my google-fu is lacking, also the Bullet docs are painfully inadequate.

This code here is how I initialize my rigid bodies:

RESULT_CODE ubAddRigidBody(HANDLE collisionShape, float mass, ubVector3 position, ubVector4 orientation, HANDLE* rigidBodyHandle)
{
if (rigidBodyHandle == nullptr)
{
    return INVALID_PARAM;
}

if (_world->isValidCollisionShapeHandle(collisionShape) != SUCCESS)
{
    return INVALID_HANDLE;
}

auto transform = btTransform(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w), btVector3(position.x, position.y, position.z));
auto collisionShapeObject = _world->m_collisionShapes[collisionShape].get();

auto motionStateObject = new btDefaultMotionState();
motionStateObject->setWorldTransform(transform);

auto rigidBodyInfo = btRigidBody::btRigidBodyConstructionInfo(btScalar(mass), motionStateObject, collisionShapeObject);

// Enable rotations for the object

collisionShapeObject->calculateLocalInertia(mass, rigidBodyInfo.m_localInertia);
rigidBodyInfo.m_linearDamping = .2f;
rigidBodyInfo.m_angularDamping = .2f;

auto rigidBody = new btRigidBody(rigidBodyInfo);
auto uniqueHandle = _world->getUniqueHandle();

rigidBody->setFriction(.5f);
rigidBody->setRollingFriction(.5f);

_world->m_world->addRigidBody(rigidBody);
_world->m_rigidBodies[uniqueHandle] = unique_ptr<ubRigidBody>(new ubRigidBody(rigidBody, collisionShapeObject, motionStateObject));

*rigidBodyHandle = uniqueHandle;

return SUCCESS;
}

sentences:
How can I communicate user information from a website to a hosted Unity game? I have a Ruby on Rails website running which provides a log-in system and dashboard for users. I am building a small game in Unity which is much like an inventory management system. But, the inventory is specific to a user and the user can make changes to it. The user sees the game as a part of his dashboard.

What I'd like is for the moment the user lands on his dashboard, the Unity game should load with the inventory of the signed-in user. How can I get this user information from the Ruby dashboard over to Unity?

sentences:
How to make a cartoon like trail particle system? I'm currently working on an little Android game, it's a reaction casual game. Because the user needs to tap some balls flying around at the right moment, I want to add some new effects to them.

So I looked at some other games and found this cool looking cartoon like effect.

As you can see the ball there has an cool tail.

So my question is, does anyone know how to recreate such a trail with the Unity particle effects or some other tools?

sentences:
How to make a triangle pixellated with GLFW? How can one make a triangle look pixelated without modifying the size of the window in GLFW3?

Preferably, I'd like to accomplish this without the use of shaders. For example, by setting the size of the frame buffer to be 1/8th the size of the window.

I've created an Xcode test project for this and tried setting a small window size to create a small framebuffer, then changing the window size to be big afterwards, but the framebuffer size always changes to match the window size.

Example project output:

Desired output:

sentences: How much memory does a texture take up on the GPU? A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?

sentences:
Empty game object (child of player) not changing position correctly when key pressed I've made an empty game object which is the child of the player. It is by default on his right side and following his every move, and I want to make it so that every time a directional key is pressed (WASD) it changes position and stays there. But the way I've made it, it's not working as intended and seemingly goes to random positions every time. Here's the script:

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

public class ChangePositionAccordingToKey : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            transform.position = new Vector3(-0.58f, 3.09f,0);
        }
    }
}

This is probably a dumb question but I am new to coding so I can't figure it out. Any help is greatly appreciated

sentences:
How to make a text box where text "types" smoothly I want to create a textbox that behaves like most textboxes seen in other games where the text appears gradually. So far this has been my attempt at it but unfortunately, the text appears very unevenly and slow even when changing the letter pause to an insanely low amount.

public float letterPause = 0.1f;

IEnumerator TypeText()
{
    //number of char typed per loop
    int len = 3;
    for (int i = 0; i < text.Length; i += len)
    {

        if (i + len > text.Length)
        {
            ibubbletext.text += text.Substring(i, text.Length - i);
        }

        else
        {
            ibubbletext.text += text.Substring(i, len);
        }
        yield return new WaitForSeconds(letterPause);
    }
}

sentences:
How can I calculate when a spesific amount of time has passed I am trying to get something to happen, when a spesific amount of time has passed(in my case it is in secounds). I have tried using this method:

   long elapsed = (System.nanoTime()-startTime)/1000000;
   if(elapsed > 1000)
   {
       score++;
       startTime = System.nanoTime();
   }

with the starttime beiing initiated in the constructor. But when I attack(part of the game) the app either:
chrashes
the things the game renders dissapears, and everything turns black.

I have tried asking google, but it in general gave me the save way. Any new improved ideas?

sentences: How to have random and different colors on multiple objects with one material? I want to have one material applied to multiple objects that has a random color on each object. How can I achieve this so that I don't need to use a different material for every object? This is in Unity 5 by the way.

sentences:
How to draw objects that have a smaller Y axis first? In my game there is a large 2D map of various objects. Example. As you see, upon creation objects of the same type (trees for example) are placed correctly, but objects of another type (enemies) are placed on top of the no matter the position. Now, how can I arrange that everything is drawn according to it's position?

Another example (the dog should be drawn before the tree, and not on top of it):

sentences:
Attach movement to each list object How would i move every sphere that gets spawned every 2 seconds ? Basically i want every sphere to follow the previous spawned sphere or even all N-1 spheres should follow the first spawned sphere along a predefined path and they should keep rolling as a train of spheres. I am lost when i try to imprint movement to each sphere.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour
{
    public GameObject[] prefabs;
    public List<GameObject> listBalls = new List<GameObject>();
    private GameObject x;
    public int timer = 0;
    private float movementSpeed = 5f;

    void Start()
    {
        createBall();
    }

    void Update()
    {
        if (Time.time - timer > 0.8f)
        {
            createBall();
            timer += 2;
        }
        listBalls[listBalls.Count-1].transform.position += new Vector3(0, 0, movementSpeed * Time.deltaTime);
    }

    void createBall()
    {
        x = prefabs[Random.Range(0, prefabs.Length)];
        Instantiate(x, x.transform.position, Quaternion.identity);
        listBalls.Add(x);
    }

    void moveBall(GameObject x, GameObject y)
    {
        x.transform.position += y.transform.position - new Vector3(0,0,-1);
    }
}

Loop added but movement staggered

        void Update()
    {
        if (Time.time - timer > 0.8f)
        {
            createBall();
            timer += 2;
        }
        foreach (GameObject item in listBalls)
        {
            item.transform.position += new Vector3(0, 0, movementSpeed * Time.deltaTime);
        }
    }

```

sentences:
Quaternion to axis-angle, or ripping apart a full transform matrix My game entities currently hold a quaternion for their orientation with the ability to return either a 3X3 full rotation matrix (based on that quaternion), or a full 4X4 transform matrix. though what I have come to find is that I am not able to convert from my matricies to DirectX matricies directly, so my next thought would be to force the conversion by hand. which of the following methods would work best/easiest/accurate?

take the quaternion, and break it down into the individual axis-aligned rotations
take either the full rotation matrix, or the full transform matrix and break it down

for either approach it would need to yield the component rotations (theta about X, phi about Y, rho about Z).

I have a feeling that breaking the quaternion down might be the easier rout, but I am not sure as to the actual operations to do this break down.

sentences:
Troubleshooting Unity & Unity Hub Problems Behind Firewall I'm teaching game design at a high school in the US. This means that we're behind a firewall that does packet inspection. Our lab machines are running Windows 10 and have the school's certificate installed as a "Trusted Root Certification Authority" (as seen in certlm).

The problem I'm seeing are:

Unity Hub (2.0.0) silently fails when trying to download Unity installs
Unity (2019.1.3f1) complains about a "self-signed certificate in the trust chain" (roughly)

This post from the Unity Forums suggests that Unity might know how to read the local computer's list of trusted certificates, but there are also responses indicating that it may not always work.

My questions:

Where do Unity and Unity Hub log certificate errors (do they)?
Suggestions for troubleshooting?

sentences:
Android opengles how to use glunproject How to use glunproject in my android app?

I have the following parts in my engine:

A projection matrix
A view matrix for the camera
A model matrix for each of the objects in my world. This matrix is calculated from the parent objects model matrix and the objects own model matrix. These matrices are calculated from a translation, rotation and scale matrix. (this all works fine)

These matrices are then multiplied and passed to my vertex shader.

Now I understand glunproject needs the model matrix and the projection matrix and can caluclate a near and far 3d coordinate depending on the camera viewport settings ( for the near and far plane)

Do I need to use glunproject for each of the objects in my world and then check if the ray produced by these near and far coords intersects my object?
This seems quite expensive on the cpu?

What is the proper use for glunproject

sentences:
How to stop an animation from looping I want to make Unity play a squish animation when the player hits the ground, but only once, until the player jumps and hits the ground again, although Unity its constantly detecting that the player is on the ground and keeps playing the squish animation over and over again, only jumping stops it cause the condition to play the animation is if the player is on the ground. (loop already disabled)
How I can possibly solve this?

 if (isGrounded == true)
        anim.SetTrigger("EnterGround");

sentences:
Which open source licenses can address these concerns for an open source game engine? I am on a team that is looking to open source an engine we are building.  It's intended as an engine for Online RPG style games.  We're writing it to work on both desktops and android platforms.

I've been over to the OSI http://opensource.org/licenses/category to check out the most common licenses. However, this will be my first time going into an open source project and I wanted to know if the community had some insight into which licenses might be best suited.

Key licensing concerns:

Removing or limiting our liability (most already seem to cover this, but stating for completeness).
We want other developers to be able to take part or all of our project and use it in their own projects with proper accreditation to our project.
Licensing should not hinder someone's ability to quickly use the engine. They should be able to download a release and start using it without needing to wait on licensing issues.
Game content (gfx, sound, etc.) that is not part of the engine should be allowed to be licensed separately. If someone is using our engine, they can retain full copy right of their content, including engine generated data.
Our primary goal is exposure, which is why we're going open source to
start with.  Both for the project and for the individuals developing it.  Are there any licenses that can require accreditation visible to players? Update: As per comments, I mean this to be a requirement for either a splash screen or placement in the credits. Not a constantly visible logo.

While I'd put our primary goal as exposure, for licensing the accreditation is less of a concern.

From what I've read through (and have been able to understand) it doesn't seem like any of the licenses cover anything that is produced by the licensed software.  Are there any that state this specifically, or does simply not mentioning it leave it open for other licensing?

Are there any other concerns that we should consider?

Has anyone had any issues using any of these licenses?

sentences: How to create a decent strategy game without becoming an artist? I love to make games. But I am not an artist. I never learned to make 2d or 3d models. I spent most of my time on programming. I know there are Game engines for non-programmers. But I am looking a way to create a decent strategy game (medieval theme) without spending time to learn how to model 2d or 3d models it is more time consume than learning how to program for an artist.

sentences:
Zooming in so a smaller portion of the game scene fills the entire screen so i am creating a game similar to super-smash-bros, in which the camera should zoom in on players when they are close together, and scale back when they are apart. I create a window for my game via

m_pWindow = SDL_CreateWindow("First SDL game attempt", SDL_WINDOWPOS_UNDEFINED,
                SDL_WINDOWPOS_UNDEFINED, 1000, 1000, SDL_WINDOW_SHOWN);

and then initialise my render via

m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, SDL_RENDERER_ACCELERATED);

and when i call render for my buffer, it simply calls

SDL_SetRenderDrawColor(m_pRenderer, m_clearRed, m_clearGreen, m_clearBlue, 0xff);
SDL_RenderClear(m_pRenderer);
SDL_RenderPresent(m_pRenderer);

Now i am wondering where in this solution should i implement the camera, if you could point me in the right direction that would be great. For example, i have a player positioned at {500, 800}, and another at {300,800}. I want to zoom in on this point of the screen. The total window is 1000x1000, but rendering {x = 200->600, y = 600->1000} is what i want to achieve.

I have currently tried using

SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = 900; //TEST VALUES
rect.h = 900; //TEST VALUES
SDL_RenderSetViewport(m_pRenderer,
    &rect);

But this simply doesn't render part of the screen, as opposed to scaling the entire view.

Any other help would be greatly appreciated

sentences:
Scrolling the camera when the mouse cursor gets to the edge of the screen I was wondering if you could help me:

In XNA I have a hexagonal map, and the size of the map currently exceeds the size of the window. There is already code in place to move the 'camera' around the map using the directional keys, which is as follows:

if (ks.IsKeyDown(Keys.Left))
        {
            Camera.Location.X = MathHelper.Clamp(Camera.Location.X - 8, 0,
                (myMap.MapWidth - squaresAcross) * Tile.TileStepX);
        }

But I'd prefer using the mouse, like in good ol' Command and Conquer.

So basically: If mouse coords are within 5 pixels of game window edge, move map appropriately'. Any help would be greatly appreciated!

sentences:
Transform.forward having problems after rotation I have this script,

void Update () {

        float pitch, yaw, roll;

        pitch = Input.GetAxis ("Mouse Y");
        yaw = Input.GetAxis ("Mouse X");
        roll=Input.GetAxis ("Roll");

        transform.Rotate (-pitch, yaw, -roll);

        if (Input.GetKey (KeyCode.W))
            Rigid.AddRelativeForce (transform.forward * 50);
        else if (Input.GetKey (KeyCode.S))
            Rigid.AddRelativeForce (-transform.forward * 50);
        else if (Input.GetKey (KeyCode.D))
            Rigid.AddRelativeForce (transform.right * 50);
        else if (Input.GetKey (KeyCode.A))
            Rigid.AddRelativeForce (-transform.right * 50);
        else
            Rigid.velocity = Vector3.zero;

        if (Input.GetKey (KeyCode.Space)) {

            transform.rotation = Quaternion.Euler (Vector3.zero);
            Rigid.velocity=Vector3.zero;
            Rigid.angularVelocity=Vector3.zero;
        }

    }

My "Roll" is defined as 'q' and 'e' keys. "Rigid" is rigidbody object.

I simply want to implement 6DoF on this cube, the pitch, yaw and roll works fine , but when it comes to movement it behaves in very unusual way after the object is rotated, I tried moving by using localPosition still no result. I also used relative torque for rotation but it resulted in worse, that is why rotation is controlled by transform.rotation not torque.

I suppose I am not handling gimbal lock or something? Or am I doing it completely wrong?

sentences:
Monogame sprite rotation issue I'm having interesting problem with rotating a sprite in MonoGame. Here is how origin, destination rectangle and scale are created:

  Vector2 origin = new Vector2(tx.Width / 2, tx.Height / 2);

  Rectangle dstRectangle = new Rectangle((int)e.Xpos, (int)e.Ypos, (int)(tx.Width), (int)(tx.Height));
        dstRectangle.X += (tx.Width / 2);
        dstRectangle.Y += (tx.Height / 2);

  Vector2 scale = new Vector2(tx.Width * (float)TxScaleFactor, tx.Height * (float)TxScaleFactor);

And here is the draw function:

 Editor.spriteBatch.Draw(texture: GlowWhite, destinationRectangle: dstRectangle, color: Tint * (Alpha * 0.6f), rotation: rotation, scale: scale, origin: origin);

Now, with angle 0.0f, everything is fine but any additional rotations become weird:

Zero rotation, white background is WinForms picturebox, below is MonoGame

90 deg

And 180 deg

Its like there is some kind of offset - I've tried to change 0 to 90, and back 0 and next to 180 - result is always the same (apparently, there is no adding). I'm guessing that problem is related to origin, destination rectangle or scale. Sprites are rotated in place as you can see (no issues with that) but something with rotation isn't right. Any ideas?

sentences:
Does Unity have existing support for Timelines? I am planning the development of a game in Unity3D, and trying to come to terms with what the engine has already provided, and what I must code myself.

The game itself is going to be a rhythm game, which means synching audio and graphical events so that they always play when they're supposed to. What I'm looking to avoid is a potential scenario of lag where either the audio or the graphics starts to progress faster than the other.

When we discussed this type of coordinating system in my game design class back at university, my professor called this type of design a "Timeline" class. The idea being that you can instantiate one or more of these to progress at different rates, schedule things to happen in the future, and synch up periodic events. However, calling this a "Timeline" class seems to have been limited to my professor himself, as googling for whether a certain API features "Timeline" functionality has been a fruitless endeavor.

Is there some more common name for this kind of functionality? Does Unity have any pre-existing methods to coordinate the scheduling of events like this, or is this the kind of thing that needs to be built onto the engine? And if it does, I'd appreciate being pointed towards some tutorials!

sentences:
How can I add a parallax effect into my side-scrolling game? How can I add a parallax effect into my side-scrolling game? I read a lot about parallax scrolling so I know what the logic is and what parallax is but I can't create a dynamic parallax effect.

I have draw and update functions like this:

void UpdateBackground(Background &back)
{
    back.x += back.velX * back.dirX;
    if(back.x + back.width <= 0)
        back.x = 0;
}
void DrawBackground(Background &back)
{
    draw_bitmap(back.image, back.x, back.y, 0);

    if(back.x + back.width < WIDTH)
        draw_bitmap(back.image, back.x + back.width, back.y, 0);
}

So this draws a parallax effect with two background objects but it draws it statically. I'm creating a 2D side-scrolling game and I'm translating my character and my camera position along x axis. So I have to translate my parallax effect with my camera but when I add to background position.x it doesn't work. How can I solve this?

sentences:
toString() - method doesnt' choose right Array Index My topic is a adventure game. The heroes have Superpowers, but if I want to print the superpowers from a superhero, it prints just the last index of my array, which I set it before.

My code: `

public void createdTeam() {
    Superhero krieger = new Superhero("Thylraz");
    Superpower[] kriegerPowers = { new Superpower("Schwertwirbel\n", " Thylraz wirbelt mit seinem Schwert."),
            new Superpower("Schildschlag\n", " Thylraz schlägt den Zombie mit dem Schwert."),
            new Superpower("Durchschlag\n", " Thylraz macht einen Durchschlag!") };
    krieger.setSuperpowers(kriegerPowers);
    krieger.setHeroRole("Krieger");
    team.add(0, krieger);
    Superhero archer = new Superhero("Artemis");
    Superpower[] archerPowers = {
            new Superpower("gezielter Schuss", " Artemis versucht einen gezielten Schuss zu treffen."),
            new Superpower("Pfeilregen", " Artemis lässt Pfeile über den Zombie regnen!"),
            new Superpower("Falkenschlag", " Artemis ruft nach ihrer Falke!") };
    archer.setSuperpowers(archerPowers);
    archer.setHeroRole("Bogenschützin");
    team.add(1, archer);
    Superhero berserk = new Superhero("Adukan");
    Superpower[] berserkPowers = {
            new Superpower(" Elektroschlag", " Adukan lädt seine Äxte mit Elektrizität auf und schlägt zu!"),
            new Superpower(" Blutrausch",
                    " Adukan geriet in Blutrausch! Er haut auf sein Gegner mit voller Aggro!"),
            new Superpower(" Blutiger Schlag", " Adukan versucht einen tödlichen Schlag zu treffen!") };
    berserk.setSuperpowers(berserkPowers);
    berserk.setHeroRole("Berserker");
    team.add(2, berserk);
}

and my print method:

public void printOneSuperhero() {
    System.out.println("\nVon welchem Superhelden möchtest du die Daten sehen?\n");
    int index = selectSuperhero();
    System.out.println("=====================================================================================");
    System.out.println("Heldenname\tHeldenrolle\tHP-Max\tHP\tEXP\tKampfbereit\tlebendig\tFähigkeiten");
    System.out.println("=====================================================================================");
    System.out.println(team.get(index).toString());
    startMenu();
}

public class Superpower {
private String id = UUID.randomUUID().toString();
private static String superpowerName;
private static String actionDescription;

public Superpower(String superpowerName, String actionDescription) {
    this.superpowerName = superpowerName;
    this.actionDescription = actionDescription;
}
public String toString() {
         return "Skill: " + superpowerName + "\n" + "Beschreibung: " + actionDescription + "\n";

}

}

Edit:

public int selectSuperhero() {
int index = 0;
for (int i = 0; i < team.size();) {
    System.out.println("Position: " + (i++) + "" + team.get(index).print());
    index++;
}
index = scan.nextInt();
return index;

}

sentences:
Different types of cubes I'm looking into making 4 types of cubes; grass, stone, dirt, and empty. I have a cube class that is just for storing the location of the cube.

    public Cube(GraphicsDevice Device, Vector3 Position, Texture2D Texture)

I want the Texture2D to be changed to something like CubeType. In my cube class, I have a grass and stone class which both inherit cube, but I don't know how to make that work for what I want.

    public class Grass : Cube
    {
        public Grass()
        {
            isMineable = false;
        }
    }

    public class Stone : Cube
    {
        public Stone()
        {
            isMineable = false;
        }
    }

The only thing that makes each cube differ from each other is the texture and if theyre mineable or not.
What's the easiest way to implement what I want? I guess one way of doing it is just adding another parameter to Cube(bool isMineable), but for learning purposes I want to see if there's a better way to do it.

sentences:
How do I create a decal system? I'm currently given the task to design & create a simple decal-system in C++/DirectX.

Does anybody know a great tutorial, article or paper to start with? (Especially the part about 2D-texture to 3D-surface projection and clipping isn't entierly obvious to me.)

I'd also appreciate just simple hints and best-practices.

sentences:
Why projection window is between -1 and 1 Is it a convetion ? What we achieve with this ?

I am reading about how the perspective and orthographic matrix is getting calculated and everyone is trying to normalize the homogenous coordinates to [-1,1]

Thank you !

Orthographic Projection

sentences:
Unity - Button still interactable even when interactable is set to false my button can still be pressed in-game even if I set it to button.interactable = false;

What I'm trying to achieve is when the Panel CropsPanel is opened, or active in Unity, I want the EquipmentButton to be disabled and to be not usable by the user. Here is the code I've written:

 public void Start ()
     {
         GetComponent<Button>().interactable = false;
         if (CropsPanel.activeInHierarchy == true)
         {
           EquipmentButton.interactable = false;
         }
     }

I have also set all buttons in the inspector, placed a Debug.Log("msg here"); to see if the particular code is working. But I can't seem to get it working. Am I missing something? Thanks guys!

sentences:
LWJGL Lighting advice / fix Problem: The spotlight I've set up with OpenGL won't light up anything behind it, no matter what values I set for GL_SPOT_DIRECTION

    float[] LightDir = new float[]{0,0,-1,0};
    float[] LightPos = new float[]{0,0,15f,1};

Initialization code for lighting

        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glLightModel(GL_LIGHT_MODEL_AMBIENT,asFlippedFloatBuffer(new float[]{0.1f, 0.1f, 0.1f, 1f}));
        glLight(GL_LIGHT0,GL_DIFFUSE,asFlippedFloatBuffer(new float[]{0.5f, 0.5f, 0.5f, 1f}));
        glLight(GL_LIGHT0, GL_POSITION, asFlippedFloatBuffer(new float[]{0, 0, 0, 1}));
        glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,60.0f);
        glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,2.0f);

        glEnable(GL_COLOR_MATERIAL);
        glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glShadeModel(GL_SMOOTH);

Lighting code ran every loop

         glLight(GL_LIGHT0,GL_SPOT_DIRECTION,asFlippedFloatBuffer(LightDir));
         glLight(GL_LIGHT0,GL_POSITION,asFlippedFloatBuffer(LightPos));

The Following shows:

To try and change the direction I hit a key that does

LightDir[1]++;

The angle of the light goes up as expected, but seems to stop turning once it's pointed straight up. Which looks like

Which is the problem, it wont turn around.
Iv'e tried every possible value for LightDir in all it's values, but I cannot get it to illuminate the back pf the tube. I've even tried to transform to light around the scene with glRotate and glTranslate.
The light is supposed to function as a flashlight.
Is this something that would be potentially solved with Shaders?
Thanks in advance!

EDIT:

Anytime LightDir[2] goes above 0 the light goes dark.

sentences:
Unity 5 - Error with code to make pitch changes based on distance I really need help.  It's 2:00 AM here and my brain is half dead so I can't, for the life of me, find out what's wrong with this code anymore.  It's supposed to find the distance between the game object to which it's attached (the target), and another game object (the player). Then, depending on the that distance, it should change the pitch of an AudioSource inside a child (in the player). However, the pitch only changes when I'm practically over the gameobject. So, for about 9/10 of the way, nothing changes in the pitch, but when I'm right there the pitch suddenly changes (but not to maximum value of Clamp function).

What's going on? I want the pitch to, at first, stay at 0. But soon after you walk some steps in the right direction, the pitch must change gradually (and in a evenly manner), as (player) gets closer to (target). =|

ps.: The script is inside a instantiated prefab, that's why I used FindGameObjectWithTag and FindChild. Also, I'm using Unity 5.

<!-- language: lang-cs -->

[four blanks]using System.Windows.Controls;
[more indented code]

using UnityEngine;
using System.Collections;

 public class ProximitySensor : MonoBehaviour {
     public GameObject player;
     private Transform playerTrans;
     private Transform targetTrans;
     public Transform beepTrans;
     public AudioSource beepSound;
     private float distanceCurrent;

     void Start () {

         targetTrans = transform;
         player = GameObject.FindGameObjectWithTag("Player");
         playerTrans = player.transform;
         beepTrans = playerTrans.FindChild ("beepController");
         beepSound = beepTrans.GetComponent<AudioSource>();

     }

     void Update () {

         distanceCurrent = Vector3.Distance (playerTrans.position, targetTrans.position);
         beepSound.pitch = Mathf.Clamp ((1 / distanceCurrent), 0.1f, 3.0f);

     }
 }

sentences:
How can I make a swinging rope? Base question: How can I make a swinging rope in box2d?

Context: The idea is to have a rope where the player can grab it, swing a little bit to get more "momentum" and reach the next platform. Like in the Mario games for Nintendo DS and Wii.

What I did: I constructed a chain like rope with a series of RevoluteJoint. This is the fixture of the different links:

fixtureDef.shape = robeLinkShape;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.0f;
fixtureDef.restitution = 0.0f;
fixtureDef.filter.categoryBits = Box2DConst.BIT_ROPE;
fixtureDef.filter.maskBits = Box2DConst.BIT_PLAYER;

BodyDef bodyDef = new BodyDef();
bodyDef.angularDamping = 1.0f;
bodyDef.linearDamping = 1.0f;

I've implemented a ContactListener which creates a RevoluteJoint to connect the body and on of the links of the body. Now the problem I face is this: The rope does not swing, if I apply a linearImpulse to the player (attached to the rope) e.g. to the left, it goes to the left but it doesn't swing back. If the player isn't attached the rope swings.

Last points:

I made the player a dynamic body with a density of 1. Is it better, if the player body does not have a density set?
If the chain is to "light" (lower density) the player can torn it apart if he is attached to the rope. If I connect the last link with the first link of the chain with a RopeJoint the last and the first link stay at the same distance but for some reason, the links between still get torn apart. Question is, should I make my rope only of RopeJoins?

I know there are some tutorials out there with some instructions but some of them use a special class which is not available to me and other simply construct a rope and use a MouseJoint. Again in this scenario my rope thing looks good the problem that when the player body is attached to it it behaves a little bit strange. I know there are also similar posts to mine but since I have some sort of a working solution there solution (if the have any) was not helpful.

Update

If I create the rope solely from RopeJoints I get a nice swinging rope. It behaves exaclty as I woulrd expect. If I then a RevoluteJoint with a density (my player body fixture also has a density) the rope does no longer swing.

sentences:
Sort buttons in unity 2D I've a list of buttons that I create using XML stored data. To achieve it, I've created a Prefab. These buttons are created correctly, and now I want them to be sorted for the user.

public List<GameObject> myButtons;

As I said, now I want to sort them. I've found out that sorting the List itself, buttons are sorted in the UI.

myButtons.Sort((x, y) => ...);

The problem is, that I don't have the necessary data to sort them within them. This leaves the .Sort() method unavailable for use.

I've tried to sort them adding an script to each one, which contains the data that I need to use to sort them. However, it doesn't work correctly and I seem unable to find out why, so I'm wondering about other more direct methods to sort them.

Notice that I'm referring to simple buttons in a 2D game, and that they're all inside the same parent/gameobject.

Technical Details

Let's start by the basics: I want to order the buttons taking into account if the user has reached a point in which the item it represents should be available.

This is stored in an instance of a class that represents the items related to the buttons of the question.

public class myItemClass
    {
        # Here there are other properties
        public bool available;
    }

Therefore, we've a correspondence between two lists:

public List<myItemClass> myItems;
public List<GameObject> myButtons;

Where:

  myItems[0] is related/represented by myButtons[0]

  ...

NOTICE that this relation exist at the initialization of the game, so i need to keep it at any moment (meaning, having to sort both lists).

What I tried

To be able to order my buttons depending on if the items are available or not, what I've done is:

Creating an script myItemScript, which has a reference to my original items from the other list.
Sorted the items using Sort function over them.

public class myItemScript: MonoBehaviour {
    public OtherClass.myItemClass dataObject;
}

And then sorting them like:

myButtons.Sort((x, y) => y.GetComponent<myItemScript>().dataObject.available.CompareTo(x.GetComponent<myItemScript>().dataObject.available));

As I said before, both list need to be following the same order, so just after it, I order the item list as well:

myItems.Sort((x, y) => y.available.CompareTo(x.available));

Checking/Debug

As result, I found that items were in fact sorting different. However:

Items inside myItems List were sorted as expected.
Buttons in UI (and hence, myButtons List were not sorted as expected. Mixed items (available = true/false) were mixed and not ordered in two blocks, one first and then the other one.

This was checked using breakpoints within VS2017 and pausing the game in Unity interface.

sentences:
When do I need to ask for permission to recreate an old game? Possible Duplicates:
  How closely can a game resemble another game without legal problems
  Legal issues for a "fangame" of a commercial franchise?

I want to do a mobile version of an old game I used to like called Bow And Arrow (video, game). There's a project already port it in Ruby. I'm wondering if I can do a remake of this game. Do I have to get permission from the creator, or does it only matter if I use the same resources (graphics and sound)?

sentences: Real Time Physics Based Mesh Deformation I'm working on a game through unity that draws one of is essential elements from traditional tool forging techniques for building tools and such. I want the feel of the game to be able to create a tool that is truly yours and slowly make it better in both design and functionality over time. One major thing I cant't seem to figure out is to be able to take a mesh (in this case a hot piece of meta) and deform it in such a way that you aren't loosing any of the mesh, its just being shifted slightly with each hit of a hammer (or in my testing case click of a mouse). I have looked all over youtube and various forums and I can't seem to find an efficient way of going about it. Any thoughts?

sentences: Sprite sheet or multiple resources When animating for the Android platform is it a better practice to create a sprite sheet with multiple states for each sprite on a single picture or should I instead export individual images for each character/state/etc.? Which option gives me a smaller file size for resources and which is easier for the programmer to animate?

sentences:
Get object position on texture I'm rendering a 3D object to texture (2048x1600) and show this texture on a panel (1600x285) using a RawImage (2048x1600) component as child. This texture is rendered successfully on screen.

This 3d object contains several mountpoints as empty objects. Now I want to show several sprites to visualize those mountpoints on the texture (panel) at their corresponding screen position (must not pixel perfect).

I tried several camera transforms, but could not get the correct position values:

  var main = camera.WorldToScreenPoint(slot.mountpoint.position);
  Debug.Log("Maincam screenpos: " + main.ToString());

  RectTransform rect = this.GetComponentInParent<RectTransform>();
  Debug.Log("Rect size delta: " + rect.sizeDelta.ToString());

  Vector2 viewPos = camera.WorldToViewportPoint(slot.mountpoint.position);
  Debug.Log("Viewport pos : " + viewPos.ToString());

  Vector2 localPos = new Vector2(viewPos.x * rect.sizeDelta.x, viewPos.y * rect.sizeDelta.y);
  Debug.Log("Viewport pos local : " + localPos.ToString());

How I could realize this?

sentences:
Stretch the game to fit the game window, in Unity 5 (Desktop) I want to make it so that when the user re-sizes the game window, the game is stretched to fill the window.
(Similarly, for Android) I want it to be stretched to fit the screen as well.

The game's real resolution is supposed to be 720x1280 (16:9 equivalent). In the image on the left you can see the actual resolution.

I can see that unity automatically re-scales it everytime the game window is re-sized, but it kind of keeps the same aspect ratio. This results in either black bars or part of the game being off-screen. How can I scale my game based on the current window aspect ratio ? I know the graphics will get distorted.

Isn't there a way to stretch the game without keeping the same aspect ratio, within the unity interface ? If not, how could I do that within a script ?

In xna or libgdx, I would simply add a scale matrix on every spriteBatch.Begin() method call. That scale would be based on the (current window width, current window height) and the ("real" game width, "real" game height).

For example, since my game is 720x1280, if you had your window re-sized at 500x500, I would scale the graphics by 500/720 on X axis and 500/1280 on Y axis. And then I would have to scale the inputs by 1/scale matrix. I need to know how this works on unity. Perhaps, setting Camera.main.aspect to the current aspect ratio of the current window (I could calculate that everytime the window is resized), would solve the problem (?), but is there another option ?

I assumed that supported aspect ratios would do just what I needed. But when I re-size my game window to 720x1080 (4:3 equivalent) down from 720x1280 (16:9 equivalent) it just adds black bars. When I want the game to stretch, in all cases.

sentences: What is the best way to debug and profile a web application on an iPod in Mobile Safari? I've built a web app that makes heavy use of JavaScript and HTML5 canvas. It's easy to debug in Chrome, but on a mobile device the developer tools are much less robust. Is there a tool or technique that will enable me to easily debug and profile my application on an iPod in Mobile Safari?

sentences:
How can I access the normal map value in Unity? I'm simulating laser scanners in Unity with Raycasts, and I've got some "bumpy" items I'd like to scan.
I had tried generating the actual geometry for these objects, but there are tons of these objects and the polygon count exploded.
What I would like to do is something like described here to get the color from a raycast intersection:
Renderer renderer = raycastHit.collider.GetComponent<MeshRenderer>();
Texture2D texture2D = renderer.material.mainTexture as Texture2D;
Vector2 pCoord = raycastHit.textureCoord;
pCoord.x *= texture2D.width;
pCoord.y *= texture2D.height;

Vector2 tiling = renderer.material.mainTextureScale;
Color color = texture2D.GetPixel(Mathf.FloorToInt(pCoord.x * tiling.x) , Mathf.FloorToInt(pCoord.y * tiling.y));

But, instead of getting the color, I'd like to access the normal. I used grayscale bump maps to simulate height differences, but the raycasting doesn't take the normal map into account and I can't figure out how to access normal map values. Ideally there'd be some texture2D.GetNormal() I could use in place of the texture2D.GetPixel() given in the snippet above, but I can't seem to find anything anywhere on getting at the material normals.
I'm using Unity 2019.4, with the Universal Render Pipeline at the moment.

sentences:
How to create button prompts for interactable objects in Unity? I have a class of objects tagged as interactables that my player can interact with when within range.

When my player is near them, I want to display a button prompt at the bottom of the screen, along with a description of the type of interaction possible (for example, "inspect", "use", etc.).

I want to account for the possibility that the player might be within range of two or more of them at once, and thus allow him to toggle through them, displaying their button prompts in turn.

If my player interacts with something which generates a text box or other modal, I want the button prompt to disappear, but to return when the text box or modal is closed.

Any advice on how to go about achieving this?

I've done it in the past in different engines, but I have always been unhappy with how convoluted my method was. I'd like to hear how others might tackle this. Given how common this kind of thing is in games, I'm surprised I haven't found a good tutorial on it yet.

You can be as general or as specific as you'd like in your answer.

sentences:
How can I draw things just in an area that can have a shape such as the shape of the letter B and not draw outside this form? I want to draw stuff on an image, for Example, if I have a letter, as an image and I want to draw on the letter it is necessary that this image is touchable.
This is what I did:

Image.addListener (new clickListener () {
public boolean Touchdown (InputEvent event, float x, float y, int pointer, int button)
{
/ * posCurseurX = x;
posCurseurY = y * /

// Begin to draw on the screen

touch = true;
traitSprite = new Sprite (rectangleTexture, 0.0, tailleTrait, tailleTrait)

traitSprite.setPosition (x-tailleTrait / 2 (height) -y - tailleTrait / 2);
tabRectangelSprite.add (traitSprite);
counter ++;

dessinerTrait (touch);
dessinerCurseur ();
// The index of the number of meter rectangle forming a line

return true;
}
});

But I want to add another listener for mouse movements, but it does not work with MouseMove.
and the other thing I would like, is to draw that if I'm on my image. If the cursor position is not between the coordinates of the image so I will not draw.

that's what I tried:

if (posCurseurX> = image.getX posCurseurX && <= + image.getX image.getWidth) {

..}

But the texture does not necessarily have that width, that's an example:

sentences:
iPhone Game - Sprites I have made games with cocos2d for the iphone however I am looking to move on from that, is there a good direction you could suggest? If not I was planning on using what the SDK gives me, and so for example to make a sprite, say the player on screen, rather than a CCSprite, what would be best to use? What do I need to go and learn?

Thanks.

sentences:
Seamless tiling with TexturePacker and Marmalade/IwGX I'm looking for a way to get seamless tiling working, where the tiles are sprites off a TexturePacker sprite sheet, and the rendering is done with Marmalade's IwGX's streams. I also need to render the tiles in multiple scales at the same time.

Even with TP settings "reduce border artifacts: off" and "inner padding: 0", there are very noticeable, pixel-wide gaps between the tiles. If I move the tiles close together, they look fine at a scale of 1, but anything smaller or larger yields gaps.

If I use one tile per texture, I get no gaps, but it means that I either can't have a variety, or each tile will take one draw call + material switching, which is not only slow, but brings the gaps back.

Any tips?

sentences:
Loading screen OpenGL with glut API I'm trying to make a loading screen. My idea is to have two threads working - one in the background loading the 'game' scene, one displaying 'load' scene. When building 'game' scene is finished, it's displayed instead of 'load' scene. Before threading I want to make it work the usual way: first display 'load' scene, then 'game' scene. Both GameScene and LoadScene inherit from a virtual function Scene. Here's how my main looks like:

LoadScene *load_scene;
GameScene *game_scene;
Scene *scene;

int main(int argc, char **argv)
{
// Init GLUT and create window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA | GLUT_STENCIL);
glutInitWindowPosition(initWindowX, initWindowY);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("OpenGL");

// Register callback functions for change in size and rendering.
glutDisplayFunc(renderScene);
glutReshapeFunc(changeSize);
glutIdleFunc(renderScene);

// Register Input callback functions.
// 'Normal' keys processing
glutKeyboardFunc(processNormalKeys);
glutKeyboardUpFunc(processNormalKeysUp);
// Special keys processing
glutSpecialFunc(processSpecialKeys);
glutSpecialUpFunc(processSpecialKeysUp);

// Mouse callbacks
glutMotionFunc(processActiveMouseMove);
glutPassiveMotionFunc(processPassiveMouseMove);
// void glutMouseFunc(void(*func)(int button, int state, int x, int y))
glutMouseFunc(processMouseButtons);
glutMouseWheelFunc(processMouseWheel);
// Position mouse in centre of windows before main loop (window not resized
yet)
glutWarpPointer(windowWidth / 2, windowHeight / 2);
// Hide mouse cursor
glutSetCursor(GLUT_CURSOR_NONE);
// warp

// Initialise input and scene objects.
input = new Input();
//scene = new LoadingScene(input);
load_scene = new LoadScene();
game_scene = new GameScene(input);

// load scene
// Create GameScene();
// Create LoadingScene(GameScene *)
// delete LoadingScene();
// LoadingScene thread tells game to start loafing assetss

// Enter GLUT event processing cycle
glutMainLoop();

return 1;
}

The game scene reassignment must be called in changeSize function. I thought it should be in the renderScene function but it's the only way it works. Here's how it looks like:

void changeSize(int w, int h)
{
scene = load_scene;

scene->resize(w, h);
}

Any ideas how I could go on about it? So far if I assign to 'scene' pointer 'load_scene' object it's displaying 'load' scene. Same goes for 'game' scene.
Is it even possible to achieve a transition between scenes without threading?

sentences:
How can I draw a linerenderer line between two vector3 positions using the mouse left button click? This code is drawing a line but it's not drawing it on the camera in front of the camera.

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

public class DemoScriptDraw : MonoBehaviour
{
    private List<Vector3> _positions = new List<Vector3>();
    private LineRenderer lr;

    private void Start()
    {
        lr = this.GetComponent<LineRenderer>();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 pos = Input.mousePosition;
            pos = Camera.main.ScreenToWorldPoint(new Vector3(pos.x, pos.y, lr.transform.position.z));
            _positions.Add(pos);

            if (_positions.Count == 2)
            {
                SpawnLineGenerator(_positions[0], _positions[1], Color.red);
            }
        }
    }

    void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();

        myLine.AddComponent<LineRenderer>();
        myLine.AddComponent<EndHolder>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.useWorldSpace = true;
        lr.endColor = color;
        lr.startWidth = 0.1f;//0.03f;
        lr.endWidth = 0.1f;//0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }
}

The result is that the line is seen in the scene view window but not in the game view window:

sentences:
anisotropic fog of war Here I am not talking about how to render fog of war, but how to model exploring of terrain in a more sophisticated way.

In a straight-forward approach, terrain explored by a game unit is simply represented by a circle whose radius is how far this unit can see. And visible area is just union of isometric circles. But I can tell that it is not the case in popular games.

Please take a look at the following screenshot from League of Legends, for example.

The sight of view is anisotropic. The shape of surrounding terrain is also taken in to account.

Any idea how this can be done?

sentences:
Coroutine wrong Behavior when scene is loaded. Ok so I have this coroutine :

 IEnumerator ShowCharTraits()
    {

        while(!hasPlayerChosen)
        {
            yield return null;
            traitPanel.SetActive(true);
        }
        hasPlayerChosen = false;
        traitPanel.SetActive(false);
    //    Debug.Log("Got called! job done");

    }

It's being called like this from the awake method in my GameManager:

players = GameObject.FindGameObjectsWithTag("Player");
                foreach (GameObject g in players)
                {
                    ui_Controller.StartShowCharTraits();
                    g.GetComponent<PlayerToken>().isTurn = false;
                }

StartShowCharTraits() is a simple method that does this :

  public void StartShowCharTraits()
    {
        StartCoroutine("ShowCharTraits");
    }

Now, I have checked the tags, no null reference exception, actually no errors or warnings are being thrown. If i load the scene in the editor and then play it everything works fine. traitPanel.SetActive(true); get called and my panel shows up. However when I load my scene from another scene using   SceneManager.LoadScene(1); the above mentioned line is never reached. Any ideas why this is happening ?

sentences:
When should I use a physics engine? Since I found out Box2D, I'm using it for kind of any game-like application I try to write, from very small prototypes or small programs to test something, to actual projects.

Thanks to it it's so terribly easy to handle anything from collisions, to the actual physics.

Sometimes, though, I have some doubts about it: if I only have to handle circles or AABB, and don't need advanced physics tools (joints or stuff like that), I think that a physics engine could add a sort of big, unneeded overhead.

To reassume my question: would you use Box2D (or other physics engines) in a game where physics is really simple (like Super Mario, let's say)? And, if not, why?

sentences:
How to render portals in OpenGL? I am making RPG in OpenGl and I need to make some portals.
How should I render it if I want to see through the portal on the other side?

sentences: How do I make wasd controls for a top down game in unreal engine 4.13.1 I've been trying to make controls for a top down game in unreal engine 4 but I can't figure out how to make it and all the tutorials I've been seeing are outdated.

sentences:
Problem with shooting So what I am trying to achieve is have the player shoot toward the mouse positiion and I have that working but I want the player to have to charge their shot. So if the player just presses the button it only goes a certain distance but if the player holds the button down for a bit it goes farther.

I tried to make a video that kinda explains what I am going for.

This is the code that controls the shooting

public class BowController : MonoBehaviour {

    public GameObject arrow;
    public Transform shootLoc;

    public float force;
    public Camera cam;

    public float chargeMin;
    public float chargeAmount;
    public float chargeMax;

    public bool charging;

    void Start () {

    }

    void Update () {

        Ray cameraRay = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        Vector3 pointToLook;

        if (Physics.Raycast(cameraRay, out hit, 50))
        {
            pointToLook = hit.point;
            Debug.DrawLine(cameraRay.origin, pointToLook, Color.blue);

        }
        else
        {
            pointToLook = cameraRay.origin + (cameraRay.direction * 50);
        }
        transform.LookAt(pointToLook);

        if(Input.GetMouseButtonDown(0))
        {
            charging = true;

        }
        if (charging)
        {
            Charging();
        }

        if (Input.GetMouseButtonUp(0))
        {
            GameObject tempArrow;
            tempArrow = Instantiate(arrow, shootLoc.position, shootLoc.rotation) as GameObject;

            tempArrow.transform.LookAt(pointToLook);

            Rigidbody tempBody;
            tempBody = tempArrow.GetComponent<Rigidbody>();

            tempBody.AddForce(transform.forward * force, ForceMode.Impulse);

            force = 100;
            charging = false;
        }
    }

    void Charging()
    {
        force += Time.deltaTime * chargeAmount;

        if (force >= 500)
        {
            force = 500;
        }
    }
}

And this is the code that is on the arrow

  public Rigidbody rBody;
  public float speed;

    void Awake () {
        flying = true;
    }

    void Update () {
        if (flying)
        {

            //rBody.velocity = rBody.velocity.normalized * speed;
            transform.LookAt(transform.position - GetComponent<Rigidbody>().velocity);
            transform.Rotate(0, 180, 0);
        }
    }

    void FixedUpdate()
    {

        /*
        if (flying)
        {
            transform.rotation = Quaternion.LookRotation(rBody.velocity);
        }
        */
    }

    void OnCollisionEnter(Collision collision)
    {
        flying = false;
    }
}

I am still pretty new to coding so any help is appreciated. Thank you all very much in advance for the help!

sentences:
why child class can access object while parent can't I have Block class which is the parent and StandardBlock the child , the prefab block have StandardBlock script attached to it, and according to my small knowledge in inheriting I though this would work

public class Block : MonoBehaviour
{
HUD HUDscript;
// Start is called before the first frame update
void Start()
{
    HUDscript = GameObject.FindWithTag("Canvas").GetComponent<HUD>();
}
public void OnCollisionEnter2D(Collision2D col)
{
    HUDscript.addPoints();
    Destroy(gameObject);
}
}

and child class

public class StandardBlock : Block
 {

      // some code
}

but this is the error that i got

NullReferenceException: Object reference not set to an instance of an object
Block.OnCollisionEnter2D (UnityEngine.Collision2D col) (at Assets/Scripts/Gameplay/Block.cs:24)

while writing OnCollisionEnter2D in the child class worked fine

sentences: What article discusses weightmaps for ai control? A while back, I read an article on using weightmaps to control ai movement, particularly in an RTS environment. I can't find the article again, so perhaps someone here read it? I'm not asking for a list, there's a specific article I'm looking for, and so far I haven't found the magic query on google to find it.

sentences:
Implementing Spine animations in Libgdx I've been searching a lot for a guide on how to implement 2D animations exported from Spine to Libgdx, but all I could find was outdated tutorials and source codes. I can handle basic Libgdx but Spine seems to be completely different.
I was there, [there](https://esotericsoftware.com/spine-using-runtimes"esoterics software") and also on lots of other sites (low rep level won't let me post more links) but still I've got no idea how to do it.
Does anyone know how to add those animations properly? (doesn't matter if it's json or binary)
Preferably paste some code showing how to display something like spineboy so that I can see exactly what needs to be done. Any other suggestions appreciated..

sentences:
How to create a bounding box around a Sprite in C++? Hello everyone, I am trying to create a bounding box around a Sprite in my simple Pong game. The bounding box needs to be a simple rectangle around the sprite so that it can act as a collision detector between the ball and paddle.

I have already tried to create the bounding box but it's not quite working as expected.

    float current_x = paddle_right->xPos();
    float current_y = paddle_right->yPos();
    float current_x2 = paddle_left->xPos();
    float current_y2 = paddle_left->yPos();

    float width_x = current_x + 16;
    float width_y = current_y + 150;
    float width_x2 = current_x2 + 16;
    float width_y2 = current_y2 + 150;

    if((x_pos > current_x && x_pos < width_x && y_pos > current_y && y_pos < width_y)||
        (x_pos > current_x2 && x_pos < width_x2 && y_pos > current_y2 && y_pos < width_y2))
    {
        dir_vector.setX(dir_vector.getX() * -1);
    }

The above code is the code I have used to create said bounding box, but like I said, it's simply not working correctly (As in the ball will sometimes go through the Sprite or have an abnormal reaction to it such as bouncing the wrong way).

I hope I have explained this well, if not please ask me which part to explain again. Basically, I just want do create a bounding box around a Sprite (in this case, the Paddle) to which then the ball can collide from.

For reference I am using the AwesomeSauce Game Engine.

sentences:
Does calling VSSetShader() twice with the same shader have a performance penalty? Let's say I render 2 objects that are using the same shader (and the same ID3D11VertexShader object). When I call VSSetShader() to set the shader for the 1st object DirectX has to change previous shader to the new one which takes some CPU/GPU time. But when I then render the 2nd object and call VSSetShader() again with the same argument(s) does it set the shader again (and take as much CPU/GPU time as before) or is DirectX "smart" enough to figure out it's the same shader and it doesn't have to change anything?

Actually, I'd like to ask a broader question - does the same hold true for other analogous state changing function calls? Like setting buffers, sampler states, blending states etc... Pretty much whenever it's a matter of "applying"/"setting as current" objects and states when I actually try to set the same as before.

sentences:
Derive direction in which a spot light emites its light from a projection matrix First of all, sorry if my question sounds too basic or even makes no sense. I'm new with game development

I'm working with HPL1Engine, specifically, the lights parts. I need to know the direction in which a spot light emits its light. But the class that represents a spot light, doesn't have any direction vector.

So, I've been reading about lights in 3D engines, and I've detected in the class some other properties that I consider important. Like a projection matrix and angles (FOV and aspect). I'm trying to focus on the projection matrix (here, how the engine calculates it), but I'm not sure if I'm wasting my time.

Again, my goal is to know the direction in which a spot light emits its light (a vector), but I just have this matrix, and many other properties I don't relate with the spot direction calculation.

How could I know this direction from which I have (what the class provides me)?

Many thanks in advance.

sentences:
Is there any case to mix Android UI with LibGDX? my question is about creating "non-playable" screens in games with the help of native android tools.

For example, I have an Android LibGDX game (singleplatform), what should I use to provide start screen, level selection screen etc?

Is it "right" to build all screens in LibGDX only (where I know nothing about UI) - skins, scene2d...?

Or is it ok to build all in Android UI (I'm pretty familiar with that, and it seems to me more easy and fast to develop), and only use separate LibGDX Activity/Fragment where the game actually begins?

What is the common approach?

Thank you in advance! :)

sentences:
Connecting clients with UDP and WebSocket connections I'm in the process of making a physics intensive multiplayer game. Naturally I use a UDP to transfer packets regarding rigidbodies between client and an authoritative  server.

However non-essential packets I'd prefer to use a more reliable connection like WebSockets. This would be for things like voice chat, text chat, scoreboard, etc. It also seems the be a nice approach to checking if the client is still connected and if not, stop sending it UDP packets.

I'm actually unable to find use cases of this dual connection approach online and I was wondering how this is typically handled in similar games. Is it very far fetched or unconventional?

Another question would be how far do I take relying on the WebSocket connection? Lets say for managing remaining bullets in a guns magazine, would it be better over UDP or WebSocket?

I feel like WebSockets would be best in this case because if the bullet was successfully spawned and the server needs to remove a bullet from the client's gun's magazine, if that packet doesn't arrive at the client, then they shot a free bullet...

The UDP equivalent for this scenario would be to always send the client's magazine state as packets and the client just updates it's magazine whenever the packets get to them. My concern here is overloading the network traffic data that might not have even changed...

sentences:
Blur effect on background to make the forground more clear unity I'm making a game in unity and I'm trying to add a background blur effect to my game to make things a bit more clear.

Here is an example of what I am looking to do:

I'm trying to get the background blurriness and cloudy effect, but I have no idea how to go about getting a similar effect. It looks like a blur + cloudiness of some sort, but I've tried blurring my background objects and it just looks terrible.

Here is what I currently have:

I'm using Unity, it's all 2D sprites so I don't think I can use shaders, which is the only solution I could find people talking about, and have no idea how to proceed. Any help would be appreciated, Thanks.

Edit: Even knowing the terms I could use to search for a solution would help as I'm not quite sure what it is called.

sentences:
Switching a project written in Lua to a compiled language I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, misspellings caught at compile time, and the ability to create efficient data structures for things like 2D vectors.

I thought about some alternatives:

C++ should be very efficient, but it also would make me have to worry about low-level details like manual memory management, and compiling for different platforms.

Java is cross-platform, but as far as I know it does not support pass-by-value data structures, which I would really like. There are also the claims of it being large and slow, but I'm not sure how valid they are.

C# seems to have similar advantages and disadvantages to Java, plus it only officially supports Windows, which makes me hesitant since I mainly use Linux and would like my program to be cross-platform.

So, if my ideas about one of those languages is wrong, or you have other suggestions, I would be interested to find out.

sentences:
Do I lose any functionality using Visual Studio for Unity 3d? MonoDevelop has always had a strange tendency to stop functioning in basic ways ... autocompletion, copy/paste-clipboard, error detecting, and other silly things.

I routinely fix this by running clean / rebuild all, then restarting MonoDevelop. But this is time-consuming. I've read that Monodevelop has issues...

If I switch to Visual Studio will I lose anything at all that I rely on with Monodevelop's integration to unity? Or will I in fact gain?

sentences:
Using 2D Heightmap Data to generate terrain with the Marching Cubes Algorithm The Marching Cubes (MC) algorithm works by taking 8 points of a cube with different density values and converting them into vertices and triangles based on a given iso level (threshold above which is considered solid area). It can create quite a smooth result. For example the following picture shows MC generating polygons using a 3D noise perlin function.

However 3D perlin noise is not very useful for generating terrain. 2D perlin noise is much better. One could use the following function to generate the density values at each corner of each cube sent through the marching cubes algorithm with an iso level of 0:

float IsoValue(Vector3 pos) {
    float gap = maxHeight - minHeight;
    float perlin = (Mathf.PerlinNoise(pos.x * frequency, pos.z * frequency) * gap) + minHeight;
    if(pos.y > perlin) {
        return -1f;
    }
    else {
        return 1f;
    }
}

It produces a jagged-looking result:

This is because unlike the 3d-noise function, the density values go straight from 0 to 1, and MC always generates vertices along a grid instead of at different heights in between the grid. How do I modify the above IsoValue function to not always give values between 0 and 1 (to make smoother looking terrain) depending on how close the generated noise is to the grid?

sentences: Unity. Draw mesh without a mesh class Is there a way to draw an array of vertices/traingles directly from code, above 65k verts? I looked at Graphics class but it can only render a Mesh object.

sentences:
Why do I get this error when setting up Android support for Game Maker? Game Maker asks me to install the Android SDK API 13 for it to work. I opened the SDK Manager and clicked at API 13 but I wasn't able to click the "install packages" button.

I clicked at the obsolete and then I was able to install. But when I pressed "Accept Licence" I wasn't able to click install as an error came out:

Package Google Tv Addon, Android API 13, revision 1 (Obsolete) depends on Missing SDK Platform Android, API 13".

Any help would be much appreciated.

sentences:
Is there a way to assign a texture to a button and resize it in the Unreal Engine? I'm attempting to create a main menu for my game and have followed an easy tutorial to do so. The tutorial doesn't cover assigning textures or images to buttons, so I set out to do this myself.

Assigning the image to the button (I have a 'normal', 'hover', and 'clicked' texture) was rather easy, but the images don't fit.

Using the 'Image Size' options don't do anything at all and I've got no idea on how to change the image without going back into Photoshop or GIMP and just redoing the whole image to fit the button size.

Is there any way to actually change the size of the image inside the button in Unreal? Or do I just have to suck it up and re-do it?

sentences:
Superclassing RPG Game Entities I am in the design process of an RPG game and I have no experience at all in game dev.
This question is about how I should approach entity management using OOP classes.

My train of thought is as followed:

Have Entity interface with basic update() function
"Mortal" class and "NPC" class implement Entity
"Hero" and "Monster" class inherit from "Mortal" class

In this case, Mortal class are all those entities that have statuses such as HP and MP.
NPC are self explanatory.

I am sure my approach is naive so I would like to know the pros and cons and what would be a better way to approach this.

sentences:
What's the most efficient way to deal with in-game messages in Allegro 5? I have a little 2D game made with Allegro, and I want to introduce strings during gameplay. For example, I've just made it so a key is needed to open a door, so I'd need some tutorial text to appear when the player collides with the door that tells them they need the key first.
This is just a learning experience for me, really - the key is pretty visible but I would like to learn how to handle this sort of messages especially for tutorial purposes in a bigger, better game.

Right now, during gameplay, I have running game_loop() (which handles player movement, collisions etc) and game_render(), which obviously runs after it. To introduce these messages, what I have successfully done so far is to add a global std::vector<const char*> to which I push_back messages whenever appropriate.

My message_renderer() then goes like so:

static double t = 0, c = 0;

    if (!messages.empty())
    {

    for (unsigned int i = 0; i < messages.size(); i++)
    {

        al_draw_text(font18, al_map_rgb_f(255, 255, 255), wWidth / 2, wHeight - 50, ALLEGRO_ALIGN_CENTRE, messages[i]);
        if (t < 2)
         {
           t += get_dt();
           c += get_dt();
            if (c > 1)
                  c = 1;
          }
        else
        {
        t = 0;
        c = 0;
        messages.pop_back();
        }

    }
    }

I then call this message_renderer() in my game_render() after I've drawn everything else, to ensure that the message appears on top.

Now, again, this does work - the message displays for 2 seconds at render time once it's added to the vector. However, this solution doesn't really seem particularly neat to me, since as far as I know there are standardised ways of dealing with these sort of events - I just don't know what they are!

So my question is - is my current method efficient enough? Can it be improved, in Allegro (or generally, in logic!) and if so, how?

Thank you in advance!

EDIT: I've modified the code since posting the question, so it should now behave like expected - showing a message for 3 seconds. It does so, but when I have two strings in the vector at the same time they overlap - I thought the timer would work as "pause" between each iteration but I guess not... If someone could point me in the right direction for that too, it'd be much appreciated :)

sentences:
How should I develop my Android game efficiently? I have attached a image of a flow chart that I made in paint.

The image shows how I want to develop my game. I want a game that runs great with smart coding that is easy to update and ad features over time. My target platform is the Android smartphone and all code will be written in java with XML inflated resources, if that matters. I am not looking for hard code,although pseudo code will help, I would more so prefer suggestions and advise from the pros.

My questions are :

Is this a good way to program a game or are there better ways to do this? Are there any modifications that need to be made? Any suggestions would be useful because I am not experienced in game programming so I would prefer the advice from someone who has written several games and knows from experience how one should go about setting their code up to run efficiently.

sentences:
Hammer Editor - How to fix harsh lighting between brushes I'm working on an old Half-Life 2 map that I haven't worked on in many years. I changed some textures on the map and for some reason, lighting between the old textures and the ones I now just changed is very harsh.

There are no errors during map compilation. Any ideas what may be causing this issue or how to fix it?

sentences:
Tuning physics for a "worms"-like game I'm using LibGDX and Box2D for my physics but my characters bounce all over the place when moving and if there is a small slope in the terrain they launch off of it.
I've tried tweaking settings but it either seems to completely kill the motion or send the player off to space. How can I get movement closer to Worms where there is a little bounce but the players for the most part stick to the floor.

For reference I want it to be like this:

https://www.youtube.com/watch?v=zMDfo2czbu0&t=5s

What kind of things can I tweak to get that kind of motion?

sentences:
How can I fade in 3D foliage smoothly? Take a look at this picture:

This is a picture of me diving down from a high height. As you can see, the world is a simple world with grass, snow, trees, etc.

The problem here is the 3D foliage. If is obviously just "jumping" into the scene. It also changes the scene dramatically - Instead of simply adding detail to the "current" scene, it's effectively overwriting the terrain underneath it and setting it's own colours/details.

Let's take a look at a popular game, such as war thunder:

Yes, you can see the 3D foliage appearing as the player gets closer to it. However, it is very hard to actually focus on how or where it is appearing. Also, the grass adds detail to the terrain, rather than completely overwriting it and providing a completely different picture.

The TL;DR on this is - My game has grass that "pops" into existence and creates an obvious change in the terrain, whereas professional games have unobtrusive hard-to-notice geometry gradually fading into view.

How do other games do this, and how can I implement it?

sentences:
What's the name for the random animations played when character isn't doing anything else? In many games, the main characters or enemies usually do some random stuff when idle other than just standing there breathing. For example, they may take a nap or eat some food.

These add nothing to gameplay, but help develop some personality for the characters. I can't find a word to describe them; do these animations have a standard name in the industry?

sentences:
Can't go above max speed with RigidBody2D.AddForce() I'm having trouble making a character move faster than a certain limit using RigidBody2D.AddForce(). My game is a top-down 2D game (constrained to the x/y plane).

I'm using a float 'MovementSpeed' to scale a normalized vector passed to RigidBody2D.AddForce(), however, when I increase MovementSpeed past 1000, there's almost no noticeable difference in the object's "speed"; going from 100 to 1000 is a drastic difference, but there's almost no noticeable difference going from 1000 to 1000000. Here's my WASDMovement() function (called during FixedUpdate() ):

private void WASDMovement() {
    Vector3 translationVector = Vector3.zero;

    if (Input.GetKey(KeyCode.W)) {
        translationVector += new Vector3(0.0f, 1.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.A)) {
        translationVector += new Vector3(-1.0f, 0.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.S)) {
        translationVector += new Vector3(0.0f, -1.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.D)) {
        translationVector += new Vector3(1.0f, 0.0f, 0.0f);
    }

    translationVector.Normalize();
    rigidbody2D.AddForce(translationVector * MovementSpeed);
}

Here's a video demonstrating my problem to make it easier to see what I'm doing wrong: http://youtu.be/9kwKvfDOYoo

sentences:
TurnBasedGame with libGDX + Google Play Services I'm trying to write a small card game for Android using libgdx framework. My game is turn-based. I wrote to interface with the necessary methods to access the API interface from Google. I faced the problem after I called Games.TurnBasedMultiplayer.createMatch(gameHelper.getApiClient(), tbmc) I got the result of the callback. If initiateMatchResult.getMatch().getData() is null I am initiating games data, and here's the PROBLEM: I don't know how to go back in GameScreen???

This is piece of code in AndroidLauncher:

Games.TurnBasedMultiplayer
                .createMatch(gameHelper.getApiClient(), tbmc)
                .setResultCallback(new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() {
                    @Override
                    public void onResult(@NonNull TurnBasedMultiplayer.InitiateMatchResult initiateMatchResult) {
                        if (!initiateMatchResult.getStatus().isSuccess()) {
                            gameHelper.showFailureDialog();
                            return;
                        }
                        TurnBasedMatch match = initiateMatchResult.getMatch();

                        if (match.getData() != null) {
                            Log.d("MyLogs", "match: not null");
                        }
                        initGame();
                        myGame.setScreen(myGame);
                    }
                });

If just call myGame.setScreen(new GameScreen(myGame)) is the GameScreen displaying is not correct. In GameScreen I have table and images in this table and the images displaying is not correct!!!

This code of my GameScreen

public class GameScreen implements Screen {

final MyGame myGame;
private Stage stage;
private Table table;
private Image card1, card2, card3, card4, card5, card6;

public GameScreen(MyGame myGame) {
    this.myGame = myGame;

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    card1 = new Image(new Texture(Gdx.files.internal("1.png")));
    card2 = new Image(new Texture(Gdx.files.internal("2.png")));
    card3 = new Image(new Texture(Gdx.files.internal("3.png")));
    card4 = new Image(new Texture(Gdx.files.internal("4.png")));
    card5 = new Image(new Texture(Gdx.files.internal("5.png")));
    card6 = new Image(new Texture(Gdx.files.internal("6.png")));

    table = new Table();
    table.setFillParent(true);
    table.setDebug(true);
    table.add(card1).width(140).height(202).padLeft(15).padRight(15).padBottom(10);
    table.add(card2).width(140).height(202).padBottom(10);
    table.add(card3).width(140).height(202).padLeft(15).padRight(15).padBottom(10).row();
    table.add(card4).width(140).height(202).padLeft(15).padRight(15);
    table.add(card5).width(140).height(202);
    table.add(card6).width(140).height(202).padLeft(15).padRight(15).row();

    stage.addActor(table);
}

@Override
public void show() {

}

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

    stage.act(delta);
    stage.draw();
}

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

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    stage.dispose();
    mySkin.dispose();
    dixit.getScreen().dispose();
}

SCREENSHOT BELOW

this screenshot shows how to display images in my table
Tell me what my mistake and what am I doing wrong? Can anyone advise how best to do otherwise??

sentences:
How do professional games avoid showing pixel seams in adjacent mesh boundaries due to decimal imprecision? Graphics cards are mathematically imprecise.

So when some meshes are joined by their borders, the graphics card often makes mistakes and decides that some pixels at the seam represent neither object, and unwanted pixels appear.

It's a natural behaviour on all graphics cards. How are such worries avoided in Pro Games? Batching? Shaders? Different tangent vectors? Merging? Overlaping seams? Dark backgrounds? Extra vertices at borders? Z precision? Camera distance tweaks?

Screencap of a fix that ended up not working:

sentences:
Unity 5 lighting broken EDIT: I've discovered the cause of the problem and it might make more sense if I continue in another question.

To start with unity has decided that lighting inside reflection probe bounding boxes is different :

This is fixed by disabling the probe but this isn't an acceptable solution.
I have no idea how to fix this.

Secondly:
Unity has decided to make my shadows flicker on and off (btw: kinda in sync to me pressing my mouse buttons)
Disabling the probes once again helped but this time did not solve the problem completely as the shadows would still flicker between resolutions.

Oh and I've been getting these bugs and no shadows at all sometimes:

rc.right == m_GfxWindow->GetWidth() && rc.bottom == m_GfxWindow->GetHeight()
GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly.

Please could someone help because I really don't understand why this is happening. Thanks...

Edit:
I was told that it would be necessary to detail what I've already done and some more information on the scene.

What I've tried:
Updating to the latest release of Unity (5.2.3f1)
Adjusting the near and far clipping planes
Turning things on off (GameObjects)
Changing the shadow settings (Shadow cascades, shadow distance)
Changing between Realtime and Baked Lighting and GI
Clearing the GI cache
Switching between deferred and forward rendering

If there's anything else anyone needs to know I will more than happily add it here because as I say I have no idea what you need to know to solve this.

sentences:
Multiple buffers and calling glBufferSubData Originally asked this on Computer Graphics, but it might fit in better here.

In my project, for convenience I would like to use many buffers.
Many buffers in my case means 50-100 terrain patches represented by buffers with vertex coordinates, normals, indices and maybe color. The magnitude of data would be, let's say 10^4 floats per buffer. Some of this data can be shared between each terrain patch, f.ex. xz-coordinates and indices.

During the rendering loop, some terrain patches will be updated. Which means that for certain buffers I call glBufferSubData() for the whole buffer.

My question is; are there any pros/cons, performance wise between these two methods:

1) Controlling my data in many buffers (50-100), thus letting me call glBufferSubData on a complete buffer when needed.

2) Controlling my data in fewer (5-20) buffers, with more data in each. But then having to set up a system where I need to call glBufferSubData on smaller portion of a buffer. (Which leads to a more complex design in my case).

sentences:
Switching between world and battle scene with no or minimum loading? I am making a strategy game where the player roams a grid map.
When the player encounter enemy on the map he is transferred to a "battle" scene where two armies are fighting in turn based battle.
Imagine Heroes 3 like game.
My question is:

Should I load the battle scene in additive mode and temporary hide the "world map" and when the battle is finished to just show the "world map" and hide the "battle" scene?

Or i should unload the world scene and load the battle scene, and when the battle is over -> unload the battle scene and load the world scene ?

I think the 1st approach will give me less loading time between the two scenes, but will require more RAM ?
Second approach is standard one, but i will have loading between the scenes ?
My idea is to have no or minimal loading between battle and world scenes.
What do you guys thing ? Did you know what is the best practice in this case ?
By the way, i am using Unity as a engine.

sentences: Gamemaker Key Press Duration I am looking for a way to track the duration of a key press in gamemaker. I was looking into alarm functions, but I figured there's a more elegant way. How can I track the duration of a keypress?

sentences:
How can I remove scores or ban users from Google Play leaderboards? I have included Google Play game services in my Android game. I see lot of users posting fake scores.

Can I ban them or can I delete these scores somehow?

sentences:
Dynamically Discovering Game Content I am trying to determine the best way to dynamically discover new levels in my Windows Phone game. This is necessary because I will be selling some levels separately to those included with the initial game purchase. I assume that it is possible for such purchases to be automatically downloaded and merged into the same directory that contains the game itself.

All my levels are pre-processed and stored as XNBs. Ideally, I would be able to obtain an enumeration of all XNBs of a particular type (ie. Level) within my game directory, but I cannot find a means of doing this. Alternatively, if I could get a list of all XNB names then I could use a naming convention to identify levels. Unfortunately, I can't find a way to do that either.

Am I barking up the wrong tree here? Can anyone shed any light on how I might dynamically discover content in my game?

sentences:
Raycasting with a selection rectangle box I'm currently making a level editor for my game and want to implement a selection tool to make it easier to select multiple voxels at once.
My question is what the most efficient way is to get all the selected objects?
Do I just unproject the starting position and end position of the selection rectangle and create a bounding box that I then can use for intersection checking or is there a better way?

EDIT: Since I can't rotate a bounding box I need to find another way. I just need a way to find out if the bounding box of a voxel is inside the box that is formed by the four points of the selection.

sentences: Weird blue shine on URP Lit shader Unity I recently started to use URP and I am noticing a weird blue like tint on shiny objects that use the URP/lot shader and I can't understand what it is and how can i remove it.

sentences:
Is there a way to run Unity without rendering the scene on the monitor (headless)? I am doing some machine learning and I get my environment from Unity in the form of images but the training is taking too long and it keeps me from doing anything else on my system. Is there a way to hide the simulation rendering?
Any help will be highly appreciated.

sentences:
How do I load/use substances with libgdx? I've been looking at some substances (.sbsar file format) but I have no clue how to load or use these files. The links I find brings me to Unity & Unreal Engine, but if I search up anything related to libgdx or opengl, I can't get any results.
Does anyone know how I can use these textures in my libgdx java game?

sentences:
openGL textures in bitmap mode For reasons detailed
here
I need to texture a quad using a bitmap (as in, 1 bit per pixel, not an 8-bit pixmap).

Right now I have a bitmap stored in an on-device buffer, and am mounting it like so:

glBindBuffer(GL_PIXEL_UNPACK_BUFFER, BFR.G[(T+1)%2]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, W, H, 0, GL_COLOR_INDEX, GL_BITMAP, 0);

The OpenGL spec has this to say about glTexImage2D:
"If type is GL_BITMAP, the data is considered as a string of unsigned bytes (and format must be GL_COLOR_INDEX). Each data byte is treated as eight 1-bit elements..."

Judging by the spec, each bit in my buffer should correspond to a single pixel. However, the following experiments show that, for whatever reason, it doesn't work as advertised:

1) When I build my texture, I write to the buffer in 32-bit chunks. From the wording of the spec, it is reasonable to assume that writing 0x00000001 for each value would result in a texture with 1-px-wide vertical bars with 31-wide spaces between them. However, it appears blank.

2) Next, I write with 0x000000FF. By my apparently flawed understanding of the bitmap mode, I would expect that this should produce 8-wide bars with 24-wide spaces between them. Instead, it produces a white 1-px-wide bar.

3) 0x55555555 = 1010101010101010101010101010101, therefore writing this value ought to create 1-wide vertical stripes with 1 pixel spacing. However, it creates a solid gray color.

4) Using my original 8-bit pixmap in GL_BITMAP mode produces the correct animation.

I have reached the conclusion that, even in GL_BITMAP mode, the texturer is still interpreting 8-bits as 1 element, despite what the spec seems to suggest. The fact that I can generate a gray color (while I was expecting that I was working in two-tone), as well as the fact that my original 8-bit pixmap generates the correct picture, support this conclusion.

Questions:

1) Am I missing some kind of prerequisite call (perhaps for setting a stride length or pack alignment or something) that will signal to the texturer to treat each byte as 8-elements, as it suggests in the spec?

2) Or does it simply not work  because modern hardware does not support it? (I have read that GL_BITMAP mode was deprecated in 3.3, I am however forcing a 3.0 context.)

3) Am I better off unpacking the bitmap into a pixmap using a shader? This is a far more roundabout solution than I was hoping for but I suppose there is no such thing as a free lunch.

sentences:
XNA game for Xbox360 I learn XNA 4 and made a simple game for Windows. Now i want to run it on Xbox360.
I choose "Create Copy of Project for Xbox360" and build it. After that i have in bin folder two files with extensions .exe and .pdb and Content folder.
How i can run this on Xbox360?

sentences:
Managing multiple references of the same game entity in different places using IDs I've seen great questions on similar topics, but none that addressed this particular method:

Given that I have multiple collections of game entities in my [XNA Game Studio] game, with many entities belonging to multiple lists, I'm considering ways I could keep track of whenever an entity is destroyed and remove it from the lists it belongs to.

A lot of potential methods seem sloppy/convoluted, but I'm reminded of a way I've seen before in which, instead of having multiple collections of game entities, you have collections of game entity IDs instead.  These IDs map to game entities via a central "database" (perhaps just a hash table).

So, whenever any bit of code wants to access a game entity's members, it first checks to see if it's even in the database still.  If not, it can react accordingly.

Is this a sound approach?  It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

sentences:
Acknowledgement reliability using UDP I have a question about UDP. For context, I'm working on a real-time action game.

I've read quite a bit about the differences between UDP and TCP and I feel I understand them quite well, but there's one piece that has never felt correct, and that's reliability, and specifically acknowledgements. I understand that UDP offers no reliability by default (i.e. packets can be dropped or arrive out of order). When some reliability is required, the solution I've seen (which makes sense conceptually) is to use acknowledgements (i.e. the server sends a packet to the client, and when the client receives that message, it sends back an acknowledgement to the server).

What happens when the acknowledgement is dropped?

In the example above (one server sending a packet to one client), the server handles potential packet loss by re-sending packets every frame until acknowledgements are received for those packets. You could still run into issues of bandwidth or out-of-order messages, but purely from a packet-loss perspective, the server is covered.

However, if the client sends an acknowledgement that never arrives, the server would have no choice but to eventually stop sending that message, which could break the game if the information contained in that packet was required. You could take a similar approach to the server (i.e. keep sending acknowledgements until you receive an ack for the ack?), but that approach would have you looping back and forth forever (since you'd need an ack for the ack for the ack and so on).

I feel my basic logic is correct here, which leaves me with two options.

Send a single acknowledgment packet and hope for the best.
Send a handful of acknowledgment packets (maybe 3-4) and hope for the best, assuming that not all of them will be dropped.

Is there an answer to this problem? Am I fundamentally misunderstanding something? Is there some guarantee of using UDP I'm not aware of? I feel hesitant to move forward with too much networking code until I feel comfortable that my logic is sound.

sentences: What is differential scrolling? I have seen the term a few times (e.g. here). I tried looking it up but did not find much information. I thought it would be something like parallax-scrolling, but I have seen suggestions otherwise (e.g. here). What is the difference?

sentences:
How to move objects across a canvas with consistent speed on different screen resolutions? I am making a rhythm game in Unity. I have been using Transform.Translate for moving images on a canvas as the music notes. However, I cannot consistently use this method on different screen widths. The notes move the same amount each frame.
I want to use interpolation for my music notes. I want to have the notes reach the center of the canvas at the same time despite the width of the screen. How can I write such a script?

sentences:
How do you programmatically generate a sphere? Could someone please explain how it would be possible to create a sphere vertices, indices and texture coordinates? There is a surprising lack of documentation on how to do so and it is something that I am interested in learning.

I have tried the obvious, googling, looking on gamedev.net, etc. However, nothing covers the generations of spherical points, indexing them, and texturing.

sentences:
Problems With Opening Room Gamemaker In Gamemaker, I have a main menu room, and hitting start takes you to the gameplay room. When testing it, it did not take me to the gameplay room. I made it load into the problem room first, and all it loaded was a black screen. I also noticed when I looked in the console it was said:

  RequestStats - failed: 2

What's causing this and how do I fix it?

Here is my game:
https://drive.google.com/open?id=1xWota0WfzcwvYGHY4zFVwS0vXDwNQfDp

sentences:
Application toolkits like QT versus traditional game/multimedia libraries like SFML I currently intend to use SFML for my next game project.  I'll need a substantial GUI though (RPG/strategy-type) so I'll either have to implement my own or try to find an appropriate third party library, which seem to boil down to CEGUI, libRocket, and GWEN.  At the same time, I do not anticipate doing that many advanced graphical effects.  My game will be 2D and primarily sprite-based with some sprite animations.

I've recently discovered that QT applications can have their appearance styled so that they don't have to look like plain OS apps.  Given that, I am beginning to consider QT a valid alternative to SFML.  I wouldn't have to implement the GUI functionality I'd need, and I may not be taking advantage of SFML's lower-level access anyway.  The only drawbacks I can think of immediately are the learning curve for QT and figuring out how to fit game logic inside such a framework after getting used to the input/update/render loop of traditional game libraries.

When would an application toolkit like QT be more appropriate for a game than a traditional game or multimedia library like SFML?

sentences: UNITY : I want to make my UI text fade in after 5 seconds I know this question has been asked and asked but none of the topics i visited gave me an answer. I'm making a game programmed in c# where you control a boat and i want my UI to appear smoothly by fading in after X seconds. May someone help me?

sentences:
Why does PIX crash while creating render target views in my D3D11 application? I'm trying to use PIX to debug my Direct3D11 application. PIX crashes and gives the following stack trace:

Frame 000001 ........PRE: <this=0x054338e0>IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........POST: <S_OK><this=0x054338e0> IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........PRE: <this=0x05433978>ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........POST: <E_INVALIDARG><this=0x05433978> ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........PRE: <this=0x054b70d0>ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)
Frame 000001 ........POST: <E_INVALIDARG><this=0x054b70d0> ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)

What can I do to get around this problem so that I can debug my application?

sentences:
How do 3d engines add textures to objects? I was wondering how 3d engines like Unity or OpenGL added textures to objects.

Example:

How would Unity add this texture to the side the arrow is pointing to?

sentences:
2D Platformer AABB collision problems I have a problem with AABB collision resolution.

I resolve AABB intersection by resolving the X axis first, then the Y axis.
This is done to prevent this bug: http://i.stack.imgur.com/NLg4j.png

The current method works fine when an object moves into the player and the player has to be pushed horizontally. As you can see in the .gif, the horizontal spikes push the player correctly.

When the vertical spikes move into the player, however, the X axis is still resolved first. This makes "using the spikes as a lift" impossible.

When the player moves into the vertical spikes (affected by gravity, falls into them), he's pushed on the Y axis, because there was no overlap on the X axis to begin with.

Something I tried was the method described in the first answer of this link: 2D rectangular object collision detection

However the spikes and moving objects move by having their position changed, not velocity, and I don't calculate their next predicted position until their Update() method is called.
Needless to say this solution didn't work either. :(

I need to solve AABB collision in a way that both of the cases described above work as intended.

This is my current collision source code: http://pastebin.com/MiCi3nA1

I'd be really grateful if someone could look into this, since this bug has been present in the engine all the way back from the beginning, and I've been struggling to find a good solution, without any success. This is seriously making me spend nights looking at the collision code and preventing me from getting to the "fun part" and coding the game logic :(

I tried implementing the same collision system as in the XNA AppHub platformer demo (by copy-pasting most of the stuff). However the "jumping" bug occurs in my game, while it doesn't occur in the AppHub demo.
[ jumping bug: http://i.stack.imgur.com/NLg4j.png ]

To jump I check if the player is "onGround", then add -5 to Velocity.Y.

Since the player's Velocity.X is higher than Velocity.Y (refer to the fourth panel in the diagram), onGround is set to true when it shouldn't be, and thus lets the player jump in mid-air.

I believe this doesn't happen in the AppHub demo because the player's Velocity.X will never be higher than Velocity.Y, but I may be mistaken.

I solved this before by resolving on the X axis first, then on the Y axis. But that screws up the collision with the spikes as I stated above.

sentences:
How to connect Unity with Arduino using Bluetooth module? I will be getting data in real-time from an Arduino. I want to display that data (such as rpm of a bike) in my Unity game and use it to control the subjects in the game.

I have Bluetooth module HC-05 which I want to use to send the data from the Arduino to Unity.  I found a plugin for this on Unity store but it costs $20.

Could you guide me on how to include Bluetooth access in Unity as well as Arduino?

sentences:
Animation rotates model but I don't see how I have 2 animations.
In the following animation preview, the same model is being used.
As you can see in the animator, there is no significant rotation difference.
However, one animation rotates the model 90 degrees to the left.
I have inspected all the rotation values in the animation tab. I just don't see any difference.
What causes this signifant rotation difference?
Thank you!

sentences:
Using NinePatch in libGDX for Loading Bar I am trying to create images for a loading bar in libGDX. I came across the NinePatch class and I was hoping to use it for this loading bar, since stretching images with a plain Texture or Sprite looks terrible. Does anyone have any examples on how to use this class? I have done some searching around and I've gotten it to work but the image I use just comes through as slightly transparent and gray. It just doesn't look like the same image. The actual loading bar itself seems to work fine as I just set the width of the foreground loading image. Here is the code I am using so far...

// Class vars
private NinePatch loadingBackground;
private NinePatch loadingForeground;

...

// In my constructor
loadingBackground = new NinePatch(new Texture(Gdx.files.internal("loadingback.png")), 8, 8, 8, 8);
loadingForeground = new NinePatch(new Texture(Gdx.files.internal("loadingfore.png")), 8, 8, 8, 8);

...

// Drawing
batch.begin();
loadingBackground.draw(batch, x, y, width, height);
loadingForeground.draw(batch, x, y, loadingWidth, height);
batch.end();

I am open to any other suggestions on how I should implement this as well.

sentences:
Singleton pattern Class attached to multiple GameObjects still only 1 instance? I'm currently working on an Inventory/Equipment System and so far have been using a Singleton Pattern to instantiate my Inventory and Equipment classes. I was wondering if i attach this Script to multiple gameObjects, whether they each have a seperate instance or whether they share it? This would be important for the Equipment classes as each GameObject should obviously have different Items equipped.
My current Singleton pattern looks like this:

public static Inventory Instance { get { return instance; } }

void Awake()
{
    if(instance != null && instance != this)
    {
        Destroy(this.gameObject);
        Debug.LogWarning("More than one instance of Inventory found!");
        return;
    }
    instance = this;
}

sentences:
Generating interesting water using perlin noise I use Mathf.PerlinNoise to generate grass/water in a 2d square. It works as intended, however I am not really getting very interesting water, and at times it can look very bare or unrealistic, here is a sample of a bad generation:

Unfortunately it took me about 20 tries to find an interesting one, what I want is something along these lines:

Or something like this, but I don't want any tiny areas of water:

You can copy/paste the components below and try urself with 1x1 cubes (if you don't have Odin just delete that part):

using UnityEngine;
using Sirenix.OdinInspector;

public class GenerateMap : MonoBehaviour
{
    [Range(0, 40)]
    public int mapWidth = 20;
    [Range(0, 40)]
    public int mapHeight = 20;
    [Range(0, 20)]
    public float noiseScale;

    [Space]
    public GameObject parent;
    public GameObject grassTile, waterTile;

    [Button("Generate map")]
    public void GenerateMap()
    {
        for (int i = 0; i < parent.transform.childCount; i++)
        {
            Destroy(parent.transform.GetChild(i).gameObject);
        }

        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, noiseScale);

        for (int x = 0; x < mapWidth; x++)
        {
            for (int y = 0; y < mapHeight; y++)
            {
                Debug.Log(noiseMap[x, y]);

                if (noiseMap[x, y] >= .3)
                    Instantiate(grassTile, new Vector3(x, 0, y), Quaternion.identity, parent.transform);
                else
                    Instantiate(waterTile, new Vector3(x, 0, y), Quaternion.identity, parent.transform);
            }
        }
    }
}

Noise:

using UnityEngine;

public static class Noise
{

    public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, float scale)
    {
        float[,] noiseMap = new float[mapWidth, mapHeight];

        Vector2 offset = new Vector2(Random.Range(0, 100), Random.Range(0, 100));

        if (scale <= 0)
            scale = .0001f;

        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float sampleX = x / scale + offset.x;
                float sampleY = y / scale + offset.y;

                float perlinValue = Mathf.PerlinNoise(sampleX, sampleY);
                noiseMap[x, y] = perlinValue;
            }
        }

        return noiseMap;
    }
}

sentences:
UniRx: Subscribing to ReactiveProperty condition I'm trying to track a cold source with a contiguous range, and every example I've seen involves discrete increments or events that are already handled, so I'm vague on how to apply it.

Here's what I have:

ReactiveProperty<float> CurrentAlpha = new ReactiveProperty<float>(msg.GetComponent<CanvasRenderer>().GetAlpha());
CurrentAlpha.Where(x => x <= 0.0f).Subscribe(x =>
{
    Debug.Log($"CurrentAlpha == {CurrentAlpha} Observed");
    img.transform.SetParent(null);
    Destroy(msg);
});

I verified the alpha value, but never received notice when it reached 0. What have I mistaken?

EDIT: Found that it's actually subscribing to the value returned, which will always be 1. The value it receives is outside managed code, so there's no object property to observe, and CanvasRenderer itself doesn't observe it.

Is it possible to observe a method's return value?

sentences:
Stitching terrain tiles made in Blender at runtime Background

I'm making several individual terrain tiles inside of blender for use within a Unity 3D 5 game. Each tile is square and is made to represent a segment of a world. In game the tiles are randomly* chosen and placed between each other. However these tiles do not always have matching sides.

Why the tiles

To allow for greater terrain sculpting possibilities such as caves, precision-placed landmarks e.t.c. but still allow for a procedurally generated feeling; randomly placed static tiles are used.

There are mountain tiles and there are plane tiles. Mountain tiles have a more extreme terrain and are mostly next to other mountain tiles so that bigger mountains can be formed. Plane tiles are similarity placed next to other plane tiles.

The game is "low poly" and so is the terrain. This makes it hard to have flat sides on every tile at the same height for easy "stitching".

Concrete question

How can I match these edges runtime to ensure that there are no visible tile edges?

sentences:
Finding a suitable axis-angle to avoid gimbal lock In OpenGL the camera faces the -z axis with the +y axis pointing up. I am using quaternions to represent the orientation of my objects (which works well) and am trying to do the same for the camera. I want the camera's initial orientation rotation to face the +x axis with the up vector being +z. I was attempting to initialize the camera's quaternion rotation by multiplying two 90 degree rotation quaternions in an effort to achieve this, but I believe I am experiencing gimbal lock because I cannot orient the camera properly (the first rotation works fine, the second one produces undesired results). I haven't been able to wrap my head around an axis-angle representation that will orient the camera the way I want.

In summary:

I'm searching for an axis angle (or anything that can be converted to a quaternion really) that will provide the following rotation:

inital camera orientation: facing -z axis, +y pointing up

desired orientation: facing +x axis, +z pointing up

Note: I am already aware of gluLookAt, this problem was my attempt at understanding more about how everything works.

sentences:
Unity3D animation trigger reset How can I reset conditions for animations using an animation controller?

I have a door that will open when a boolean property in a script is set to true. This then calls setTrigger on the animator to play the open door condition and then reset the boolean property to false. After 5 seconds I then close the door. However when I change the boolean to true again to open the door, either the setTrigger isn't working again on the animator, or the trigger for the door close is conflicting. How would I resolve this? Is there a way in the animator to set a condition to false when a particular animation has finished? Initially I was using a boolean condition in the animator but ran into the same problem. I looked at the 2D sample project which used trigger instead and assumed this would only fire once. However I guess something else could be wrong. The code in my script is as follows: (where anim is the animator component)

   void Update(){
    if (open) {
        OpenDoor();
        open = false;
    }
}

void OpenDoor(){
    anim.SetTrigger ("OpenDoor");
    Invoke("CloseDoor",5);
}

void CloseDoor(){
    anim.SetTrigger ("CloseDoor");

}

As I say the animation fires correctly the 1st time but not on subsequent times. I'm just trying this by changing the public "open" property in the inspector

thanks

sentences:
Is Unity NGUI still that usable after Unity has add support for 2D? I am tempted to refactor out the existing component which uses NGUI ("Next-Gen UI kit") given that what I needed is only the sprite and texture atlas.

Since in the newer versions of Unity those parts are natively supported, is there any reason I should still keep NGUI?

sentences:
Playing a Song in MonoGame I'm trying to play a song in a MonoGame project, but it always gives me a weird error. Here is the (Very simple) code:

Song song = Content.Load<Song>("Song1");
        MediaPlayer.Play(song);

But whenever I run the program, it says this:

System.InvalidCastException: 'Unable to cast object of type 'Microsoft.Xna.Framework.Audio.SoundEffect' to type 'Microsoft.Xna.Framework.Media.Song'.'

Do you know why this happens? Any help would be appreciated! :D

sentences:
How do I design my RPG-like class system in a more modular way? I'm building a mod for Terraria that will add classes and their corresponding abilities to the game. You're a warrior? Push your ability key and you'll use your berserk ability.

I'm trying to make my player code as simple as possible. I'd like to set the player's in-game "class" by doing something like this at the top of the player class so the rest of the methods in it can access it later:

//Set class
WarriorClass playerClass == new WarriorClass(playerReference, level)

Herein lies the first issue. I get an error at playerReference that says:

Error   CS0236  A field initializer cannot reference the non-static field, method, or property 'ModPlayer.playerReference'  MyMod

Ok, so I looked that up and set the initialization in the WarriorClass instead:

public Player playerReference = new Player();

And I have this now in my player code:

//Set class
     WarriorClass playerClass = new WarriorClass(level);

Here's the beauty of it. In the gamepad input method within my player code all I ever have to do is:

    //On key presses
    public override void ProcessTriggers(TriggersSet triggersSet)
    {
        if (MyMod.ability1Key.JustPressed)
        {
             playerClass.UseAbility(MyMod.ability1Key);
        }

Now that the ability1 key was pressed, let the WarriorClass handle what to do:

    public void UseAbility(ModHotKey key)
    {
            //Ability 1
            if (key.JustPressed == MyMod.ability1Key)
            {
                //Start berserking
                if (player.HasBuff(ModContent.BuffType<BerserkBuff>()) == false )
                {
                    //Lose 10% of your life
                    lifeLost = player.statLifeMax2 / 10;
                    player.statLife = player.statLife - (int)lifeLost;

                    //Berserk and add damage over in the Buff code
                    player.AddBuff(ModContent.BuffType<BerserkBuff>(), 600, false);
                }

This is all great!!! I can add any amount of classes I want and this player code never changes. Except If I want to add if/then logic to select a class in say, Update() then it breaks the following reference in my gamepad input code:

playerClass.UseAbility(MyMod.ability1Key);

Of course it won't have a reference unless I hard code it at the top of the player file, but I don't know what class a player will be until they pick one.

Am I doing this fundamentally in a bad way or am I missing something else in terms of OO programming? I don't want to have to initialize every class for the character at the top of the file like this:

WarriorClass warriorClass = new WarriorClass(level);
ArcherClass archerClass = new ArcherClass(level);
...

... just to do this in the gamepad input method:

if (classChoice == "Warrior")
{
     warriorClass.UseAbility(MyMod.ability1Key);
}
else if (classChoice == "Archer")
{
     archerClass.UseAbility(MyMod.ability1Key);
}

sentences:
How does one test the effectiveness of a game engine? A few friends and I are working on a home-brewed engine for a selection of games we wish to produce in the future. We're making it to satisfy a few key requirements that we haven't found were properly handled in professional game engines. But we were wondering, how can we test how effective our engine is at solving the problems we set out to solve?

For example, our games require a very specific internal OOP architecture, and the engine facilitates that, making it easy for us to do what we want. How are we supposed to make sure the engine actually helps us?

The reason I ask is because I've written unit tests before, but they've usually been to test whether or not something is correct. Does the engine properly determine collisions between convex polygons? Does the event propagator properly respond to user input? Is the implementation of Bresenham's line algorithm for rendering line primitives correct? Things like this.

When it comes to testing effectiveness of the application as a whole, however, there is no notion of right or wrong. It's fuzzy, it could be pretty effective, very effective, or not effective at all. Is the only solution just to make a game using the engine, and determine the engine's effectiveness from there? I want to say no, because the point of testing is to catch errors early on right, so if we make a game to test effectiveness, we have to build the entire engine beforehand.

How would tests like these even be included? If we integrated "test games" using the same program we use to integrate unit tests, they'd get run every time the engine builds. But we don't want our stupid test games to start running every time we build.

So is there another solution?

sentences:
Detect mouse over a line in Phaser We're developing a game in Phaser as a university project and have come across an obstacle. We need to detect when the mouse is over a line between two points. There are not a lot of lines, definitely fewer then 500. We were thinking of just checking it with line equations on every update call, but that might slow the game down. We haven't found anything useful on google. Should we just stick with the equations or is there a more elegant way?

Cheers

sentences:
Where do you search/look for game developers for an indie game startup? I just recently saw stackoverflow had a game dev sister site so here I am, wondering if you experienced fellows know where one can search/look for game developers for an indie game startup? In other words:

I have a game idea which I've written down with as much detail as possible (so anyone else can understand how it works) and now I'm looking for a heavy php programmer with whom to pair up in order to go from idea to reality. I'm a front-end/interface designer and an intermediate programmer. I recognize my project requires heavy programming skills which I do not have as of today =)

So, what websites, communities or places do you recommend I go look into? Where do good programmers interested in indie games go look for projects if they don't have their own?

Thanks in advance
G.Campos

sentences:
How does the Path of Exile ItemRenderer determine the items' rarity? This question is really specific to Path of Exile and their forum.

Basically, they render the items from a json object.

require(["PoE/Item/DeferredItemRenderer"], function(R) { (new R(JSON)) })

And the json of an item is of the form:

      {
         "verified":true,
         "w":1,
         "h":1,
         "icon":"http:\/\/webcdn.pathofexile.com\/image\/Art\/2DItems\/Rings\/Ring5.png?v=d645f9adfc012c52674c94d16b4292b2",
         "support":true,
         "league":"Default",
         "sockets":[

         ],
         "name":"Honour Grip",
         "typeLine":"Topaz Ring",
         "identified":true,
         "requirements":[
            {
               "name":"Level",
               "values":[
                  [
                     "41",
                     0
                  ]
               ],
               "displayMode":0
            }
         ],
         "implicitMods":[
            "+22% to Lightning Resistance"
         ],
         "explicitMods":[
            "Adds 4-48 Lightning Damage",
            "+8 to Evasion Rating",
            "+70 to maximum Life",
            "+35% to Cold Resistance"
         ],
         "frameType":2,
         "socketedItems":[

         ]
      }

I don't see the rarity of the item anywhere... How do you think they determine it? They could count the mods, but what if the object is not identified?

sentences:
Reference keyboard keys as "justPressed", "pressed", and "justReleased" with SDL in C++ I'm teaching myself 3D graphics with OpenGL and SDL in C++. I'm at a point where I need to be able to query states of individual keys, like so:

if (InputManager::justPressed(SDLK_UP)) {}
if (InputManager::pressed(SDLK_UP)) {}
if (InputManager::justReleased(SDLK_UP) {}

I'm not sure if I should be using SDL_GetKeyboardState or bool arrays for SDL_Keycode/SDL_Scancode, using states seems to me to be the more correct way. I've implemented this previously using states in C# with XNA (see that here). But I've been unsuccessful trying to replicate that with SDL.

Method 1 - Using SDL_GetKeyboardState

// InputManager stores
Uint8* _curKeys, _oldKeys;

void InputManager::init() {
    _curKeys = SDL_GetKeyboardState(NULL);
    _oldKeys = new Uint8[sizeof(_curKeys)/sizeof(Uint8)];
}

void InputManager::update() {
    memcpy(_oldKeys, _curKeys, sizeof(_curKeys)/sizeof(Uint8)); // this seems to work
    std::copy(std::begin(_curKeys), std::end(_oldKeys), std::begin(_curKeys));
}

bool InputManager::pressed(SDL_Keycode code) {
    return _curKeys[code];
}

bool InputManager::justPressed(SDL_Keycode code) {
    return _curKeys[code] && !_oldKeys[code];
}

bool InputManager::justReleased(SDL_Keycode code) {
    return !_curKeys[code] && _oldKeys[code];
}

In the main loop I update the InputManager instance by copying the current keyboard state and updating the current state. Since I'm relatively new to C++ I'm unsure of exactly the best way to copy the values from _curKeys to _oldKeys without using a for-loop. I can't just set _oldKeys=_curKeys because that just makes _oldKeys point to _curKeys. But memcpy seemed to work.

With this implementation justReleased is constantly true, no matter what key is pressed, and justPressed and pressed are always false.

Method 2 -Array of bools

// SDL_PollEvent() loop
case SDL_KEYDOWN: InputManager::keyDown(//event keycode);
case SDL_KEYUP: InputManager::keyUp(//event keycode);

The keyDown and keyUp functions just set keyArray[keycode] to true and false. In the InputManager update function I once again duplicate of the array, simulating "states". But with this implementation all three functions are always false.

Anyway

I hope that this question wasn't too incoherent, I tried to explain it as best as I could. I've found some forums where people had similar problems, the criticism always was that this kind of functionality isn't needed. I would disagree, a good use case for this would be, for example, a charge-up weapon in a game. At justPressed you start the charge, increment a charge counter while pressed is true, and at justReleased you fire the weapon.

If anyone has any pointers for me (no pun intended :P) that would be awesome.

sentences:
Mario like jumping and landing in box2d, help I've been trying to get Mario type jumping/landing in a Box2d game and it's been giving me some trouble.

Results: Player loses velocity on landing

Desired Results: When player lands it will continue at the same velocity it was in the air.

[edit] Player loses velocity on impact, but quickly regains its set max speed.

I know this is an issue with friction and I've tried setting the friction to 0 when the user is pressing Left and Right movement keys and back to normal friction when the player is not pressing those keys. This however, does not work as the state does not get changed until the collision is over and the player will be stuck sliding until the collision state has changed.

My next best guess is to set friction to zero all together for the player and simulating an opposing force on the player.

Solution? Tips? Heck... maybe there's a tutorial out there I missed.

Thanks in advance.

Example
http://www.guioui.com/saxattack/box2d_landing.png

        Vector2 a = entityBody.getLinearVelocity();
        float force = 0;

        if(Gdx.input.isKeyPressed(Keys.D)){
            if(a.x < 5) force = 25;
            //entityBody.getFixtureList().get(0).setFriction(0);
            //floor.entityBody.getFixtureList().get(0).setFriction(0);
            //entityBody.resetMassData();

            //entityBody.applyLinearImpulse(new Vector2(0f,1f), entityBody.getWorldCenter());
            //entityBody.applyForce(new Vector2(0f,50f), entityBody.getWorldCenter());
        }
        else if(Gdx.input.isKeyPressed(Keys.A)){
            if(a.x > -5) force = -25;
            //entityBody.getFixtureList().get(0).setFriction(0);
            //floor.entityBody.getFixtureList().get(0).setFriction(0);
            //entityBody.resetMassData();

            //entityBody.applyForce(new Vector2(0f,50f), entityBody.getWorldCenter());
        }
        else{
            entityBody.getFixtureList().get(0).setFriction(.4f);
            floor.entityBody.getFixtureList().get(0).setFriction(.4f);
        }

        if(Gdx.input.isKeyPressed(Keys.W)){
            a.y = 5;
            entityBody.setLinearVelocity(a);
        }

        entityBody.applyForce(new Vector2(force, 0), entityBody.getWorldCenter());

sentences:
How can I prevent cheating in my collecting and trading game? I develop and manage an online game where users collect and trade virtual pets (it is entirely online).  It's a simple game, we periodically release new pets, users collect them and get random ones, then they trade for the ones they want, and some are rare.  We also do holiday events.
The problem is, there's nothing preventing people from creating new accounts, collecting a bunch of free pets, and then trading them all to their main account, or at least the rare ones.  They could also trade them all to other users in exchange for things on other sites.  This is against our rules, but enforcing it is subjective and difficult.
Historically, we've fought this by manually catching these users and banning them, looking at ip addresses, messages, trading patterns, etc.  The common defense is usually "that's just my friend/sibling and they don't play as seriously as I do".  And that may be true, I have no way to prove it, I just have to determine myself if they've gone too far or are abusing the system.  This type of cheating can be bad for our economy as it hurts rarity values, and gives cheaters an unfair advantage in the market.
I believe this is a fundamentally flawed system and am trying to figure out how to fix it so cheating is not possible, or at least very difficult.  I've seen other similar games force users to play mini-games to earn currency to get things, whereas we just give away free stuff periodically.  I don't like this approach because 1.programming mini-games is a lot of extra work and 2.we're known for being a casual game, I don't think users would like playing tedious mini-games over and over to collect pets.
The solution I've been considering would be implementing a currency, say gold, that you get periodically for logging in and "being active" on the site.  Gold would be required to collect the free pets, and to trade them.  So even if you create a new account, you can't just trade away everything you just collected.  In order to do big trades where you give away large amounts of stuff, you would have to accumulate lots of gold.  Pokemon Go used this approach with stardust, but then again, there's a lot more to do in that game to earn it, and perhaps that's my problem.  This has always been a simple, free to play game, and that's why people like it.  Also, it's just me working on this, and my skill set is mostly web development.
Can anyone offer advice?  I would really appreciate any feedback.
EDIT: Thanks for all the great suggestions, the answers and discussion this generated helped me a lot.

sentences:
C# - Network flooding I just created a simple MMO in unity3d, then me and my friends test it via LAN and the result is very smooth. But when I hosted it in public (100ms ping) the server became unresponsive and causes random disconnection.

Host Setup
- 1gbps
- 32gb ram
- 256 ssd
- off firewall

Server Setup
- max of 100 players
- every 100ms update
- no other updates, just only X and Y location of player by index
- c# sockets w/ async

Server Flow
- when 100ms tick reaches, server sends position of player base on index in a loop.

ex.

if (gtick >= 0.1f) {
    for (x < maxPlayers; x++) {

        // check ifs
        //couples of ifs here...

        // send
        sendToWorld(x ... player[x].posX ... player[x].posY);
    }

    // somewhere, gtick = 0, then counts up again...

}

then the result is delay, unresponsive, and random disconnection.
maybe it flooding itself, I don't know. but when we test it locally (10+ players), it is very smooth and no problem at all.

My question is, How can I update all players every 0.1 without server flooding itself?

sentences:
How to extend a line to infinity? In my game I have a line that simulates the trajectory of a gun shot, fired by the main character.
The line starts at the character and ends at the mouse position at the moment of the click.
What happens is that sometimes the click is before the target. So the line does not extend to the target. I wish I could extend the line, at least to the end of the room.
What happens:

What I would like to happen:

Line:
(x1,y1,x2,y2)

(obj.x,obj.y,mouse_x,mouse_y)

Attempt based on liggiorgio's answer:

sentences:
Refactoring out asynchronous webrequests to an interface I have a Unity project with UnityWebRequest calls in it. They are all working correctly, but I'd like to refactor them out (they are implemented pretty badly at the moment).

The way I would like to do this is with a WebRequestSender class that implements an IWebRequest interface. Each call would return a WebResult object that I can use.

public class WebResult
{
    public long ResponseCode { get; set; }
    public bool IsError { get; set; }
    public string Value { get; set; }

    public static WebResult Success(long responseCode, string value)
    {
        return new WebResult
        {
            IsError = false,
            ResponseCode = responseCode,
            Value = value
        };
    }

    public static WebResult Failure(long responseCode)
    {
        return new WebResult
        {
            IsError = true,
            ResponseCode = responseCode,
        };
    }
}

I'm having trouble understanding how to implement the interface, as these calls are asynchronous.

Ideally, in the script when I need to make a call, I would have one line, like so:

WebRequest.Login(form) and that would return the result. I'm not sure what I have to add for it to wait for the call, or however it is executed.

public interface IWebRequest
{
    WebResult Register(WWWForm form);
}

Do I need to alter the return object so it allows for asynchronous calls? Or do I have to change the implementation/the call of the implementation?

As for my implementation, it doesn't work. The return statement on the Register function isn't called (even if it was, I'm not sure the return object would be populated?)  Sample below:

public class WebRequestSender : MonoBehaviour, IWebRequest
{
    private const string REGISTER_URL = "http://localhost:51044/api/Users/Register";

    private WebResult webResult;

    public WebResult Register(WWWForm form)
    {
        StartCoroutine(MakeWebCall(REGISTER_URL, form, (UnityWebRequest webRequest) => RegisterDelegate(webRequest)));

        return webResult;
    }

    private void RegisterDelegate(UnityWebRequest webRequest)
    {
        if (webRequest.isHttpError || webRequest.isNetworkError)
        {
            webResult = WebResult.Failure(webRequest.responseCode);
        }
        else
        {
            webResult = WebResult.Success(webRequest.responseCode, webRequest.downloadHandler.text);
        }
    }

    private IEnumerator MakeWebCall(string url, WWWForm form, Action<UnityWebRequest> finishDelegate)
    {
        using (UnityWebRequest www = UnityWebRequest.Post(url, form))
        {
            yield return www.SendWebRequest();
            finishDelegate(www);
        }
    }
}

sentences:
Get return of asynchronous callback since module export- Nodejs Server:

require('./MovimientoJugador')();
var camino4=MoverJugador(startX,startY,endX,endY,mapa2);
console.log("Camino: " + camino4);

MovimientoJugador:

module.exports = function() {
  var Camino="uno";
 this.MoverJugador = function(startX,startY,endX,endY,mapa) {
easystar.findPath(startX, startY, endX, endY,function( path ) {
Camino=JSON.stringify(path);
 console.log("C:" + Camino)
 return Camino;
}}

Console:

Camino= uno
C=(X:1,Y1)(X2:Y2) etc...

The variable Camino has the value of one when declared.
At the time that the server shows it, it does not give you time to show the last return value.

How could I turn this into a promise or make a wait of x seconds?

sentences:
Should I use the X-Y-plane when using an orthographic projection in OpenGL? I'm currently at a loss rendering a tile-based 3D map with an orthographic projection in OpenGL. Imagine any isometric 3D game (using actual geometry instead of sprites).

Internally, the tiles of my map have x and y coordinates (for column and row position within the map respectively). The tile with x=0 and y=0 is the one in the "top left", the one with y=0 and x=1 the one to the right of the first tile and so on.

Since in OpenGL, the coordinate system is so that the X-Z-plane is the "ground" plane, I create the model matrix for each tile by using the tile's y coordinate for the matrix' (or position vector's) z component. I then set up an orthographic "camera" by using glm::ortho().

This seems to work fine at first, but I quickly ran into clipping issues when trying to render larger parts of the map. I assume this is due to the fact that the orthographic projection clips on z. A quick and dirty attempt of having the map in the X-Y-plane confirmed this, as I didn't have clipping issues then.

Now, I'm not sure what's the best approach here?

Change the code so the tiles are being layed out in the X-Y plane? In that case, it seems as if I would have to remember to rotate every single object around x accordingly, which seems wrong.
Do I need to set up the orthographic projection manually to use Y as the clipping plane? Is that even possible? I think OpenGL always uses z for clipping, right?
Some other approach? I think I'm lost in coordinates and matrices, really.

I assume this is a common problem with a well-known solution, so I'm hoping to learn about that before I go ahead, change a lot and then learn I did it the wrong way...

sentences:
Enemies and item drops issue Disclaimer: I'm relatively new to developing games so bear with me.

In my scene I have enemies and when they die, they drop items. No matter which item is dropped, the same prefab (the physical representation of the dropped item) is instantiated. That physical orb on the ground may represent different items. It could be a pile of coins, a sword, etc. Depending on which item is dropped, I want its name to appear in a UI label attached to the top of the item. Basic ARPG stuff really. The problem I'm running into is that I can't seem to get the references right.

DisplayItemNameLabel is a script which is attached to each item when it is dropped. I did it this way so each item can be in charge of its own UI label.

ItemDrops is attached to each enemy. SpawnItem(Item item) is a function which is called when the enemy dies.

The last relevant Monobehaviour script is the ItemData script which is attached to an Item Manager game object which is there from the beginning and persists forever. This class just defines the different items that are possible in the game.

So basically the structure is that when an enemy dies, if the random number generated is within some range, then some item will drop.

If (randomNumber < 0.5)
{
    SpawnItem(itemData.coin);
}

where SpawnItem(Item item) is something like...

private void SpawnItem(Item item)
    {
        itemDropped = true;
        nameOfDroppedItem = item.itemName;

        Instantiate(itemPrefab, transform.position - offset, Quaternion.identity);
    }

Again, this is attached to each enemy.

In the DisplayItemLabel script then, I would like to set itemNameText.text to that nameOfDroppedItem. But the DisplayItemLabel script is attached to each item. I don't think I can make each item a child of each enemy because enemies are destroyed when they are killed so the scripts would be destroyed. I also can't use GameObject.FindGameObjectWithTag("Enemy").GetComponent<ItemDrops>(); because it wouldn't always grab the enemy I want. I thought maybe I could set the text in SpawnItem but it would have to reference the correct item, so I couldn't use GameObject.FindGameObjectWithTag...

What should I do?

sentences:
Proper names and wordings for Real/Fake fullscreen video modes I have an option in my game which allows Player to choose between video modes:

Fullscreen Fake
Fullscreen Real
Windowed

First and second corresponds to SDL_WINDOW_FULLSCREEN_DESKTOP and SDL_WINDOW_FULLSCREEN in the SDL library.

While their meanings whould be clear for GameDev people, for average Player, I think, it will be not so obvious. I never saw any examples of that kind of Video Settings. Other games often provide just a choice between the two: Fullscreen / Windowed.

What names and explanations I should provide, so it will not be confusing for a common user ?
Are there any examples of games which have similar options ?

sentences:
ToonRamp Shader + Normal Maps: How to keep strict lighting bands? I'm trying to achieve a shading similar to the one on this image:

Image 1: https://imgur.com/a/eTTvSCD

To get something similar to this I wrote a toon ramp shader (similar to the one in the Standard Assets) with normal maps. The shader works, and without a normal map you can see the lighting bands strictly defined, with visible seams separating them (Image 2). But once you add a normal map, the toon bands won' t have well defined seams anymore, and will blend smoothly all across the mesh (Image 3).

Image 2 & 3: https://imgur.com/a/SI3BxED

This is my current shader:

Shader "Custom/ToonRampWithNormals"
{
    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _BumpMap("Bumpmap", 2D) = "bump" {}
        _Ramp("Toon Ramp", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Ramp

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        sampler2D _Ramp;

        half4 LightingRamp(SurfaceOutput s, half3 lightDir, half atten)
        {
            half NdotL = dot(s.Normal, lightDir);
            half diff = NdotL * 0.5 + 0.5;
            half3 ramp = tex2D(_Ramp, float2(diff,diff)).rgb;
            half4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten;
            c.a = s.Alpha;
            return c;
        }

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_BumpMap;
        };

        sampler2D _MainTex;
        sampler2D _BumpMap;
        half _Glossiness;
        fixed4 _Color;

        UNITY_INSTANCING_BUFFER_START(Props)
            // put more per-instance properties here
        UNITY_INSTANCING_BUFFER_END(Props)

        void surf (Input IN, inout SurfaceOutput o)
        {
            // Albedo comes from a texture tinted by color
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

So, what have I done wrong? How can I have well defined lighting bands and have normal mapping?

If you can think of a better way to achieve something similar to the reference or have any thoughts about it please share, any contribution is much appreciated.

sentences:
scanline filling a trapezoid I have computed the four corners of the viewable bit of 2d map in my 3d view.  So I know the trapezoid that is visible, and I want to 'visit' these tiles in my map.

So my algorithm is basically a convex polygon scanline fill, specifically with four points.

However, I have trouble finding simple sample code to borrow; all want to cope with the complexities of concave and complex polygons and apply winding and such, which is unnecessary in my case and cluttering.

I've contemplated sitting down and writing my own simple trapezoid scanline fill implementation from first principles but was wondering if anyone had a tried and tested version to share that I could copy instead?

Or maybe I've just been googling for the wrong terms and there are some on the net to point me at?

sentences:
How can I load a large tile map with cocos2d? I am try to design a cocos2d game with a big world. The world's tile map is very big, maybe 20 iPad screen sizes worth of tiles.

I want to know how to load this using a CCTMXTiledMap? If I directly add it to screen, will it use too much memory? If so, is there a solution to solve this problem?

sentences:
How do you go about distributing resources procedurally in a game? What I mean by resource distribution is the placement of items in the game. More specifically "minable" items in builder/resource gathering games like Factorio, Oxygen not included or/and RimWorld.

The games all place clumps of the same items around each other. For example in Factorio there will be fields of resources like coal, iron, copper, etc. which will spawn together in little clusters rather than there being single resource tiles being sprinkled around the map. See screenshot:

This is a similar behaviour in Oxygen not included, similar resources are more likely to be next to each other but depending on the rarity they can also be found alone as a single block. In the game there are also zones which denote what resources can spawn which appear to be preset locations and shapes as they are the same each game (with the types mixed up), but resources themselves are position procedurally. I grabbed a screenshot online and highlighted some of the resource types to make the distribution more obvious.

The ideal answer will show what methods would work well to reproduce "clustered resource distribution", with advantages and disadvantages of a given method. It will not necessarily have code examples but rather the rough steps/pseudocode that would have to be taken.

sentences:
What is "u" and "v" in this Navier Stokes implementation? reference: https://pdfs.semanticscholar.org/847f/819a4ea14bd789aca8bc88e85e906cfc657c.pdf

while ( simulating )
{
    get_from_UI ( dens_prev, u_prev, v_prev );
    vel_step ( N, u, v, u_prev, v_prev, visc, dt );
    dens_step ( N, dens, dens_prev, u, v, diff, dt );
    draw_dens ( N, dens );
}

Is u,v the same as x,y?

sentences:
How do I change my gravity and jumping logic to put the character at a specific height at a specific point in time? I'm making a 2D platformer on Android using libGDX. One thing I've had a problem with recently is gravity and jumping. I found a few tutorials on the internet and was able to come up with this...

public static final int JUMP_HEIGHT = 64;
public static final float JUMP_GRAVITY= -6.0f;
public static final float MAX_GRAVITY = 20.0f;
public static final float GRAVITY= 19.0f;

private void updateGravity(float delta) {
    if(Gdx.input.isTouched() && !jumping) {
        jumping = true;
        gravity = Config.JUMP_GRAVITY;
    }

    if(jumping) {
        // change frame to jump
        sprite.setRegion(walkFrames[0]);
        sprite.translate(0, (-1*gravity));
        // runner has landed?
        if(sprite.getY() <= idleY) {
            jumping = false;
            sprite.setPosition(Config.RUNNER_X, idleY);
        }
        // slowdown / fall
        if (gravity < Config.MAX_GRAVITY) gravity += Config.GRAVITY*delta;

    }
}

The code works and my character will jump and fall smoothly. Although the time it takes for him to jump and comedown is independent from delta the height he jumps is not. If the device lags while jumping he will jump only a portion of how high he should. For the life of me I cannot get it to make sure it jumps a specific height (JUMP_HEIGHT) and in a specific time independent of the delta.

labels: matrix android java splines roblox unity xna unity c# xna unity java compression ai unity opengl unity c# c++ c++ unity mathematics architecture unity mathematics unity java opengl mathematics audio 2d c# game-design unity game-design game-maker xna shaders unity xna xna game-design unity opengl collision-detection opengl javascript libgdx unity libgdx geometry barycentric-coordinates game-design tilemap c++ c++ open-source unity unity unity unity game-loop unity c++ procedural-generation unity unity java javascript directx11 java networking assets .net opengl java unity game-design spritekit javascript unity cocos2d-iphone collision-detection andengine unity ios architecture c# c++ shaders open-source unity iphone unity opengl unity sdl2 2d c++ unity face opengl unity opengl graphics-programming javascript unity unity unity architecture opengl spritesheet ios graphics 2d java android unity javascript android terrain 3d unity unity flash rotation mathematics unity unity phaser physics opengl textures path-finding android xna unity xna unity c++ algorithm actionscript-3 networking twine glsl textures opengl unity unity c# level-design unity c++ unity c++ android ai physics path-finding unity collision-detection multiplayer 2d c++ c++ android javascript algorithm unity collision-detection architecture opengl c# opengl physics opengl xna multithreading opengl c# unity steam c++ directx c++ unity unity unity xna rendering gui python unity advertisements java physics unity savegame animation unity c++ c# unreal-4 unity c++ xna xna android xna c# 2d c++ game-design c# android unity unity unity unity browser-based-games 2d java mathematics unity hlsl shaders 2d c# directx xna monogame oop opengl unity unity terrain-rendering 2d level-design java c++ c# unity legal slick xna 2d c++ android rpg mathematics server ai unity c collision-detection interpolation opengl c++ directx android opengl unity opengl unity textures unity physics 2d opengl legal unity c# unity mathematics java unity sales unity unity c++ mathematics unity windows opengl lua silverlight path-finding c# directx xna c++ opengl actionscript-3 matrix sound opengl renpy architecture java java unity unity game-mechanics unity java unity java unity unity geometry php libgdx game-design unity opengl unity udk c# c++ xna unity collision-detection unity unity opengl xna architecture unity unreal-4 mathematics opengl-es2 java game-loop 2d xna c++ unity unity andengine business game-design udk c++ c# textures java unity world-of-warcraft-modding bullet-physics shaders unity unity unity android 2d opengl opengl physics unity game-design interpolation opengl java android game-design physics c# unity xna unity software-engineering java unity game-maker xna c# unity c++ algorithm unity c++ java libgdx platformer unity unity flash c++ udk multiplayer xna unity unreal-4 textures unity javascript c++ unity html5 unity graphics java game-design collision-detection unity 3d isometric flash directx opengl 3d ranking unity c# game-recording opengl udk collision-detection unity unity c++ c# algorithm c# opengl opengl physics android xna performance mathematics unity android unity unity collision-detection php unity node.js mathematics libgdx mathematics xna blender c# algorithm unity opengl box2d rotation rendering c++ c# minecraft-modding xna animation unity algorithm c# c# java transparency opengl c# opengl xna c++ unity unity xna-4.0 box2d android c# game-loop c# unity unity xna java c# phaser multithreading libgdx procedural-generation game-mechanics animation opengl textures unity libgdx 2d directx opengl c# c# mathematics unity opengl matrix game-design 2d c# rotation mathematics c++ monogame 2d movement unity xna 2d unity cocos2d-iphone game-design 2d android rigidbody game-design unity microsoft graphics-programming unity unity c# android c++ html5 c++ java java libgdx c# simulations c# algorithm c# google-play game-design controllers unity 2d unity models unity opengl game-mechanics unity opengl algorithm unity c++ java c++ unity libgdx architecture c++ javascript camera networking android unity unity opengl unity java blender c# xna android unity c++ xna unity c# unity 2d xna-4.0 collision-detection opengl unity android java unity unity c# frame-rate directx mmo unity networking unity unity opengl opengl opengl unity collision-detection unity game-maker java unity multiplayer unity 2d xna unity path-finding unity opengl xna collision-detection animation unity android textures sprites opengl architecture opengl php unity c++ collision-detection unity c++ javascript interpolation 2d java xna javascript opengl libgdx libgdx physics unity 2d 2d xna xna collision-detection rendering mathematics xna java coordinates assets android 3d 3d collision-detection sdl collision-detection algorithm mathematics game-design java unity unity xna android mathematics directx opengl java c# mathematics c# 2d opengl lua assets java opengl-es libgdx c++ career animation architecture javascript unity xna actionscript-3 unity unity java legal cross-platform unity php unity xna godot unity c# unity unity 2d java graphics graphics assets unity unity opengl android geometry java opengl iphone xna 2d unity collider directx11 path-finding ai directx unity entity-system opengl unreal-4 game-design unity unity game-mechanics xna 2d networking algorithm unity java gui c++ c++ c++ xna shaders c# 3d shaders unity game-design opengl c++ unity unity android unity xna mesh architecture xna performance opengl opengl sprites opengl c++ xna c# java ai unity xna shaders javascript xna flash c++ unity unity c# unity lighting opengl-es unity java libgdx game-design splines unity java collision-detection java 2d c++ algorithm opengl unity opengl xna unity ai collision-detection unity c++ physics leaderboards c++ libgdx 3d-meshes movement xna unity unity xna networking sdl maps books android game-loop c++ unity java collision-detection mathematics java c unity unity unity c++ opengl opengl c# opengl animation game-design random graphics opengl unity java xna unity java unity xna c++ unity c# android textures unity legal unity unity unity android java copyright collision-detection c++ lighting unity c# box2d camera models unity physics mobile iphone unity level-of-detail 2d algorithm algorithm shaders mmo hlsl software-engineering java unity c++ architecture graphics opengl unity networking actionscript-3 javascript directx c++ shaders unity cocos2d-iphone opengl android xna glsl c++ unity physics networking entity-component unity physics unity opengl c++ animation c++ python java unity c++ c++ xna physics sprites xna unity 3d 3d server unity game-design animation unity c++ algorithm java c++ opengl unity c# android directx9 xna unity architecture unity physics design-patterns xna physics unity puzzle camera udk android gui unity xna game-design unity game-design c# xna-4.0 input slimdx c# unity android java collision-detection rendering unity c++ xna legal c# rotation c++ graphics-programming c# physics networking game-design unity java opengl 3d collision-detection 2d 3d xna opengl graphics unity unity mathematics rotation game-design opengl unity unity shaders unity opengl c++ java sprites path-finding networking unity xna 3d java 3d server unity opengl unity xna unity unity xna unity game-design xna javascript unity opengl sprites collision-detection sprites directx maps html5 networking xna java unity unity xna algorithm unity path-finding c# unity unity box2d directx flash unity python c# cocos2d-x 3d game-design c++ physics grid java unity xna collision-detection opengl-es2 c# c# input 2d game-design opengl android unity unity c++ interpolation gpu unity opengl graphics xna physics unity opengl rendering unity cryengine algorithm c++ c++ java c# unity unity emulation opengl game-design 2d java c# 3d c++ c# rpg music unity unity unity java unity monogame unity ai android c# c++ unity ios android opengl vector unity performance unity c# collision-detection c++ xna c# shaders pygame architecture unity unity c# textures 2d game-maker unity software-engineering animation java xna unity mathematics c# unity javascript unity audio java unity c++ javascript c# game-design godot unity unity godot c# lua game-design 3d iphone libgdx unity xna unity ios unity xna unity unity java xna xna collision-detection libgdx c++ java 2d input javascript c textures c# game-design unity c# opengl shaders xna shaders unity unity unity java havok xna unity godot collision-detection xna unity c++ opengl game-design architecture android xna component-based xna-4.0 libgdx opengl unity unity unity rendering coordinates libgdx unity unity ui-design game-design spritesheet java graphics java python c++ unity demo component-based adventure-games rts xna java c++ c++ directx assimp java java javascript java opengl unity c# java unity unity unity unity physics unity c++ opengl unity c# networking c# physics physics content-rating javascript unity c++ unity performance savegame 3d ai java c++ 3d xna shaders unity version-control algorithm 2d unity opengl movement c# java rotation libgdx tilemap c# 2d game-maker architecture xna algorithm c# performance c++ game-mechanics unity unity unity 3d unity tiles unity c# unity java unity unity unity xna particles c# game-design unity unity libgdx unity unity 2d xna unity unreal 2d heuristics animation c++ mathematics cocos2d-iphone xna 2d unity mmo xna user-interface ai directx terrain libgdx collision-detection opengl unity xna directx c# unity opengl unity c++ box2d virtual-reality xna unity unity unity unreal-4 animation unity movement c++ xna 3d textures c++ ios c# sfml entity-system xna unity c++ c# c++ 3d unity entity-system libgdx java opengl ai java java xna c# opengl unity publishing unity java game-design performance java opengl javascript unity c++ game-design java c++ libgdx c# 2d multiplayer opengl unity c# piracy unity animation flash c++ java unity opengl opengl animation android javascript mathematics c# c# unity unity unity java leaderboards unity game-design optimization textures opengl unity minecraft-modding game-design c++ camera networking xna opengl-es game-design opengl collision-detection opengl architecture java unity unity java unity unity xna unity opengl textures particles unity bullet-physics opengl xna libgdx libgdx assets unity box2d 2d c# animation game-design c++ unity javafx opengl opengl unity java flash shaders unity input rotation unity c++ java libgdx c# opengl libgdx sprites xna opengl opengl 2d unity rendering c# 2d unity textures mobile unity color unity unity geometry 2d game-loop opengl terrain-rendering opengl unity unity 2d iphone networking xna unreal 3d c++ architecture c++ screen xna unity xna 3d c++ animation glsl sprites architecture c# game-design unity unity 2d unity unity 3d java unity xna camera 2d unity 2d xna path-finding unity unity unity game-maker opengl-es javascript unity graphics 3d android java c++ xna andengine java animation 2d game-design c++ unity unity unity opengl 3d 3dsmax first-person-shooter licensing physics copyright opengl c++ opengl unity unity unity unity unity directx 2d starcraft-2 unity 2d c++ c# unity unity unity unity android unity c# procedural-generation unity unity 2d flash unity xna entity-system unity 3d android opengl lua directx11 career java unity unreal-4 unity timer unity xna-4.0 collision-detection jmonkeyengine unity unity opengl c# rendering unity physics unity unity 2d javascript shaders javascript xna unity unity server c++ marketing multiplayer 3d libgdx unity opengl flash resource-management unity unity android mathematics game-design unity unity game-design opengl physics unity unity 3d c++ game-design opengl physics iphone 3d 2d opengl unity c++ c# 2d opengl android c++ pygame c++ libgdx game-design opengl unity opengl shaders mmo unity modding rendering unity geometry game-design android unity c++ xna game-mechanics xna-4.0 java depth-buffer rts unity lua libgdx unity unity unity android c# directx c# android box2d java cocos2d-iphone c++ game-maker c++ c++ c# unity java c++ unity opengl unity component-based unity architecture algorithm game-design android unity xna unity directx11 unity c# unity c++ c++ hlsl procedural-generation javascript models c++ opengl java game-design shaders game-design collision-detection java unity unity opengl unity xna libgdx c++ c# ai unity javascript animation c# c++ textures unity xna java javascript game-design javascript architecture unity input c++ xna xna android c# java c++ game-design c# unity unity java xna assets javascript unity sdl opengl game-maker flash unity unity unity unity unity c++ xna tiles architecture user-experience modding opengl unity c++ c# 2d unity directx c++ unity unity c++ procedural-generation shaders mathematics c# sfml unity linux opengl c# architecture opengl unity algorithm libgdx mathematics shaders c# 2d 2d c# 2d mmo directx9 unity unity c++ html5 physics libgdx xna unity iphone multiplayer opengl matrix ios c++ opengl unity 2d flash opengl unity unity game-design 2d xna 2d c++ transformation networking unity opengl unity game-design collision-detection unity unity architecture xna ogre unity opengl networking unity cocos2d-iphone unity opengl javascript unity opengl networking unity collision-detection path-finding unity c# unity java andengine unity java mathematics android android unity libgdx unity unity glsl java unity xna sharpdx xna unity unity human-resources unity mathematics directx java libgdx rpg xna mathematics opengl unity game-maker unity directx11 unreal java xna unity normals unity 2d c++ unity graphics 3d directx python xna monogame control opengl sound 2d c# unity unity procedural-generation tiles opengl html-canvas 3d timer unity java textures server unity opengl unity unity unity software-rendering xna unity ai architecture xna opengl c++ unity c++ c# game-design unity c# java rendering porting networking unity unity xna java xna algorithm unity opengl open-source unity shaders c# lua path-finding mathematics architecture xna glsl unity c++ xna android unity c++ databases android unity unity normals opengl unity c# c++ game-design game-maker unity java unity mathematics html-canvas xna networking unity rendering xna facebook rendering c++ javascript gpu libgdx unity mathematics java xna-4.0 opengl opengl opengl collision-detection directx11 opengl java actionscript-3 javascript unity mobile transformation unity architecture 2d rendering java mathematics android unity c# procedural-generation unity documentation opengl marketing unity rotation android unity procedural-generation rotation shaders c++ linux java unity graphics java physics 2d data-structure xna c# balance libgdx 2d databases opengl xna glfw libgdx game-design unreal-4 ai unity-networking unity c# unity c# xna unity unity unity opengl 2d directx directx11 architecture tilemap java unity xna unity game-design 3dsmax xna game-mechanics javascript unity unity procedural-generation c# java directx11 2d unity c++ mathematics unity unity unity java physics tilemap opengl 2d c++ android unity architecture client-server c# algorithm mathematics opengl java opengl video opengl java graphics opengl c++ graphic-effects shaders unity unity unity modding c# simulations unity art unity 2d unity unity textures unity software-engineering web 3d xna textures graphics unity physics iphone udk unity xna modding shaders unity opengl sharpdx glsl unity unity camera c++ java java unity unity collision-detection performance unity mathematics javascript 2d level-design java terminology android 2d hlsl unity c# 2d lighting unity unity opengl performance unity ios unity unity algorithm unity unity unity unity physics modding unity unity c# xna unity xna unity unity unity c# opengl game-industry unity lighting 3d animation game-design unity c++ android xna c++ libgdx python xna c# java andengine mathematics unity android unity unity java java platformer game-design collision-detection matrix unity opengl .net game-design 3d unity unity unity unity unity opengl sprites memory java opengl mathematics xna shaders physics animation eclipse collision-detection actionscript-3 libgdx unity unity opengl c# java unity xna c# xna networking geometry unity 3d unity unity anti-cheat cryengine unity java 2d assets ai xna unity c++ graphics c++ 2d c# jogl ios maps unity development-speed android textures simulations libgdx game-design scripting c# xna xna textures unity opengl c++ 2d sprites c# unity unity opengl c++ unity c# physics 2d unity movement c# game-design flash unity animation unity unity xna c++ unity mathematics c# unity unity libgdx graphics c++ java architecture 3d physics c++ networking unity unity unity collision-detection procedural-generation architecture opengl unity opengl xna opengl architecture physics opengl 2d xna architecture unity mathematics collision-detection movement unity lighting game-maker shaders c# webgl box2d physics directx11 c++ art unity 3d geolocation android opengl unity opengl farseer-physics-engine xna-4.0 opengl xna unity unity open-source unity tiles unity game-design xna-4.0 mathematics java c# unity component-based box2d game-design c++ java android unity libgdx opengl minecraft-modding xna c++ unity java flash unity sprites procedural-generation mathematics marketing 3d game-design iphone iphone unity unity collision-detection unity 2d xna unity animation opengl unity c++ unity textures 3d shaders c++ xna opengl android 3d java c++ unity python unity opengl unity html5 c++ directx collision-detection 3d html5 c# udk algorithm opengl c++ mathematics unity sdl2 textures java cocos2d-iphone maya ai algorithm books java unity c++ c# html5 collision-detection mathematics xna c# opengl c# java xna cocos2d-iphone c# web iphone unity libgdx shaders xna-4.0 maps unity shaders unity xna unity libgdx opengl algorithm rendering terrain unity java xna unity 2d performance xna-4.0 android xna ios unity xna java aspect-ratio 2d c# physics unity unity unity unity localization path-finding marketing xna java java libgdx xna mathematics xna opengl javascript directx unity 3d c++ unity unity procedural-generation opengl unity security animation unity xna unity physics libgdx physics unity android path-finding three.js 3d unity opengl java unity c++ c++ unity unity c# c++ java xna-4.0 opengl xna python xna unity directx unity java textures c++ opengl java camera unity architecture unity java opengl mobile animation physics unity game-loop c++ java c++ collision-detection cross-platform directx c# rendering c++ java libgdx 2d opengl unreal-4 input corona-sdk unity android graphics textures c++ collision-detection c++ 2d directx unity collision-detection networking android unity c++ xna mathematics unity sdl2 unreal-4 graphics unity multiplayer opengl unity ios unity libgdx java game-design assets c++ java java glsl opengl opengl c++ java ai opengl javascript rotation marketing unity design-patterns unity libgdx mathematics ai opengl unity animation unity android unity c# unity java algorithm visual-studio box2d unity unity opengl opengl libgdx unity input opengl animation c# c++ xna xna networking c++ unity xna android unity mesh steam opengl unity opengl spritekit unity c++ graphics sdl2 networking c++ opengl collision-detection unity xna browser-based-games directx11 unity resolution iphone xna entity-system mathematics unity shaders tools xna ios html5 opengl blender xna unity movement collision-detection c++ python java opengl server opengl unity physics legal unity c# opengl opengl xna opengl-es2 unity unity unity java collision-detection collision-detection xna c++ java opengl c++ unity c# collision-detection architecture unity terrain udk xna networking shaders opengl architecture geometry java c# c# opengl 3d networking procedural-generation collision-detection models xna copyright java xbox360 java unity unity python opengl unity opengl unity entity-system html5 physics c++ unity udk unity music collision-detection unity c++ unity game-design c++ playstation4 c++ opengl python opengl unity 2d c# unity-ads unity c++ shaders unity mmo unity 2d c++ xna education minecraft-modding c# unity hlsl unity opengl input unity java c# iphone path-finding unity camera xna java c++ opengl c++ browser-based-games unity c++ unity c++ flash 3d unity directx11 iphone 3d c# opengl opengl unity c++ unity unity 3d licensing unity xna game-design game-design python opengl unity unity unity unity 3d javascript c# rendering collision-detection linear-algebra unity box2d coordinates xna 2d c# xna algorithm game-industry 2d collision-detection shaders unity collision-detection 2d unity competition audio java c++ c++ unity camera unity libgdx graphics rendering procedural-generation xna 2d unity unity shaders scripting 2d emulation java xna c++ directx11 c++ java android unity directx11 c# unity 3d terminology 3d ios unity c# c# unity java c# c++ unity 2d java game-design python android unity c# opengl xna shaders unity xna geometry vector interpolation unity c# unity grid unity scripting networking flash multiplayer android 2d shaders unity 3d unity unity tilemap networking isometric unity models java unity unity software-engineering 2d javascript movement iphone animation sound xna java unity console c++ video unity unity legal unity flash c# opengl flash copyright unity game-design unity unity libgdx opengl javascript c++ xna c# camera entity-system physics collision-detection rendering unity unity marketing rendering directx unity c++ java 2d architecture android c# xna unity iphone architecture unity keyboard 2d collision-detection java game-design java c++ unity c# c++ macos unity c# xna-4.0 shaders opengl opengl unity python xna unity server unity c++ java multiplayer collision-detection unity java unity opengl unity game-design collision-detection unity rendering xna-4.0 algorithm animation opengl mmo java animation unity bullet-physics libgdx zbrush opengl legal rotation unity unity ai flash directx11 networking unity unity unity android game-design transformation xna 3d java camera animation opengl c++ animation 2d java opengl 3d unity game-design unity unity unity unity c++ java game-industry unity game-industry unity opengl opengl 3d c++ path-finding xna java 2d c++ legal unity unity c# c# c++ unity stage3d java terrain-rendering java mmo sdl 2d c# mathematics java 3d c# game-design c++ unity opengl unity unity cross-platform camera collision-detection javascript community-management c++ opengl xna opengl opengl java path-finding opengl java javascript box2d 2d xna java multiplayer xna vertex unity python algorithm opengl unity unity libgdx c++ tilemap unity python unity unity c++ mathematics java opengl camera multiplayer opengl unity sprites mathematics c# modding graphic-effects c++ java unity mathematics java directx algorithm unity c# xna unity unity java c++ 3d unity blender unity android unity 3d xna unity unreal-4 sound android java opengl java android xna physics architecture opengl opengl c++ unity unity animation unity unity unity unity opengl algorithm c# collision-detection sfml xna c++ xna unity c++ opengl graphics c++ unity rendering unity physics optimization c++ unity vb.net 2d algorithm unity directx iphone android marketing unity c++ software-engineering tools unity legal unity java networking unity libgdx xna opengl unity unity c++ xna unity html-canvas iphone java directx11 unity javascript vector xna 3d architecture directx11 collision-detection unity ai textures c# unity 2d unity c++ unity mathematics xna 2d unity flash iphone xna xna c# unity c# xna unity unity game-design opengl c++ xna opengl c++ gpu directx11 game-maker physics-engine c++ java android unity video monogame cocos2d unity unity c# ai c# xna textures java xna lwjgl unity marketing unity opengl-es algorithm unity game-design opengl unity architecture unity libgdx sdl2 xna opengl c++ physics software-engineering unity architecture rendering movement unity iphone tilemap android 2d libgdx game-maker mobile unity unity 3d textures java unity console opengl algorithm unity 2d 2d mathematics 2d unity unity unity unity c++ c++ java c++ android video opengl game-mechanics mesh unity java ios unity graphics procedural-generation shaders collision-detection android xna-4.0 2d unity iphone resolution opengl unity textures unity directx graphics mmo c# unity c# unity lwjgl game-design unity xna networking java sprites physics unity 2d algorithm unity physics ai mathematics opengl architecture unity opengl opengl unity opengl c# 2d unity unity xna mathematics c# java unity shaders unity software-engineering avatar unity 2d c++ procedural-generation javascript c++ tools html-canvas networking 3d android xna java c# unity java flash cocos2d-x libgdx game-design unity glsl unity unity unity architecture game-design camera xna architecture unity c++ java lwjgl collision-detection game-design procedural-generation c++ opengl unity java unity procedural-generation monogame c++ java software-engineering opengl c++ opengl c# 2d unity 2d game-design software-engineering unity unity unity unity opengl unity mathematics java xna multiplayer animation game-mechanics unity first-person-shooter unity sprites c++ c++ 2d flash 2d shaders c# opengl opengl unity server architecture unity box2d unity java balance unity unity c++ animation java architecture unity unity c# opengl-es java iphone procedural-generation physics unity c++ 2d opengl 2d unity unity java c++ c# rendering c# physics directx c++ c# performance flash sdl cocos2d java xna unity server unity c# architecture unity mathematics unity mathematics c++ architecture shaders collision-detection xna marketing python directx unity unity unity unity java vector opengl unity resolution rpg xna-4.0 javascript python unity minecraft-modding monogame quaternion tiles web unity java cocos2d-iphone 2d opengl java glsl java xna unity algorithm c++ box2d unity opengl balance unity 2d jmonkeyengine c++ maps c# unity xna rotation java c++ unity javascript libgdx flash unity c++ shaders licensing opengl 3d unity unity unity c++ unity collision-detection game-design unity flash xna directx c# unreal-4 ios unity entity-system c++ hexagonal-grid game-design opengl linux 2d libgdx opengl rendering c++ path-finding unity 3d c# game-design unity opengl godot xna input c# game-design lua linux c# xna-4.0 physics unity unity unity java unity multiplayer blender camera unity xna opengl rts unity c++ unity source-engine physics c# sdl cocos2d-iphone directx11 component-based game-maker unity java c# geometry mmo opengl c# unity c++ unity xna path-finding unity c# ios unity mathematics c++ physics android game-design sprites opengl unity unity procedural-generation gpu c# animation raycasting unity unity vector unity ios efficiency unity unity unity directx9 motivation java java sound android multithreading unity directx c# movement graphics c# animation opengl space-partitioning unity c++ textures mathematics opengl unity unity xna 2d unity directx unity game-design data-structure rotation c++ mathematics unity legal c++ unity sdl2 unity facebook opengl unity ai scripting c++ unity android mathematics javascript xna xna java c++ game-design unity xna unity c# opengl-es box2d c++ terrain vector java unity directx c++ multiplayer unity unity opengl android java textures directx10 python 3d hardware-acceleration unity opengl c++ loading c++ pygame game-design c++ xna ai opengl unity architecture input opengl camera c# unity c++ server c++ unity java 2d opengl unity unity user-experience game-design unity xna procedural-generation collision-detection unity platformer game-loop unity opengl unity procedural-generation unity 3d java game-design unity unity opengl unity 2d 2d collision-detection 2d unity game-design java ai 2d unity 2d assets physics maps opengl c# collision-detection sdl glsl java architecture unity xna-4.0 unity scripting mathematics maps unreal-4 collision-detection physics 3d unity unity opengl collision-detection physics unity c++ 2d java java opengl windows game-mechanics c# java unity opengl c# xna unity opengl android level-design unity sprites godot algorithm unity unity unity java libgdx unity unity textures game-industry c++ directx9 unity unity udk collision-detection collision-detection xna c# unity unity 2d architecture xna unity game-mechanics unity unity unity c# unity java 3dsmax game-design 3d unity unity unity java opengl javascript gui unity monogame c# projectile-physics unity procedural-generation collision-detection unity unity unity unity unity xna javascript c++ unity physics mathematics architecture collision-detection unity unity unity c# textures javascript ios xbox360 unity 2d android legal physics opengl xna xna unity tools console opengl minecraft-modding legal xna-4.0 unity unity game-maker opengl-es unity character 2d xna c++ file-format xna 2d unity rendering opengl mathematics unity c# unity mmo opengl directx opengl unity mathematics unity java java c++ sprites xna textures architecture 2d android unity unity xna unity java unity c++ unity unity android unity game-design directx c# java c# hlsl opengl shaders unity 2d collision-detection collision-detection game-design c# unity facebook simulations turn-based-strategy minecraft-modding libgdx sprites c# sdl java mmo mathematics libgdx javascript flash unity java unity java hardware unity opengl game-design unity javascript procedural-generation unity textures unity pixel java unity c++ unity c++ unity unity opengl gui c++ game-mechanics c# unity collision-detection c++ xna unity unity xna collision-detection game-design xna unity intellectual-property c++ c++ unity unity collision-detection collision-detection mobile unity vertex-buffer opengl opengl java opengl algorithm unity unity unity unity opengl tools c# c++ c++ xna libgdx c# tools xna puzzle line-of-sight 3d-meshes data-structure xna unity art terrain unity flash xna java iphone unity python steam input pixel-art opengl unity game-maker unity crusader-kings-2-modding unity c++ performance java game-mechanics unity unity sdl tools game-design 2d unity 2d multiplayer c# opengl unity android collision-detection unity game-design opengl unity 3d flash flash xna software-engineering unity xna unity c++ unreal unity c# performance mathematics mathematics unity unity game-design unity xna unity libgdx xna flash multiplayer camera unity android networking software-engineering directx9 design-patterns c++ pico-8 c# unity c++ opengl c++ directx 3dsmax rendering unity unity architecture unity trademark physics java android xna physics game-maker java graphics opengl 3d unity rendering c++ opengl physics opengl c# networking ios publishing algorithm data-structure physics windows xna java unity path-finding blender open-source unity directx physics animation c++ libgdx mmo unity unity opengl unity opengl mathematics multiplayer unity iphone content-generation c++ c++ cocos2d unity directx11 java textures directx11 xna c++ sprites entity-system xna unity bounding-boxes c++ unity directx11 sound rpg gpu java procedural-generation unity unity unity unity xna c++ opengl unity c++ python networking directx unity 2d unreal-4 ios collision-detection collision-detection unity unity c++ game-design algorithm ogre game-design unity unity 2d unity javascript libgdx unity unity udk unity architecture unity education cocos2d-x unity unity c# webgl unity c# unity java graphics animation game-design unity opengl opengl opengl logic ai android c# javascript unity unity game-mechanics unity libgdx trigonometry libgdx c# java unity unity unity java collision-detection shaders input xna unity collision-detection algorithm opengl shaders xna xna unity unity opengl html5 libgdx android unity opengl blender opengl c++ game-design opengl python directx unity unity minecraft-modding unity unity physics unity java opengl c++ unity resolution unity multiplayer c++ unity opengl unity android android unity opengl mathematics unity opengl movement c++ android android c++ c++ c# android unity unity xna tools terminology xna libgdx java unity unity andengine babylonjs xna xna xna unity c++ c# c# physics mmo multiplayer 3d procedural-generation c# mathematics rotation c# opengl assets xna opengl-es game-design collision-detection xna physics shaders opengl blender directx mathematics unity xna java flash opengl actionscript-3 unity architecture physx cocos2d-x textures c# java unity c# c++ line-of-sight opengl unity xbox360 xna unity unity unity xbox opengl marketing opengl unity unity c# graphics 2d ai java box2d textures collision-detection java udk unity unity graphics unity xna unity c# textures tilemap architecture ai physics algorithm scene-graph opengl unity unity unity unity unity 3d c++ unity xna networking android performance c++ physics statistics xna javascript game-mechanics algorithm unity directx networking collision-detection lua physics c++ unity graphics xna unity unity c++ unity unity c# game-maker collision-detection character android iphone xna unity c++ xna-4.0 opengl directx9 networking c++ c# android sprites android webgl opengl shaders java sound unity unity unity c++ android c++ mathematics opengl unity unity project-management android c# java java collision-detection unity game-design xbox360 iphone unity java unity unity xna unity unity godot unity multiplayer java unity unity c++ legal algorithm unity textures libgdx opengl networking open-source unity mathematics collision-detection 2d c++ unity unity c++ unity rendering opengl unity unity xna c# android assets animation nintendo unity tilemap opengl assets unity terminology c++ software-engineering collision-detection 2d unity unity mathematics java unity opengl unity unity unity opengl animation performance java unity mouse tower-defense unity xna game-design unity unity directx11 methodology android shaders lua movement tilemap entity-component-system 2d unity c# graphics javascript 2d collision-detection c++ java c++ 3d unity unity 3d unity c++ actionscript-3 opengl architecture iphone unity unity unreal-4 unity rendering networking mathematics architecture opengl c++ unity unity python c++ rendering input unity opengl android entity-system javascript models unity unity 2d 3d levels unity geometry java game-design collision-detection java unity tilemap graphics 2d game-design networking algorithm game-design xna opengl unreal-4 c++ monogame game-maker space-partitioning unity xna unity collision-detection physics multiplayer unreal tiles c++ opengl unity unity unity physics java server unity ai xna flash physics c++ browser-based-games architecture unity xna unity unity multiplayer unity unity opengl-es libgdx unity unity game-design unity c++ opengl unity opengl compatibility unity unity unity multiplayer opengl python unity python game-design xna box2d algorithm xna mathematics 3d ai c++ opengl c++ unity unity opengl xna unity unity java unity javascript unity directx unity android unity legal graphics c++ xna rotation c# architecture opengl java xna directx opengl unity opengl unity java unity legal unity android unity c# javascript unity unity libgdx game-design rendering opengl unity terrain unity physics opengl unreal-4 unity unity ai java c++ directx matrix java networking c# c# unity c# unity android unreal-4 entity-system c++ java source-engine java opengl character unity android vertex lighting opengl unity game-maker leaderboards xna 3d unity unity opengl opengl xna-4.0 xna networking 2d unity rendering game-maker gui unity directx11 3d 2d unity unity java unity unity unity blender opengl unity unity monogame c# architecture phaser game-design data-driven opengl 2d game-design unity game-maker unity javascript opengl unity sdl2 unity c++ cocos2d-iphone procedural-generation fluid-dynamics android